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

Fixing IAM on m1 catalyst #1076

Merged
merged 4 commits into from
Apr 18, 2022
Merged

Fixing IAM on m1 catalyst #1076

merged 4 commits into from
Apr 18, 2022

Conversation

emawby
Copy link
Contributor

@emawby emawby commented Apr 18, 2022

Description

One Line Summary

IAMs will no longer be displayed when running for Mac Catalyst on an M1 Mac.

Details

Our logic to not display IAMs on mac catalyst was not working for M1 Macs, because it was directly looking at the architecture. This PR now properly checks the compile target and will not display IAMs for catalyst.

Motivation

bug

Scope

This affects the getDeviceVariant method, which was also incorrect for simulators on M1 Macs.

Testing

Unit testing

I have fixed the unit tests for this, but they now need to be run on specific device targets to test every case since I could not mock the compile target.

Manual testing

I tested on the M1 Mac in the office as well as my intel mac for simulator, catalyst, and device.

Affected code checklist

  • Notifications
    • Display
    • Open
    • Push Processing
    • Confirm Deliveries
  • Outcomes
  • Sessions
  • In-App Messaging
  • REST API requests
  • Public API changes

Checklist

Overview

  • I have filled out all REQUIRED sections above
  • PR does one thing
    • If it is hard to explain how any codes changes are related to each other then it most likely needs to be more than one PR
  • Any Public API changes are explained in the PR details and conform to existing APIs

Testing

  • I have included test coverage for these changes, or explained why they are not needed
  • All automated tests pass, or I explained why that is not possible
  • I have personally tested this on my device, or explained why that is not possible

Final pass

  • Code is as readable as possible.
    • Simplify with less code, followed by splitting up code into well named functions and variables, followed by adding comments to the code.
  • I have reviewed this PR myself, ensuring it meets each checklist item
    • WIP (Work In Progress) is ok, but explain what is still in progress and what you would like feedback on. Start the PR title with "WIP" to indicate this.

This change is Reviewable

We previously were relying on the device architecture to determine the device variant, but that is no longer sufficient with the release of M1 macs.
@emawby emawby requested review from jkasten2, a team and nan-li April 18, 2022 16:50
Copy link
Member

@jkasten2 jkasten2 left a comment

Choose a reason for hiding this comment

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

Reviewed 5 of 5 files at r1, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @emawby and @nan-li)


iOS_SDK/OneSignalSDK/Source/OneSignalHelper.m, line 477 at r1 (raw file):

    // x86_64 could mean an iOS Simulator or Catalyst app on macOS
    #if TARGET_OS_MACCATALYST

This will definitely work if this was app code, but this file is part of the xcframework / SwfitPM. Its likely this will also work for library code since xcframeworks do have different target folders. However we have never done this before so we should confirm it does work end-to-end.

Copy link
Member

@jkasten2 jkasten2 left a comment

Choose a reason for hiding this comment

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

Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @nan-li)


iOS_SDK/OneSignalSDK/Source/OneSignalHelper.m, line 477 at r1 (raw file):

Previously, jkasten2 (Josh Kasten) wrote…

This will definitely work if this was app code, but this file is part of the xcframework / SwfitPM. Its likely this will also work for library code since xcframeworks do have different target folders. However we have never done this before so we should confirm it does work end-to-end.

@emawby Tested, works as expected on mac catalyst, simulator and a iOS device.

Copy link
Member

@jkasten2 jkasten2 left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @nan-li)

@emawby emawby merged commit 08fac33 into main Apr 18, 2022
@emawby emawby deleted the fix/IAM_on_M1_catalyst branch April 18, 2022 18:39
@emawby emawby mentioned this pull request Apr 18, 2022
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