Skip to content

Commit 855d049

Browse files
authored
Merge branch 'master' into notification_status
2 parents 7fe2e44 + e5de2b7 commit 855d049

File tree

8 files changed

+114
-100
lines changed

8 files changed

+114
-100
lines changed

Iterable-iOS-AppExtensions.podspec

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ Pod::Spec.new do |s|
88
App extensions for rich push notifications with Iterable's iOS SDK
99
DESC
1010

11-
s.homepage = "https://github.com/Iterable/swift-sdk.git"
11+
s.homepage = "https://github.com/Iterable/iterable-swift-sdk.git"
1212
s.license = "MIT"
1313
s.author = { "Jay Kim" => "[email protected]" }
1414

15-
s.platform = :ios, "10.0"
16-
s.source = { :git => "https://github.com/Iterable/swift-sdk.git", :tag => s.version }
15+
s.platform = :ios, "12.0"
16+
s.source = { :git => "https://github.com/Iterable/iterable-swift-sdk.git", :tag => s.version }
1717
s.source_files = "notification-extension/*.{h,m,swift}"
1818

1919
s.pod_target_xcconfig = {

Iterable-iOS-SDK.podspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ Pod::Spec.new do |s|
88
Iterable's iOS SDK integrating utility and the Iterable API
99
DESC
1010

11-
s.homepage = "https://github.com/Iterable/swift-sdk.git"
11+
s.homepage = "https://github.com/Iterable/iterable-swift-sdk.git"
1212
s.license = "MIT"
1313
s.author = { "Jay Kim" => "[email protected]" }
1414

1515
s.platform = :ios, "12.0"
16-
s.source = { :git => "https://github.com/Iterable/swift-sdk.git", :tag => s.version }
16+
s.source = { :git => "https://github.com/Iterable/iterable-swift-sdk.git", :tag => s.version }
1717
s.source_files = "swift-sdk/**/*.{h,m,swift}"
1818
s.exclude_files = "swift-sdk/swiftui/**"
1919

fastlane/Fastfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ platform :ios do
101101
)
102102

103103
github_release = set_github_release(
104-
repository_name: "Iterable/swift-sdk",
104+
repository_name: "Iterable/iterable-swift-sdk",
105105
api_token: github_token,
106106
name: "#{version}",
107107
tag_name: "#{version}",
@@ -135,4 +135,4 @@ platform :ios do
135135
slack_url: slack_webhook,
136136
)
137137
end
138-
end
138+
end

swift-sdk/Constants.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,11 @@ enum Const {
9595
static let location = "Location"
9696
static let setCookie = "Set-Cookie"
9797
}
98+
99+
enum RemoteNotification {
100+
static let aps = "aps"
101+
static let contentAvailable = "content-available"
102+
}
98103
}
99104

