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: push images and processing simple push #230

Merged
merged 5 commits into from
Dec 6, 2022
Merged

Conversation

levibostian
Copy link
Contributor

@levibostian levibostian commented Dec 5, 2022

Closes: https://github.com/customerio/issues/issues/8640

This PR is the same as Aman's (thanks so much for finding this bug fix, Aman!) PR, but this one:

  • Fixes another bug that I found while testing a simple push in an iOS app.
  • This PR is a hotfix PR to release to customers faster.

@levibostian levibostian changed the base branch from develop to main December 5, 2022 21:05
@levibostian levibostian marked this pull request as ready for review December 5, 2022 21:06
@ami-oss-ci
Copy link

ami-oss-ci commented Dec 5, 2022

Pull request title looks good 👍!

If this pull request gets merged, it will cause a new release of the software. Example: If this project's latest release version is 1.0.0. If this pull request gets merged in, the next release of this project will be 1.0.1. This pull request is not a breaking change.

All merged pull requests will eventually get deployed. But some types of pull requests will trigger a deployment (such as features and bug fixes) while some pull requests will wait to get deployed until a later time.

To merge this pull request, add the label Ready to merge to this pull request and I'll merge it for you.

This project uses a special format for pull requests titles. Expand this section to learn more (expand by clicking the ᐅ symbol on the left side of this sentence)...

This project uses a special format for pull requests titles. Don't worry, it's easy!

This pull request title should be in this format:

<type>: short description of change being made

If your pull request introduces breaking changes to the code, use this format:

<type>!: short description of breaking change

where <type> is one of the following:

  • feat: - A feature is being added or modified by this pull request. Use this if you made any changes to any of the features of the project.

  • fix: - A bug is being fixed by this pull request. Use this if you made any fixes to bugs in the project.

  • docs: - This pull request is making documentation changes, only.

  • refactor: - A change was made that doesn't fix a bug or add a feature.

  • test: - Adds missing tests or fixes broken tests.

  • style: - Changes that do not effect the code (whitespace, linting, formatting, semi-colons, etc)

  • perf: - Changes improve performance of the code.

  • build: - Changes to the build system (maven, npm, gulp, etc)

  • ci: - Changes to the CI build system (Travis, GitHub Actions, Circle, etc)

  • chore: - Other changes to project that don't modify source code or test files.

  • revert: - Reverts a previous commit that was made.

Examples:

feat: edit profile photo
refactor!: remove deprecated v1 endpoints
build: update npm dependencies
style: run formatter 

Need more examples? Want to learn more about this format? Check out the official docs.

Note: If your pull request does multiple things such as adding a feature and makes changes to the CI server and fixes some bugs then you might want to consider splitting this pull request up into multiple smaller pull requests.

