-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: sample app issues #551
Changes from all commits
f62ddc6
879519a
cc6dece
2b049ce
5dbff1b
539ea5a
acc197e
5e8573b
fd28e8e
ff17022
b3bb9cf
19fb72e
3bb7da8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -73,30 +73,14 @@ extension MessagingPushImplementation { | |
|
||
// This conditional will only work in production and not in automated tests. But this file cannot be in automated tests so this conditional is OK for now. | ||
if let composedRichPush = composedRichPush as? UNNotificationWrapper { | ||
self.finishTasksThenReturn(contentHandler: contentHandler, notificationContent: composedRichPush.notificationContent) | ||
self.logger.info("Customer.io push processing is done!") | ||
contentHandler(composedRichPush.notificationContent) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When we call the This might be out of scope of this PR, but I think that we need to make sure that before we call the contentHandler, we confirm the I see above this line of code There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yup, that is correct, i'll create a separate PR for it. But good callout. |
||
} | ||
} | ||
|
||
return true | ||
} | ||
|
||
private func finishTasksThenReturn( | ||
contentHandler: @escaping (UNNotificationContent) -> Void, | ||
notificationContent: UNNotificationContent | ||
) { | ||
logger | ||
.debug( | ||
"running all background queue tasks and waiting until complete to prevent OS from killing notification service extension before all HTTP requests have been performed" | ||
) | ||
// FIXME: [CDP] Request to Journey | ||
// backgroundQueue.run { | ||
// self.logger.debug("all background queue tasks done running.") | ||
// self.logger.info("Customer.io push processing is done!") | ||
// | ||
// contentHandler(notificationContent) | ||
// } | ||
} | ||
|
||
/** | ||
iOS telling the notification service to hurry up and stop modifying the push notifications. | ||
Stop all network requests and modifying and show the push for what it looks like now. | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -140,8 +140,8 @@ extension RichPushHttpClient { | |
public static let defaultAPIHost = "https://cdp.customer.io/v1" | ||
|
||
static func authorizationHeaderForWriteKey(_ key: String) -> String { | ||
var returnHeader = "" | ||
if let encodedRawHeader = key.data(using: .utf8) { | ||
var returnHeader = "\(key):" | ||
if let encodedRawHeader = returnHeader.data(using: .utf8) { | ||
returnHeader = encodedRawHeader.base64EncodedString(options: NSData.Base64EncodingOptions(rawValue: 0)) | ||
} | ||
return returnHeader | ||
|
@@ -160,8 +160,10 @@ extension RichPushHttpClient { | |
|
||
static func getBasicSession() -> URLSession { | ||
let configuration = URLSessionConfiguration.ephemeral | ||
configuration.httpMaximumConnectionsPerHost = 2 | ||
configuration.allowsCellularAccess = true | ||
configuration.timeoutIntervalForResource = 30 | ||
configuration.timeoutIntervalForRequest = 60 | ||
configuration.httpAdditionalHeaders = [:] | ||
Comment on lines
+164
to
+166
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why were these lines added? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. they are in |
||
let session = URLSession(configuration: configuration, delegate: nil, delegateQueue: nil) | ||
return session | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should have a comment in the code explaining why having a unique file name is important. Or, why this UUID is needed beyond "suggest file name"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i would have hoped naming would have done the trick, as in
suggestedFileName
instead ofuniqueFileName
which was before, because suggested file name even from the name doesn't say its going to be unique.and then adding
UUID().uuidString
and referring it asuniqueFileName
to mention we would have a unique path.So from a presepective of someone who is looking for the first time, they would understand whats happening just by looking into names.
But i can add comment on it, if it helps.