100105
enum JsonKey {

swift-sdk/Internal/InternalIterableAPI.swift

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -706,7 +706,16 @@ final class InternalIterableAPI: NSObject, PushTrackerProtocol, AuthProvider {
706706
guard let launchOptions = launchOptions else {
707707
return
708708
}
709+
709710
if let remoteNotificationPayload = launchOptions[UIApplication.LaunchOptionsKey.remoteNotification] as? [AnyHashable: Any] {
711+
712+
if let aps = remoteNotificationPayload[Const.RemoteNotification.aps] as? [String: Any],
713+
let contentAvailable = aps[Const.RemoteNotification.contentAvailable] as? Int,
714+
contentAvailable == 1 {
715+
ITBInfo("Received push notification with wakey content-available flag")
716+
return
717+
}
718+
710719
if let _ = IterableUtil.rootViewController {
711720
// we are ready
712721
IterableAppIntegration.implementation?.performDefaultNotificationAction(remoteNotificationPayload)

tests/unit-tests/AuthTests.swift

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -562,30 +562,30 @@ class AuthTests: XCTestCase {
562562
func testAuthTokenRefreshRetryOnlyOnce() throws {
563563
throw XCTSkip("skipping this test - auth token retries should occur more than once")
564564

565-
let condition1 = expectation(description: "\(#function) - callback not called correctly in some form")
566-
condition1.expectedFulfillmentCount = 2
567-
568-
let authDelegate = createAuthDelegate({
569-
condition1.fulfill()
570-
return AuthTests.authToken
571-
})
572-
573-
let config = IterableConfig()
574-
config.authDelegate = authDelegate
575-
576-
let mockNetworkSession = MockNetworkSession(statusCode: 401,
577-
json: [JsonKey.Response.iterableCode: JsonValue.Code.invalidJwtPayload])
578-
579-
let internalAPI = InternalIterableAPI.initializeForTesting(config: config,
580-
networkSession: mockNetworkSession)
581-
582-
internalAPI.email = AuthTests.email
583-
584-
// two calls here to trigger the retry more than once
585-
internalAPI.track("event")
586-
internalAPI.track("event")
587-
588-
wait(for: [condition1], timeout: testExpectationTimeout)
565+
// let condition1 = expectation(description: "\(#function) - callback not called correctly in some form")
566+
// condition1.expectedFulfillmentCount = 2
567+
//
568+
// let authDelegate = createAuthDelegate({
569+
// condition1.fulfill()
570+
// return AuthTests.authToken
571+
// })
572+
//
573+
// let config = IterableConfig()
574+
// config.authDelegate = authDelegate
575+
//
576+
// let mockNetworkSession = MockNetworkSession(statusCode: 401,
577+
// json: [JsonKey.Response.iterableCode: JsonValue.Code.invalidJwtPayload])
578+
//
579+
// let internalAPI = InternalIterableAPI.initializeForTesting(config: config,
580+
// networkSession: mockNetworkSession)
581+
//
582+
// internalAPI.email = AuthTests.email
583+
//
584+
// // two calls here to trigger the retry more than once
585+
// internalAPI.track("event")
586+
// internalAPI.track("event")
587+
//
588+
// wait(for: [condition1], timeout: testExpectationTimeout)
589589
}
590590

591591
func testPriorAuthFailedRetryPrevention() {

tests/unit-tests/EmbeddedManagerTests.swift

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -10,30 +10,30 @@ final class EmbeddedManagerTests: XCTestCase {
1010
func testManagerSingleDelegateUpdated() throws {
1111
throw XCTSkip("skipping this test - manager logic updated, needs to be revisited")
1212

13-
let condition1 = expectation(description: #function)
14-
15-
let mockApiClient = MockApiClient()
16-
17-
let manager = IterableEmbeddedManager(apiClient: mockApiClient,
18-
urlDelegate: nil,
19-
customActionDelegate: nil,
20-
urlOpener: MockUrlOpener(),
21-
allowedProtocols: [],
22-
enableEmbeddedMessaging: true)
23-
24-
let view1 = ViewWithUpdateDelegate(
25-
onMessagesUpdatedCallback: {
26-
condition1.fulfill()
27-
},
28-
onEmbeddedMessagingDisabledCallback: nil
29-
)
30-
31-
manager.addUpdateListener(view1)
32-
33-
mockApiClient.haveNewEmbeddedMessages()
34-
manager.syncMessages {}
35-
36-
wait(for: [condition1], timeout: 2)
13+
// let condition1 = expectation(description: #function)
14+
//
15+
// let mockApiClient = MockApiClient()
16+
//
17+
// let manager = IterableEmbeddedManager(apiClient: mockApiClient,
18+
// urlDelegate: nil,
19+
// customActionDelegate: nil,
20+
// urlOpener: MockUrlOpener(),
21+
// allowedProtocols: [],
22+
// enableEmbeddedMessaging: true)
23+
//
24+
// let view1 = ViewWithUpdateDelegate(
25+
// onMessagesUpdatedCallback: {
26+
// condition1.fulfill()
27+
// },
28+
// onEmbeddedMessagingDisabledCallback: nil
29+
// )
30+
//
31+
// manager.addUpdateListener(view1)
32+
//
33+
// mockApiClient.haveNewEmbeddedMessages()
34+
// manager.syncMessages {}
35+
//
36+
// wait(for: [condition1], timeout: 2)
3737
}
3838

3939
// getMessages

tests/unit-tests/IterableAPIResponseTests.swift

Lines changed: 45 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -102,51 +102,51 @@ class IterableAPIResponseTests: XCTestCase {
102102

103103
func testRetryOnInvalidJwtPayload() throws {
104104
throw XCTSkip("skipping this test - retry logic updated, needs to be revisited")
105-
let xpectation = expectation(description: "retry on 401 with invalidJWTPayload")
106-
107-
// Mock the dependencies and requestProvider for your test
108-
let authManager = MockAuthManager()
109-
110-
let networkErrorSession = MockNetworkSession() { _ in
111-
MockNetworkSession.MockResponse(statusCode: 401,
112-
data: ["code":"InvalidJwtPayload"].toJsonData(),
113-
delay: 1)
114-
}
115-
116-
let networkSuccessSession = MockNetworkSession() { _ in
117-
MockNetworkSession.MockResponse(statusCode: 200,
118-
data: ["msg": "success"].toJsonData(),
119-
delay: 1)
120-
}
121-
122-
let urlErrorRequest = createApiClient(networkSession: networkErrorSession).convertToURLRequest(iterableRequest: IterableRequest.post(PostRequest(path: "", args: nil, body: [:])))!
123-
124-
125-
let urlSuccessRequest = createApiClient(networkSession: networkSuccessSession).convertToURLRequest(iterableRequest: IterableRequest.post(PostRequest(path: "", args: nil, body: [:])))!
126-
127-
let requestProvider: () -> Pending<SendRequestValue, SendRequestError> = {
128-
if authManager.retryWasRequested {
129-
return RequestSender.sendRequest(urlSuccessRequest, usingSession: networkSuccessSession)
130-
}
131-
return RequestSender.sendRequest(urlErrorRequest, usingSession: networkErrorSession)
132-
}
133-
134-
let result = RequestProcessorUtil.sendRequest(
135-
requestProvider: requestProvider,
136-
authManager: authManager,
137-
requestIdentifier: "TestIdentifier"
138-
)
139-
140-
result.onSuccess { value in
141-
xpectation.fulfill()
142-
XCTAssert(true)
143-
}.onError { error in
144-
if authManager.retryWasRequested {
145-
xpectation.fulfill()
146-
}
147-
}
148-
149-
waitForExpectations(timeout: testExpectationTimeout)
105+
// let xpectation = expectation(description: "retry on 401 with invalidJWTPayload")
106+
//
107+
// // Mock the dependencies and requestProvider for your test
108+
// let authManager = MockAuthManager()
109+
//
110+
// let networkErrorSession = MockNetworkSession() { _ in
111+
// MockNetworkSession.MockResponse(statusCode: 401,
112+
// data: ["code":"InvalidJwtPayload"].toJsonData(),
113+
// delay: 1)
114+
// }
115+
//
116+
// let networkSuccessSession = MockNetworkSession() { _ in
117+
// MockNetworkSession.MockResponse(statusCode: 200,
118+
// data: ["msg": "success"].toJsonData(),
119+
// delay: 1)
120+
// }
121+
//
122+
// let urlErrorRequest = createApiClient(networkSession: networkErrorSession).convertToURLRequest(iterableRequest: IterableRequest.post(PostRequest(path: "", args: nil, body: [:])))!
123+
//
124+
//
125+
// let urlSuccessRequest = createApiClient(networkSession: networkSuccessSession).convertToURLRequest(iterableRequest: IterableRequest.post(PostRequest(path: "", args: nil, body: [:])))!
126+
//
127+
// let requestProvider: () -> Pending<SendRequestValue, SendRequestError> = {
128+
// if authManager.retryWasRequested {
129+
// return RequestSender.sendRequest(urlSuccessRequest, usingSession: networkSuccessSession)
130+
// }
131+
// return RequestSender.sendRequest(urlErrorRequest, usingSession: networkErrorSession)
132+
// }
133+
//
134+
// let result = RequestProcessorUtil.sendRequest(
135+
// requestProvider: requestProvider,
136+
// authManager: authManager,
137+
// requestIdentifier: "TestIdentifier"
138+
// )
139+
//
140+
// result.onSuccess { value in
141+
// xpectation.fulfill()
142+
// XCTAssert(true)
143+
// }.onError { error in
144+
// if authManager.retryWasRequested {
145+
// xpectation.fulfill()
146+
// }
147+
// }
148+
//
149+
// waitForExpectations(timeout: testExpectationTimeout)
150150
}
151151

152152
func testResponseCode401() { // 401 = unauthorized

0 commit comments

Comments
 (0)