if sdkConfigStore.config.autoTrackPushEvents,
let deliveryID: String = request.content.userInfo["CIO-Delivery-ID"] as? String,
let deviceToken: String = request.content.userInfo["CIO-Delivery-Token"] as? String {
guard let deliveryID: String = request.content.userInfo["CIO-Delivery-ID"] as? String,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The code changes done in this file addresses a bug that I found. If you use the new rich composer and send a simple push (just title and body), this code originally would process the simple push, say that the push was not sent from CIO, then would just return without calling the contentHandler resulting in the simple push not showing up until ~30 seconds later when the OS would kill our NSE (by calling serviceExtensionTimeWillExpire) and then show the push on the device.

This change I made uses the deliverId and token to determine if the push was sent by CIO - simple or rich. Then, the processing will end early for simple pushes or continue for rich.

@@ -92,15 +92,15 @@ public class MessagingPushFCM: MessagingPushFCMInstance {
_ request: UNNotificationRequest,
withContentHandler contentHandler: @escaping (UNNotificationContent) -> Void
) -> Bool {
messagingPush.didReceive(request, withContentHandler: contentHandler)
(messagingPush as MessagingPushInstance).didReceive(request, withContentHandler: contentHandler)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

In iOS v2, I made some refactors that no longer require this casting. But for v1 with the way the code is today, it still requires this casting to be done.

@codecov
Copy link

codecov bot commented Dec 6, 2022

Codecov Report

Merging #230 (7ce1337) into main (da62a8e) will decrease coverage by 0.13%.
The diff coverage is 0.00%.

@@            Coverage Diff             @@
##             main     #230      +/-   ##
==========================================
- Coverage   52.34%   52.21%   -0.14%     
==========================================
  Files         101      101              
  Lines        1173     1176       +3     
==========================================
  Hits          614      614              
- Misses        559      562       +3     
Impacted Files Coverage Δ
...essagingPush/RichPush/MessagingPush+RichPush.swift 0.00% <0.00%> (ø)
Sources/MessagingPushAPN/MessagingPushAPN.swift 10.00% <ø> (ø)
Sources/MessagingPushFCM/MessagingPushFCM.swift 10.00% <ø> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@levibostian levibostian merged commit f109f04 into main Dec 6, 2022
@levibostian levibostian deleted the levi/fix-push branch December 6, 2022 15:29
ami-ci pushed a commit that referenced this pull request Dec 6, 2022
### [1.2.7](1.2.6...1.2.7) (2022-12-06)

### Bug Fixes

* push images and processing simple push ([#230](#230)) ([f109f04](f109f04))
@ami-ci
Copy link
Contributor

ami-ci commented Dec 6, 2022

🎉 This PR is included in version 1.2.7 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@ami-ci ami-ci added the released label Dec 6, 2022
github-actions bot pushed a commit to nagyist/customerio-ios that referenced this pull request Feb 23, 2023
## [2.0.0](1.2.4...2.0.0) (2023-02-23)

### ⚠ BREAKING CHANGES

* make delivered push metric more reliable
* remove FCM dependency from cocoapods (customerio#210)
* singleton API only way to use SDK now (customerio#209)

### Features

* add in-app event listener ([customerio#211](https://github.com/nagyist/customerio-ios/issues/211)) ([737d43b](737d43b))
* in-app feature no longer requires orgId ([customerio#252](https://github.com/nagyist/customerio-ios/issues/252)) ([acd12da](acd12da))

### Bug Fixes

* access modifier for metric ([customerio#263](https://github.com/nagyist/customerio-ios/issues/263)) ([e641982](e641982))
* add sdkwrapperconfig to rich push SDK config ([customerio#226](https://github.com/nagyist/customerio-ios/issues/226)) ([e43b4cf](e43b4cf))
* added reusable code for wrapper SDKs ([customerio#247](https://github.com/nagyist/customerio-ios/issues/247)) ([36adf15](36adf15))
* async running BQ operations in loop ([customerio#250](https://github.com/nagyist/customerio-ios/issues/250)) ([f0a3d9c](f0a3d9c))
* device attributes shows sdk version instead of wrapper version ([e2462b9](e2462b9))
* do not modify custom attributes casing ([customerio#234](https://github.com/nagyist/customerio-ios/issues/234)) ([8160fdf](8160fdf))
* download rich push images from CDN ([customerio#237](https://github.com/nagyist/customerio-ios/issues/237)) ([b30cf02](b30cf02))
* fix compile time errors notification service extensions ([customerio#214](https://github.com/nagyist/customerio-ios/issues/214)) ([bd5911b](bd5911b))
* fix compile time errors notification service extensions ([customerio#216](https://github.com/nagyist/customerio-ios/issues/216)) ([6e8484a](6e8484a))
* in-app missing event ([customerio#259](https://github.com/nagyist/customerio-ios/issues/259)) ([43b3e97](43b3e97))
* make delivered push metric more reliable ([0478e52](0478e52))
* modify in-app event listener action parameters to new name ([customerio#255](https://github.com/nagyist/customerio-ios/issues/255)) ([b46528a](b46528a))
* prevent stackoverflow while executing background queue with lots of tasks in it ([customerio#245](https://github.com/nagyist/customerio-ios/issues/245)) ([ef0c428](ef0c428))
* push images and processing simple push ([customerio#230](https://github.com/nagyist/customerio-ios/issues/230)) ([f109f04](f109f04))
* region visibility modifier to be used by wrappers ([customerio#260](https://github.com/nagyist/customerio-ios/issues/260)) ([f0edfbc](f0edfbc))
* revert 2.0.2 as it was found unstable ([customerio#249](https://github.com/nagyist/customerio-ios/issues/249)) ([51b5831](51b5831))
* sdk not able to compile in ios app ([customerio#225](https://github.com/nagyist/customerio-ios/issues/225)) ([e4d1b3f](e4d1b3f))
* universal links deep links open host app ([customerio#268](https://github.com/nagyist/customerio-ios/issues/268)) ([29c95b5](29c95b5))
* universal links when touch a push notification open host app ([customerio#265](https://github.com/nagyist/customerio-ios/issues/265)) ([7dcaf73](7dcaf73))
* update the gist version in podspec ([customerio#256](https://github.com/nagyist/customerio-ios/issues/256)) ([5451488](5451488))

### Code Refactoring

* remove FCM dependency from cocoapods ([customerio#210](https://github.com/nagyist/customerio-ios/issues/210)) ([3547076](3547076))
* singleton API only way to use SDK now ([customerio#209](https://github.com/nagyist/customerio-ios/issues/209)) ([72b7477](72b7477))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants