various small fixups
This commit is contained in:
parent
f910d87a23
commit
a2791a6717
4 changed files with 16 additions and 20 deletions
|
|
@ -15,7 +15,6 @@ import "package:nexus/controllers/rooms.dart";
|
|||
import "package:nexus/controllers/space_edges.dart";
|
||||
import "package:nexus/controllers/sync_status.dart";
|
||||
import "package:nexus/controllers/top_level_spaces.dart";
|
||||
import "package:nexus/controllers/unified_push.dart";
|
||||
import "package:nexus/helpers/extensions/gomuks_buffer.dart";
|
||||
import "package:nexus/main.dart";
|
||||
import "package:nexus/models/capabilities.dart";
|
||||
|
|
@ -345,10 +344,7 @@ class ClientController extends AsyncNotifier<int> {
|
|||
Future<File> downloadMedia(DownloadMediaRequest request) async =>
|
||||
.new((await _sendCommand("download_media", request.toJson()))["path"]);
|
||||
|
||||
Future<void> logout() async {
|
||||
await ref.watch(UnifiedPushController.provider.notifier).deregister();
|
||||
await _sendCommand("logout");
|
||||
}
|
||||
Future<void> logout() => _sendCommand("logout");
|
||||
|
||||
Future<void> markRead(Room room) async {
|
||||
final eventRowId = room.timeline[room.timeline.keys.reduce(max)];
|
||||
|
|
|
|||
|
|
@ -252,16 +252,14 @@ class SettingsSectionsController
|
|||
final colorScheme = Theme.of(context).colorScheme;
|
||||
return M3EButton.icon(
|
||||
onPressed: () async {
|
||||
Navigator.of(context)
|
||||
.popUntil((route) => route.isFirst);
|
||||
Navigator.of(context)
|
||||
.popUntil((route) => route.isFirst);
|
||||
|
||||
await WidgetsBinding.instance.endOfFrame;
|
||||
|
||||
await ref
|
||||
.watch(UnifiedPushController.provider.notifier)
|
||||
.deregister()
|
||||
.onError(showError);
|
||||
await ref
|
||||
.watch(ClientController.provider.notifier)
|
||||
.logout();
|
||||
.logout()
|
||||
.onError(showError);
|
||||
},
|
||||
label: Text(title),
|
||||
icon: Icon(icon),
|
||||
|
|
|
|||
|
|
@ -132,9 +132,8 @@ class UnifiedPushController extends AsyncNotifier<bool> {
|
|||
);
|
||||
}
|
||||
|
||||
if (!alreadyRegistered &&
|
||||
!await UnifiedPush.tryUseCurrentOrDefaultDistributor()) {
|
||||
throw Exception("No UnifiedPush distributors found");
|
||||
if (!await UnifiedPush.tryUseCurrentOrDefaultDistributor()) {
|
||||
throw Exception("No UnifiedPush distributors found.");
|
||||
}
|
||||
|
||||
await UnifiedPush.register(
|
||||
|
|
|
|||
|
|
@ -78,9 +78,11 @@ class const SelectServerPage({super.key}) extends HookConsumerWidget {
|
|||
ClientIdController.provider(url).future,
|
||||
),
|
||||
),
|
||||
)
|
||||
.onError(showError);
|
||||
);
|
||||
}
|
||||
} catch (error, stackTrace) {
|
||||
showError(error, stackTrace);
|
||||
rethrow;
|
||||
} finally {
|
||||
isLoading.value = false;
|
||||
}
|
||||
|
|
@ -95,7 +97,7 @@ class const SelectServerPage({super.key}) extends HookConsumerWidget {
|
|||
style: .new(color: theme.colorScheme.onErrorContainer),
|
||||
),
|
||||
action: SnackBarAction(
|
||||
onPressed: () => tryLogin(newHomeserver!),
|
||||
onPressed: () => tryLogin(newHomeserver!).onError(showError),
|
||||
label: "Attempt log in anyways",
|
||||
textColor: theme.colorScheme.onErrorContainer,
|
||||
),
|
||||
|
|
@ -103,11 +105,12 @@ class const SelectServerPage({super.key}) extends HookConsumerWidget {
|
|||
),
|
||||
);
|
||||
} else {
|
||||
tryLogin(newUrl);
|
||||
await tryLogin(newUrl);
|
||||
}
|
||||
}
|
||||
} catch (error, stackTrace) {
|
||||
showError(error, stackTrace);
|
||||
rethrow;
|
||||
} finally {
|
||||
isLoading.value = false;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue