mirror of
https://github.com/immich-app/immich.git
synced 2024-12-25 10:43:13 +02:00
chore(mobile): styling and linter (#1807)
* chore(mobile): styling and linter * style: adaptive SwitchListTile
This commit is contained in:
parent
88a2966666
commit
03d484aba2
5
mobile/ios/Runner/Runner.entitlements
Normal file
5
mobile/ios/Runner/Runner.entitlements
Normal file
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict/>
|
||||
</plist>
|
@ -301,12 +301,11 @@ class BackgroundService {
|
||||
// indefinitely and can run later
|
||||
// Android is fine to wait here until the lock releases
|
||||
final waitForLock = Platform.isIOS
|
||||
? acquireLock()
|
||||
.timeout(
|
||||
const Duration(seconds: 5),
|
||||
onTimeout: () => false,
|
||||
)
|
||||
: acquireLock();
|
||||
? acquireLock().timeout(
|
||||
const Duration(seconds: 5),
|
||||
onTimeout: () => false,
|
||||
)
|
||||
: acquireLock();
|
||||
|
||||
final bool hasAccess = await waitForLock;
|
||||
if (!hasAccess) {
|
||||
@ -381,7 +380,8 @@ class BackgroundService {
|
||||
}
|
||||
// Android should check for new assets added while performing backup
|
||||
} while (Platform.isAndroid &&
|
||||
true == await _backgroundChannel.invokeMethod<bool>("hasContentChanged"));
|
||||
true ==
|
||||
await _backgroundChannel.invokeMethod<bool>("hasContentChanged"));
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -555,8 +555,8 @@ class BackgroundService {
|
||||
Future<DateTime?> getIOSBackupLastRun(IosBackgroundTask task) async {
|
||||
// Seconds since last run
|
||||
final double? lastRun = task == IosBackgroundTask.fetch
|
||||
? await _foregroundChannel.invokeMethod('lastBackgroundFetchTime')
|
||||
: await _foregroundChannel.invokeMethod('lastBackgroundProcessingTime');
|
||||
? await _foregroundChannel.invokeMethod('lastBackgroundFetchTime')
|
||||
: await _foregroundChannel.invokeMethod('lastBackgroundProcessingTime');
|
||||
if (lastRun == null) {
|
||||
return null;
|
||||
}
|
||||
@ -565,15 +565,11 @@ class BackgroundService {
|
||||
}
|
||||
|
||||
Future<int> getIOSBackupNumberOfProcesses() async {
|
||||
return await _foregroundChannel
|
||||
.invokeMethod('numberOfBackgroundProcesses');
|
||||
return await _foregroundChannel.invokeMethod('numberOfBackgroundProcesses');
|
||||
}
|
||||
}
|
||||
|
||||
enum IosBackgroundTask {
|
||||
fetch,
|
||||
processing
|
||||
}
|
||||
enum IosBackgroundTask { fetch, processing }
|
||||
|
||||
class _Throttle {
|
||||
_Throttle(this._fun, Duration interval) : _interval = interval.inMicroseconds;
|
||||
|
@ -21,7 +21,7 @@ class BackupInfoCard extends StatelessWidget {
|
||||
borderRadius: BorderRadius.circular(20), // if you need this
|
||||
side: BorderSide(
|
||||
color: isDarkMode
|
||||
? const Color.fromARGB(255, 101, 101, 101)
|
||||
? const Color.fromARGB(255, 56, 56, 56)
|
||||
: Colors.black12,
|
||||
width: 1,
|
||||
),
|
||||
|
@ -11,12 +11,13 @@ class IosDebugInfoTile extends HookConsumerWidget {
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final futures = [
|
||||
ref.read(backgroundServiceProvider)
|
||||
.getIOSBackupLastRun(IosBackgroundTask.fetch),
|
||||
ref.read(backgroundServiceProvider)
|
||||
.getIOSBackupLastRun(IosBackgroundTask.processing),
|
||||
ref.read(backgroundServiceProvider)
|
||||
.getIOSBackupNumberOfProcesses(),
|
||||
ref
|
||||
.read(backgroundServiceProvider)
|
||||
.getIOSBackupLastRun(IosBackgroundTask.fetch),
|
||||
ref
|
||||
.read(backgroundServiceProvider)
|
||||
.getIOSBackupLastRun(IosBackgroundTask.processing),
|
||||
ref.read(backgroundServiceProvider).getIOSBackupNumberOfProcesses(),
|
||||
];
|
||||
return FutureBuilder<List<dynamic>>(
|
||||
future: Future.wait(futures),
|
||||
@ -41,9 +42,8 @@ class IosDebugInfoTile extends HookConsumerWidget {
|
||||
} else if (processing != null && fetch == null) {
|
||||
subtitle = 'Processing ran ${df.format(processing)}';
|
||||
} else {
|
||||
final fetchOrProcessing = fetch!.isAfter(processing!)
|
||||
? fetch
|
||||
: processing;
|
||||
final fetchOrProcessing =
|
||||
fetch!.isAfter(processing!) ? fetch : processing;
|
||||
subtitle = 'Last sync ${df.format(fetchOrProcessing)}';
|
||||
}
|
||||
}
|
||||
@ -52,8 +52,20 @@ class IosDebugInfoTile extends HookConsumerWidget {
|
||||
duration: const Duration(milliseconds: 200),
|
||||
child: ListTile(
|
||||
key: ValueKey(title),
|
||||
title: Text(title ?? ''),
|
||||
subtitle: Text(subtitle ?? ''),
|
||||
title: Text(
|
||||
title ?? '',
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 14,
|
||||
color: Theme.of(context).primaryColor,
|
||||
),
|
||||
),
|
||||
subtitle: Text(
|
||||
subtitle ?? '',
|
||||
style: const TextStyle(
|
||||
fontSize: 14,
|
||||
),
|
||||
),
|
||||
leading: Icon(
|
||||
Icons.bug_report,
|
||||
color: Theme.of(context).primaryColor,
|
||||
@ -64,4 +76,3 @@ class IosDebugInfoTile extends HookConsumerWidget {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -263,14 +263,14 @@ class BackupControllerPage extends HookConsumerWidget {
|
||||
if (!isBackgroundEnabled)
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 8.0),
|
||||
child:
|
||||
const Text("backup_controller_page_background_description")
|
||||
.tr(),
|
||||
child: const Text(
|
||||
"backup_controller_page_background_description",
|
||||
).tr(),
|
||||
),
|
||||
if (isBackgroundEnabled && Platform.isAndroid)
|
||||
SwitchListTile(
|
||||
title:
|
||||
const Text("backup_controller_page_background_wifi").tr(),
|
||||
SwitchListTile.adaptive(
|
||||
title: const Text("backup_controller_page_background_wifi")
|
||||
.tr(),
|
||||
secondary: Icon(
|
||||
Icons.wifi,
|
||||
color: isWifiRequired ? activeColor : null,
|
||||
@ -289,9 +289,10 @@ class BackupControllerPage extends HookConsumerWidget {
|
||||
: null,
|
||||
),
|
||||
if (isBackgroundEnabled)
|
||||
SwitchListTile(
|
||||
title: const Text("backup_controller_page_background_charging")
|
||||
.tr(),
|
||||
SwitchListTile.adaptive(
|
||||
title:
|
||||
const Text("backup_controller_page_background_charging")
|
||||
.tr(),
|
||||
secondary: Icon(
|
||||
Icons.charging_station,
|
||||
color: isChargingRequired ? activeColor : null,
|
||||
@ -319,7 +320,9 @@ class BackupControllerPage extends HookConsumerWidget {
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
).tr(args: [formatBackupDelaySliderValue(triggerDelay.value)]),
|
||||
).tr(
|
||||
args: [formatBackupDelaySliderValue(triggerDelay.value)],
|
||||
),
|
||||
subtitle: Slider(
|
||||
value: triggerDelay.value,
|
||||
onChanged: hasExclusiveAccess
|
||||
@ -339,18 +342,21 @@ class BackupControllerPage extends HookConsumerWidget {
|
||||
),
|
||||
),
|
||||
ElevatedButton(
|
||||
onPressed: () =>
|
||||
ref.read(backupProvider.notifier).configureBackgroundBackup(
|
||||
enabled: !isBackgroundEnabled,
|
||||
onError: showErrorToUser,
|
||||
onBatteryInfo: showBatteryOptimizationInfoToUser,
|
||||
),
|
||||
onPressed: () => ref
|
||||
.read(backupProvider.notifier)
|
||||
.configureBackgroundBackup(
|
||||
enabled: !isBackgroundEnabled,
|
||||
onError: showErrorToUser,
|
||||
onBatteryInfo: showBatteryOptimizationInfoToUser,
|
||||
),
|
||||
child: Text(
|
||||
isBackgroundEnabled
|
||||
? "backup_controller_page_background_turn_off"
|
||||
: "backup_controller_page_background_turn_on",
|
||||
style:
|
||||
const TextStyle(fontWeight: FontWeight.bold, fontSize: 12),
|
||||
style: const TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 12,
|
||||
),
|
||||
).tr(),
|
||||
),
|
||||
],
|
||||
@ -434,7 +440,7 @@ class BackupControllerPage extends HookConsumerWidget {
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
side: BorderSide(
|
||||
color: isDarkMode
|
||||
? const Color.fromARGB(255, 101, 101, 101)
|
||||
? const Color.fromARGB(255, 56, 56, 56)
|
||||
: Colors.black12,
|
||||
width: 1,
|
||||
),
|
||||
@ -534,7 +540,7 @@ class BackupControllerPage extends HookConsumerWidget {
|
||||
borderRadius: BorderRadius.circular(20), // if you need this
|
||||
side: BorderSide(
|
||||
color: isDarkMode
|
||||
? const Color.fromARGB(255, 101, 101, 101)
|
||||
? const Color.fromARGB(255, 56, 56, 56)
|
||||
: Colors.black12,
|
||||
width: 1,
|
||||
),
|
||||
|
Loading…
Reference in New Issue
Block a user