refactor: update global states to ValueNotifiers
This commit is contained in:
@@ -73,7 +73,7 @@ class LoginPageCubit extends Cubit<LoginPageState> with LogMixin {
|
||||
ServiceLocator.registerPostGlobalStates();
|
||||
|
||||
// Fetch server features
|
||||
await di<ServerFeatureConfigCubit>().getFeatures();
|
||||
await di<ServerFeatureConfigProvider>().getFeatures();
|
||||
|
||||
emit(state.copyWith(isServerValidated: true));
|
||||
} finally {
|
||||
@@ -141,7 +141,7 @@ class LoginPageCubit extends Cubit<LoginPageState> with LogMixin {
|
||||
await di<IUserRepository>().upsert(user);
|
||||
// Remove and Sync assets in background
|
||||
await di<IAssetRepository>().deleteAll();
|
||||
await di<GalleryPermissionNotifier>().requestPermission();
|
||||
await di<GalleryPermissionProvider>().requestPermission();
|
||||
unawaited(di<AssetSyncService>().performFullRemoteSyncIsolate(user));
|
||||
unawaited(di<AlbumSyncService>().performFullDeviceSyncIsolate());
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@ import 'dart:async';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:immich_mobile/domain/models/server-info/server_feature_config.model.dart';
|
||||
import 'package:immich_mobile/i18n/strings.g.dart';
|
||||
import 'package:immich_mobile/presentation/components/common/gap.widget.dart';
|
||||
import 'package:immich_mobile/presentation/components/common/loading_indicator.widget.dart';
|
||||
@@ -132,9 +131,9 @@ class _CredentialsFormState extends State<_CredentialsForm> {
|
||||
selector: (model) => model.isValidationInProgress,
|
||||
builder: (_, isValidationInProgress) => isValidationInProgress
|
||||
? const ImLoadingIndicator()
|
||||
: BlocBuilder<ServerFeatureConfigCubit, ServerFeatureConfig>(
|
||||
bloc: di(),
|
||||
builder: (_, state) => Column(
|
||||
: ValueListenableBuilder(
|
||||
valueListenable: di<ServerFeatureConfigProvider>(),
|
||||
builder: (_, state, __) => Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
|
||||
Reference in New Issue
Block a user