Skip to content
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

Merged
merged 13 commits into from
Feb 22, 2024
Merged

fix: sample app issues #551

merged 13 commits into from
Feb 22, 2024

Conversation

Shahroz16
Copy link
Contributor

@Shahroz16 Shahroz16 requested a review from a team February 22, 2024 15:05
Copy link

github-actions bot commented Feb 22, 2024

Sample app builds 📱

Below you will find the list of the latest versions of the sample apps. It's recommended to always download the latest builds of the sample apps to accurately test the pull request.


  • CocoaPods-FCM: Build failed. See CI job logs to determine the issue and try re-building.
  • APN-UIKit: Build failed. See CI job logs to determine the issue and try re-building.

Copy link
Contributor

@levibostian levibostian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this PR be pointing to main?

The PR title says this is a sample app issue, but it's a NSE rich push image issue. I suggest modifying the PR title to indicate that this is a bug fix for rich push images being more reliable.

Comment on lines 76 to 79
self.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"
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
self.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"
)

Since we are not running the BQ anymore in the NSE, we can remove this log statement.

)

self.logger.info("Customer.io push processing is done!")
contentHandler(composedRichPush.notificationContent)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When we call the contentHandler(), we are telling the OS that our NSE is completely done doing what it needs to do.

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 delivered metric HTTP request has finished, correct?

I see above this line of code trackMetricFromNSE(deliveryID: pushCioDeliveryInfo.id, event: .delivered, deviceToken: pushCioDeliveryInfo.token) and because there is no async callback in that line of code, we are not informed when the HTTP request concludes, correct?

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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 onComplete(nil)
}

let uniqueFileName = UUID().uuidString + "_" + suggestedFileName
Copy link
Contributor

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"

Copy link
Contributor Author

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 of uniqueFileName 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 as uniqueFileName 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.

Comment on lines +164 to +166
configuration.timeoutIntervalForResource = 30
configuration.timeoutIntervalForRequest = 60
configuration.httpAdditionalHeaders = [:]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why were these lines added?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

they are in main so I think they were adding values in there.

}

func testDownloadFileCreatesExpectedFile() {
if let session = session {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this test and think we should get it running in the CI, at least in the short-term.

Assuming you agree, could we modify session to be non-nil? So we don't need this if let condition? I would like us to feel more confident that this test will execute and having this if let makes me think sometimes it might not run.

Also, what do you think about performing a 2nd HTTP request in this test function, downloading the same image URL, and expect that the 2 local file paths are unique?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could run it in CI, if needed. if let was there to ensure it doesn't run on CI but we can update that.

Copy link
Contributor Author

@Shahroz16 Shahroz16 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will create a separate PR directed at main with this fix. This was for CDP sample app to be able to pass all tests.

Comment on lines +164 to +166
configuration.timeoutIntervalForResource = 30
configuration.timeoutIntervalForRequest = 60
configuration.httpAdditionalHeaders = [:]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

they are in main so I think they were adding values in there.

return onComplete(nil)
}

let uniqueFileName = UUID().uuidString + "_" + suggestedFileName
Copy link
Contributor Author

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 of uniqueFileName 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 as uniqueFileName 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.

)

self.logger.info("Customer.io push processing is done!")
contentHandler(composedRichPush.notificationContent)
Copy link
Contributor Author

Choose a reason for hiding this comment

The 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.

}

func testDownloadFileCreatesExpectedFile() {
if let session = session {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could run it in CI, if needed. if let was there to ensure it doesn't run on CI but we can update that.

@Shahroz16 Shahroz16 merged commit 05544b3 into main-replica-for-cdp Feb 22, 2024
3 of 8 checks passed
@Shahroz16 Shahroz16 deleted the shahroz/mbl-123 branch February 22, 2024 21:00
github-actions bot pushed a commit that referenced this pull request Mar 20, 2024
## [3.0.0](2.12.5...3.0.0) (2024-03-20)

### ⚠ BREAKING CHANGES

* iOS as a source for Data Pipelines (#659)

### Features

* iOS as a source for Data Pipelines ([#659](#659)) ([0a68373](0a68373))
* migration module to cater to all migration tasks  ([#530](#530)) ([2feb1d4](2feb1d4))

### Bug Fixes

* add attributes to properties  ([#649](#649)) ([4b02e92](4b02e92))
* all sdk modules can only be initialized once ([ae46c7f](ae46c7f))
* app crash on identify method ([#458](#458)) ([13e9862](13e9862))
* compilation for test ([f14b773](f14b773))
* compilation issue ([420a61e](420a61e))
* eventbus handler ref ([#469](#469)) ([8c8ef91](8c8ef91))
* journey id in migration payload ([#653](#653)) ([3b649c9](3b649c9))
* prevent duplicate automatic screenview events from being tracked ([fea9ec5](fea9ec5))
* pushEventHandler test ([dc80fc2](dc80fc2))
* remove occurrence of autoTrackDeviceAttributes from all push modules ([#505](#505)) ([8dc6507](8dc6507))
* removed last_used from properties  ([#477](#477)) ([b0b9631](b0b9631))
* sample app issues ([#551](#551)) ([05544b3](05544b3))
* use git commit instead of git branch for segment dependency ([d245015](d245015))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants