Flutter: StorylyViewController openStory Not Working
Closed this issue · 1 comments
Summary
I'm trying to present a screen in Flutter which automatically begins playing a story the Storyly Flutter package for both iOS and Android.
Environment Details
Storyly SDK Version: 1.26.0
Flutter SDK Version: 3.0.5
Platform:
- Android
- iOS
Device Model:
- Android Pixel 4a Emulator
- iPhone SE 3rd generation simulator
Device OS Version:
- Android API 32
- iOS 15.5
Additional Info:
n/a
Expected Behavior
Storyly should present the story and begin playing it to the user when openStory
is invoked on both iOS and Android. I should also see consistent delegate calls between iOS and Android (e.g. storylyLoaded
is invoked on iOS but not Android).
Current Behavior
iOS, nothing happens after invoking openStory
on the StorylyViewController
instance. The storylyLoaded
delegate is never invoked by the library.
Android, nothing happens after invoking openStory
on the StorylyViewController
instance. The storylyLoaded
delegate is invoked by the library multiple times. If I move the openStory
call out of onStorylyViewCreated
and into storylyLoaded
, then I can get the story to play but the storylyLoaded
delegate is called multiple times and this seems like the wrong approach.
Steps to Reproduce
To reproduce this issue try running the following code below. On both iOS and Android the story won't play. On Android the storylyLoaded
callback is invoked while on iOS it isn't. If the openStory
call is moved to the storylyLoaded
callback on Android, then the story plays. However, this doesn't seem like the correct solution.
class StorylyScreen extends StatefulWidget {
const StorylyScreen({Key? key}) : super(key: key);
@override
State<StatefulWidget> createState() => _StorylyScreenState();
}
class _StorylyScreenState extends State<StorylyScreen> {
static const token = 'abcdef....';
static const groupId = '####';
late final StorylyViewController _storylyViewController;
S get _s => S.of(context);
void onStorylyViewCreated(StorylyViewController storylyViewController) async {
_storylyViewController = storylyViewController;
await _storylyViewController.openStory(groupId, token);
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(),
body: SafeArea(
child: StorylyView(
onStorylyViewCreated: onStorylyViewCreated,
androidParam: StorylyParam()..storylyId = token,
iosParam: StorylyParam()..storylyId = token,
storylyLoadFailed: (errorMessage) {},
storylyStoryDismissed: () => Navigator.pop(context),
storylyEvent: (
String event,
StoryGroup? storyGroup,
Story? story,
StoryComponent? storyComponent,
) {
},
storylyLoaded: (storyGroups, dataSource) {},
),
),
);
}
}
Hello @masterwok,
We've released storyly_flutter@2.0.0.
Please refer Deeplinks for Stories for details.
Thanks,