Skip to content

Commit

Permalink
Update develop with main - hotfix for language issue, and ability to …
Browse files Browse the repository at this point in the history
…trigger account deletion (#1056)

* fix issue with default locale being arabic when not

* updated version

* Added option to delete account from user settings page (#1041)

* added option to delete account from user settings page

* added padding at the bottom of user settings page

* Bumped build number for App Store release
  • Loading branch information
hjiangsu authored Jan 15, 2024
1 parent 2495369 commit 5b37d5a
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/globals.dart
Original file line number Diff line number Diff line change
@@ -1 +1 @@
const String currentVersion = '0.2.7+35';
const String currentVersion = '0.2.8+37';
16 changes: 16 additions & 0 deletions lib/l10n/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,10 @@
"@compactViewSettings": {
"description": "Subcategory in Setting -> Appearance -> Posts"
},
"confirm": "Confirm",
"@confirm": {
"description": "Label for the confirm action in the dialog"
},
"condensed": "Condensed",
"@condensed": {
"description": "Condensed post body view type"
Expand Down Expand Up @@ -261,6 +265,10 @@
"@currentSinglePress": {},
"customizeSwipeActions": "Customize swipe actions (tap to change)",
"@customizeSwipeActions": {},
"dangerZone": "Danger Zone",
"@dangerZone": {
"description": "Describes a section where the actions could be dangerous (e.g., permanently deleting account)"
},
"debug": "Debug",
"@debug": {
"description": "Debug settings category."
Expand All @@ -271,6 +279,14 @@
},
"delete": "Delete",
"@delete": {},
"deleteAccount": "Delete Account",
"@deleteAccount": {
"description": "Label for action to delete account"
},
"deleteAccountDescription": "To permanently delete your account, you will be redirected to your instance site. \n\nAre you sure you want to continue?",
"@deleteAccountDescription": {
"description": "Description for confirmation action to delete account"
},
"deleteLocalDatabase": "Delete Local Database",
"@deleteLocalDatabase": {
"description": "Label for action to delete local database"
Expand Down
2 changes: 1 addition & 1 deletion lib/thunder/bloc/thunder_bloc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ class ThunderBloc extends Bloc<ThunderEvent, ThunderState> {
bool useDisplayNames = prefs.getBool(LocalSettings.useDisplayNamesForUsers.name) ?? true;
bool markPostReadOnMediaView = prefs.getBool(LocalSettings.markPostAsReadOnMediaView.name) ?? false;
bool showInAppUpdateNotification = prefs.getBool(LocalSettings.showInAppUpdateNotification.name) ?? false;
String? appLanguageCode = prefs.getString(LocalSettings.appLanguageCode.name);
String? appLanguageCode = prefs.getString(LocalSettings.appLanguageCode.name) ?? 'en';
FullNameSeparator userSeparator = FullNameSeparator.values.byName(prefs.getString(LocalSettings.userFormat.name) ?? FullNameSeparator.at.name);
FullNameSeparator communitySeparator = FullNameSeparator.values.byName(prefs.getString(LocalSettings.communityFormat.name) ?? FullNameSeparator.dot.name);
bool hideTopBarOnScroll = prefs.getBool(LocalSettings.hideTopBarOnScroll.name) ?? false;
Expand Down
4 changes: 2 additions & 2 deletions lib/thunder/bloc/thunder_state.dart
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class ThunderState extends Equatable {
this.useAdvancedShareSheet = true,
this.showCrossPosts = true,
this.keywordFilters = const [],
this.appLanguageCode,
this.appLanguageCode = 'en',

/// -------------------------- Post Page Related Settings --------------------------
this.disablePostFabs = false,
Expand Down Expand Up @@ -317,7 +317,7 @@ class ThunderState extends Equatable {
bool? dimReadPosts,
bool? useAdvancedShareSheet,
bool? showCrossPosts,
String? appLanguageCode,
String? appLanguageCode = 'en',
List<String>? keywordFilters,

/// -------------------------- Post Page Related Settings --------------------------
Expand Down
35 changes: 35 additions & 0 deletions lib/user/pages/user_settings_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,18 @@ import 'package:thunder/core/auth/bloc/auth_bloc.dart';
import 'package:thunder/core/enums/full_name_separator.dart';
import 'package:thunder/core/singletons/lemmy_client.dart';
import 'package:thunder/feed/feed.dart';
import 'package:thunder/settings/widgets/settings_list_tile.dart';
import 'package:thunder/settings/widgets/toggle_option.dart';
import 'package:thunder/shared/community_icon.dart';
import 'package:thunder/shared/dialogs.dart';
import 'package:thunder/shared/input_dialogs.dart';
import 'package:thunder/shared/snackbar.dart';
import 'package:thunder/shared/user_avatar.dart';
import 'package:thunder/thunder/thunder_icons.dart';
import 'package:thunder/user/bloc/user_settings_bloc.dart';
import 'package:thunder/user/widgets/user_indicator.dart';
import 'package:thunder/utils/instance.dart';
import 'package:thunder/utils/links.dart';
import 'package:thunder/utils/navigate_instance.dart';
import 'package:thunder/utils/navigate_user.dart';

Expand Down Expand Up @@ -250,6 +253,38 @@ class _UserSettingsPageState extends State<UserSettingsPage> {
emptyText: l10n.noCommunityBlocks,
items: getCommunityBlocks(context, state, state.communityBlocks),
),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 8.0),
child: Text(l10n.dangerZone, style: theme.textTheme.titleMedium),
),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16.0),
child: SettingsListTile(
icon: Icons.delete_forever_rounded,
description: l10n.deleteAccount,
widget: const SizedBox(
height: 42.0,
child: Icon(Icons.chevron_right_rounded),
),
onTap: () async {
showThunderDialog<void>(
context: context,
title: l10n.deleteAccount,
contentText: l10n.deleteAccountDescription,
onSecondaryButtonPressed: (dialogContext) => Navigator.of(dialogContext).pop(),
secondaryButtonText: l10n.cancel,
onPrimaryButtonPressed: (dialogContext, _) async {
if (context.mounted) {
Navigator.of(context).pop();
handleLink(context, url: 'https://${LemmyClient.instance.lemmyApiV3.host}/settings');
}
},
primaryButtonText: l10n.confirm,
);
},
),
),
const SizedBox(height: 100.0),
],
),
);
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: thunder
description: An open-source cross-platform Lemmy client for iOS and Android built with Flutter
publish_to: "none"
version: 0.2.7+35
version: 0.2.8+37

environment:
sdk: "^3.0.0"
Expand Down

0 comments on commit 5b37d5a

Please sign in to comment.