💄 Better user agent

This commit is contained in:
2024-09-16 11:57:16 +08:00
parent c18ce88993
commit 780f7c22bc
39 changed files with 140 additions and 113 deletions

View File

@ -205,7 +205,6 @@ class _ActionCard extends StatelessWidget {
final Function onTap;
const _ActionCard({
super.key,
required this.onTap,
required this.title,
required this.caption,

View File

@ -31,7 +31,7 @@ class _NotificationScreenState extends State<NotificationScreen> {
}
if (markList.isNotEmpty) {
final client = auth.configureClient('auth');
final client = await auth.configureClient('auth');
await client.put('/notifications/read', {'messages': markList});
}
@ -53,7 +53,7 @@ class _NotificationScreenState extends State<NotificationScreen> {
setState(() => _isBusy = true);
final client = auth.configureClient('auth');
final client = await auth.configureClient('auth');
await client.put('/notifications/read/${element.id}', {});

View File

@ -126,7 +126,7 @@ class _PersonalizeScreenState extends State<PersonalizeScreen> {
return;
}
final client = auth.configureClient('auth');
final client = await auth.configureClient('auth');
final resp = await client.put(
'/users/me/$position',
@ -148,7 +148,7 @@ class _PersonalizeScreenState extends State<PersonalizeScreen> {
setState(() => _isBusy = true);
final client = auth.configureClient('auth');
final client = await auth.configureClient('auth');
_birthday?.toIso8601String();
final resp = await client.put(

View File

@ -46,7 +46,7 @@ class _AccountProfilePageState extends State<AccountProfilePage> {
Future<void> _getUserinfo() async {
setState(() => _isBusy = true);
var client = ServiceFinder.configureClient('auth');
var client = await ServiceFinder.configureClient('auth');
var resp = await client.get('/users/${widget.name}');
if (resp.statusCode != 200) {
context.showErrorDialog(resp.bodyString).then((_) {
@ -56,7 +56,7 @@ class _AccountProfilePageState extends State<AccountProfilePage> {
_userinfo = Account.fromJson(resp.body);
}
client = ServiceFinder.configureClient('interactive');
client = await ServiceFinder.configureClient('interactive');
resp = await client.get('/users/${widget.name}');
if (resp.statusCode != 200) {
context.showErrorDialog(resp.bodyString).then((_) {
@ -71,7 +71,7 @@ class _AccountProfilePageState extends State<AccountProfilePage> {
}
Future<void> getPinnedPosts() async {
final client = ServiceFinder.configureClient('interactive');
final client = await ServiceFinder.configureClient('interactive');
final resp = await client.get('/users/${widget.name}/pin');
if (resp.statusCode != 200) {
context.showErrorDialog(resp.bodyString).then((_) {
@ -95,7 +95,7 @@ class _AccountProfilePageState extends State<AccountProfilePage> {
_relationshipProvider = Get.find();
_postController = PostListController(author: widget.name);
_albumPagingController.addPageRequestListener((pageKey) async {
final client = ServiceFinder.configureClient('files');
final client = await ServiceFinder.configureClient('files');
final resp = await client.get(
'/attachments?take=10&offset=$pageKey&author=${widget.name}&original=true',
);

View File

@ -48,7 +48,7 @@ class _StickerScreenState extends State<StickerScreen> {
);
if (confirm != true) return false;
final client = auth.configureClient('files');
final client = await auth.configureClient('files');
final resp = await client.delete('/stickers/${item.id}');
return resp.statusCode == 200;
@ -107,7 +107,7 @@ class _StickerScreenState extends State<StickerScreen> {
final AuthProvider auth = Get.find();
final name = auth.userProfile.value!['name'];
_pagingController.addPageRequestListener((pageKey) async {
final client = ServiceFinder.configureClient('files');
final client = await ServiceFinder.configureClient('files');
final resp = await client.get(
'/stickers/manifest?take=10&offset=$pageKey&author=$name',
);

View File

@ -49,7 +49,7 @@ class _SignInScreenState extends State<SignInScreen> {
setState(() => _isBusy = true);
final client = ServiceFinder.configureClient('auth');
final client = await ServiceFinder.configureClient('auth');
final lookupResp = await client.get('/users/lookup?probe=$username');
if (lookupResp.statusCode != 200) {
context.showErrorDialog(lookupResp.bodyString);
@ -74,7 +74,7 @@ class _SignInScreenState extends State<SignInScreen> {
final username = _usernameController.value.text;
if (username.isEmpty) return;
final client = ServiceFinder.configureClient('auth');
final client = await ServiceFinder.configureClient('auth');
setState(() => _isBusy = true);
@ -114,7 +114,7 @@ class _SignInScreenState extends State<SignInScreen> {
void _performGetFactorCode() async {
if (_factorPicked == null) return;
final client = ServiceFinder.configureClient('auth');
final client = await ServiceFinder.configureClient('auth');
setState(() => _isBusy = true);
@ -147,7 +147,7 @@ class _SignInScreenState extends State<SignInScreen> {
final password = _passwordController.value.text;
if (password.isEmpty) return;
final client = ServiceFinder.configureClient('auth');
final client = await ServiceFinder.configureClient('auth');
setState(() => _isBusy = true);
@ -288,7 +288,9 @@ class _SignInScreenState extends State<SignInScreen> {
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
TextButton(
onPressed: _isBusy ? null : () => _previousStep(),
onPressed: (_isBusy || _period > 1)
? null
: () => _previousStep(),
style:
TextButton.styleFrom(foregroundColor: Colors.grey),
child: Row(

View File

@ -28,7 +28,7 @@ class _SignUpScreenState extends State<SignUpScreen> {
nickname.isEmpty ||
password.isEmpty) return;
final client = ServiceFinder.configureClient('auth');
final client = await ServiceFinder.configureClient('auth');
final resp = await client.post('/users', {
'name': username,

View File

@ -97,7 +97,6 @@ class _ChannelChatScreenState extends State<ChannelChatScreen>
setState(() => _ongoingCall = Call.fromJson(resp.body));
}
} catch (e) {
print((e as dynamic).stackTrace);
context.showErrorDialog(e);
}

View File

@ -79,7 +79,7 @@ class _ChannelDetailScreenState extends State<ChannelDetailScreen> {
setState(() => _isBusy = true);
final client = auth.configureClient('messaging');
final client = await auth.configureClient('messaging');
final resp = await client
.put('/channels/${widget.realm}/${widget.channel.alias}/members/me', {

View File

@ -75,7 +75,7 @@ class _PostPublishScreenState extends State<PostPublishScreen> {
setState(() => _isBusy = true);
final client = auth.configureClient('interactive');
final client = await auth.configureClient('interactive');
Response resp;
if (widget.edit != null) {

View File

@ -43,7 +43,7 @@ class _RealmOrganizeScreenState extends State<RealmOrganizeScreen> {
setState(() => _isBusy = true);
final client = auth.configureClient('auth');
final client = await auth.configureClient('auth');
final payload = {
'alias': _aliasController.value.text.toLowerCase(),