Skip to content

Commit

Permalink
Merge pull request #80 from ennioma/develop
Browse files Browse the repository at this point in the history
Fixed push notifications request - iOS10
  • Loading branch information
ennioma authored Jun 6, 2017
2 parents 51c77b8 + 30066a8 commit 47184af
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,8 @@ public struct ArekPopupData {
```

This is an example of the `ArekContacts` pre-enable popup using `PMAlertController`:
<img src="https://github.com/ennioma/arek/blob/master/code/Assets/arek_contacts.png" width="100">
<br />
<img src="https://github.com/ennioma/arek/blob/master/code/Assets/arek_contacts.png" width="150">

If you want to present a native `UIAlertController` set the type to `.native` otherwise if you want to setup a `PMAlertController` set the type to `.codeido`.

Expand Down Expand Up @@ -184,7 +185,7 @@ Add AREK to your Podfile
```ruby
use_frameworks!
target 'MyTarget' do
pod 'arek', '~> 1.3.0'
pod 'arek', '~> 1.3.1'
end
```

Expand All @@ -194,7 +195,7 @@ $ pod install

## Carthage
```ruby
github "ennioma/arek" ~> "1.3.0"
github "ennioma/arek" ~> "1.3.1"
```

Then on your application target *Build Phases* settings tab, add a "New Run Script Phase". Create a Run Script with the following content:
Expand Down Expand Up @@ -237,7 +238,6 @@ For any information or request feel free to contact me on twitter (@ennioma).
# TODO
- [] Provide a way to inject a custom PMAlertController in a permission
- [] Update the Swift Package Manager installation
- [] Add Siri Permission (<a href=""https://developer.apple.com/library/content/documentation/Intents/Conceptual/SiriIntegrationGuide/CreatingtheIntentsExtension.html#//apple_ref/doc/uid/TP40016875-CH4-SW11> Doc </a>)

<a name="licenseCredits"></a>
# License and Credits
Expand Down
2 changes: 1 addition & 1 deletion arek.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'arek'
s.version = '1.3.0'
s.version = '1.3.1'
s.summary = 'AREK is a clean and easy to use wrapper over any kind of iOS permission.'
s.homepage = 'https://github.com/ennioma/arek'
s.license = { :type => 'MIT', :file => 'LICENSE'}
Expand Down
8 changes: 8 additions & 0 deletions code/Classes/Permissions/ArekNotifications.swift
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ open class ArekNotifications: ArekBasePermission, ArekPermissionProtocol {
return completion(.notDetermined)
}
if granted {
self.registerForRemoteNotifications()

print("[🚨 Arek 🚨] Push notifications permission authorized by user ✅")
return completion(.authorized)
}
Expand All @@ -73,6 +75,12 @@ open class ArekNotifications: ArekBasePermission, ArekPermissionProtocol {
}
} else if #available(iOS 9.0, *) {
UIApplication.shared.registerUserNotificationSettings(UIUserNotificationSettings(types: [.badge, .sound, .alert], categories: nil))
self.registerForRemoteNotifications()
}
}

fileprivate func registerForRemoteNotifications() {
DispatchQueue.main.async {
UIApplication.shared.registerForRemoteNotifications()
}
}
Expand Down

0 comments on commit 47184af

Please sign in to comment.