OAuth Support #53
3 changed files with 44 additions and 1 deletions
Add logout button
commit
ff6b7f7306
|
|
@ -1,3 +1,7 @@
|
||||||
org.gradle.jvmargs=-Xmx4G -XX:+HeapDumpOnOutOfMemoryError
|
org.gradle.jvmargs=-Xmx4G -XX:+HeapDumpOnOutOfMemoryError
|
||||||
android.useAndroidX=true
|
android.useAndroidX=true
|
||||||
android.enableJetifier=true
|
android.enableJetifier=true
|
||||||
|
# This builtInKotlin flag was added automatically by Flutter migrator
|
||||||
|
android.builtInKotlin=false
|
||||||
|
# This newDsl flag was added automatically by Flutter migrator
|
||||||
|
android.newDsl=false
|
||||||
|
|
|
||||||
|
|
@ -266,6 +266,8 @@ class ClientController extends AsyncNotifier<int> {
|
||||||
Future<void> setMembership(SetMembershipRequest request) =>
|
Future<void> setMembership(SetMembershipRequest request) =>
|
||||||
_sendCommand("set_membership", request.toJson());
|
_sendCommand("set_membership", request.toJson());
|
||||||
|
|
||||||
|
Future<void> logout() => _sendCommand("logout");
|
||||||
|
|
||||||
Future<void> markRead(Room room) async {
|
Future<void> markRead(Room room) async {
|
||||||
final eventRowId = room.timeline[room.timeline.keys.reduce(max)];
|
final eventRowId = room.timeline[room.timeline.keys.reduce(max)];
|
||||||
final event = eventRowId == null ? null : room.events[eventRowId];
|
final event = eventRowId == null ? null : room.events[eventRowId];
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,8 @@ import "package:fast_immutable_collections/fast_immutable_collections.dart";
|
||||||
import "package:flutter/material.dart";
|
import "package:flutter/material.dart";
|
||||||
import "package:flutter_riverpod/flutter_riverpod.dart";
|
import "package:flutter_riverpod/flutter_riverpod.dart";
|
||||||
import "package:intl/intl.dart";
|
import "package:intl/intl.dart";
|
||||||
|
import "package:m3e_buttons/m3e_buttons.dart";
|
||||||
|
import "package:nexus/controllers/client.dart";
|
||||||
import "package:nexus/controllers/settings.dart";
|
import "package:nexus/controllers/settings.dart";
|
||||||
import "package:nexus/models/settings_category.dart";
|
import "package:nexus/models/settings_category.dart";
|
||||||
import "package:nexus/main.dart";
|
import "package:nexus/main.dart";
|
||||||
|
|
@ -87,11 +89,46 @@ class SettingsSectionsController
|
||||||
]),
|
]),
|
||||||
),
|
),
|
||||||
]),
|
]),
|
||||||
|
"Account": .new([
|
||||||
|
.new(title: "Profile", icon: Icons.person, settings: .new([])),
|
||||||
|
.new(
|
||||||
|
title: "Other",
|
||||||
|
icon: Icons.key,
|
||||||
|
settings: .new([
|
||||||
|
.new(
|
||||||
|
title: "Log Out",
|
||||||
|
description:
|
||||||
|
"Log out of your account, returning you to the login page.",
|
||||||
|
builder: (title, description, icon) => Builder(
|
||||||
|
builder: (context) {
|
||||||
|
final colorScheme = Theme.of(context).colorScheme;
|
||||||
|
return M3EButton.icon(
|
||||||
|
onPressed: () async {
|
||||||
|
await ref
|
||||||
|
.watch(ClientController.provider.notifier)
|
||||||
|
.logout();
|
||||||
|
if (context.mounted) Navigator.of(context).pop();
|
||||||
|
},
|
||||||
|
label: Text(title),
|
||||||
|
icon: Icon(icon),
|
||||||
|
tooltip: description,
|
||||||
|
decoration: .styleFrom(
|
||||||
|
backgroundColor: colorScheme.errorContainer,
|
||||||
|
foregroundColor: colorScheme.onErrorContainer,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
icon: Icons.logout,
|
||||||
|
),
|
||||||
|
]),
|
||||||
|
),
|
||||||
|
]),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
static final provider =
|
static final provider =
|
||||||
AsyncNotifierProvider<
|
AsyncNotifierProvider.autoDispose<
|
||||||
SettingsSectionsController,
|
SettingsSectionsController,
|
||||||
IMap<String, IList<SettingsCategory>>
|
IMap<String, IList<SettingsCategory>>
|
||||||
>(SettingsSectionsController.new);
|
>(SettingsSectionsController.new);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue