Improve design and usability, general tweaks and fixes (#226)
See #226 for more details.
This commit is contained in:
parent
90841e0589
commit
7881ce22b4
69 changed files with 3040 additions and 2812 deletions
|
|
@ -1,11 +1,13 @@
|
|||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
|
||||
import 'package:frosty/apis/twitch_api.dart';
|
||||
import 'package:frosty/constants.dart';
|
||||
import 'package:frosty/main.dart';
|
||||
import 'package:frosty/screens/settings/stores/user_store.dart';
|
||||
import 'package:frosty/widgets/button.dart';
|
||||
import 'package:frosty/widgets/dialog.dart';
|
||||
import 'package:mobx/mobx.dart';
|
||||
import 'package:sentry_flutter/sentry_flutter.dart';
|
||||
import 'package:webview_flutter/webview_flutter.dart';
|
||||
|
|
@ -88,6 +90,52 @@ abstract class AuthBase with Store {
|
|||
return NavigationDecision.navigate;
|
||||
}
|
||||
|
||||
/// Shows a dialog verifying that the user is sure they want to block/unblock the target user.
|
||||
Future<void> showBlockDialog(
|
||||
BuildContext context, {
|
||||
required String targetUser,
|
||||
required String targetUserId,
|
||||
}) {
|
||||
final isBlocked = user.blockedUsers.where((blockedUser) => blockedUser.userId == targetUserId).isNotEmpty;
|
||||
|
||||
final title = isBlocked ? 'Unblock $targetUser' : 'Block $targetUser';
|
||||
|
||||
final message =
|
||||
'Are you sure you want to ${isBlocked ? 'unblock $targetUser?' : 'block $targetUser? This will remove them from channel lists, search results, and chat messages.'}';
|
||||
|
||||
void onPressed() {
|
||||
if (isBlocked) {
|
||||
user.unblock(targetId: targetUserId, headers: headersTwitch);
|
||||
} else {
|
||||
user.block(
|
||||
targetId: targetUserId,
|
||||
displayName: targetUser,
|
||||
headers: headersTwitch,
|
||||
);
|
||||
}
|
||||
Navigator.pop(context);
|
||||
}
|
||||
|
||||
return showDialog(
|
||||
context: context,
|
||||
builder: (context) => FrostyDialog(
|
||||
title: title,
|
||||
message: message,
|
||||
actions: [
|
||||
Button(
|
||||
onPressed: onPressed,
|
||||
child: const Text('Yes'),
|
||||
),
|
||||
Button(
|
||||
onPressed: Navigator.of(context).pop,
|
||||
color: Colors.grey,
|
||||
child: const Text('Cancel'),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
AuthBase({required this.twitchApi}) : user = UserStore(twitchApi: twitchApi);
|
||||
|
||||
/// Initialize by retrieving a token if it does not already exist.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue