Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/sync #600

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions commitlint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,6 @@ rules:
- notifications_push_repository
- release
- sort_box
- synchronize
- talk_app
- tool
7 changes: 7 additions & 0 deletions packages/neon_framework/example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1409,6 +1409,13 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.2.0"
synchronize:
dependency: "direct overridden"
description:
path: "../packages/synchronize"
relative: true
source: path
version: "1.0.0"
synchronized:
dependency: transitive
description:
Expand Down
4 changes: 3 additions & 1 deletion packages/neon_framework/example/pubspec_overrides.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# melos_managed_dependency_overrides: account_repository,cookie_store,dashboard_app,dynamite_runtime,files_app,interceptor_http_client,neon_framework,neon_http_client,neon_lints,news_app,nextcloud,notes_app,notifications_app,sort_box,talk_app
# melos_managed_dependency_overrides: account_repository,cookie_store,dashboard_app,dynamite_runtime,files_app,interceptor_http_client,neon_framework,neon_http_client,neon_lints,news_app,nextcloud,notes_app,notifications_app,sort_box,synchronize,talk_app
dependency_overrides:
account_repository:
path: ../packages/account_repository
Expand Down Expand Up @@ -28,5 +28,7 @@ dependency_overrides:
path: ../packages/notifications_app
sort_box:
path: ../packages/sort_box
synchronize:
path: ../packages/synchronize
talk_app:
path: ../packages/talk_app
42 changes: 41 additions & 1 deletion packages/neon_framework/lib/l10n/en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,9 @@
"actionContinue": "Continue",
"actionCancel": "Cancel",
"actionDone": "Done",
"actionPrevious": "Previous",
"actionNext": "Next",
"actionFinish": "Finish",
"firstLaunchGoToSettingsToEnablePushNotifications": "Go to the settings to enable push notifications",
"nextPushSupported": "NextPush is supported!",
"nextPushSupportedText": "NextPush is a FOSS way of receiving push notifications using the UnifiedPush protocol via a Nextcloud instance.\nYou can install NextPush from the F-Droid app store.",
Expand Down Expand Up @@ -294,5 +297,42 @@
"userStatusClearAtThisWeek": "This week",
"userStatusActionClear": "Clear status",
"userStatusStatusMessage": "Status message",
"userStatusOnlineStatus": "Online status"
"userStatusOnlineStatus": "Online status",
"sync": "Synchronization",
"syncOptionsNoSynchronizations": "No {type} synchronizations",
"@syncOptionsNoSynchronizations": {
"placeholders": {
"type": {
"type": "String"
}
}
},
"syncOptionsAdd": "Add {type} synchronization",
"@syncOptionsAdd": {
"placeholders": {
"type": {
"type": "String"
}
}
},
"syncOptionsRemove": "Remove synchronization",
"syncOptionsSyncNow": "Synchronize now",
"syncOptionsStatusUnknown": "Unknown synchronization status",
"syncOptionsStatusIncomplete": "Not completely synchronized",
"syncOptionsStatusComplete": "Completely synchronized",
"syncOptionsRemoveConfirmation": "Do you want to remove the synchronization?",
"syncOptionsAutomaticSync": "Sync automatically",
"syncResolveConflictsLocal": "Local",
"syncResolveConflictsRemote": "Remote",
"syncResolveConflictsTitle": "Found {count} conflicts for syncing {name}",
"@syncResolveConflictsTitle": {
"placeholders": {
"count": {
"type": "int"
},
"name": {
"type": "String"
}
}
}
}
96 changes: 96 additions & 0 deletions packages/neon_framework/lib/l10n/localizations.dart
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,24 @@ abstract class NeonLocalizations {
/// **'Done'**
String get actionDone;

/// No description provided for @actionPrevious.
///
/// In en, this message translates to:
/// **'Previous'**
String get actionPrevious;

/// No description provided for @actionNext.
///
/// In en, this message translates to:
/// **'Next'**
String get actionNext;

/// No description provided for @actionFinish.
///
/// In en, this message translates to:
/// **'Finish'**
String get actionFinish;

/// No description provided for @firstLaunchGoToSettingsToEnablePushNotifications.
///
/// In en, this message translates to:
Expand Down Expand Up @@ -870,6 +888,84 @@ abstract class NeonLocalizations {
/// In en, this message translates to:
/// **'Online status'**
String get userStatusOnlineStatus;

/// No description provided for @sync.
///
/// In en, this message translates to:
/// **'Synchronization'**
String get sync;

/// No description provided for @syncOptionsNoSynchronizations.
///
/// In en, this message translates to:
/// **'No {type} synchronizations'**
String syncOptionsNoSynchronizations(String type);

/// No description provided for @syncOptionsAdd.
///
/// In en, this message translates to:
/// **'Add {type} synchronization'**
String syncOptionsAdd(String type);

/// No description provided for @syncOptionsRemove.
///
/// In en, this message translates to:
/// **'Remove synchronization'**
String get syncOptionsRemove;

/// No description provided for @syncOptionsSyncNow.
///
/// In en, this message translates to:
/// **'Synchronize now'**
String get syncOptionsSyncNow;

/// No description provided for @syncOptionsStatusUnknown.
///
/// In en, this message translates to:
/// **'Unknown synchronization status'**
String get syncOptionsStatusUnknown;

/// No description provided for @syncOptionsStatusIncomplete.
///
/// In en, this message translates to:
/// **'Not completely synchronized'**
String get syncOptionsStatusIncomplete;

/// No description provided for @syncOptionsStatusComplete.
///
/// In en, this message translates to:
/// **'Completely synchronized'**
String get syncOptionsStatusComplete;

/// No description provided for @syncOptionsRemoveConfirmation.
///
/// In en, this message translates to:
/// **'Do you want to remove the synchronization?'**
String get syncOptionsRemoveConfirmation;

/// No description provided for @syncOptionsAutomaticSync.
///
/// In en, this message translates to:
/// **'Sync automatically'**
String get syncOptionsAutomaticSync;

/// No description provided for @syncResolveConflictsLocal.
///
/// In en, this message translates to:
/// **'Local'**
String get syncResolveConflictsLocal;

/// No description provided for @syncResolveConflictsRemote.
///
/// In en, this message translates to:
/// **'Remote'**
String get syncResolveConflictsRemote;

/// No description provided for @syncResolveConflictsTitle.
///
/// In en, this message translates to:
/// **'Found {count} conflicts for syncing {name}'**
String syncResolveConflictsTitle(int count, String name);
}

class _NeonLocalizationsDelegate extends LocalizationsDelegate<NeonLocalizations> {
Expand Down
54 changes: 54 additions & 0 deletions packages/neon_framework/lib/l10n/localizations_en.dart
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,15 @@ class NeonLocalizationsEn extends NeonLocalizations {
@override
String get actionDone => 'Done';

@override
String get actionPrevious => 'Previous';

@override
String get actionNext => 'Next';

@override
String get actionFinish => 'Finish';

@override
String get firstLaunchGoToSettingsToEnablePushNotifications => 'Go to the settings to enable push notifications';

Expand Down Expand Up @@ -507,4 +516,49 @@ class NeonLocalizationsEn extends NeonLocalizations {

@override
String get userStatusOnlineStatus => 'Online status';

@override
String get sync => 'Synchronization';

@override
String syncOptionsNoSynchronizations(String type) {
return 'No $type synchronizations';
}

@override
String syncOptionsAdd(String type) {
return 'Add $type synchronization';
}

@override
String get syncOptionsRemove => 'Remove synchronization';

@override
String get syncOptionsSyncNow => 'Synchronize now';

@override
String get syncOptionsStatusUnknown => 'Unknown synchronization status';

@override
String get syncOptionsStatusIncomplete => 'Not completely synchronized';

@override
String get syncOptionsStatusComplete => 'Completely synchronized';

@override
String get syncOptionsRemoveConfirmation => 'Do you want to remove the synchronization?';

@override
String get syncOptionsAutomaticSync => 'Sync automatically';

@override
String get syncResolveConflictsLocal => 'Local';

@override
String get syncResolveConflictsRemote => 'Remote';

@override
String syncResolveConflictsTitle(int count, String name) {
return 'Found $count conflicts for syncing $name';
}
}
6 changes: 6 additions & 0 deletions packages/neon_framework/lib/neon.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import 'package:neon_framework/src/blocs/accounts.dart';
import 'package:neon_framework/src/blocs/first_launch.dart';
import 'package:neon_framework/src/blocs/next_push.dart';
import 'package:neon_framework/src/blocs/push_notifications.dart';
import 'package:neon_framework/src/blocs/sync.dart';
import 'package:neon_framework/src/models/app_implementation.dart';
import 'package:neon_framework/src/models/disposable.dart';
import 'package:neon_framework/src/platform/platform.dart';
Expand Down Expand Up @@ -91,6 +92,10 @@ Future<void> runNeon({
accountsSubject: accountsBloc.accounts,
globalOptions: globalOptions,
);
final syncBloc = SyncBloc(
accountsBloc,
appImplementations,
);

runApp(
MultiProvider(
Expand All @@ -100,6 +105,7 @@ Future<void> runNeon({
NeonProvider<AccountsBloc>.value(value: accountsBloc),
NeonProvider<FirstLaunchBloc>.value(value: firstLaunchBloc),
NeonProvider<NextPushBloc>.value(value: nextPushBloc),
NeonProvider<SyncBloc>.value(value: syncBloc),
Provider<BuiltSet<AppImplementation>>(
create: (_) => appImplementations,
dispose: (_, appImplementations) => appImplementations.disposeAll(),
Expand Down
9 changes: 9 additions & 0 deletions packages/neon_framework/lib/src/blocs/apps.dart
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@ abstract class AppsBloc implements InteractiveBloc {
/// If no bloc exists yet a new one will be instantiated and cached in [AppImplementation.blocsCache].
T getAppBloc<T extends Bloc>(AppImplementation<T, dynamic> appImplementation);

/// Returns the active [Bloc] for the given [appId].
///
/// If no bloc exists yet a new one will be instantiated and cached in [AppImplementation.blocsCache].
/// See [getAppBloc] for getting the [Bloc] by the [AppImplementation].
T getAppBlocByID<T extends Bloc>(String appId);

/// Returns the active [Bloc] for every registered [AppImplementation] wrapped in a Provider.
List<Provider<Bloc>> get appBlocProviders;
}
Expand Down Expand Up @@ -280,6 +286,9 @@ class _AppsBloc extends InteractiveBloc implements AppsBloc {
@override
T getAppBloc<T extends Bloc>(AppImplementation<T, dynamic> appImplementation) => appImplementation.getBloc(account);

@override
T getAppBlocByID<T extends Bloc>(String appId) => allAppImplementations.find(appId).getBloc(account) as T;

@override
List<Provider<Bloc>> get appBlocProviders =>
allAppImplementations.map((appImplementation) => appImplementation.blocProvider).toList();
Expand Down
Loading
Loading