You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Apologies in advance, this is a very specific issue where I'm trying to get two mature Flutter packages to play nice. I'm in the process of implementing both CarPlay and Adapty for my flutter app and ran into a blocker which I overcame but only with an unpleasant hack.
Dependencies:
To implement CarPlay (see https://pub.dev/packages/flutter_carplay) it's required that we implement a SceneDelegate as detailed on their package info, see Getting Started step 3.
To have the Adapty SDK work properly we need application(didFinishLaunchingWithOptions) callback to trigger in module SwiftAdaptyFlutterPlugin because it's required that activateOnLaunch() execute to pull the settings from the Adapty-Info.plist
Problem statement: My CarPlay app is functioning normally but my Adapty integration that was previously working now does not. Debugging suggests this is because we're using a SceneDelegate to register plugins and subsequently the callback application(didFinishLaunchingWithOptions) doesn't trigger so Adapty doesn't initialise. We then get an error when trying to use any subsequent Adapty functions such as GetProfile.
Now to the hack: Fortunately setLogLevel works, so I've added the hackiest of hack calls to activateOnLaunch() in module SwiftAdaptyFlutterPlugin just before the line Adapty.logLevel = logLevel in function handleSetLogLevel. I mainly wanted to see if this would work given the timing of the call and good news is that it does and my Adapty paywall is now working, but there are probably some gotchas that I'm not aware of!
Steps To Reproduce: Follow both flutter_carplay (1.0.3) and Adapty (2.7.1) standard implementation steps (a shortcut would be to add Adapty to the flutter_carplay sample app).
Question: Is it possible for a) Adapty to trap SceneDelegate lifecycle callbacks that are similar/equivalent to application(didFinishLaunchingWithOptions) so as to ensure that Adapty initialises in this scenario or b) Allow control from early in the Flutter lifecycle to call Activate() or similar manually.
I get that there's a reason the activation is being done automatically so as to play nice with StoreKit but unless I put this hack in or implement another custom method call in the SDK I can't see this being resolved. I'm pretty sure the CarPlay solution needs to retain the SceneDelegate approach.
Thanks in advance for your assistance!
Mark
The text was updated successfully, but these errors were encountered:
Hi, @kingsglade! Thank you for the interesting issue, we will discuss your case internally and try to reproduce it. I hope we'll be able to suggest a solution for you soon!
Hi @kingsglade! I apologize for the late response; our team has been really busy preparing the new release for iOS. I think we will add an option for manual activation for Adapty Flutter, as well as an automatic one, which will resolve your original issue.
Hi All,
Apologies in advance, this is a very specific issue where I'm trying to get two mature Flutter packages to play nice. I'm in the process of implementing both CarPlay and Adapty for my flutter app and ran into a blocker which I overcame but only with an unpleasant hack.
Dependencies:
SceneDelegate
as detailed on their package info, see Getting Started step 3.application(didFinishLaunchingWithOptions)
callback to trigger in moduleSwiftAdaptyFlutterPlugin
because it's required thatactivateOnLaunch()
execute to pull the settings from theAdapty-Info.plist
Problem statement: My CarPlay app is functioning normally but my Adapty integration that was previously working now does not. Debugging suggests this is because we're using a
SceneDelegate
to register plugins and subsequently the callbackapplication(didFinishLaunchingWithOptions)
doesn't trigger so Adapty doesn't initialise. We then get an error when trying to use any subsequent Adapty functions such asGetProfile
.Now to the hack: Fortunately
setLogLevel
works, so I've added the hackiest of hack calls toactivateOnLaunch()
in moduleSwiftAdaptyFlutterPlugin
just before the lineAdapty.logLevel = logLevel
in functionhandleSetLogLevel
. I mainly wanted to see if this would work given the timing of the call and good news is that it does and my Adapty paywall is now working, but there are probably some gotchas that I'm not aware of!Steps To Reproduce: Follow both flutter_carplay (1.0.3) and Adapty (2.7.1) standard implementation steps (a shortcut would be to add Adapty to the flutter_carplay sample app).
Question: Is it possible for a) Adapty to trap SceneDelegate lifecycle callbacks that are similar/equivalent to
application(didFinishLaunchingWithOptions)
so as to ensure that Adapty initialises in this scenario or b) Allow control from early in the Flutter lifecycle to callActivate()
or similar manually.I get that there's a reason the activation is being done automatically so as to play nice with StoreKit but unless I put this hack in or implement another custom method call in the SDK I can't see this being resolved. I'm pretty sure the CarPlay solution needs to retain the SceneDelegate approach.
Thanks in advance for your assistance!
Mark
The text was updated successfully, but these errors were encountered: