From aa2595efbfeebd085b407e134f71b48442058bbf Mon Sep 17 00:00:00 2001 From: Vick Top Date: Wed, 28 Feb 2024 16:44:04 +0100 Subject: [PATCH] Add BSD-3-Clause license --- LICENSE | 9 +++++++++ lib/src/go_router.dart | 16 ++++++++++++++++ lib/src/models/start_configuration.dart | 3 +++ lib/src/services/killswitch_service.dart | 10 ++++++++++ 4 files changed, 38 insertions(+) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..4c21bd7 --- /dev/null +++ b/LICENSE @@ -0,0 +1,9 @@ +Copyright (c) 2024 Iconica, All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + + Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file diff --git a/lib/src/go_router.dart b/lib/src/go_router.dart index c9113db..1a6b03a 100644 --- a/lib/src/go_router.dart +++ b/lib/src/go_router.dart @@ -5,6 +5,14 @@ import 'package:flutter/material.dart'; import 'package:go_router/go_router.dart'; +/// Builds a screen with a fade transition. +/// +/// The [context] parameter is the [BuildContext] in which this widget is built. +/// The [state] parameter is the [GoRouterState] that contains +/// the current routing state. +/// The [child] parameter is the widget that will be displayed on the screen. +/// +/// Returns a [CustomTransitionPage] with a fade transition. CustomTransitionPage buildScreenWithFadeTransition({ required BuildContext context, required GoRouterState state, @@ -17,6 +25,14 @@ CustomTransitionPage buildScreenWithFadeTransition({ FadeTransition(opacity: animation, child: child), ); +/// Builds a screen without any transition. +/// +/// The [context] parameter is the [BuildContext] in which this widget is built. +/// The [state] parameter is the [GoRouterState] that contains +/// the current routing state. +/// The [child] parameter is the widget that will be displayed on the screen. +/// +/// Returns a [CustomTransitionPage] without any transition. CustomTransitionPage buildScreenWithoutTransition({ required BuildContext context, required GoRouterState state, diff --git a/lib/src/models/start_configuration.dart b/lib/src/models/start_configuration.dart index 4dbf8c9..0064201 100644 --- a/lib/src/models/start_configuration.dart +++ b/lib/src/models/start_configuration.dart @@ -1,8 +1,11 @@ import 'package:flutter/material.dart'; import 'package:flutter_introduction/flutter_introduction.dart'; +/// An immutable class that represents the configuration for +/// starting a user story. @immutable class StartUserStoryConfiguration { + /// Creates a new instance of [StartUserStoryConfiguration]. const StartUserStoryConfiguration({ this.splashScreenBuilder, this.introductionBuilder, diff --git a/lib/src/services/killswitch_service.dart b/lib/src/services/killswitch_service.dart index 14e02d9..3b0cd01 100644 --- a/lib/src/services/killswitch_service.dart +++ b/lib/src/services/killswitch_service.dart @@ -3,7 +3,17 @@ import 'dart:convert'; import 'package:http/http.dart' as http; import 'package:package_info_plus/package_info_plus.dart'; +/// A service class to check if a killswitch is active for the current app. class KillswitchService { + /// Checks if the killswitch is active for the current app. + /// + /// It makes a GET request to a specific URL with the app + /// name as a query parameter. + /// If the request fails or times out after 5 seconds, + /// it defaults to returning 'false'. + /// + /// Returns a [Future] that completes with 'true' if the killswitch is active, + /// and 'false' otherwise. Future isKillswitchActive() async { var packageInfo = await PackageInfo.fromPlatform(); var appName = packageInfo.appName;