Skip to content

Commit

Permalink
feat(neon): Implement syncing
Browse files Browse the repository at this point in the history
Signed-off-by: jld3103 <[email protected]>
  • Loading branch information
provokateurin committed Aug 29, 2023
1 parent 6792431 commit 73948ad
Show file tree
Hide file tree
Showing 33 changed files with 1,080 additions and 121 deletions.
7 changes: 7 additions & 0 deletions packages/app/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1199,6 +1199,13 @@ packages:
url: "https://pub.dev"
source: hosted
version: "0.3.1"
synchronize:
dependency: "direct overridden"
description:
path: "../synchronize"
relative: true
source: path
version: "1.0.0"
synchronized:
dependency: transitive
description:
Expand Down
4 changes: 3 additions & 1 deletion packages/app/pubspec_overrides.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# melos_managed_dependency_overrides: dynamite_runtime,file_icons,neon,neon_files,neon_news,neon_notes,neon_notifications,nextcloud,sort_box,neon_lints
# melos_managed_dependency_overrides: dynamite_runtime,file_icons,neon,neon_files,neon_news,neon_notes,neon_notifications,nextcloud,sort_box,neon_lints,synchronize
dependency_overrides:
dynamite_runtime:
path: ../dynamite/dynamite_runtime
Expand All @@ -20,3 +20,5 @@ dependency_overrides:
path: ../nextcloud
sort_box:
path: ../sort_box
synchronize:
path: ../synchronize
24 changes: 23 additions & 1 deletion packages/neon/neon/lib/l10n/en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@
"actionShowSlashHide": "Show/Hide",
"actionExit": "Exit",
"actionContinue": "Continue",
"actionPrevious": "Previous",
"actionNext": "Next",
"actionCancel": "Cancel",
"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 @@ -125,6 +129,7 @@
"optionsCategoryStartup": "Startup",
"optionsCategorySystemTray": "System tray",
"optionsCategoryNavigation": "Navigation",
"optionsCategorySync": "Synchronization",
"optionsSortOrderAscending": "Ascending",
"optionsSortOrderDescending": "Descending",
"globalOptionsThemeMode": "Theme mode",
Expand Down Expand Up @@ -180,5 +185,22 @@
},
"accountOptionsInitialApp": "App to show initially",
"accountOptionsAutomatic": "Automatic",
"licenses": "Licenses"
"licenses": "Licenses",
"syncOptionsAdd": "Add synchronization",
"syncOptionsRemove": "Remove synchronization",
"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"
}
}
}
}
72 changes: 72 additions & 0 deletions packages/neon/neon/lib/l10n/localizations.dart
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,30 @@ abstract class AppLocalizations {
/// **'Continue'**
String get actionContinue;

/// 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 @actionCancel.
///
/// In en, this message translates to:
/// **'Cancel'**
String get actionCancel;

/// 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 @@ -473,6 +497,12 @@ abstract class AppLocalizations {
/// **'Navigation'**
String get optionsCategoryNavigation;

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

/// No description provided for @optionsSortOrderAscending.
///
/// In en, this message translates to:
Expand Down Expand Up @@ -688,6 +718,48 @@ abstract class AppLocalizations {
/// In en, this message translates to:
/// **'Licenses'**
String get licenses;

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

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

/// 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 _AppLocalizationsDelegate extends LocalizationsDelegate<AppLocalizations> {
Expand Down
38 changes: 38 additions & 0 deletions packages/neon/neon/lib/l10n/localizations_en.dart
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,18 @@ class AppLocalizationsEn extends AppLocalizations {
@override
String get actionContinue => 'Continue';

@override
String get actionPrevious => 'Previous';

@override
String get actionNext => 'Next';

@override
String get actionCancel => 'Cancel';

@override
String get actionFinish => 'Finish';

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

Expand Down Expand Up @@ -232,6 +244,9 @@ class AppLocalizationsEn extends AppLocalizations {
@override
String get optionsCategoryNavigation => 'Navigation';

@override
String get optionsCategorySync => 'Synchronization';

@override
String get optionsSortOrderAscending => 'Ascending';

Expand Down Expand Up @@ -344,4 +359,27 @@ class AppLocalizationsEn extends AppLocalizations {

@override
String get licenses => 'Licenses';

@override
String get syncOptionsAdd => 'Add synchronization';

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

@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';
}
}
8 changes: 8 additions & 0 deletions packages/neon/neon/lib/neon.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import 'package:neon/src/blocs/accounts.dart';
import 'package:neon/src/blocs/first_launch.dart';
import 'package:neon/src/blocs/next_push.dart';
import 'package:neon/src/blocs/push_notifications.dart';
import 'package:neon/src/blocs/sync.dart';
import 'package:neon/src/models/account.dart';
import 'package:neon/src/models/app_implementation.dart';
import 'package:neon/src/platform/platform.dart';
Expand Down Expand Up @@ -61,6 +62,10 @@ Future runNeon({
globalOptions,
disabled: nextPushDisabled,
);
final syncBloc = SyncBloc(
accountsBloc,
appImplementations,
);

runApp(
MultiProvider(
Expand All @@ -80,6 +85,9 @@ Future runNeon({
Provider<NextPushBloc>(
create: (final _) => nextPushBloc,
),
Provider<SyncBloc>(
create: (final _) => syncBloc,
),
Provider<Iterable<AppImplementation>>(
create: (final _) => appImplementations,
),
Expand Down
3 changes: 3 additions & 0 deletions packages/neon/neon/lib/src/blocs/apps.dart
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,9 @@ class AppsBloc extends InteractiveBloc implements AppsBlocEvents, AppsBlocStates
T getAppBloc<T extends Bloc>(final AppImplementation<T, dynamic> appImplementation) =>
appImplementation.getBloc(_account);

T? getAppBlocByID<T extends Bloc>(final String appId) =>
_allAppImplementations.tryFind(appId)?.getBloc(_account) as T?;

List<Provider> get appBlocProviders =>
_allAppImplementations.map((final appImplementation) => appImplementation.blocProvider).toList();
}
Loading

0 comments on commit 73948ad

Please sign in to comment.