diff --git a/StudioProjects/yimaru_app/android/app/src/main/AndroidManifest.xml b/StudioProjects/yimaru_app/android/app/src/main/AndroidManifest.xml index cd0a3f9..a7e20a5 100644 --- a/StudioProjects/yimaru_app/android/app/src/main/AndroidManifest.xml +++ b/StudioProjects/yimaru_app/android/app/src/main/AndroidManifest.xml @@ -3,7 +3,8 @@ + android:icon="@mipmap/ic_launcher" + android:usesCleartextTraffic="true"> + + + + + + + + + + + + Gradle Configuration Cache + + + +
+ +
+ Loading... +
+ + + + + + diff --git a/StudioProjects/yimaru_app/lib/app/app.dart b/StudioProjects/yimaru_app/lib/app/app.dart index a8ba819..32e28cd 100644 --- a/StudioProjects/yimaru_app/lib/app/app.dart +++ b/StudioProjects/yimaru_app/lib/app/app.dart @@ -26,6 +26,9 @@ import 'package:yimaru_app/services/authentication_service.dart'; import 'package:yimaru_app/services/api_service.dart'; import 'package:yimaru_app/services/secure_storage_service.dart'; import 'package:yimaru_app/services/dio_service.dart'; +import 'package:yimaru_app/services/status_checker_service.dart'; +import 'package:yimaru_app/ui/views/welcome/welcome_view.dart'; +import 'package:yimaru_app/ui/views/assessment/assessment_view.dart'; // @stacked-import @StackedApp( @@ -50,6 +53,8 @@ import 'package:yimaru_app/services/dio_service.dart'; MaterialRoute(page: LearnView), MaterialRoute(page: LearnLevelView), MaterialRoute(page: LearnModuleView), + MaterialRoute(page: WelcomeView), + MaterialRoute(page: AssessmentView), // @stacked-route ], dependencies: [ @@ -60,6 +65,7 @@ import 'package:yimaru_app/services/dio_service.dart'; LazySingleton(classType: ApiService), LazySingleton(classType: SecureStorageService), LazySingleton(classType: DioService), + LazySingleton(classType: StatusCheckerService), // @stacked-service ], bottomsheets: [ diff --git a/StudioProjects/yimaru_app/lib/app/app.locator.dart b/StudioProjects/yimaru_app/lib/app/app.locator.dart index 471c929..4319ba3 100644 --- a/StudioProjects/yimaru_app/lib/app/app.locator.dart +++ b/StudioProjects/yimaru_app/lib/app/app.locator.dart @@ -15,6 +15,7 @@ import '../services/api_service.dart'; import '../services/authentication_service.dart'; import '../services/dio_service.dart'; import '../services/secure_storage_service.dart'; +import '../services/status_checker_service.dart'; final locator = StackedLocator.instance; @@ -34,4 +35,5 @@ Future setupLocator({ locator.registerLazySingleton(() => ApiService()); locator.registerLazySingleton(() => SecureStorageService()); locator.registerLazySingleton(() => DioService()); + locator.registerLazySingleton(() => StatusCheckerService()); } diff --git a/StudioProjects/yimaru_app/lib/app/app.router.dart b/StudioProjects/yimaru_app/lib/app/app.router.dart index f2872b4..0e07180 100644 --- a/StudioProjects/yimaru_app/lib/app/app.router.dart +++ b/StudioProjects/yimaru_app/lib/app/app.router.dart @@ -5,12 +5,13 @@ // ************************************************************************** // ignore_for_file: no_leading_underscores_for_library_prefixes -import 'package:flutter/material.dart' as _i22; +import 'package:flutter/material.dart' as _i24; import 'package:flutter/material.dart'; import 'package:stacked/stacked.dart' as _i1; -import 'package:stacked_services/stacked_services.dart' as _i23; +import 'package:stacked_services/stacked_services.dart' as _i25; import 'package:yimaru_app/ui/views/account_privacy/account_privacy_view.dart' as _i10; +import 'package:yimaru_app/ui/views/assessment/assessment_view.dart' as _i23; import 'package:yimaru_app/ui/views/call_support/call_support_view.dart' as _i13; import 'package:yimaru_app/ui/views/downloads/downloads_view.dart' as _i7; @@ -37,6 +38,7 @@ import 'package:yimaru_app/ui/views/telegram_support/telegram_support_view.dart' as _i12; import 'package:yimaru_app/ui/views/terms_and_conditions/terms_and_conditions_view.dart' as _i16; +import 'package:yimaru_app/ui/views/welcome/welcome_view.dart' as _i22; class Routes { static const homeView = '/home-view'; @@ -79,6 +81,10 @@ class Routes { static const learnModuleView = '/learn-module-view'; + static const welcomeView = '/welcome-view'; + + static const assessmentView = '/assessment-view'; + static const all = { homeView, onboardingView, @@ -100,6 +106,8 @@ class Routes { learnView, learnLevelView, learnModuleView, + welcomeView, + assessmentView, }; } @@ -185,129 +193,154 @@ class StackedRouter extends _i1.RouterBase { Routes.learnModuleView, page: _i21.LearnModuleView, ), + _i1.RouteDef( + Routes.welcomeView, + page: _i22.WelcomeView, + ), + _i1.RouteDef( + Routes.assessmentView, + page: _i23.AssessmentView, + ), ]; final _pagesMap = { _i2.HomeView: (data) { - return _i22.MaterialPageRoute( + return _i24.MaterialPageRoute( builder: (context) => const _i2.HomeView(), settings: data, ); }, _i3.OnboardingView: (data) { - return _i22.MaterialPageRoute( + return _i24.MaterialPageRoute( builder: (context) => const _i3.OnboardingView(), settings: data, ); }, _i4.StartupView: (data) { - return _i22.MaterialPageRoute( - builder: (context) => const _i4.StartupView(), + final args = data.getArgs( + orElse: () => const StartupViewArguments(), + ); + return _i24.MaterialPageRoute( + builder: (context) => _i4.StartupView(key: args.key, label: args.label), settings: data, ); }, _i5.ProfileView: (data) { - return _i22.MaterialPageRoute( + return _i24.MaterialPageRoute( builder: (context) => const _i5.ProfileView(), settings: data, ); }, _i6.ProfileDetailView: (data) { - return _i22.MaterialPageRoute( + return _i24.MaterialPageRoute( builder: (context) => const _i6.ProfileDetailView(), settings: data, ); }, _i7.DownloadsView: (data) { - return _i22.MaterialPageRoute( + return _i24.MaterialPageRoute( builder: (context) => const _i7.DownloadsView(), settings: data, ); }, _i8.ProgressView: (data) { - return _i22.MaterialPageRoute( + return _i24.MaterialPageRoute( builder: (context) => const _i8.ProgressView(), settings: data, ); }, _i9.OngoingProgressView: (data) { - return _i22.MaterialPageRoute( + return _i24.MaterialPageRoute( builder: (context) => const _i9.OngoingProgressView(), settings: data, ); }, _i10.AccountPrivacyView: (data) { - return _i22.MaterialPageRoute( + return _i24.MaterialPageRoute( builder: (context) => const _i10.AccountPrivacyView(), settings: data, ); }, _i11.SupportView: (data) { - return _i22.MaterialPageRoute( + return _i24.MaterialPageRoute( builder: (context) => const _i11.SupportView(), settings: data, ); }, _i12.TelegramSupportView: (data) { - return _i22.MaterialPageRoute( + return _i24.MaterialPageRoute( builder: (context) => const _i12.TelegramSupportView(), settings: data, ); }, _i13.CallSupportView: (data) { - return _i22.MaterialPageRoute( + return _i24.MaterialPageRoute( builder: (context) => const _i13.CallSupportView(), settings: data, ); }, _i14.LanguageView: (data) { - return _i22.MaterialPageRoute( + return _i24.MaterialPageRoute( builder: (context) => const _i14.LanguageView(), settings: data, ); }, _i15.PrivacyPolicyView: (data) { - return _i22.MaterialPageRoute( + return _i24.MaterialPageRoute( builder: (context) => const _i15.PrivacyPolicyView(), settings: data, ); }, _i16.TermsAndConditionsView: (data) { - return _i22.MaterialPageRoute( + return _i24.MaterialPageRoute( builder: (context) => const _i16.TermsAndConditionsView(), settings: data, ); }, _i17.RegisterView: (data) { - return _i22.MaterialPageRoute( + return _i24.MaterialPageRoute( builder: (context) => const _i17.RegisterView(), settings: data, ); }, _i18.LoginView: (data) { - return _i22.MaterialPageRoute( + return _i24.MaterialPageRoute( builder: (context) => const _i18.LoginView(), settings: data, ); }, _i19.LearnView: (data) { - return _i22.MaterialPageRoute( + return _i24.MaterialPageRoute( builder: (context) => const _i19.LearnView(), settings: data, ); }, _i20.LearnLevelView: (data) { - return _i22.MaterialPageRoute( + return _i24.MaterialPageRoute( builder: (context) => const _i20.LearnLevelView(), settings: data, ); }, _i21.LearnModuleView: (data) { - return _i22.MaterialPageRoute( + return _i24.MaterialPageRoute( builder: (context) => const _i21.LearnModuleView(), settings: data, ); }, + _i22.WelcomeView: (data) { + return _i24.MaterialPageRoute( + builder: (context) => const _i22.WelcomeView(), + settings: data, + ); + }, + _i23.AssessmentView: (data) { + final args = data.getArgs(nullOk: false); + return _i24.MaterialPageRoute( + builder: (context) => + _i23.AssessmentView(key: args.key, data: args.data), + settings: data, + ); + }, }; @override @@ -317,7 +350,61 @@ class StackedRouter extends _i1.RouterBase { Map get pagesMap => _pagesMap; } -extension NavigatorStateExtension on _i23.NavigationService { +class StartupViewArguments { + const StartupViewArguments({ + this.key, + this.label = 'Loading', + }); + + final _i24.Key? key; + + final String label; + + @override + String toString() { + return '{"key": "$key", "label": "$label"}'; + } + + @override + bool operator ==(covariant StartupViewArguments other) { + if (identical(this, other)) return true; + return other.key == key && other.label == label; + } + + @override + int get hashCode { + return key.hashCode ^ label.hashCode; + } +} + +class AssessmentViewArguments { + const AssessmentViewArguments({ + this.key, + required this.data, + }); + + final _i24.Key? key; + + final Map data; + + @override + String toString() { + return '{"key": "$key", "data": "$data"}'; + } + + @override + bool operator ==(covariant AssessmentViewArguments other) { + if (identical(this, other)) return true; + return other.key == key && other.data == data; + } + + @override + int get hashCode { + return key.hashCode ^ data.hashCode; + } +} + +extension NavigatorStateExtension on _i25.NavigationService { Future navigateToHomeView([ int? routerId, bool preventDuplicates = true, @@ -346,14 +433,17 @@ extension NavigatorStateExtension on _i23.NavigationService { transition: transition); } - Future navigateToStartupView([ + Future navigateToStartupView({ + _i24.Key? key, + String label = 'Loading', int? routerId, bool preventDuplicates = true, Map? parameters, Widget Function(BuildContext, Animation, Animation, Widget)? transition, - ]) async { + }) async { return navigateTo(Routes.startupView, + arguments: StartupViewArguments(key: key, label: label), id: routerId, preventDuplicates: preventDuplicates, parameters: parameters, @@ -598,6 +688,37 @@ extension NavigatorStateExtension on _i23.NavigationService { transition: transition); } + Future navigateToWelcomeView([ + int? routerId, + bool preventDuplicates = true, + Map? parameters, + Widget Function(BuildContext, Animation, Animation, Widget)? + transition, + ]) async { + return navigateTo(Routes.welcomeView, + id: routerId, + preventDuplicates: preventDuplicates, + parameters: parameters, + transition: transition); + } + + Future navigateToAssessmentView({ + _i24.Key? key, + required Map data, + int? routerId, + bool preventDuplicates = true, + Map? parameters, + Widget Function(BuildContext, Animation, Animation, Widget)? + transition, + }) async { + return navigateTo(Routes.assessmentView, + arguments: AssessmentViewArguments(key: key, data: data), + id: routerId, + preventDuplicates: preventDuplicates, + parameters: parameters, + transition: transition); + } + Future replaceWithHomeView([ int? routerId, bool preventDuplicates = true, @@ -626,14 +747,17 @@ extension NavigatorStateExtension on _i23.NavigationService { transition: transition); } - Future replaceWithStartupView([ + Future replaceWithStartupView({ + _i24.Key? key, + String label = 'Loading', int? routerId, bool preventDuplicates = true, Map? parameters, Widget Function(BuildContext, Animation, Animation, Widget)? transition, - ]) async { + }) async { return replaceWith(Routes.startupView, + arguments: StartupViewArguments(key: key, label: label), id: routerId, preventDuplicates: preventDuplicates, parameters: parameters, @@ -877,4 +1001,35 @@ extension NavigatorStateExtension on _i23.NavigationService { parameters: parameters, transition: transition); } + + Future replaceWithWelcomeView([ + int? routerId, + bool preventDuplicates = true, + Map? parameters, + Widget Function(BuildContext, Animation, Animation, Widget)? + transition, + ]) async { + return replaceWith(Routes.welcomeView, + id: routerId, + preventDuplicates: preventDuplicates, + parameters: parameters, + transition: transition); + } + + Future replaceWithAssessmentView({ + _i24.Key? key, + required Map data, + int? routerId, + bool preventDuplicates = true, + Map? parameters, + Widget Function(BuildContext, Animation, Animation, Widget)? + transition, + }) async { + return replaceWith(Routes.assessmentView, + arguments: AssessmentViewArguments(key: key, data: data), + id: routerId, + preventDuplicates: preventDuplicates, + parameters: parameters, + transition: transition); + } } diff --git a/StudioProjects/yimaru_app/lib/main.dart b/StudioProjects/yimaru_app/lib/main.dart index ad534c7..c3f54fc 100644 --- a/StudioProjects/yimaru_app/lib/main.dart +++ b/StudioProjects/yimaru_app/lib/main.dart @@ -27,8 +27,8 @@ class MainApp extends StatelessWidget { Widget _buildMaterialApp() => MaterialApp( initialRoute: Routes.startupView, theme: ThemeData(fontFamily: 'Aeonik'), - onGenerateRoute: StackedRouter().onGenerateRoute, navigatorKey: StackedService.navigatorKey, + onGenerateRoute: StackedRouter().onGenerateRoute, navigatorObservers: [StackedService.routeObserver], ); } diff --git a/StudioProjects/yimaru_app/lib/models/assessment.dart b/StudioProjects/yimaru_app/lib/models/assessment.dart new file mode 100644 index 0000000..e1cc5e5 --- /dev/null +++ b/StudioProjects/yimaru_app/lib/models/assessment.dart @@ -0,0 +1,20 @@ +import 'package:json_annotation/json_annotation.dart'; +import 'package:yimaru_app/models/option.dart'; +import 'package:yimaru_app/models/question.dart'; +part 'assessment.g.dart'; + +@JsonSerializable() +class Assessment { + @JsonKey(name: 'Question') + final Question? question; + + @JsonKey(name: 'Options') + final List