diff --git a/CHANGELOG.md b/CHANGELOG.md index 8efe74a..d876097 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 2.0.4 + +- Removed `AlwaysShowIntroduction` option, changed naming of `isKillSwitchActive` to `isAllowedToPassThrough`. + ## 2.0.3 - Added after splashscreen route diff --git a/lib/src/models/start_configuration.dart b/lib/src/models/start_configuration.dart index ef9d608..4dbf8c9 100644 --- a/lib/src/models/start_configuration.dart +++ b/lib/src/models/start_configuration.dart @@ -13,7 +13,6 @@ class StartUserStoryConfiguration { this.introductionFallbackScreen, this.introductionScrollPhysics, this.showIntroduction = true, - this.alwaysShowIntroduction = false, this.useKillswitch = false, this.minimumSplashScreenDuration = 3, this.splashScreenFuture, @@ -47,9 +46,6 @@ class StartUserStoryConfiguration { /// If the introduction should be shown. final bool showIntroduction; - /// If this is true the introduction will always be shown. - final bool alwaysShowIntroduction; - /// If the killswitch is enabled this app can be remotely disabled. final bool useKillswitch; diff --git a/lib/src/user_stories/flutter_start_userstory_go_router.dart b/lib/src/user_stories/flutter_start_userstory_go_router.dart index 2d68823..cd0dbec 100644 --- a/lib/src/user_stories/flutter_start_userstory_go_router.dart +++ b/lib/src/user_stories/flutter_start_userstory_go_router.dart @@ -22,7 +22,7 @@ List getStartStoryRoutes( path: StartUserStoryRoutes.splashScreen, pageBuilder: (context, state) { var go = context.go; - var killSwitchIsActive = false; + var isAllowedToPassThrough = false; var introductionSeen = false; String? routeAfterSplash; Future splashLoadingMethod() async { @@ -32,7 +32,7 @@ List getStartStoryRoutes( Duration.zero, () async { if (configuration.useKillswitch) - killSwitchIsActive = + isAllowedToPassThrough = await KillswitchService().isKillswitchActive(); var introService = configuration.introductionService ?? IntroductionService( @@ -54,10 +54,9 @@ List getStartStoryRoutes( ], ); - if (configuration.useKillswitch && killSwitchIsActive) return; + if (configuration.useKillswitch && isAllowedToPassThrough) return; - if (!configuration.showIntroduction || - (introductionSeen && !configuration.alwaysShowIntroduction)) { + if (!configuration.showIntroduction || introductionSeen) { return go( routeAfterSplash ?? StartUserStoryRoutes.home, ); diff --git a/lib/src/user_stories/flutter_start_userstory_navigator.dart b/lib/src/user_stories/flutter_start_userstory_navigator.dart index 2945839..5a1965b 100644 --- a/lib/src/user_stories/flutter_start_userstory_navigator.dart +++ b/lib/src/user_stories/flutter_start_userstory_navigator.dart @@ -19,7 +19,7 @@ Widget _splashScreen( BuildContext context, ) { var navigator = Navigator.of(context); - var killSwitchIsActive = false; + var isAllowedToPassThrough = false; var introductionSeen = false; Future myFunction() async { await Future.wait( @@ -29,7 +29,7 @@ Widget _splashScreen( Duration.zero, () async { if (configuration.useKillswitch) - killSwitchIsActive = + isAllowedToPassThrough = await KillswitchService().isKillswitchActive(); var introService = configuration.introductionService ?? IntroductionService( @@ -47,10 +47,9 @@ Widget _splashScreen( ], ); - if (configuration.useKillswitch && killSwitchIsActive) return; + if (configuration.useKillswitch && isAllowedToPassThrough) return; - if (!configuration.showIntroduction || - (introductionSeen && !configuration.alwaysShowIntroduction)) { + if (!configuration.showIntroduction || introductionSeen) { await navigator.pushReplacement( MaterialPageRoute( builder: (context) => _home(configuration, context), diff --git a/pubspec.yaml b/pubspec.yaml index 7cc8783..75165af 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,7 +1,7 @@ name: flutter_start description: "Flutter_start is a package that allows you to jumpstart your application with a splashScreen, introduction and a home." publish_to: "none" -version: 2.0.3 +version: 2.0.4 environment: sdk: ">=3.2.5 <4.0.0"