OneSignal / OneSignal-iOS-SDK

OneSignal is a free push notification service for mobile apps. This plugin makes it easy to integrate your native iOS app with OneSignal. https://onesignal.com
Other
493 stars 262 forks source link

OneSignalLiveActivities framework included for mac catalyst #1446

Closed nan-li closed 3 months ago

nan-li commented 4 months ago

Description

One Line Summary

Add mac catalyst to supported destinations in the OneSignalLiveActivities framework, make ActivityKit-depending files blank, with no change to the umbrella OneSignalFramework.

Details

What's Changed

Screenshot 2024-06-09 at 4 26 49 PM

Screenshot 2024-06-09 at 4 26 59 PM

Solutions Investigated

The errors developers encountered was that the umbrella framework couldn't find OneSignalLiveActivities. So, initially, we considered just adding OneSignalLiveActivities to the OneSignalFramework for mac catalyst.

However, this does not work when building the frameworks with our build script. Tried some other modifications to no avail.

Back to the drawing board... can we continue to exclude Mac Catalyst and make changes elsewhere? Mac catalyst really should not include OneSignalLiveActivities. The problem next is with our Podspec that names it as a dependency of OneSignalFramework.

I investigated how to modify our Podspec to only include Live Activities for ios and not mac catalyst. However, it is tricky. A key problem is that Mac Catalyst is an ios sdk and not a macOS sdk, and not easily differentiable so we cannot use ios vs osx specifications for a Podspec.

What I landed on finally was including Mac Catalyst for OneSignalLiveActivities and removing functionality related to ActivityKit. It did not appear any changes to OneSignalFramework was needed.

Motivation

Scope

Mac Catalyst support

Testing

Unit testing

None

Manual testing

Reproduction of Original Issue

How the changes in this PR were tested

Cocoapods

  1. Build the SDK with the build all frameworks script
  2. Pod install to a project and run on iPhone and Mac Catalyst
  3. Mac Catalyst logs the stub message "oneSignalLiveActivities not found. In order to use OneSignal's LiveActivities features the OneSignalLiveActivities module must be added"

Swift Package Manager

  1. Change the URL in the Package.swift file for each zip to point to the OneSignalXCFramework repo and pick an existing release. Then edit that release and attach the zips.
  2. Have a test app point at this branch when adding SwiftPM
  3. Run on Mac Catalyst and iPhone
  4. Mac Catalyst logs the stub message "oneSignalLiveActivities not found. In order to use OneSignal's LiveActivities features the OneSignalLiveActivities module must be added"

Affected code checklist

Checklist

Overview

Testing

Final pass


This change is Reviewable

nan-li commented 3 months ago

There's some weird behavior I am still investigating. Going to focus on building just Live Activities, I think related to its scheme.

Making Live Activities use the normal build script from build_all_frameworks.sh causes some strange issues when looking at the files generated. OneSignal_LiveActivities itself built differently, looks like some file creation and removal didn't happen but also every package before it in the build script is missing the zip (seems correct). Every package after (Location, IAM, XCFramework) contains the zip, I think the old zips so these packages never built successfully?

Build logs are also so verbose it is hard to parse, no obvious errors either.

Screenshot 2024-06-06 at 9 00 39 AM

emawby commented 3 months ago

There's some weird behavior I am still investigating. Going to focus on building just Live Activities, I think related to its scheme.

Making Live Activities use the normal build script from build_all_frameworks.sh causes some strange issues when looking at the files generated. OneSignal_LiveActivities itself built differently, looks like some file creation and removal didn't happen but also every package before it in the build script is missing the zip (seems correct). Every package after (Location, IAM, XCFramework) contains the zip, I think the old zips so these packages never built successfully?

Build logs are also so verbose it is hard to parse, no obvious errors either.

Screenshot 2024-06-06 at 9 00 39 AM

Is it just the zipping that is failing or are the XCFrameworks corrupted/out of date. You can try dragging in the XCFrameworks to a test app directly to see if they build/have the expected changes.

nan-li commented 3 months ago

I haven't run yet the 2nd script that generates the zips. The build_all_frameworks.sh will delete the zips. I believe probably building Live Activities is failing and preventing the subsequent frameworks to be built (which would remove their zips, which are still present).

Still looking at this.

webbpage commented 3 months ago

This is not working for me. Are there new deployment steps specific to Catalyst that I'm missing?

nan-li commented 3 months ago

I see you followed up at https://github.com/OneSignal/OneSignal-iOS-SDK/issues/1445. I will continue the conversation there.