这是indexloc提供的服务,不要输入任何密码
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 2 additions & 8 deletions lib/provider/accounts_notifier_provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import 'package:riverpod_annotation/riverpod_annotation.dart';

import '../model/account.dart';
import 'dio_provider.dart';
import 'emojis_notifier_provider.dart';
import 'shared_preferences_provider.dart';
import 'tokens_notifier_provider.dart';

Expand Down Expand Up @@ -37,14 +36,9 @@ class AccountsNotifier extends _$AccountsNotifier {
if (state.contains(account)) {
return;
}
await ref.read(tokensNotifierProvider.notifier).add(account, token);
state = [...state, account];
await Future.wait([
_save(),
ref.read(tokensNotifierProvider.notifier).add(account, token),
]);
await ref
.read(emojisNotifierProvider(account.host).notifier)
.reloadEmojis();
await _save();
}

Future<bool> loginWithToken(String host, String token) async {
Expand Down
2 changes: 1 addition & 1 deletion lib/provider/accounts_notifier_provider.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 12 additions & 13 deletions lib/view/page/authenticate_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,18 @@ class AuthenticatePage extends ConsumerWidget {
),
body: Center(
child: ElevatedButton(
onPressed: () => futureWithDialog(
context,
Future(() async {
final succeeded =
await ref.read(miAuthNotifierProvider.notifier).check();
if (!context.mounted) return;
if (succeeded) {
context.go('/timelines');
} else {
await showMessageDialog(context, t.misskey.loginFailed);
}
}),
),
onPressed: () async {
final succeeded = await futureWithDialog(
context,
ref.read(miAuthNotifierProvider.notifier).check(),
);
if (!context.mounted) return;
if (succeeded ?? false) {
context.go('/timelines');
} else {
await showMessageDialog(context, t.misskey.loginFailed);
}
},
child: Text(t.aria.authenticated),
),
),
Expand Down