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

[MBL-957] Add RichPushNotifications push service extension to supportrich push notifications with Braze #1882

Merged
merged 7 commits into from Nov 28, 2023

Conversation

amy-at-kickstarter
Copy link
Contributor

@amy-at-kickstarter amy-at-kickstarter commented Nov 13, 2023

📲 What

Add a service extension, RichPushNotifications, to support rich push notifications with Braze.

🤔 Why

This will allow our content marketing team to send push notifications that include images and gifs.

✔️ How to test this

To test this locally:

  1. Double-check that your provisioning profiles are set up to run the Beta scheme for Kickstarter-iOS. You can do this by signing into your developer account in Xcode and checking the automatic code signing switch for the Beta scheme.
  2. Double-check that your provisioning profiles can run the Beta scheme for RichPushNotifications. The same instructions as above should work - but note that it must be using the same developer account as in step 1.
  3. (Possibly optional) I can't run the Firebase Crashlytics script on my local machine. Go to Build Phases, find Firebase Crashlytics, and comment out the run command in that script like
  echo "Not running this"
  # ${SRCROOT}/bin/firebase-crashlytics-run.sh

  1. Select the Beta scheme (by default, it's Debug) of Kickstarter-iOS and deploy the app onto your phone. (If this doesn't work, double check steps 1 and 2 or whatever code signing errors you get.)
  2. Swap into Staging in the KickBeta app and log into an account.
  3. In the Braze dashboard, select 'Segment_Kickstarter_Staging` as your environment.
  4. Create a new campaign, target iOS, and add an image to the rich content section.
  5. Swap to the 'test' tab. Delete the default testers (probably something like 'Newsletter Test Group' and instead add an individual. Use the e-mail you logged in with in step 5.
  6. Hit send. If everything goes well, it will say 'Push successfully sent' and you'll receive your rich push notification shortly!

⏰ TODO

To complete this work, we need to create app ids and matching profiles for the RichPushNotification target. Because a service extension must include the app identifier of its parent in its own app identifier, we will need four separate app IDs:

com.kickstarter.kickstarter.RichPushNotifications
com.kickstarter.kickstarter.debug.RichPushNotifications
com.kickstarter.kickstarter.beta.RichPushNotifications
com.kickstarter.kickstarter.kickAlpha.RichPushNotifications

Once these are set up, we'll add them to our Fastfile, like so, and use the various fastlane match lanes to update our certs:

  desc "Fastlane Match - App Store"
  private_lane :match_appstore do
    match(
      app_identifier: ["com.kickstarter.kickstarter", "com.kickstarter.kickstarter.RichPushNotifications"],
      type: "appstore",
      ...

I've validated this work by running it for com.kickstarter.kickstarter.debug.RichPushNotifications, but I'd like to make sure that it looks good (and we're confident in this) before I do the same fastlane changes for our Enterprise and App Store targets.

@@ -0,0 +1,102 @@
import UIKit
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is almost 100% copy-pasted from Braze's example code. The only difference is that I changed print to my own printDebug method to keep us from spamming the console in production. I gave this a read-through and I think this implementation is fine, if a bit verbose and cautious.

@@ -37,7 +37,8 @@ platform :ios do
private_lane :match_development do
match(
app_identifier: [
"com.kickstarter.kickstarter.debug"
"com.kickstarter.kickstarter.debug",
"com.kickstarter.kickstarter.debug.RichPushNotifications"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

TODO: Before we ship this, I need to make this change for the Enterprise and App Store targets. But I wanted to get a sign-off from either @ifosli or @scottkicks before I do it - since I'll have to run/update our fastlane certs to do so. I'm fine doing that for the dev target, but want to make sure I don't bury us in certificate problems by doing it for the other app targets!

Copy link
Contributor

Choose a reason for hiding this comment

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

discussed offline and decided that we should have enough time during this sprint to address any certificate issues that come up.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

💯 Yeah my plan is to do the other upgrades on Monday so I've got a full week of (non-Holiday) runway if someone goes haywire

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

Copy link

codecov bot commented Nov 20, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (e1e5d68) 83.74% compared to head (c801d6a) 83.74%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1882   +/-   ##
=======================================
  Coverage   83.74%   83.74%           
=======================================
  Files        1222     1222           
  Lines      111440   111440           
  Branches    29644    29644           
=======================================
+ Hits        93322    93324    +2     
+ Misses      17101    17099    -2     
  Partials     1017     1017           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@amy-at-kickstarter amy-at-kickstarter marked this pull request as ready for review November 28, 2023 15:09
@nativeksr
Copy link
Collaborator

1 Warning
⚠️ Big PR

Generated by 🚫 Danger

@scottkicks scottkicks added this to the release-5.11.0 milestone Nov 28, 2023
@amy-at-kickstarter amy-at-kickstarter merged commit 1156229 into main Nov 28, 2023
7 checks passed
@amy-at-kickstarter amy-at-kickstarter deleted the feat/adyer/mbl-967/rich-push branch November 28, 2023 19:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants