|
|
@ -64,28 +64,23 @@ 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) { |
|
|
|
final options = _accountsBloc.getOptions(_account); |
|
|
|
setActiveApp(_accountsBloc.pushNotificationApp); |
|
|
|
unawaited( |
|
|
|
_accountsBloc.pushNotificationApp = null; |
|
|
|
options.initialApp.stream.first.then((var initialApp) async { |
|
|
|
} else { |
|
|
|
if (initialApp == null) { |
|
|
|
final options = _accountsBloc.getOptions(_account); |
|
|
|
if (appImplementations.where((final a) => a.id == 'files').isNotEmpty) { |
|
|
|
unawaited( |
|
|
|
initialApp = 'files'; |
|
|
|
options.initialApp.stream.first.then((var initialApp) { |
|
|
|
} else if (appImplementations.isNotEmpty) { |
|
|
|
if (initialApp == null) { |
|
|
|
// This should never happen, because the files app is always installed and can not be removed, but just in |
|
|
|
if (appImplementations.where((final a) => a.id == 'files').isNotEmpty) { |
|
|
|
// case this changes at a later point. |
|
|
|
initialApp = 'files'; |
|
|
|
initialApp = appImplementations[0].id; |
|
|
|
} else if (appImplementations.isNotEmpty) { |
|
|
|
|
|
|
|
// This should never happen, because the files app is always installed and can not be removed, but just in |
|
|
|
|
|
|
|
// case this changes at a later point. |
|
|
|
|
|
|
|
initialApp = appImplementations[0].id; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
if (!_activeAppSubject.hasValue) { |
|
|
|
} |
|
|
|
setActiveApp(initialApp); |
|
|
|
if (!_activeAppSubject.hasValue) { |
|
|
|
} |
|
|
|
setActiveApp(initialApp); |
|
|
|
}), |
|
|
|
} |
|
|
|
); |
|
|
|
}), |
|
|
|
} |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
@ -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 |
|
|
|