Skip to content

Commit

Permalink
fix to issue #192.
Browse files Browse the repository at this point in the history
  • Loading branch information
j-fbriere committed Feb 10, 2024
1 parent c9ad129 commit f671566
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 5 additions & 0 deletions lib/client/client_account.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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<void> flushLastTwitterOauthToken() async {
final prefs = await SharedPreferences.getInstance();
prefs.remove('lastTwitterOauthToken');
}

static Future<Map<String,dynamic>?> getNextTwitterTokenInfo(String uriPath, int total) async {
List<TwitterTokenEntity> filteredTwitterTokenLst = currentAccountTypes == twitterAccountTypesOnlyRegular ?
_twitterTokenLst.where((e) => !e.guest).toList() :
Expand Down
3 changes: 2 additions & 1 deletion lib/settings/_account.dart
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ class _SettingsAccountFragmentState extends State<SettingsAccountFragment> {
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();
Expand Down

0 comments on commit f671566

Please sign in to comment.