π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Try new plugin
vishnukvmd26e903b1f1da
diff --git a/mobile/lib/ui/home/custom_icons.dart b/mobile/lib/ui/home/custom_icons.dartnew file mode 100644index 0000000000..2922a20322--- /dev/null+++ b/mobile/lib/ui/home/custom_icons.dart@@ -0,0 +1,68 @@+import 'package:flutter_app_icon_changer/flutter_app_icon_changer.dart';++class CustomIcons {+ /// A list of all available [CustomIcon] instances.+ static final List<CustomIcon> list = [+ IconLight(),+ IconDark(),+ IconGreen(),+ ];+}++/// A sealed class representing a custom app icon with a preview path.+///+/// This class cannot be extended outside of its library.+sealed class CustomIcon extends AppIcon {+ /// The file path to the preview image of the icon.+ final String previewPath;++ CustomIcon({+ required this.previewPath,+ required super.iOSIcon,+ required super.androidIcon,+ required super.isDefaultIcon,+ });++ /// Creates a [CustomIcon] instance from a string [icon] name.+ ///+ /// Returns the corresponding [CustomIcon] if found;+ /// Otherwise, returns the default icon.+ factory CustomIcon.fromString(String? icon) {+ if (icon == null) return IconGreen();++ return CustomIcons.list.firstWhere(+ (e) => e.iOSIcon == icon || e.androidIcon == icon,+ orElse: () => IconGreen(),+ );+ }+}++final class IconLight extends CustomIcon {+ IconLight()+ : super(+ iOSIcon: 'IconLight',+ androidIcon: 'IconLight',+ previewPath: 'assets/icons/icon2.png',+ isDefaultIcon: false,+ );+}++final class IconDark extends CustomIcon {+ IconDark()+ : super(+ iOSIcon: 'IconDark',+ androidIcon: 'IconDark',+ previewPath: 'assets/icons/icon2.png',+ isDefaultIcon: false,+ );+}++final class IconGreen extends CustomIcon {+ IconGreen()+ : super(+ iOSIcon: 'IconGreen',+ androidIcon: 'IconGreen',+ previewPath: 'assets/icons/icon2.png',+ isDefaultIcon: true,+ );+}diff --git a/mobile/lib/ui/home/landing_page_widget.dart b/mobile/lib/ui/home/landing_page_widget.dartindex edd65477de..3516d8a008 100644--- a/mobile/lib/ui/home/landing_page_widget.dart+++ b/mobile/lib/ui/home/landing_page_widget.dart@@ -4,6 +4,7 @@ import 'dart:io';import 'package:dots_indicator/dots_indicator.dart';import "package:flutter/foundation.dart";import 'package:flutter/material.dart';+import "package:flutter_app_icon_changer/flutter_app_icon_changer.dart";import "package:launcher_icon_switcher/launcher_icon_switcher.dart";import "package:logging/logging.dart";import "package:photos/app.dart";@@ -20,6 +21,7 @@ import 'package:photos/ui/common/gradient_button.dart';import 'package:photos/ui/components/buttons/button_widget.dart';import 'package:photos/ui/components/dialog_widget.dart';import 'package:photos/ui/components/models/button_type.dart';+import "package:photos/ui/home/custom_icons.dart";import 'package:photos/ui/payment/subscription.dart';import "package:photos/ui/settings/developer_settings_page.dart";import "package:photos/ui/settings/developer_settings_widget.dart";@@ -258,7 +260,7 @@ class _LandingPageWidgetState extends State<LandingPageWidget> {Future<void> _changeIcon() async {Logger("Icon").info("Initializing");await LauncherIconSwitcher()- .initialize(['IconLight', 'IconDark', 'IconGreen'], 'IconLight');+ .initialize(['IconLight', 'IconDark', 'IconGreen'], 'IconGreen');Logger("Icon").info("Initialized");final currentIcon = await LauncherIconSwitcher().getCurrentIcon();Logger("Icon").info("Current Icon: " + currentIcon);@@ -272,6 +274,32 @@ class _LandingPageWidgetState extends State<LandingPageWidget> {Logger("Icon").info("Changed");}+ Future<void> _changeIcon2() async {+ try {+ Logger("Icon").info("Initializing");+ final iconChanger = FlutterAppIconChangerPlugin(+ iconsSet: CustomIcons.list,+ );+ Logger("Icon").info("Initialized");+ final currentIcon = await iconChanger.getCurrentIcon() ?? "none";+ Logger("Icon").info("Current Icon: " + currentIcon);+ final isSupported = await iconChanger.isSupported();+ Logger("Icon").info("Supported: " + isSupported.toString());+ if (currentIcon == CustomIcons.list[0].androidIcon) {+ await iconChanger.changeIcon(CustomIcons.list[1].androidIcon);+ } else if (currentIcon == CustomIcons.list[1].androidIcon) {+ await iconChanger.changeIcon(CustomIcons.list[2].androidIcon);+ } else {+ await iconChanger.changeIcon(CustomIcons.list[0].androidIcon);+ }+ final newIcon = await iconChanger.getCurrentIcon() ?? "none";+ Logger("Icon").info("App icon changed to " + newIcon);+ return;+ } catch (e, s) {+ Logger("Icon").severe(e, s);+ }+ }+void _navigateToSignInPage() {updateService.hideChangeLog().ignore();Widget page;