|
|
@ -64,13 +64,9 @@ class AppsBloc extends $AppsBloc { |
|
|
|
result.data != null ? _filteredAppImplementations(result.data!) : <AppImplementation>[]; |
|
|
|
result.data != null ? _filteredAppImplementations(result.data!) : <AppImplementation>[]; |
|
|
|
|
|
|
|
|
|
|
|
if (result.data != null) { |
|
|
|
if (result.data != null) { |
|
|
|
if (_accountsBloc.pushNotificationApp != null) { |
|
|
|
|
|
|
|
setActiveApp(_accountsBloc.pushNotificationApp); |
|
|
|
|
|
|
|
_accountsBloc.pushNotificationApp = null; |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
final options = _accountsBloc.getOptions(_account); |
|
|
|
final options = _accountsBloc.getOptions(_account); |
|
|
|
unawaited( |
|
|
|
unawaited( |
|
|
|
options.initialApp.stream.first.then((var initialApp) { |
|
|
|
options.initialApp.stream.first.then((var initialApp) async { |
|
|
|
if (initialApp == null) { |
|
|
|
if (initialApp == null) { |
|
|
|
if (appImplementations.where((final a) => a.id == 'files').isNotEmpty) { |
|
|
|
if (appImplementations.where((final a) => a.id == 'files').isNotEmpty) { |
|
|
|
initialApp = 'files'; |
|
|
|
initialApp = 'files'; |
|
|
@ -86,7 +82,6 @@ class AppsBloc extends $AppsBloc { |
|
|
|
}), |
|
|
|
}), |
|
|
|
); |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
_loadApps(); |
|
|
|
_loadApps(); |
|
|
@ -120,17 +115,14 @@ class AppsBloc extends $AppsBloc { |
|
|
|
final _appImplementationsSubject = BehaviorSubject<Result<List<AppImplementation>>>(); |
|
|
|
final _appImplementationsSubject = BehaviorSubject<Result<List<AppImplementation>>>(); |
|
|
|
late final _activeAppSubject = BehaviorSubject<String?>(); |
|
|
|
late final _activeAppSubject = BehaviorSubject<String?>(); |
|
|
|
|
|
|
|
|
|
|
|
final Map<AppImplementation, RxBlocBase> _blocs = {}; |
|
|
|
final Map<String, RxBlocBase> _blocs = {}; |
|
|
|
|
|
|
|
|
|
|
|
T getAppBloc<T extends RxBlocBase>(final AppImplementation appImplementation) { |
|
|
|
T getAppBloc<T extends RxBlocBase>(final AppImplementation appImplementation) { |
|
|
|
if (_blocs[appImplementation] != null) { |
|
|
|
if (_blocs[appImplementation.id] != null) { |
|
|
|
return _blocs[appImplementation]! as T; |
|
|
|
return _blocs[appImplementation.id]! as T; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
final bloc = appImplementation.buildBloc(_account.client); |
|
|
|
return _blocs[appImplementation.id] = appImplementation.buildBloc(_account.client) as T; |
|
|
|
_blocs[appImplementation] = bloc; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return bloc as T; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@override |
|
|
|
@override |
|
|
|