Skip to content

Commit

Permalink
feat(mobile): cosmetic update
Browse files Browse the repository at this point in the history
  • Loading branch information
alextran1502 authored Oct 14, 2022
2 parents d43a08e + f05d5bd commit a7f14dc
Show file tree
Hide file tree
Showing 17 changed files with 64 additions and 39 deletions.
12 changes: 6 additions & 6 deletions mobile/assets/i18n/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"backup_controller_page_backup_sub": "Backed up photos and videos",
"backup_controller_page_cancel": "Cancel",
"backup_controller_page_created": "Created on: {}",
"backup_controller_page_desc_backup": "Turn on backup to automatically upload new assets to the server.",
"backup_controller_page_desc_backup": "Turn on foreground backup to automatically upload new assets to the server when opening the app.",
"backup_controller_page_excluded": "Excluded: ",
"backup_controller_page_failed": "Failed ({})",
"backup_controller_page_filename": "File name: {} [{}]",
Expand All @@ -58,14 +58,14 @@
"backup_controller_page_select": "Select",
"backup_controller_page_server_storage": "Server Storage",
"backup_controller_page_start_backup": "Start Backup",
"backup_controller_page_status_off": "Backup is off",
"backup_controller_page_status_on": "Backup is on",
"backup_controller_page_status_off": "Automatic foreground backup is off",
"backup_controller_page_status_on": "Automatic foreground backup is on",
"backup_controller_page_storage_format": "{} of {} used",
"backup_controller_page_to_backup": "Albums to be backup",
"backup_controller_page_total": "Total",
"backup_controller_page_total_sub": "All unique photos and videos from selected albums",
"backup_controller_page_turn_off": "Turn off Backup",
"backup_controller_page_turn_on": "Turn on Backup",
"backup_controller_page_turn_off": "Turn off foreground backup",
"backup_controller_page_turn_on": "Turn on foreground backup",
"backup_controller_page_uploading_file_info": "Uploading file info",
"backup_err_only_album": "Cannot remove the only album",
"backup_info_card_assets": "assets",
Expand Down Expand Up @@ -172,4 +172,4 @@
"version_announcement_overlay_title": "New Server Version Available \uD83C\uDF89",
"experimental_settings_title": "Experimental",
"experimental_settings_subtitle": "Use at your own risk!"
}
}
1 change: 0 additions & 1 deletion mobile/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import 'package:flutter/services.dart';
import 'package:flutter_displaymode/flutter_displaymode.dart';
import 'package:hive_flutter/hive_flutter.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:immich_mobile/constants/immich_colors.dart';
import 'package:immich_mobile/constants/locales.dart';
import 'package:immich_mobile/modules/backup/background_service/background.service.dart';
import 'package:immich_mobile/modules/backup/models/hive_backup_albums.model.dart';
Expand Down
1 change: 0 additions & 1 deletion mobile/lib/modules/album/ui/album_viewer_appbar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:fluttertoast/fluttertoast.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:immich_mobile/constants/immich_colors.dart';
import 'package:immich_mobile/modules/album/providers/album.provider.dart';
import 'package:immich_mobile/modules/album/providers/album_viewer.provider.dart';
import 'package:immich_mobile/modules/album/providers/asset_selection.provider.dart';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ class SelectUserForSharingPage extends HookConsumerWidget {
actions: [
TextButton(
style: TextButton.styleFrom(
primary: Theme.of(context).primaryColor,
foregroundColor: Theme.of(context).primaryColor,
),
onPressed:
sharedUsersList.value.isEmpty ? null : _createSharedAlbum,
Expand Down
4 changes: 4 additions & 0 deletions mobile/lib/modules/asset_viewer/views/gallery_viewer.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'package:auto_route/auto_route.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_hooks/flutter_hooks.dart';
import 'package:flutter_swipe_detector/flutter_swipe_detector.dart';
import 'package:hive/hive.dart';
Expand Down Expand Up @@ -111,6 +112,9 @@ class GalleryViewerPage extends HookConsumerWidget {
: const BouncingScrollPhysics(),
itemCount: assetList.length,
scrollDirection: Axis.horizontal,
onPageChanged: (value) {
HapticFeedback.selectionClick();
},
itemBuilder: (context, index) {
initState(index);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ Future<bool> loadTranslations() async {

await controller.loadTranslations();

return Localization.load(controller.locale,
translations: controller.translations,
fallbackTranslations: controller.fallbackTranslations);
return Localization.load(
controller.locale,
translations: controller.translations,
fallbackTranslations: controller.fallbackTranslations,
);
}
6 changes: 3 additions & 3 deletions mobile/lib/modules/backup/views/album_preview_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ class AlbumPreviewPage extends HookConsumerWidget {
final assets = useState<List<AssetEntity>>([]);

_getAssetsInAlbum() async {
assets.value =
await album.getAssetListRange(start: 0, end: album.assetCount);
assets.value = await album.getAssetListRange(
start: 0, end: await album.assetCountAsync);
}

useEffect(
Expand All @@ -34,7 +34,7 @@ class AlbumPreviewPage extends HookConsumerWidget {
title: Column(
children: [
Text(
"${album.name} (${album.assetCount})",
"${album.name} (${album.assetCountAsync})",
style: const TextStyle(fontSize: 14, fontWeight: FontWeight.bold),
),
Padding(
Expand Down
11 changes: 8 additions & 3 deletions mobile/lib/modules/backup/views/backup_controller_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,6 @@ class BackupControllerPage extends HookConsumerWidget {
}

void _showBatteryOptimizationInfoToUser() {
final buttonTextColor = Theme.of(context).primaryColor;
showDialog<void>(
context: context,
barrierDismissible: false,
Expand All @@ -173,13 +172,14 @@ class BackupControllerPage extends HookConsumerWidget {
).tr(),
),
actions: [
OutlinedButton(
ElevatedButton(
onPressed: () => launchUrl(
Uri.parse('https://dontkillmyapp.com'),
mode: LaunchMode.externalApplication,
),
child: const Text(
"backup_controller_page_background_battery_info_link",
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 12),
).tr(),
),
ElevatedButton(
Expand Down Expand Up @@ -220,7 +220,12 @@ class BackupControllerPage extends HookConsumerWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
if (!isBackgroundEnabled)
const Text("backup_controller_page_background_description").tr(),
Padding(
padding: const EdgeInsets.symmetric(vertical: 8.0),
child:
const Text("backup_controller_page_background_description")
.tr(),
),
if (isBackgroundEnabled)
SwitchListTile(
title:
Expand Down
14 changes: 10 additions & 4 deletions mobile/lib/modules/home/ui/delete_diaglog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class DeleteDialog extends ConsumerWidget {
Widget build(BuildContext context, WidgetRef ref) {

return AlertDialog(
backgroundColor: Colors.grey[200],
// backgroundColor: Colors.grey[200],
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)),
title: const Text("delete_dialog_title").tr(),
content: const Text("delete_dialog_alert").tr(),
Expand All @@ -20,9 +20,12 @@ class DeleteDialog extends ConsumerWidget {
onPressed: () {
Navigator.of(context).pop();
},
child: const Text(
child: Text(
"delete_dialog_cancel",
style: TextStyle(color: Colors.blueGrey),
style: TextStyle(
color: Theme.of(context).primaryColor,
fontWeight: FontWeight.bold,
),
).tr(),
),
TextButton(
Expand All @@ -32,7 +35,10 @@ class DeleteDialog extends ConsumerWidget {
},
child: Text(
"delete_dialog_ok",
style: TextStyle(color: Colors.red[400]),
style: TextStyle(
color: Colors.red[400],
fontWeight: FontWeight.bold,
),
).tr(),
),
],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:hive/hive.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:immich_mobile/constants/hive_box.dart';
Expand Down Expand Up @@ -120,6 +121,7 @@ class AuthenticationNotifier extends StateNotifier<AuthenticationState> {
.delete(savedLoginInfoKey);
}
} catch (e) {
HapticFeedback.vibrate();
debugPrint("Error logging in $e");
return false;
}
Expand Down
4 changes: 2 additions & 2 deletions mobile/lib/modules/login/ui/change_password_form.dart
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,8 @@ class ChangePasswordButton extends ConsumerWidget {
return ElevatedButton(
style: ElevatedButton.styleFrom(
visualDensity: VisualDensity.standard,
primary: Theme.of(context).primaryColor,
onPrimary: Colors.grey[50],
backgroundColor: Theme.of(context).primaryColor,
foregroundColor: Colors.grey[50],
elevation: 2,
padding: const EdgeInsets.symmetric(vertical: 10, horizontal: 25),
),
Expand Down
4 changes: 2 additions & 2 deletions mobile/lib/modules/login/ui/login_form.dart
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,8 @@ class LoginButton extends ConsumerWidget {
return ElevatedButton(
style: ElevatedButton.styleFrom(
visualDensity: VisualDensity.standard,
primary: Theme.of(context).primaryColor,
onPrimary: Colors.grey[50],
backgroundColor: Theme.of(context).primaryColor,
foregroundColor: Colors.grey[50],
elevation: 2,
padding: const EdgeInsets.symmetric(vertical: 10, horizontal: 25),
),
Expand Down
2 changes: 2 additions & 0 deletions mobile/lib/shared/views/tab_controller_page.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'package:auto_route/auto_route.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:immich_mobile/modules/home/providers/multiselect.provider.dart';
import 'package:immich_mobile/routing/router.dart';
Expand Down Expand Up @@ -44,6 +45,7 @@ class TabControllerPage extends ConsumerWidget {
),
currentIndex: tabsRouter.activeIndex,
onTap: (index) {
HapticFeedback.selectionClick();
tabsRouter.setActiveIndex(index);
},
items: [
Expand Down
4 changes: 2 additions & 2 deletions mobile/lib/shared/views/version_announcement_overlay.dart
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ class VersionAnnouncementOverlay extends HookConsumerWidget {
style: ElevatedButton.styleFrom(
shape: const StadiumBorder(),
visualDensity: VisualDensity.standard,
primary: Colors.indigo,
onPrimary: Colors.grey[50],
backgroundColor: Colors.indigo,
foregroundColor: Colors.grey[50],
elevation: 2,
padding: const EdgeInsets.symmetric(
vertical: 10,
Expand Down
8 changes: 5 additions & 3 deletions mobile/lib/utils/image_url_builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,11 @@ String getImageUrl(final AssetResponseDto asset) {
return '${box.get(serverEndpointKey)}/asset/file?aid=${asset.deviceAssetId}&did=${asset.deviceId}&isThumb=false';
}

String _getThumbnailUrl(final String id,
{ThumbnailFormat type = ThumbnailFormat.WEBP}) {
String _getThumbnailUrl(
final String id, {
ThumbnailFormat type = ThumbnailFormat.WEBP,
}) {
final box = Hive.box(userInfoBox);

return '${box.get(serverEndpointKey)}/asset/thumbnail/${id}?format=${type.value}';
return '${box.get(serverEndpointKey)}/asset/thumbnail/$id?format=${type.value}';
}
8 changes: 4 additions & 4 deletions mobile/lib/utils/immich_app_theme.dart
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ ThemeData immichDarkTheme = ThemeData(
cardColor: Colors.grey[900],
elevatedButtonTheme: ElevatedButtonThemeData(
style: ElevatedButton.styleFrom(
onPrimary: Colors.black87,
primary: immichDarkThemePrimaryColor,
foregroundColor: Colors.black87,
backgroundColor: immichDarkThemePrimaryColor,
),
),
);
Expand Down Expand Up @@ -126,8 +126,8 @@ ThemeData immichLightTheme = ThemeData(
),
elevatedButtonTheme: ElevatedButtonThemeData(
style: ElevatedButton.styleFrom(
primary: Colors.indigo,
onPrimary: Colors.white,
backgroundColor: Colors.indigo,
foregroundColor: Colors.white,
),
),
);
12 changes: 8 additions & 4 deletions mobile/lib/utils/immich_cache_info_repository.dart
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,10 @@ class ImmichCacheInfoRepository extends ImmichCacheRepository {
}

@override
Future<CacheObject> insert(CacheObject cacheObject,
{bool setTouchedToNow = true}) async {
Future<CacheObject> insert(
CacheObject cacheObject, {
bool setTouchedToNow = true,
}) async {
int newId = keyLookupHiveBox.length == 0
? 0
: keyLookupHiveBox.values.reduce(max) + 1;
Expand Down Expand Up @@ -144,8 +146,10 @@ class ImmichCacheInfoRepository extends ImmichCacheRepository {
}

@override
Future<int> update(CacheObject cacheObject,
{bool setTouchedToNow = true}) async {
Future<int> update(
CacheObject cacheObject, {
bool setTouchedToNow = true,
}) async {
if (cacheObject.id != null) {
cacheObjectLookupBox.put(cacheObject.id, cacheObject.toMap());
return 1;
Expand Down

0 comments on commit a7f14dc

Please sign in to comment.