diff --git a/lib/client/client_account.dart b/lib/client/client_account.dart index 2b677cdb..d6ed3576 100644 --- a/lib/client/client_account.dart +++ b/lib/client/client_account.dart @@ -257,6 +257,11 @@ class TwitterAccount { await repository.update(tableRateLimits, {'remaining': json.encode(rateLimitRemaining), 'reset': json.encode(rateLimitReset)}, where: 'oauth_token = ?', whereArgs: [ oauthToken ]); } + static Future flushLastTwitterOauthToken() async { + final prefs = await SharedPreferences.getInstance(); + prefs.remove('lastTwitterOauthToken'); + } + static Future?> getNextTwitterTokenInfo(String uriPath, int total) async { List filteredTwitterTokenLst = currentAccountTypes == twitterAccountTypesOnlyRegular ? _twitterTokenLst.where((e) => !e.guest).toList() : diff --git a/lib/settings/_account.dart b/lib/settings/_account.dart index e1521e61..1c8d553b 100644 --- a/lib/settings/_account.dart +++ b/lib/settings/_account.dart @@ -46,7 +46,8 @@ class _SettingsAccountFragmentState extends State { items: accountTypeLst .map((e) => DropdownMenuItem(value: e['id'], child: Text(e['val'] as String))) .toList(), - onChange: (value) { + onChange: (value) async { + await TwitterAccount.flushLastTwitterOauthToken(); if (value == twitterAccountTypesBoth || value == twitterAccountTypesPriorityToRegular) { TwitterAccount.currentAccountTypes = value as String; TwitterAccount.sortAccounts();