|
|
@ -13,7 +13,7 @@ abstract class AppsBlocStates { |
|
|
|
|
|
|
|
|
|
|
|
BehaviorSubject<Result<NotificationsAppInterface?>> get notificationsAppImplementation; |
|
|
|
BehaviorSubject<Result<NotificationsAppInterface?>> get notificationsAppImplementation; |
|
|
|
|
|
|
|
|
|
|
|
BehaviorSubject<String> get activeAppID; |
|
|
|
BehaviorSubject<AppImplementation> get activeApp; |
|
|
|
|
|
|
|
|
|
|
|
BehaviorSubject get openNotifications; |
|
|
|
BehaviorSubject get openNotifications; |
|
|
|
|
|
|
|
|
|
|
@ -47,8 +47,8 @@ class AppsBloc extends InteractiveBloc implements AppsBlocEvents, AppsBlocStates |
|
|
|
initialApp = result.requireData.first.id; |
|
|
|
initialApp = result.requireData.first.id; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if (!activeAppID.hasValue) { |
|
|
|
if (!activeApp.hasValue && initialApp != null) { |
|
|
|
await setActiveApp(initialApp!); |
|
|
|
await setActiveApp(initialApp); |
|
|
|
} |
|
|
|
} |
|
|
|
}), |
|
|
|
}), |
|
|
|
); |
|
|
|
); |
|
|
@ -132,7 +132,7 @@ class AppsBloc extends InteractiveBloc implements AppsBlocEvents, AppsBlocStates |
|
|
|
unawaited(apps.close()); |
|
|
|
unawaited(apps.close()); |
|
|
|
unawaited(appImplementations.close()); |
|
|
|
unawaited(appImplementations.close()); |
|
|
|
unawaited(notificationsAppImplementation.close()); |
|
|
|
unawaited(notificationsAppImplementation.close()); |
|
|
|
unawaited(activeAppID.close()); |
|
|
|
unawaited(activeApp.close()); |
|
|
|
unawaited(openNotifications.close()); |
|
|
|
unawaited(openNotifications.close()); |
|
|
|
unawaited(appVersions.close()); |
|
|
|
unawaited(appVersions.close()); |
|
|
|
|
|
|
|
|
|
|
@ -144,7 +144,7 @@ class AppsBloc extends InteractiveBloc implements AppsBlocEvents, AppsBlocStates |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@override |
|
|
|
@override |
|
|
|
BehaviorSubject<String> activeAppID = BehaviorSubject<String>(); |
|
|
|
BehaviorSubject<AppImplementation> activeApp = BehaviorSubject<AppImplementation>(); |
|
|
|
|
|
|
|
|
|
|
|
@override |
|
|
|
@override |
|
|
|
BehaviorSubject<Result<Iterable<AppImplementation<Bloc, NextcloudAppSpecificOptions>>>> appImplementations = |
|
|
|
BehaviorSubject<Result<Iterable<AppImplementation<Bloc, NextcloudAppSpecificOptions>>>> appImplementations = |
|
|
@ -176,14 +176,17 @@ class AppsBloc extends InteractiveBloc implements AppsBlocEvents, AppsBlocStates |
|
|
|
|
|
|
|
|
|
|
|
@override |
|
|
|
@override |
|
|
|
Future setActiveApp(final String appID) async { |
|
|
|
Future setActiveApp(final String appID) async { |
|
|
|
|
|
|
|
if (appID == 'notifications') { |
|
|
|
|
|
|
|
openNotifications.add(null); |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
final apps = await appImplementations.firstWhere((final a) => a.hasData); |
|
|
|
final apps = await appImplementations.firstWhere((final a) => a.hasData); |
|
|
|
if (apps.requireData.tryFind(appID) != null) { |
|
|
|
final app = apps.requireData.tryFind(appID); |
|
|
|
// TODO: make activeAppID distinct |
|
|
|
if (app != null) { |
|
|
|
if (activeAppID.valueOrNull != appID) { |
|
|
|
if (activeApp.valueOrNull?.id != appID) { |
|
|
|
activeAppID.add(appID); |
|
|
|
activeApp.add(app); |
|
|
|
} |
|
|
|
} |
|
|
|
} else if (appID == 'notifications') { |
|
|
|
|
|
|
|
openNotifications.add(null); |
|
|
|
|
|
|
|
} else { |
|
|
|
} else { |
|
|
|
throw Exception('App $appID not found'); |
|
|
|
throw Exception('App $appID not found'); |
|
|
|
} |
|
|
|
} |
|
|
|