Skip to content

Commit

Permalink
fixed issue with instance url on existing accounts not working with n…
Browse files Browse the repository at this point in the history
…ew api
  • Loading branch information
hjiangsu committed Jun 27, 2023
1 parent 0f0bd42 commit fd98800
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lib/community/bloc/community_bloc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,8 @@ class CommunityBloc extends Bloc<CommunityEvent, CommunityState> {

SharedPreferences prefs = await SharedPreferences.getInstance();

PostListingType defaultListingType = PostListingType.values.byName(prefs.getString("setting_general_default_listing_type") ?? DEFAULT_LISTING_TYPE.name);
SortType defaultSortType = SortType.values.byName(prefs.getString("setting_general_default_sort_type") ?? DEFAULT_SORT_TYPE.name);
PostListingType defaultListingType = PostListingType.values.byName(prefs.getString("setting_general_default_listing_type")?.toLowerCase() ?? DEFAULT_LISTING_TYPE.name);
SortType defaultSortType = SortType.values.byName(prefs.getString("setting_general_default_sort_type")?.toLowerCase() ?? DEFAULT_SORT_TYPE.name);

try {
var exception;
Expand Down
2 changes: 1 addition & 1 deletion lib/core/auth/helpers/fetch_account.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Future<Account?> fetchActiveProfileAccount() async {
Account? account = (accountId != null) ? await Account.fetchAccount(accountId) : null;

// Update the baseUrl if account was found
if (account?.instance != null && account!.instance != LemmyClient.instance.lemmyApiV3.host) LemmyClient.instance.changeBaseUrl(account.instance!);
if (account?.instance != null && account!.instance != LemmyClient.instance.lemmyApiV3.host) LemmyClient.instance.changeBaseUrl(account.instance!.replaceAll('https://', ''));

return account;
}

0 comments on commit fd98800

Please sign in to comment.