diff --git a/designer_v2/lib/features/app.dart b/designer_v2/lib/features/app.dart index 88d18f43d..adfee289b 100644 --- a/designer_v2/lib/features/app.dart +++ b/designer_v2/lib/features/app.dart @@ -4,13 +4,12 @@ import 'package:flutter_gen/gen_l10n/app_localizations.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:studyu_designer_v2/constants.dart'; import 'package:studyu_designer_v2/localization/app_translation.dart'; +import 'package:studyu_designer_v2/localization/locale_providers.dart'; import 'package:studyu_designer_v2/localization/string_hardcoded.dart'; import 'package:studyu_designer_v2/routing/router.dart'; import 'package:studyu_designer_v2/services/notification_dispatcher.dart'; import 'package:studyu_designer_v2/theme.dart'; -import '../localization/locale_providers.dart'; - final GlobalKey scaffoldMessengerKey = GlobalKey(); /// Entry widget of the app. diff --git a/designer_v2/lib/features/app_controller.dart b/designer_v2/lib/features/app_controller.dart index bd84d5d55..944f1aeb6 100644 --- a/designer_v2/lib/features/app_controller.dart +++ b/designer_v2/lib/features/app_controller.dart @@ -1,6 +1,7 @@ import 'dart:async'; import 'package:riverpod_annotation/riverpod_annotation.dart'; +import 'package:studyu_designer_v2/constants.dart'; import 'package:studyu_designer_v2/features/app_controller_state.dart'; import 'package:studyu_designer_v2/repositories/auth_repository.dart'; @@ -12,8 +13,6 @@ abstract class IAppDelegate { Future onAppStart(); } -typedef _DelegateCallback = Future Function(IAppDelegate delegate); - /// Main controller that's bound to the top-level application widget's state @riverpod class AppController extends _$AppController { @@ -26,10 +25,12 @@ class AppController extends _$AppController { ref.listenSelf((previous, next) { print("APP CONTROLLER STATE CHANGED: $next"); }); - //ref.read(routerProvider).refresh(); // Forward onAppStart to all registered delegates so that they can // e.g. read some data from local storage for initialization - //await _callDelegates((delegate) => delegate.onAppStart(), withMinDelay: true); + await _callDelegates( + (delegate) => delegate.onAppStart(), + withMinDelay: true, + ); return const AppControllerState(status: AppStatus.initialized); } @@ -38,12 +39,13 @@ class AppController extends _$AppController { /// A dummy [Future] used for setting a lower bound on app initialization /// (so that the splash screen is shown during this time) - // TODO MERGE late final _delayedFuture = Future.delayed( - const Duration(milliseconds: Config.minSplashTime), () => true); + // ignore: avoid_redundant_argument_values, use_named_constants + const Duration(milliseconds: Config.minSplashTime), + () => true, + ); /// Executes the given callback for all registered delegates concurrently - // TODO merge where to call this? Future _callDelegates( Future Function(IAppDelegate) function, { bool withMinDelay = false, diff --git a/designer_v2/lib/features/app_controller.g.dart b/designer_v2/lib/features/app_controller.g.dart index ce14e1321..0db5fb3c9 100644 --- a/designer_v2/lib/features/app_controller.g.dart +++ b/designer_v2/lib/features/app_controller.g.dart @@ -6,7 +6,7 @@ part of 'app_controller.dart'; // RiverpodGenerator // ************************************************************************** -String _$appControllerHash() => r'fe83de481e31f72f7a492084d62f04373130fb1e'; +String _$appControllerHash() => r'bbe9d711818ec2ae14174b269317d11c5c987dbd'; /// Main controller that's bound to the top-level application widget's state /// diff --git a/designer_v2/lib/features/app_controller_state.dart b/designer_v2/lib/features/app_controller_state.dart index 5183f31f8..38498c828 100644 --- a/designer_v2/lib/features/app_controller_state.dart +++ b/designer_v2/lib/features/app_controller_state.dart @@ -9,7 +9,7 @@ class AppControllerState extends Equatable { final AppStatus status; - get isInitialized => status == AppStatus.initialized; + bool get isInitialized => status == AppStatus.initialized; @override List get props => [status]; diff --git a/designer_v2/lib/features/auth/auth_form_controller.dart b/designer_v2/lib/features/auth/auth_form_controller.dart index e16d0e114..17e18c355 100644 --- a/designer_v2/lib/features/auth/auth_form_controller.dart +++ b/designer_v2/lib/features/auth/auth_form_controller.dart @@ -1,7 +1,6 @@ import 'dart:async'; import 'package:flutter/foundation.dart'; -import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:go_router/go_router.dart'; import 'package:reactive_forms/reactive_forms.dart'; import 'package:riverpod_annotation/riverpod_annotation.dart'; @@ -57,25 +56,23 @@ enum AuthFormKey { class AuthFormController extends _$AuthFormController implements IFormGroupController { @override - AsyncValue build(AuthFormKey formKey) { + AsyncValue build(AuthFormKey formKeyArg) { authRepository = ref.watch(authRepositoryProvider); notificationService = ref.watch(notificationServiceProvider); router = ref.watch(routerProvider); - formKey = formKey; + formKey = formKeyArg; resetControlsFor(formKey); ref.listenSelf((previous, next) { print("authFormController.state updated"); if (state.hasError) { - final AuthException error = state.error as AuthException; + final AuthException error = state.error! as AuthException; switch (error.message) { case "Invalid login credentials": notificationService.show(Notifications.credentialsInvalid); - break; case "User already registered": notificationService.show(Notifications.userAlreadyRegistered); - break; default: notificationService.showMessage(error.message); } @@ -88,7 +85,7 @@ class AuthFormController extends _$AuthFormController _readDebugUser(); _onChangeFormKey(formKey); - return AsyncValue.data(null); + return const AsyncValue.data(null); } late final IAuthRepository authRepository; diff --git a/designer_v2/lib/features/auth/auth_form_controller.g.dart b/designer_v2/lib/features/auth/auth_form_controller.g.dart index 9fc00fa8b..014571aa9 100644 --- a/designer_v2/lib/features/auth/auth_form_controller.g.dart +++ b/designer_v2/lib/features/auth/auth_form_controller.g.dart @@ -7,7 +7,7 @@ part of 'auth_form_controller.dart'; // ************************************************************************** String _$authFormControllerHash() => - r'536f61faf22e316334e07415d09389bff1c76b45'; + r'd2cbe152c9e265eee89031208b3df027beb183be'; /// Copied from Dart SDK class _SystemHash { @@ -32,10 +32,10 @@ class _SystemHash { abstract class _$AuthFormController extends BuildlessAutoDisposeNotifier> { - late final AuthFormKey formKey; + late final AuthFormKey formKeyArg; AsyncValue build( - AuthFormKey formKey, + AuthFormKey formKeyArg, ); } @@ -50,10 +50,10 @@ class AuthFormControllerFamily extends Family> { /// See also [AuthFormController]. AuthFormControllerProvider call( - AuthFormKey formKey, + AuthFormKey formKeyArg, ) { return AuthFormControllerProvider( - formKey, + formKeyArg, ); } @@ -62,7 +62,7 @@ class AuthFormControllerFamily extends Family> { covariant AuthFormControllerProvider provider, ) { return call( - provider.formKey, + provider.formKeyArg, ); } @@ -86,9 +86,9 @@ class AuthFormControllerProvider extends AutoDisposeNotifierProviderImpl< AuthFormController, AsyncValue> { /// See also [AuthFormController]. AuthFormControllerProvider( - AuthFormKey formKey, + AuthFormKey formKeyArg, ) : this._internal( - () => AuthFormController()..formKey = formKey, + () => AuthFormController()..formKeyArg = formKeyArg, from: authFormControllerProvider, name: r'authFormControllerProvider', debugGetCreateSourceHash: @@ -98,7 +98,7 @@ class AuthFormControllerProvider extends AutoDisposeNotifierProviderImpl< dependencies: AuthFormControllerFamily._dependencies, allTransitiveDependencies: AuthFormControllerFamily._allTransitiveDependencies, - formKey: formKey, + formKeyArg: formKeyArg, ); AuthFormControllerProvider._internal( @@ -108,17 +108,17 @@ class AuthFormControllerProvider extends AutoDisposeNotifierProviderImpl< required super.allTransitiveDependencies, required super.debugGetCreateSourceHash, required super.from, - required this.formKey, + required this.formKeyArg, }) : super.internal(); - final AuthFormKey formKey; + final AuthFormKey formKeyArg; @override AsyncValue runNotifierBuild( covariant AuthFormController notifier, ) { return notifier.build( - formKey, + formKeyArg, ); } @@ -127,13 +127,13 @@ class AuthFormControllerProvider extends AutoDisposeNotifierProviderImpl< return ProviderOverride( origin: this, override: AuthFormControllerProvider._internal( - () => create()..formKey = formKey, + () => create()..formKeyArg = formKeyArg, from: from, name: null, dependencies: null, allTransitiveDependencies: null, debugGetCreateSourceHash: null, - formKey: formKey, + formKeyArg: formKeyArg, ), ); } @@ -146,13 +146,14 @@ class AuthFormControllerProvider extends AutoDisposeNotifierProviderImpl< @override bool operator ==(Object other) { - return other is AuthFormControllerProvider && other.formKey == formKey; + return other is AuthFormControllerProvider && + other.formKeyArg == formKeyArg; } @override int get hashCode { var hash = _SystemHash.combine(0, runtimeType.hashCode); - hash = _SystemHash.combine(hash, formKey.hashCode); + hash = _SystemHash.combine(hash, formKeyArg.hashCode); return _SystemHash.finish(hash); } @@ -160,8 +161,8 @@ class AuthFormControllerProvider extends AutoDisposeNotifierProviderImpl< mixin AuthFormControllerRef on AutoDisposeNotifierProviderRef> { - /// The parameter `formKey` of this provider. - AuthFormKey get formKey; + /// The parameter `formKeyArg` of this provider. + AuthFormKey get formKeyArg; } class _AuthFormControllerProviderElement @@ -170,7 +171,8 @@ class _AuthFormControllerProviderElement _AuthFormControllerProviderElement(super.provider); @override - AuthFormKey get formKey => (origin as AuthFormControllerProvider).formKey; + AuthFormKey get formKeyArg => + (origin as AuthFormControllerProvider).formKeyArg; } // ignore_for_file: type=lint // ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member diff --git a/designer_v2/lib/features/dashboard/dashboard_controller.dart b/designer_v2/lib/features/dashboard/dashboard_controller.dart index 5bc310138..bdfc14603 100644 --- a/designer_v2/lib/features/dashboard/dashboard_controller.dart +++ b/designer_v2/lib/features/dashboard/dashboard_controller.dart @@ -1,6 +1,5 @@ import 'dart:async'; -import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:go_router/go_router.dart'; import 'package:riverpod_annotation/riverpod_annotation.dart'; import 'package:studyu_core/core.dart'; @@ -18,8 +17,6 @@ import 'package:studyu_designer_v2/routing/router.dart'; import 'package:studyu_designer_v2/routing/router_intent.dart'; import 'package:studyu_designer_v2/utils/model_action.dart'; -import 'dashboard_state.dart'; - part 'dashboard_controller.g.dart'; @riverpod @@ -58,7 +55,7 @@ class DashboardController extends _$DashboardController final SearchController searchController = SearchController(); - _subscribeStudies() { + void _subscribeStudies() { _studiesSubscription = studyRepository.watchAll().listen((wrappedModels) { print("studyRepository.update"); // Update the controller's state when new studies are available in the repository @@ -66,11 +63,11 @@ class DashboardController extends _$DashboardController state = state.copyWith( studies: () => AsyncValue.data(studies), ); - }, onError: (error) { + }, onError: (Object error) { state = state.copyWith( studies: () => AsyncValue.error(error, StackTrace.current), ); - }); + },); } void setSearchText(String? text) { diff --git a/designer_v2/lib/features/dashboard/dashboard_controller.g.dart b/designer_v2/lib/features/dashboard/dashboard_controller.g.dart index 74914b509..96ca59be1 100644 --- a/designer_v2/lib/features/dashboard/dashboard_controller.g.dart +++ b/designer_v2/lib/features/dashboard/dashboard_controller.g.dart @@ -7,7 +7,7 @@ part of 'dashboard_controller.dart'; // ************************************************************************** String _$dashboardControllerHash() => - r'fca1f90b69e57979c77fccf0309d60a6f9ee153c'; + r'2310b394163e63741253dd431a9131917a4a0853'; /// See also [DashboardController]. @ProviderFor(DashboardController) diff --git a/designer_v2/lib/features/design/study_form_controller.dart b/designer_v2/lib/features/design/study_form_controller.dart index 0d89a6880..4427f78f9 100644 --- a/designer_v2/lib/features/design/study_form_controller.dart +++ b/designer_v2/lib/features/design/study_form_controller.dart @@ -174,7 +174,7 @@ class StudyFormViewModel extends FormViewModel /// before the [StudyController]'s [Study] is available (see also: [AsyncValue]) @riverpod StudyFormViewModel studyFormViewModel( - StudyFormViewModelRef ref, StudyID studyId) { + StudyFormViewModelRef ref, StudyID studyId,) { print("studyFormViewModel"); final state = ref.watch(studyControllerProvider(studyId)); return StudyFormViewModel( diff --git a/designer_v2/lib/features/recruit/invite_code_form_controller.dart b/designer_v2/lib/features/recruit/invite_code_form_controller.dart index 529e88181..5fab5272b 100644 --- a/designer_v2/lib/features/recruit/invite_code_form_controller.dart +++ b/designer_v2/lib/features/recruit/invite_code_form_controller.dart @@ -154,7 +154,7 @@ class InviteCodeFormViewModel extends FormViewModel { /// before the [StudyController]'s [Study] is available (see also: [AsyncValue]) @riverpod InviteCodeFormViewModel inviteCodeFormViewModel( - InviteCodeFormViewModelRef ref, StudyID studyId) { + InviteCodeFormViewModelRef ref, StudyID studyId,) { print("inviteCodeFormViewModelProvider($studyId"); // Reactively bind to and obtain [StudyController]'s current study final study = ref diff --git a/designer_v2/lib/features/recruit/study_recruit_controller.dart b/designer_v2/lib/features/recruit/study_recruit_controller.dart index 9733d886d..1c5bfc934 100644 --- a/designer_v2/lib/features/recruit/study_recruit_controller.dart +++ b/designer_v2/lib/features/recruit/study_recruit_controller.dart @@ -31,7 +31,6 @@ class StudyRecruitController extends _$StudyRecruitController router: ref.watch(routerProvider), currentUser: ref.watch(authRepositoryProvider).currentUser, inviteCodeRepository: ref.watch(inviteCodeRepositoryProvider(studyId)), - invites: const AsyncValue.loading(), ); } diff --git a/designer_v2/lib/features/recruit/study_recruit_controller.g.dart b/designer_v2/lib/features/recruit/study_recruit_controller.g.dart index e1ea441d9..13a7ffb53 100644 --- a/designer_v2/lib/features/recruit/study_recruit_controller.g.dart +++ b/designer_v2/lib/features/recruit/study_recruit_controller.g.dart @@ -7,7 +7,7 @@ part of 'study_recruit_controller.dart'; // ************************************************************************** String _$studyRecruitControllerHash() => - r'8dc8092f83dbab107eadaa274ad0cdfc09d79e38'; + r'56f67622dfd42191e84c8b323cb73bbf175c55be'; /// Copied from Dart SDK class _SystemHash { diff --git a/designer_v2/lib/features/study/study_base_controller.dart b/designer_v2/lib/features/study/study_base_controller.dart index 0fcf64ca5..be1af134e 100644 --- a/designer_v2/lib/features/study/study_base_controller.dart +++ b/designer_v2/lib/features/study/study_base_controller.dart @@ -10,7 +10,6 @@ import 'package:studyu_designer_v2/repositories/model_repository.dart'; import 'package:studyu_designer_v2/repositories/study_repository.dart'; import 'package:studyu_designer_v2/routing/router.dart'; import 'package:studyu_designer_v2/routing/router_intent.dart'; -import 'package:supabase_flutter/supabase_flutter.dart'; part 'study_base_controller.g.dart'; @@ -28,12 +27,6 @@ class StudyBaseController ); } - // TODO MERGE - /*final StudyID studyId; - final IStudyRepository studyRepository; - final User? currentUser; - final GoRouter router;*/ - StreamSubscription>? studySubscription; void subscribeStudy(StudyID studyId) { diff --git a/designer_v2/lib/features/study/study_base_controller.g.dart b/designer_v2/lib/features/study/study_base_controller.g.dart index e906e67ee..22e0550bf 100644 --- a/designer_v2/lib/features/study/study_base_controller.g.dart +++ b/designer_v2/lib/features/study/study_base_controller.g.dart @@ -7,7 +7,7 @@ part of 'study_base_controller.dart'; // ************************************************************************** String _$studyBaseControllerHash() => - r'1277944be2302e5d8f5d0c9bdc36e05a05d2d104'; + r'eee64a32d8b5b1277ee6e793df29400508bd54fc'; /// Copied from Dart SDK class _SystemHash { diff --git a/designer_v2/lib/features/study/study_controller.dart b/designer_v2/lib/features/study/study_controller.dart index 98ce248f2..7bc583a2f 100644 --- a/designer_v2/lib/features/study/study_controller.dart +++ b/designer_v2/lib/features/study/study_controller.dart @@ -9,11 +9,10 @@ import 'package:studyu_designer_v2/features/study/study_controller_state.dart'; import 'package:studyu_designer_v2/repositories/auth_repository.dart'; import 'package:studyu_designer_v2/repositories/model_repository.dart'; import 'package:studyu_designer_v2/repositories/model_repository_events.dart'; +import 'package:studyu_designer_v2/repositories/study_repository.dart'; +import 'package:studyu_designer_v2/routing/router.dart'; import 'package:studyu_designer_v2/routing/router_intent.dart'; -import '../../repositories/study_repository.dart'; -import '../../routing/router.dart'; - part 'study_controller.g.dart'; @riverpod @@ -23,10 +22,11 @@ class StudyController extends _$StudyController { syncStudyStatus(); ref.onDispose(() => _studyEventsSubscription?.cancel()); return StudyControllerState( - studyId: studyId, - studyRepository: ref.watch(studyRepositoryProvider), - router: ref.watch(routerProvider), - currentUser: ref.watch(authRepositoryProvider).currentUser); + studyId: studyId, + studyRepository: ref.watch(studyRepositoryProvider), + router: ref.watch(routerProvider), + currentUser: ref.watch(authRepositoryProvider).currentUser, + ); } StreamSubscription>? _studyEventsSubscription; @@ -52,7 +52,7 @@ class StudyController extends _$StudyController { }); } - onStudySubscriptionUpdate(WrappedModel wrappedModel) { + void onStudySubscriptionUpdate(WrappedModel wrappedModel) { ref .watch(studyBaseControllerProvider(state.studyId).notifier) .onStudySubscriptionUpdate(wrappedModel); diff --git a/designer_v2/lib/features/study/study_controller.g.dart b/designer_v2/lib/features/study/study_controller.g.dart index cff6c09e7..92266c29f 100644 --- a/designer_v2/lib/features/study/study_controller.g.dart +++ b/designer_v2/lib/features/study/study_controller.g.dart @@ -6,7 +6,7 @@ part of 'study_controller.dart'; // RiverpodGenerator // ************************************************************************** -String _$studyControllerHash() => r'23bdef67597ce483a453b46c962f93804fca09b2'; +String _$studyControllerHash() => r'65427ca5137b4388e81b0e230014c900c541beb0'; /// Copied from Dart SDK class _SystemHash { diff --git a/designer_v2/lib/features/study/study_controller_state.dart b/designer_v2/lib/features/study/study_controller_state.dart index 3874d08d0..f94a067b1 100644 --- a/designer_v2/lib/features/study/study_controller_state.dart +++ b/designer_v2/lib/features/study/study_controller_state.dart @@ -7,7 +7,7 @@ import 'package:studyu_designer_v2/features/study/study_base_state.dart'; import 'package:studyu_designer_v2/features/study/study_scaffold.dart'; import 'package:studyu_designer_v2/repositories/model_repository.dart'; -import '../../utils/model_action.dart'; +import 'package:studyu_designer_v2/utils/model_action.dart'; class StudyControllerState extends StudyControllerBaseState implements IStudyAppBarViewModel, ISyncIndicatorViewModel { @@ -19,7 +19,7 @@ class StudyControllerState extends StudyControllerBaseState super.studyWithMetadata, this.isDirty = false, this.syncState = const AsyncValue.data(null), - this.lastSynced}); + this.lastSynced,}); bool get isPublished => study.value != null && study.value!.published; @@ -34,7 +34,7 @@ class StudyControllerState extends StudyControllerBaseState .availableActions(studyVal) .where((action) => action.type != StudyActionType.edit) .toList(), - studyActionIcons); + studyActionIcons,); } // - ISyncIndicatorViewModel diff --git a/designer_v2/lib/features/study/study_test_controller.dart b/designer_v2/lib/features/study/study_test_controller.dart index a75bb1ec3..f62aa8448 100644 --- a/designer_v2/lib/features/study/study_test_controller.dart +++ b/designer_v2/lib/features/study/study_test_controller.dart @@ -3,12 +3,11 @@ import 'package:riverpod_annotation/riverpod_annotation.dart'; import 'package:studyu_designer_v2/domain/study.dart'; import 'package:studyu_designer_v2/features/study/study_test_controller_state.dart'; import 'package:studyu_designer_v2/features/study/study_test_frame_controllers.dart'; +import 'package:studyu_designer_v2/localization/locale_providers.dart'; import 'package:studyu_designer_v2/localization/string_hardcoded.dart'; import 'package:studyu_designer_v2/repositories/auth_repository.dart'; - -import '../../localization/locale_providers.dart'; -import '../../repositories/study_repository.dart'; -import '../../routing/router.dart'; +import 'package:studyu_designer_v2/repositories/study_repository.dart'; +import 'package:studyu_designer_v2/routing/router.dart'; part 'study_test_controller.g.dart'; @@ -41,7 +40,7 @@ class StudyTestController extends _$StudyTestController { @riverpod PlatformController studyTestPlatformController( - StudyTestPlatformControllerRef ref, StudyID studyId) { + StudyTestPlatformControllerRef ref, StudyID studyId,) { final state = ref.watch(studyTestControllerProvider(studyId)); PlatformController platformController; if (!kIsWeb) { diff --git a/designer_v2/lib/localization/app_translation.dart b/designer_v2/lib/localization/app_translation.dart index 0dadd0784..52529d2f7 100644 --- a/designer_v2/lib/localization/app_translation.dart +++ b/designer_v2/lib/localization/app_translation.dart @@ -7,7 +7,7 @@ AppLocalizations get tr => _tr!; late AppLocalizations? _tr; class AppTranslation { - static Future init(WidgetRef ref) { + static Future init(WidgetRef ref) async { // Loads the currently selected locale and sets the localization _tr = lookupAppLocalizations(ref.watch(localeProvider)); } diff --git a/designer_v2/lib/localization/language_picker.dart b/designer_v2/lib/localization/language_picker.dart index 2dec07d1c..3d9ac6585 100644 --- a/designer_v2/lib/localization/language_picker.dart +++ b/designer_v2/lib/localization/language_picker.dart @@ -4,11 +4,10 @@ import 'package:reactive_forms/reactive_forms.dart'; import 'package:studyu_designer_v2/constants.dart'; import 'package:studyu_designer_v2/localization/app_translation.dart'; import 'package:studyu_designer_v2/localization/locale_providers.dart'; +import 'package:studyu_designer_v2/localization/locale_state.dart'; import 'package:studyu_designer_v2/localization/locale_translate_name.dart'; import 'package:studyu_designer_v2/utils/font.dart'; -import 'locale_state.dart'; - enum LanguagePickerType { field, icon } class LanguagePicker extends ConsumerStatefulWidget { diff --git a/designer_v2/lib/localization/locale_providers.dart b/designer_v2/lib/localization/locale_providers.dart index c83ed9122..75bfa7efc 100644 --- a/designer_v2/lib/localization/locale_providers.dart +++ b/designer_v2/lib/localization/locale_providers.dart @@ -5,8 +5,6 @@ import 'package:studyu_designer_v2/constants.dart'; import 'package:studyu_designer_v2/localization/locale_state.dart'; import 'package:studyu_designer_v2/localization/platform_locale/platform_locale_interface.dart'; -import 'locale_state.dart'; - part 'locale_providers.g.dart'; /// Platform Locale Provider diff --git a/designer_v2/lib/localization/locale_state.dart b/designer_v2/lib/localization/locale_state.dart index c60fc0744..992de9858 100644 --- a/designer_v2/lib/localization/locale_state.dart +++ b/designer_v2/lib/localization/locale_state.dart @@ -4,8 +4,6 @@ import 'package:studyu_designer_v2/constants.dart'; import 'package:studyu_designer_v2/localization/locale_providers.dart'; import 'package:studyu_flutter_common/studyu_flutter_common.dart'; -import 'locale_providers.dart'; - part 'locale_state.g.dart'; Locale fallbackLocale = @@ -31,13 +29,7 @@ class LocaleStateNotifier extends _$LocaleStateNotifier { /// 1. Attempts to restore locale from storage /// 2. IF no locale in storage, attempts to set local from the platform settings // Attempt to restore from storage - final bool fromStorageSuccess = restoreFromStorage(); - - // TODO MERGE - // If storage restore did not work, set from platform - if (!fromStorageSuccess) { - setLocale(ref.read(platformLocaleProvider)); - } + restoreFromStorage(); return LocaleState(fallbackLocale); } @@ -47,14 +39,12 @@ class LocaleStateNotifier extends _$LocaleStateNotifier { /// Attempts to set the locale if it's in our list of supported locales. /// IF NOT: get the first locale that matches our language code and set that /// ELSE: do nothing. - void setLocale(Locale locale) async { + Future setLocale(Locale locale) async { final List supportedLocales = ref.watch(supportedLocalesProvider); // Set the locale if it's in our list of supported locales if (supportedLocales.contains(locale)) { state = state.copyWith(locale: locale); - // TODO MERGE - // save(); } // Get the closest language locale and set that instead @@ -72,10 +62,8 @@ class LocaleStateNotifier extends _$LocaleStateNotifier { /// Restore Locale from Storage Future restoreFromStorage() async { - // TODO MERGE - return (await load()) != null; - /*try { - LocaleState? loadedState = await load(); + try { + final LocaleState? loadedState = await load(); if (loadedState != null) { state = loadedState; return true; @@ -85,7 +73,7 @@ class LocaleStateNotifier extends _$LocaleStateNotifier { } // If storage restore did not work, set from platform setLocale(ref.watch(platformLocaleProvider)); - return false;*/ + return false; } Future load() async { diff --git a/designer_v2/lib/localization/locale_state.g.dart b/designer_v2/lib/localization/locale_state.g.dart index 69fa9100a..32cbbf45f 100644 --- a/designer_v2/lib/localization/locale_state.g.dart +++ b/designer_v2/lib/localization/locale_state.g.dart @@ -7,7 +7,7 @@ part of 'locale_state.dart'; // ************************************************************************** String _$localeStateNotifierHash() => - r'33481e3cb3540bd28ad8ad47668e6f9d1d1c5594'; + r'b46bc9c75e031b5fb7fea260827e94ca4522bd2f'; /// See also [LocaleStateNotifier]. @ProviderFor(LocaleStateNotifier) diff --git a/designer_v2/lib/repositories/auth_repository.dart b/designer_v2/lib/repositories/auth_repository.dart index 476801a60..e028d881d 100644 --- a/designer_v2/lib/repositories/auth_repository.dart +++ b/designer_v2/lib/repositories/auth_repository.dart @@ -169,4 +169,4 @@ AuthRepository authRepository(AuthRepositoryRef ref) { supabaseClient: ref.watch(supabaseClientProvider), ); return authRepository; -} \ No newline at end of file +} diff --git a/designer_v2/lib/repositories/invite_code_repository.dart b/designer_v2/lib/repositories/invite_code_repository.dart index 27e977664..7453fe7a5 100644 --- a/designer_v2/lib/repositories/invite_code_repository.dart +++ b/designer_v2/lib/repositories/invite_code_repository.dart @@ -210,7 +210,7 @@ class InviteCodeRepositoryDelegate @riverpod InviteCodeRepository inviteCodeRepository( - InviteCodeRepositoryRef ref, StudyID studyId) { + InviteCodeRepositoryRef ref, StudyID studyId,) { print("inviteCodeRepositoryProvider($studyId"); // Initialize repository for a given study final repository = InviteCodeRepository( diff --git a/designer_v2/lib/repositories/supabase_client.dart b/designer_v2/lib/repositories/supabase_client.dart index db299255f..619f4b132 100644 --- a/designer_v2/lib/repositories/supabase_client.dart +++ b/designer_v2/lib/repositories/supabase_client.dart @@ -1,4 +1,3 @@ -import 'package:flutter_riverpod/flutter_riverpod.dart' as riverpod; import 'package:riverpod_annotation/riverpod_annotation.dart'; import 'package:studyu_core/core.dart'; import 'package:studyu_core/env.dart' as env; @@ -121,4 +120,5 @@ mixin SupabaseQueryMixin on SupabaseClientDependant { // Re-expose the global client object via Riverpod @riverpod -SupabaseClient supabaseClient(SupabaseClientRef ref) => env.client; +SupabaseClient supabaseClient(AutoDisposeProviderRef ref) => + env.client; diff --git a/designer_v2/lib/repositories/supabase_client.g.dart b/designer_v2/lib/repositories/supabase_client.g.dart index c4f4bb378..6b045a168 100644 --- a/designer_v2/lib/repositories/supabase_client.g.dart +++ b/designer_v2/lib/repositories/supabase_client.g.dart @@ -6,7 +6,7 @@ part of 'supabase_client.dart'; // RiverpodGenerator // ************************************************************************** -String _$supabaseClientHash() => r'a3bca1b178af5002bfaaa08960ce5520580da5c9'; +String _$supabaseClientHash() => r'0495fe5018c2413148c8c0381a3095ec37bddfff'; /// See also [supabaseClient]. @ProviderFor(supabaseClient) diff --git a/designer_v2/lib/routing/router.dart b/designer_v2/lib/routing/router.dart index a077ab52d..b36a1295f 100644 --- a/designer_v2/lib/routing/router.dart +++ b/designer_v2/lib/routing/router.dart @@ -8,8 +8,6 @@ import 'package:studyu_designer_v2/repositories/auth_repository.dart'; import 'package:studyu_designer_v2/routing/router_config.dart'; import 'package:studyu_designer_v2/utils/combined_stream_notifier.dart'; -import 'router_config.dart'; - part 'router.g.dart'; /// How to create a new page & use it for navigation: diff --git a/designer_v2/lib/routing/router.g.dart b/designer_v2/lib/routing/router.g.dart index dcb8481ee..aae7af10b 100644 --- a/designer_v2/lib/routing/router.g.dart +++ b/designer_v2/lib/routing/router.g.dart @@ -6,7 +6,7 @@ part of 'router.dart'; // RiverpodGenerator // ************************************************************************** -String _$routerHash() => r'886e6d20b787c9de54b15fa4dbeb51079e829937'; +String _$routerHash() => r'a50ae258d96a8f7c2bec1945352920fcd92426d2'; /// How to create a new page & use it for navigation: /// diff --git a/designer_v2/pubspec.lock b/designer_v2/pubspec.lock index 4e039e46f..7031cf84f 100644 --- a/designer_v2/pubspec.lock +++ b/designer_v2/pubspec.lock @@ -65,6 +65,70 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.1" + build: + dependency: transitive + description: + name: build + sha256: "80184af8b6cb3e5c1c4ec6d8544d27711700bc3e6d2efad04238c7b5290889f0" + url: "https://pub.dev" + source: hosted + version: "2.4.1" + build_config: + dependency: transitive + description: + name: build_config + sha256: bf80fcfb46a29945b423bd9aad884590fb1dc69b330a4d4700cac476af1708d1 + url: "https://pub.dev" + source: hosted + version: "1.1.1" + build_daemon: + dependency: transitive + description: + name: build_daemon + sha256: "79b2aef6ac2ed00046867ed354c88778c9c0f029df8a20fe10b5436826721ef9" + url: "https://pub.dev" + source: hosted + version: "4.0.2" + build_resolvers: + dependency: transitive + description: + name: build_resolvers + sha256: "339086358431fa15d7eca8b6a36e5d783728cf025e559b834f4609a1fcfb7b0a" + url: "https://pub.dev" + source: hosted + version: "2.4.2" + build_runner: + dependency: "direct dev" + description: + name: build_runner + sha256: "644dc98a0f179b872f612d3eb627924b578897c629788e858157fa5e704ca0c7" + url: "https://pub.dev" + source: hosted + version: "2.4.11" + build_runner_core: + dependency: transitive + description: + name: build_runner_core + sha256: e3c79f69a64bdfcd8a776a3c28db4eb6e3fb5356d013ae5eb2e52007706d5dbe + url: "https://pub.dev" + source: hosted + version: "7.3.1" + built_collection: + dependency: transitive + description: + name: built_collection + sha256: "376e3dd27b51ea877c28d525560790aee2e6fbb5f20e2f85d5081027d94e2100" + url: "https://pub.dev" + source: hosted + version: "5.1.1" + built_value: + dependency: transitive + description: + name: built_value + sha256: c7913a9737ee4007efedaffc968c049fd0f3d0e49109e778edc10de9426005cb + url: "https://pub.dev" + source: hosted + version: "8.9.2" characters: dependency: transitive description: @@ -105,6 +169,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.1.1" + code_builder: + dependency: transitive + description: + name: code_builder + sha256: f692079e25e7869c14132d39f223f8eec9830eb76131925143b2129c4bb01b37 + url: "https://pub.dev" + source: hosted + version: "4.10.0" collection: dependency: transitive description: @@ -399,6 +471,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.8.0" + graphs: + dependency: transitive + description: + name: graphs + sha256: aedc5a15e78fc65a6e23bcd927f24c64dd995062bcd1ca6eda65a3cff92a4d19 + url: "https://pub.dev" + source: hosted + version: "2.3.1" gtk: dependency: transitive description: @@ -844,6 +924,22 @@ packages: url: "https://pub.dev" source: hosted version: "0.5.1" + riverpod_annotation: + dependency: "direct main" + description: + name: riverpod_annotation + sha256: e5e796c0eba4030c704e9dae1b834a6541814963292839dcf9638d53eba84f5c + url: "https://pub.dev" + source: hosted + version: "2.3.5" + riverpod_generator: + dependency: "direct dev" + description: + name: riverpod_generator + sha256: d451608bf17a372025fc36058863737636625dfdb7e3cbf6142e0dfeb366ab22 + url: "https://pub.dev" + source: hosted + version: "2.4.0" riverpod_lint: dependency: "direct dev" description: @@ -961,6 +1057,14 @@ packages: description: flutter source: sdk version: "0.0.99" + source_gen: + dependency: transitive + description: + name: source_gen + sha256: "14658ba5f669685cd3d63701d01b31ea748310f7ab854e471962670abcf57832" + url: "https://pub.dev" + source: hosted + version: "1.5.0" source_map_stack_trace: dependency: transitive description: @@ -1119,6 +1223,14 @@ packages: url: "https://pub.dev" source: hosted version: "0.6.0" + timing: + dependency: transitive + description: + name: timing + sha256: "70a3b636575d4163c477e6de42f247a23b315ae20e86442bebe32d3cabf61c32" + url: "https://pub.dev" + source: hosted + version: "1.0.1" typed_data: dependency: transitive description: