-
Notifications
You must be signed in to change notification settings - Fork 97
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
Conference deep link for iOS #1222
Conversation
As specified here https://developer.android.com/training/app-links Handles links that look like `confetti://conference/{conferenceId}`.
As described in the decompose docs about deep links https://arkivanov.github.io/Decompose/navigation/stack/deeplinking/#handling-deep-links
I'll make a separate PR This reverts commit 4e3f302.
Also turn autoVerify to "true", which along with this PR should not require anyone to manually do anything for Confetti to handle those links.
iOS will not get the URL directly on app startup before the component is created, so we need to do this after the fact.
…ce-deep-link-for-ios # Conflicts: # shared/src/commonMain/kotlin/dev/johnoreilly/confetti/decompose/AppComponent.kt
d67084a seems to have worked. Screen.Recording.2024-03-30.at.2.09.21.AM.1.mp4Copy paste this to test yourself too if you want |
…os/conference-deep-link-for-ios
…os/conference-deep-link-for-ios
With this change whenever a deep link is received, we create a completely new AppComponent so that we start from a clean slate. In order to be able to observe this change from SwiftUI we also store a local @State object which we increment at the same time in order to trigger a re-render of the View. This is absolutely a hack and we should find a better approach as soon as possible
Current behavior of the deep links, with Decompose 3.x, showing deep links being handled even if the app was closed before, or open before. I do not know if there's something equivalent to "process death" I can test for here? :D Turning this back into a draft so that we can handle two things better:
|
Handles cleaning up old state after a deep link where we want to start over with a clean slate
Now when there is a new deep link the appComponent inside the ObservableObject changes and the UI which observes it with @ObservedObject automatically gets informed about this and updates the state of the UI
The current behavior after commit c79600a with observable object and all working ios-deeplink-working.mp4 |
@@ -11,17 +11,41 @@ import ConfettiKit | |||
|
|||
class AppDelegate : NSObject, UIApplicationDelegate { | |||
|
|||
let root: AppComponent |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we could conform AppDelegate
to ObservableObject
for simplicity? And just make this root
property @Published var
. Can you try that? If for some reason this is not possible or not working, then maybe move the AppComponent
creation and replacing logic to AppComponentHolder
?
Otherwise looks good!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm yeah I didn't try to make AppDelegate
an ObservableObject
since I wasn't sure if that would be a weird thing to be that and an UIApplicationDelegate
at the same time. I will give that a shot.
If that does not work for whatever reason, when you say "maybe move the AppComponent creation and replacing logic to AppComponentHolder" I assume you mean so that AppDelegate
just calls a small function in init()
and on onConferenceDeepLink
so that the bulk of the work is done in there instead.
Will pick this up some next week, hopefully earlier rather than later inside of it. Thanks for the feedback 😊
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
when you say "maybe move the AppComponent creation and replacing logic to AppComponentHolder"
Yes. Just create the AppComponent
together with its ComponentContext
and Lifecycle
inside AppComponentHolder
. And also add onConferenceDeepLink
to AppComponentHolder
instead, and call that from AppDelegate
. I think this would be cleaner. But the first option with conforming AppDelegate
to ObservableObject
sounds even better.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey making AppDelegate conform to ObservableObject just worked, after fighting with it for a bit 😅 Thanks for your tips!
Make AppDelegate conform to ObservableObject to allow to directly mark the AppComponent as @published Then ConfettiIosApp can receive the AppDelegate as an @ObservedObject and use that published appComponent to pass into ConfettiApp
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
For iOS:
I got into the docs here https://developer.apple.com/documentation/xcode/supporting-associated-domains#Add-the-associated-domain-file-to-your-website
And looked into how this looks like from firebase for the Hedvig app https://hedvig.page.link/.well-known/apple-app-site-association
Then the article here mentions that the identified before the app’s package name is the teamID. So for “appID” it should be “$teamID.$bundleID”.
Not 100% confident this is correct, but when I opened the Xcode project, for the team it said “Unknown name (NT77748GS8)” so I assume either “NT77748GS8" is the right name, or something that only exists on my machine for some reason. This we need to ensure before moving forward. From some forum they say that it should be visible under https://developer.apple.com/account/#/membership and then “This will get you to your Membership Details, just scroll down to Team ID”, so I guess John is the only one who can see this to confirm.