Skip to content

Commit

Permalink
Fix import problem
Browse files Browse the repository at this point in the history
  • Loading branch information
micahmo committed Dec 12, 2024
1 parent e3b27b5 commit 03a74bd
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
11 changes: 6 additions & 5 deletions lib/user/pages/user_settings_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,7 @@ class _UserSettingsPageState extends State<UserSettingsPage> {
description: l10n.importLemmyAccountSettingsDescription,
widget: const SizedBox(height: 42.0, child: Icon(Icons.chevron_right_rounded)),
onTap: () async {
dynamic importSettings;
String importSettings;

try {
final filePath = await FlutterFileDialog.pickFile(
Expand All @@ -524,9 +524,7 @@ class _UserSettingsPageState extends State<UserSettingsPage> {
);

if (filePath != null) {
final String fileData = await File(filePath).readAsString();
importSettings = jsonDecode(fileData);
// fix this
importSettings = await File(filePath).readAsString();
} else {
showSnackbar(l10n.errorLoadingAccountSettings);
return;
Expand All @@ -548,7 +546,10 @@ class _UserSettingsPageState extends State<UserSettingsPage> {

if (response.success) {
showSnackbar(l10n.accountSettingsImportedSuccessfully);
// TODO: Maybe need to emit an event here to update the subscriptions in the UI?

// Reload the current page we're on to reflect changes to account settings
context.read<UserSettingsBloc>().add(const ResetUserSettingsEvent());
context.read<UserSettingsBloc>().add(const GetUserSettingsEvent());
} else {
showSnackbar(l10n.errorImportingAccountSettings);
}
Expand Down
4 changes: 2 additions & 2 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1158,8 +1158,8 @@ packages:
dependency: "direct main"
description:
path: "."
ref: "874005c9013de53f526562f882fe8231eb0ce5ae"
resolved-ref: "874005c9013de53f526562f882fe8231eb0ce5ae"
ref: "6d0e593503abd69e4fa6b2389712ba2031d4b47f"
resolved-ref: "6d0e593503abd69e4fa6b2389712ba2031d4b47f"
url: "https://github.com/thunder-app/lemmy_api_client.git"
source: git
version: "0.21.0"
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ dependencies:
lemmy_api_client:
git:
url: "https://github.com/thunder-app/lemmy_api_client.git"
ref: 874005c9013de53f526562f882fe8231eb0ce5ae
ref: 6d0e593503abd69e4fa6b2389712ba2031d4b47f
link_preview_generator:
git:
url: "https://github.com/thunder-app/link_preview_generator.git"
Expand Down

0 comments on commit 03a74bd

Please sign in to comment.