mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-05-20 08:08:44 +00:00
@@ -108,7 +108,7 @@ abstract final class Accounts {
|
||||
static Future<void> set(AccountType key, Account account) async {
|
||||
final oldAccount = accountMode[key.index]..type.remove(key);
|
||||
accountMode[key.index] = account..type.add(key);
|
||||
await Future.wait([account.onChange(), oldAccount.onChange()]);
|
||||
await Future.wait([?account.onChange(), ?oldAccount.onChange()]);
|
||||
if (!account.activated) await Request.buvidActive(account);
|
||||
switch (key) {
|
||||
case AccountType.main:
|
||||
|
||||
@@ -9,7 +9,7 @@ import 'package:hive/hive.dart';
|
||||
sealed class Account {
|
||||
Map<String, dynamic>? toJson() => null;
|
||||
|
||||
Future<void> onChange() => Future.syncValue(null);
|
||||
Future<void>? onChange() => null;
|
||||
|
||||
Set<AccountType> get type => const {};
|
||||
|
||||
|
||||
@@ -579,17 +579,15 @@ abstract final class PageUtils {
|
||||
vsync: state,
|
||||
duration: Duration.zero,
|
||||
reverseDuration: Duration.zero,
|
||||
)..forward();
|
||||
);
|
||||
state.showBottomSheet(
|
||||
constraints: const BoxConstraints(),
|
||||
(context) {
|
||||
return InteractiveviewerGallery(
|
||||
sources: imgList,
|
||||
initIndex: index,
|
||||
quality: GlobalData().imgQuality,
|
||||
onClose: animController.dispose,
|
||||
);
|
||||
},
|
||||
(context) => InteractiveviewerGallery(
|
||||
sources: imgList,
|
||||
initIndex: index,
|
||||
quality: GlobalData().imgQuality,
|
||||
onClose: animController.dispose,
|
||||
),
|
||||
enableDrag: false,
|
||||
elevation: 0.0,
|
||||
backgroundColor: Colors.transparent,
|
||||
|
||||
@@ -24,55 +24,55 @@ Future<bool> openAppSettings() => _handler.openAppSettings();
|
||||
/// Actions that can be executed on a permission.
|
||||
extension PermissionActions on Permission {
|
||||
/// Callback for when permission is denied.
|
||||
static FutureOr<void>? Function()? _onDenied;
|
||||
static Future<void>? Function()? _onDenied;
|
||||
|
||||
/// Callback for when permission is granted.
|
||||
static FutureOr<void>? Function()? _onGranted;
|
||||
static Future<void>? Function()? _onGranted;
|
||||
|
||||
/// Callback for when permission is permanently denied.
|
||||
static FutureOr<void>? Function()? _onPermanentlyDenied;
|
||||
static Future<void>? Function()? _onPermanentlyDenied;
|
||||
|
||||
/// Callback for when permission is restricted.
|
||||
static FutureOr<void>? Function()? _onRestricted;
|
||||
static Future<void>? Function()? _onRestricted;
|
||||
|
||||
/// Callback for when permission is limited.
|
||||
static FutureOr<void>? Function()? _onLimited;
|
||||
static Future<void>? Function()? _onLimited;
|
||||
|
||||
/// Callback for when permission is Provisional.
|
||||
static FutureOr<void>? Function()? _onProvisional;
|
||||
static Future<void>? Function()? _onProvisional;
|
||||
|
||||
/// Method to set a callback for when permission is denied.
|
||||
Permission onDeniedCallback(FutureOr<void>? Function()? callback) {
|
||||
Permission onDeniedCallback(Future<void>? Function()? callback) {
|
||||
_onDenied = callback;
|
||||
return this;
|
||||
}
|
||||
|
||||
/// Method to set a callback for when permission is granted.
|
||||
Permission onGrantedCallback(FutureOr<void>? Function()? callback) {
|
||||
Permission onGrantedCallback(Future<void>? Function()? callback) {
|
||||
_onGranted = callback;
|
||||
return this;
|
||||
}
|
||||
|
||||
/// Method to set a callback for when permission is permanently denied.
|
||||
Permission onPermanentlyDeniedCallback(FutureOr<void>? Function()? callback) {
|
||||
Permission onPermanentlyDeniedCallback(Future<void>? Function()? callback) {
|
||||
_onPermanentlyDenied = callback;
|
||||
return this;
|
||||
}
|
||||
|
||||
/// Method to set a callback for when permission is restricted.
|
||||
Permission onRestrictedCallback(FutureOr<void>? Function()? callback) {
|
||||
Permission onRestrictedCallback(Future<void>? Function()? callback) {
|
||||
_onRestricted = callback;
|
||||
return this;
|
||||
}
|
||||
|
||||
/// Method to set a callback for when permission is limited.
|
||||
Permission onLimitedCallback(FutureOr<void>? Function()? callback) {
|
||||
Permission onLimitedCallback(Future<void>? Function()? callback) {
|
||||
_onLimited = callback;
|
||||
return this;
|
||||
}
|
||||
|
||||
/// Method to set a callback for when permission is provisional.
|
||||
Permission onProvisionalCallback(FutureOr<void>? Function()? callback) {
|
||||
Permission onProvisionalCallback(Future<void>? Function()? callback) {
|
||||
_onProvisional = callback;
|
||||
return this;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user