Skip to content

Commit 5415d06

Browse files
Remove iOS 9 support for AppIntegration
1 parent 9608948 commit 5415d06

File tree

2 files changed

+5
-39
lines changed

2 files changed

+5
-39
lines changed

swift-sdk/Internal/IterableAppIntegrationInternal.swift

Lines changed: 3 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,8 @@ protocol NotificationStateProviderProtocol {
1515

1616
struct SystemNotificationStateProvider: NotificationStateProviderProtocol {
1717
func isNotificationsEnabled(withCallback callback: @escaping (Bool) -> Void) {
18-
if #available(iOS 10.0, *) {
19-
UNUserNotificationCenter.current().getNotificationSettings { setttings in
20-
callback(setttings.authorizationStatus == .authorized)
21-
}
22-
} else {
23-
// Fallback on earlier versions
24-
if let currentSettings = AppExtensionHelper.application?.currentUserNotificationSettings,
25-
currentSettings.types != [] {
26-
callback(true)
27-
} else {
28-
callback(false)
29-
}
18+
UNUserNotificationCenter.current().getNotificationSettings { setttings in
19+
callback(setttings.authorizationStatus == .authorized)
3020
}
3121
}
3222

@@ -45,7 +35,6 @@ public protocol NotificationResponseProtocol {
4535
var userText: String? { get }
4636
}
4737

48-
@available(iOS 10.0, *)
4938
struct UserNotificationResponse: NotificationResponseProtocol {
5039
var userInfo: [AnyHashable: Any] {
5140
response.notification.request.content.userInfo
@@ -144,8 +133,7 @@ struct IterableAppIntegrationInternal {
144133
}
145134

146135
/**
147-
* This method handles incoming Iterable notifications and actions for iOS < 10.
148-
* This also handles 'silent push' notifications for all iOS versions.
136+
* This method handles'silent push' notifications
149137
*
150138
* - parameter application: UIApplication singleton object
151139
* - parameter userInfo: Dictionary containing the notification data
@@ -166,23 +154,6 @@ struct IterableAppIntegrationInternal {
166154
ITBError("messageId not found in 'remove' silent push")
167155
}
168156
}
169-
} else {
170-
switch application.applicationState {
171-
case .active:
172-
break
173-
case .background:
174-
break
175-
case .inactive:
176-
if #available(iOS 10, *) {
177-
} else {
178-
// iOS 10+ notification actions are handled by userNotificationCenter:didReceiveNotificationResponse:withCompletionHandler:
179-
// so this should only be executed if iOS 10 is not available.
180-
performDefaultNotificationAction(userInfo)
181-
}
182-
break
183-
@unknown default:
184-
break
185-
}
186157
}
187158

188159
completionHandler?(.noData)
@@ -196,7 +167,6 @@ struct IterableAppIntegrationInternal {
196167
* - parameter completionHandler: Completion handler passed from the original call. Iterable will call the completion handler
197168
* automatically if you pass one. If you handle completionHandler in the app code, pass a nil value to this argument.
198169
*/
199-
@available(iOS 10.0, *)
200170
func userNotificationCenter(_: UNUserNotificationCenter?, didReceive response: NotificationResponseProtocol, withCompletionHandler completionHandler: (() -> Void)?) {
201171
ITBInfo()
202172

@@ -235,7 +205,6 @@ struct IterableAppIntegrationInternal {
235205
completionHandler?()
236206
}
237207

238-
@available(iOS 10.0, *)
239208
private static func createIterableAction(actionIdentifier: String,
240209
userText: String?,
241210
userInfo: [AnyHashable: Any],
@@ -284,7 +253,6 @@ struct IterableAppIntegrationInternal {
284253
return foundButton?[JsonKey.ActionButton.action] as? [AnyHashable: Any]
285254
}
286255

287-
@available(iOS 10.0, *)
288256
private static func createIterableDataFields(actionIdentifier: String, userText: String?) -> [AnyHashable: Any] {
289257
var dataFields = [AnyHashable: Any]()
290258

swift-sdk/IterableAppIntegration.swift

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,8 @@ import UserNotifications
88

99
@objc public class IterableAppIntegration: NSObject {
1010
/**
11-
* This method handles incoming Iterable notifications and actions for iOS < 10.
12-
* This also handles 'silent push' notifications for all iOS versions.
13-
* Call it from your app delegate's application:didReceiveRemoteNotification:fetchCompletionHandler:.
11+
* This method handles 'silent push' notifications.
12+
* Call it from your app delegate's `application:didReceiveRemoteNotification:fetchCompletionHandler:`.
1413
*
1514
* - parameter application: UIApplication singleton object
1615
* - parameter userInfo: Dictionary containing the notification data
@@ -34,7 +33,6 @@ import UserNotifications
3433
/// - center: `UNUserNotificationCenter` singleton object
3534
/// - response: Notification response containing the user action and notification data. Passed from the original call.
3635
/// - completionHandler: Completion handler passed from the original call. Iterable will call the completion handler automatically if you pass one. If you handle `completionHandler` in the app code, pass a `nil` value to this argument.
37-
@available(iOS 10.0, *)
3836
@objc(userNotificationCenter:didReceiveNotificationResponse:withCompletionHandler:)
3937
public static func userNotificationCenter(_ center: UNUserNotificationCenter?,
4038
didReceive response: UNNotificationResponse,

0 commit comments

Comments
 (0)