Skip to content

Commit

Permalink
feat(neon,neon_news,neon_files,neon_notes,neon_notifications): make d…
Browse files Browse the repository at this point in the history
…ialog adaptive

Signed-off-by: Nikolas Rimikis <[email protected]>
  • Loading branch information
Leptopoda committed Oct 22, 2023
1 parent 7e3d8e3 commit fa1cacc
Show file tree
Hide file tree
Showing 46 changed files with 1,534 additions and 1,010 deletions.
1 change: 1 addition & 0 deletions .cspell/dart_flutter.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
autofocus
Cupertino
endtemplate
expando
gapless
Expand Down
27 changes: 27 additions & 0 deletions packages/neon/neon/lib/l10n/en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,36 @@
}
}
},
"errorDialog": "An error has occurred",
"actionYes": "Yes",
"actionNo": "No",
"actionClose": "Close",
"actionDelete": "Delete",
"actionRemove": "Remove",
"actionRename": "Rename",
"actionMove": "Move",
"actionCopy": "Copy",
"actionSync": "Sync",
"actionShare": "Share",
"actionRetry": "Retry",
"actionShowSlashHide": "Show/Hide",
"actionExit": "Exit",
"actionContinue": "Continue",
"actionCancel": "Cancel",
"actionCreateFolder": "Create folder",
"folderDeleteConfirm": "Are you sure you want to delete the folder '{name}'?",
"@folderDeleteConfirm": {
"placeholders": {
"name": {
"type": "String"
}
}
},
"actionDeleteTitle": "Permanently delete?",
"actionFolderName": "Folder name",
"folder": "Folder",
"folders": "Folders",
"folderRename": "Rename folder",
"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 All @@ -97,9 +120,11 @@
"settingsAccountManage": "Manage accounts",
"settingsExport": "Export settings",
"settingsImport": "Import settings",
"settingsReset": "Reset settings?",
"settingsImportWrongFileExtension": "Settings import has wrong file extension (has to be .json.base64)",
"settingsResetAll": "Reset all settings",
"settingsResetAllConfirmation": "Do you want to reset all settings?",
"settingsResetAllExplanation": "This will reset all preferences back to their default settings.",
"settingsResetFor": "Reset all settings for {name}",
"@settingsResetFor": {
"placeholders": {
Expand All @@ -108,6 +133,8 @@
}
}
},
"settingsResetForExplanation": "This will reset your account preferences back to their default settings.",
"settingsResetForClientExplanation": "This will reset all preferences for the app back to their default settings.",
"settingsResetForConfirmation": "Do you want to reset all settings for {name}?",
"@settingsResetForConfirmation": {
"placeholders": {
Expand Down
120 changes: 120 additions & 0 deletions packages/neon/neon/lib/l10n/localizations.dart
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,12 @@ abstract class NeonLocalizations {
/// **'Route not found: {route}'**
String errorRouteNotFound(String route);

/// No description provided for @errorDialog.
///
/// In en, this message translates to:
/// **'An error has occurred'**
String get errorDialog;

/// No description provided for @actionYes.
///
/// In en, this message translates to:
Expand All @@ -287,6 +293,48 @@ abstract class NeonLocalizations {
/// **'Close'**
String get actionClose;

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

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

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

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

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

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

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

/// No description provided for @actionRetry.
///
/// In en, this message translates to:
Expand All @@ -311,6 +359,54 @@ abstract class NeonLocalizations {
/// **'Continue'**
String get actionContinue;

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

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

/// No description provided for @folderDeleteConfirm.
///
/// In en, this message translates to:
/// **'Are you sure you want to delete the folder \'{name}\'?'**
String folderDeleteConfirm(String name);

/// No description provided for @actionDeleteTitle.
///
/// In en, this message translates to:
/// **'Permanently delete?'**
String get actionDeleteTitle;

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

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

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

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

/// No description provided for @firstLaunchGoToSettingsToEnablePushNotifications.
///
/// In en, this message translates to:
Expand Down Expand Up @@ -389,6 +485,12 @@ abstract class NeonLocalizations {
/// **'Import settings'**
String get settingsImport;

/// No description provided for @settingsReset.
///
/// In en, this message translates to:
/// **'Reset settings?'**
String get settingsReset;

/// No description provided for @settingsImportWrongFileExtension.
///
/// In en, this message translates to:
Expand All @@ -407,12 +509,30 @@ abstract class NeonLocalizations {
/// **'Do you want to reset all settings?'**
String get settingsResetAllConfirmation;

/// No description provided for @settingsResetAllExplanation.
///
/// In en, this message translates to:
/// **'This will reset all preferences back to their default settings.'**
String get settingsResetAllExplanation;

/// No description provided for @settingsResetFor.
///
/// In en, this message translates to:
/// **'Reset all settings for {name}'**
String settingsResetFor(String name);

/// No description provided for @settingsResetForExplanation.
///
/// In en, this message translates to:
/// **'This will reset your account preferences back to their default settings.'**
String get settingsResetForExplanation;

/// No description provided for @settingsResetForClientExplanation.
///
/// In en, this message translates to:
/// **'This will reset all preferences for the app back to their default settings.'**
String get settingsResetForClientExplanation;

/// No description provided for @settingsResetForConfirmation.
///
/// In en, this message translates to:
Expand Down
63 changes: 63 additions & 0 deletions packages/neon/neon/lib/l10n/localizations_en.dart
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,9 @@ class NeonLocalizationsEn extends NeonLocalizations {
return 'Route not found: $route';
}

@override
String get errorDialog => 'An error has occurred';

@override
String get actionYes => 'Yes';

Expand All @@ -135,6 +138,27 @@ class NeonLocalizationsEn extends NeonLocalizations {
@override
String get actionClose => 'Close';

@override
String get actionDelete => 'Delete';

@override
String get actionRemove => 'Remove';

@override
String get actionRename => 'Rename';

@override
String get actionMove => 'Move';

@override
String get actionCopy => 'Copy';

@override
String get actionSync => 'Sync';

@override
String get actionShare => 'Share';

@override
String get actionRetry => 'Retry';

Expand All @@ -147,6 +171,32 @@ class NeonLocalizationsEn extends NeonLocalizations {
@override
String get actionContinue => 'Continue';

@override
String get actionCancel => 'Cancel';

@override
String get actionCreateFolder => 'Create folder';

@override
String folderDeleteConfirm(String name) {
return 'Are you sure you want to delete the folder \'$name\'?';
}

@override
String get actionDeleteTitle => 'Permanently delete?';

@override
String get actionFolderName => 'Folder name';

@override
String get folder => 'Folder';

@override
String get folders => 'Folders';

@override
String get folderRename => 'Rename folder';

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

Expand Down Expand Up @@ -187,6 +237,9 @@ class NeonLocalizationsEn extends NeonLocalizations {
@override
String get settingsImport => 'Import settings';

@override
String get settingsReset => 'Reset settings?';

@override
String get settingsImportWrongFileExtension => 'Settings import has wrong file extension (has to be .json.base64)';

Expand All @@ -196,11 +249,21 @@ class NeonLocalizationsEn extends NeonLocalizations {
@override
String get settingsResetAllConfirmation => 'Do you want to reset all settings?';

@override
String get settingsResetAllExplanation => 'This will reset all preferences back to their default settings.';

@override
String settingsResetFor(String name) {
return 'Reset all settings for $name';
}

@override
String get settingsResetForExplanation => 'This will reset your account preferences back to their default settings.';

@override
String get settingsResetForClientExplanation =>
'This will reset all preferences for the app back to their default settings.';

@override
String settingsResetForConfirmation(String name) {
return 'Do you want to reset all settings for $name?';
Expand Down
36 changes: 26 additions & 10 deletions packages/neon/neon/lib/src/pages/account_settings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import 'package:neon/src/settings/widgets/select_settings_tile.dart';
import 'package:neon/src/settings/widgets/settings_category.dart';
import 'package:neon/src/settings/widgets/settings_list.dart';
import 'package:neon/src/theme/dialog.dart';
import 'package:neon/src/utils/dialog.dart';
import 'package:neon/src/widgets/dialog.dart';
import 'package:neon/src/widgets/error.dart';
import 'package:neon/src/widgets/linear_progress_indicator.dart';
import 'package:nextcloud/provisioning_api.dart' as provisioning_api;
Expand All @@ -39,15 +39,23 @@ class AccountSettingsPage extends StatelessWidget {
actions: [
IconButton(
onPressed: () async {
if (await showConfirmationDialog(
context,
NeonLocalizations.of(context).accountOptionsRemoveConfirm(account.humanReadableID),
)) {
final decision = await showAdaptiveDialog<bool>(
context: context,
builder: (final context) => NeonConfirmationDialog(
icon: const Icon(Icons.logout),
title: NeonLocalizations.of(context).accountOptionsRemove,
content: Text(
NeonLocalizations.of(context).accountOptionsRemoveConfirm(account.humanReadableID),
),
),
);

if (decision ?? false) {
final isActive = bloc.activeAccount.valueOrNull == account;

options.reset();
bloc.removeAccount(account);

// ignore: use_build_context_synchronously
if (!context.mounted) {
return;
}
Expand All @@ -64,10 +72,18 @@ class AccountSettingsPage extends StatelessWidget {
),
IconButton(
onPressed: () async {
if (await showConfirmationDialog(
context,
NeonLocalizations.of(context).settingsResetForConfirmation(name),
)) {
final content =
'${NeonLocalizations.of(context).settingsResetForConfirmation(name)} ${NeonLocalizations.of(context).settingsResetForExplanation}';
final decision = await showAdaptiveDialog<bool>(
context: context,
builder: (final context) => NeonConfirmationDialog(
icon: const Icon(Icons.restart_alt),
title: NeonLocalizations.of(context).settingsReset,
content: Text(content),
),
);

if (decision ?? false) {
options.reset();
}
},
Expand Down
Loading

0 comments on commit fa1cacc

Please sign in to comment.