Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

[mob][locker] Add Legacy setup empty state

AmanRajSinghMourya36bf13098784
diff --git a/mobile/apps/locker/assets/legacy_setup.riv b/mobile/apps/locker/assets/legacy_setup.riv
new file mode 100644
index 0000000000..cb929a4670
Binary files /dev/null and b/mobile/apps/locker/assets/legacy_setup.riv differ
diff --git a/mobile/apps/locker/ios/Podfile.lock b/mobile/apps/locker/ios/Podfile.lock
index a98f77e1f1..06b19e9c3e 100644
--- a/mobile/apps/locker/ios/Podfile.lock
+++ b/mobile/apps/locker/ios/Podfile.lock
@@ -64,6 +64,8 @@ PODS:
- Flutter
- package_info_plus (0.4.5):
- Flutter
+ - rive_native (0.0.1):
+ - Flutter
- SDWebImage (5.21.5):
- SDWebImage/Core (= 5.21.5)
- SDWebImage/Core (5.21.5)
@@ -106,6 +108,7 @@ DEPENDENCIES:
- local_auth_darwin (from `.symlinks/plugins/local_auth_darwin/darwin`)
- open_file_ios (from `.symlinks/plugins/open_file_ios/ios`)
- package_info_plus (from `.symlinks/plugins/package_info_plus/ios`)
+ - rive_native (from `.symlinks/plugins/rive_native/ios`)
- sentry_flutter (from `.symlinks/plugins/sentry_flutter/ios`)
- share_plus (from `.symlinks/plugins/share_plus/ios`)
- shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/darwin`)
@@ -155,6 +158,8 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/open_file_ios/ios"
package_info_plus:
:path: ".symlinks/plugins/package_info_plus/ios"
+ rive_native:
+ :path: ".symlinks/plugins/rive_native/ios"
sentry_flutter:
:path: ".symlinks/plugins/sentry_flutter/ios"
share_plus:
@@ -189,6 +194,7 @@ SPEC CHECKSUMS:
local_auth_darwin: c3ee6cce0a8d56be34c8ccb66ba31f7f180aaebb
open_file_ios: 46184d802ee7959203f6392abcfa0dd49fdb5be0
package_info_plus: af8e2ca6888548050f16fa2f1938db7b5a5df499
+ rive_native: a57df296c558867395bfe82fafe857ec67640f58
SDWebImage: e9c98383c7572d713c1a0d7dd2783b10599b9838
Sentry: da60d980b197a46db0b35ea12cb8f39af48d8854
sentry_flutter: 27892878729f42701297c628eb90e7c6529f3684
diff --git a/mobile/apps/locker/lib/l10n/app_en.arb b/mobile/apps/locker/lib/l10n/app_en.arb
index b4824dcfca..dc9a959e53 100644
--- a/mobile/apps/locker/lib/l10n/app_en.arb
+++ b/mobile/apps/locker/lib/l10n/app_en.arb
@@ -272,6 +272,14 @@
"yourTrashIsEmpty": "Your trash is empty",
"homeLockerEmptyTitle": "Your Locker is empty",
"homeLockerEmptySubtitle": "Click the + button to get started",
+ "homeEmptyStateLegacyDescription": "Setup your Legacy so loved ones can access important information, in your absence",
+ "@homeEmptyStateLegacyDescription": {
+ "description": "Description shown in the empty Locker home state above the Legacy setup action"
+ },
+ "setupYourLegacy": "Setup your Legacy",
+ "@setupYourLegacy": {
+ "description": "Action that opens Legacy setup from the empty Locker home state"
+ },
"uploadDocument": "Upload document",
"items": "{count} items",
"@items": {
diff --git a/mobile/apps/locker/lib/main.dart b/mobile/apps/locker/lib/main.dart
index 7fbc6037a4..0534581ebc 100644
--- a/mobile/apps/locker/lib/main.dart
+++ b/mobile/apps/locker/lib/main.dart
@@ -42,6 +42,7 @@ import 'package:locker/services/update_service.dart';
import 'package:locker/ui/pages/home_page.dart';
import 'package:package_info_plus/package_info_plus.dart';
import 'package:path_provider/path_provider.dart';
+import 'package:rive/rive.dart' as rive;
import 'package:shared_preferences/shared_preferences.dart';
import 'package:tray_manager/tray_manager.dart';
import 'package:window_manager/window_manager.dart';
@@ -52,6 +53,7 @@ Future<void>? _rustInitFuture;
void main() async {
WidgetsFlutterBinding.ensureInitialized();
+ await rive.RiveNative.init();
registerCryptoApi(const EnteCryptoDartAdapter());
if (PlatformDetector.isDesktop()) {
diff --git a/mobile/apps/locker/lib/ui/components/home_empty_state_widget.dart b/mobile/apps/locker/lib/ui/components/home_empty_state_widget.dart
index 2c33546423..c34e5c5790 100644
--- a/mobile/apps/locker/lib/ui/components/home_empty_state_widget.dart
+++ b/mobile/apps/locker/lib/ui/components/home_empty_state_widget.dart
@@ -1,50 +1,90 @@
-import "package:dotted_border/dotted_border.dart";
+import 'dart:async';
+
import "package:ente_components/ente_components.dart";
import "package:flutter/material.dart";
import 'package:locker/l10n/l10n.dart';
+import 'package:rive/rive.dart' as rive;
-class HomeEmptyStateWidget extends StatelessWidget {
- const HomeEmptyStateWidget({this.isLoading = false, super.key});
+class HomeEmptyStateWidget extends StatefulWidget {
+ const HomeEmptyStateWidget({
+ super.key,
+ this.isLoading = false,
+ this.onSetupLegacy,
+ this.onSaveToLocker,
+ });
final bool isLoading;
+ final FutureOr<void> Function()? onSetupLegacy;
+ final FutureOr<void> Function()? onSaveToLocker;
+
+ @override
+ State<HomeEmptyStateWidget> createState() => _HomeEmptyStateWidgetState();
+}
+
+class _HomeEmptyStateWidgetState extends State<HomeEmptyStateWidget> {
+ late final rive.FileLoader _animationLoader;
+
+ @override
+ void initState() {
+ super.initState();
+ _animationLoader = rive.FileLoader.fromAsset(
+ 'assets/legacy_setup.riv',
+ riveFactory: rive.Factory.flutter,
+ );
+ }
+
+ @override
+ void dispose() {
+ _animationLoader.dispose();
+ super.dispose();
+ }
@override
Widget build(BuildContext context) {
final colors = context.componentColors;
- return isLoading
+ return widget.isLoading
? CircularProgressIndicator(strokeWidth: 3, color: colors.primary)
- : DottedBorder(
- options: RoundedRectDottedBorderOptions(
- strokeWidth: 1,
- color: colors.textLighter,
- dashPattern: const [5, 5],
- radius: const Radius.circular(24),
- ),
- child: Container(
- width: double.infinity,
- decoration: BoxDecoration(
- color: colors.fillLight,
- borderRadius: BorderRadius.circular(24),
+ : Column(
+ mainAxisSize: MainAxisSize.min,
+ children: [
+ SizedBox(
+ width: 234,
+ height: 140,
+ child: rive.RiveWidgetBuilder(
+ fileLoader: _animationLoader,
+ builder: (context, state) {
+ if (state is rive.RiveLoaded) {
+ return rive.RiveWidget(
+ controller: state.controller,
+ fit: rive.Fit.contain,
+ );
+ }
+ return const SizedBox.expand();
+ },
+ ),
+ ),
+ const SizedBox(height: 40),
+ Text(
+ context.l10n.homeEmptyStateLegacyDescription,
+ style: TextStyles.body.copyWith(color: colors.textLight),
+ textAlign: TextAlign.center,
),
- padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 42),
- child: Column(
- mainAxisSize: MainAxisSize.min,
- crossAxisAlignment: CrossAxisAlignment.center,
+ const SizedBox(height: 40),
+ Column(
children: [
- Image.asset('assets/upload_file.png'),
+ ButtonComponent(
+ label: context.l10n.setupYourLegacy,
+ onTap: widget.onSetupLegacy,
+ ),
const SizedBox(height: 12),
- Text(context.l10n.homeLockerEmptyTitle, style: TextStyles.h2),
- const SizedBox(height: 8),
- Text(
- context.l10n.homeLockerEmptySubtitle,
- style: TextStyles.body.copyWith(
- color: colors.primary,
- decoration: TextDecoration.none,
- ),
+ ButtonComponent(
+ label: context.l10n.saveToLocker,
+ variant: ButtonComponentVariant.neutral,
+ onTap: widget.onSaveToLocker,
),
],
),
- ),
+ ],
);
}
}
diff --git a/mobile/apps/locker/lib/ui/pages/home_page.dart b/mobile/apps/locker/lib/ui/pages/home_page.dart
index ee4e9d4fc0..6c697ef2c5 100644
--- a/mobile/apps/locker/lib/ui/pages/home_page.dart
+++ b/mobile/apps/locker/lib/ui/pages/home_page.dart
@@ -29,6 +29,7 @@ import "package:locker/ui/drawer/drawer_page.dart";
import 'package:locker/ui/mixins/search_mixin.dart';
import 'package:locker/ui/pages/save_page.dart';
import 'package:locker/ui/pages/uploader_page.dart';
+import "package:locker/ui/utils/legacy_utils.dart";
import "package:locker/ui/viewer/actions/file_selection_overlay_bar.dart";
import "package:locker/utils/bottom_sheet_illustration.dart";
import 'package:locker/utils/collection_sort_util.dart';
@@ -749,7 +750,11 @@ class _HomePageState extends UploaderPageState<HomePage>
? Center(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 16.0),
- child: HomeEmptyStateWidget(isLoading: _isSyncing),
+ child: HomeEmptyStateWidget(
+ isLoading: _isSyncing,
+ onSetupLegacy: () => openLegacyPage(context),
+ onSaveToLocker: _openSavePage,
+ ),
),
)
: SingleChildScrollView(
diff --git a/mobile/apps/locker/linux/flutter/generated_plugin_registrant.cc b/mobile/apps/locker/linux/flutter/generated_plugin_registrant.cc
index 711a150ddf..5060d19b87 100644
--- a/mobile/apps/locker/linux/flutter/generated_plugin_registrant.cc
+++ b/mobile/apps/locker/linux/flutter/generated_plugin_registrant.cc
@@ -11,6 +11,7 @@
#include <gtk/gtk_plugin.h>
#include <local_auth_linux/local_auth_linux_plugin.h>
#include <open_file_linux/open_file_linux_plugin.h>
+#include <rive_native/rive_native_plugin.h>
#include <screen_retriever_linux/screen_retriever_linux_plugin.h>
#include <sentry_flutter/sentry_flutter_plugin.h>
#include <sodium_libs/sodium_libs_plugin.h>
@@ -34,6 +35,9 @@ void fl_register_plugins(FlPluginRegistry* registry) {
g_autoptr(FlPluginRegistrar) open_file_linux_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "OpenFileLinuxPlugin");
open_file_linux_plugin_register_with_registrar(open_file_linux_registrar);
+ g_autoptr(FlPluginRegistrar) rive_native_registrar =
+ fl_plugin_registry_get_registrar_for_plugin(registry, "RiveNativePlugin");
+ rive_native_plugin_register_with_registrar(rive_native_registrar);
g_autoptr(FlPluginRegistrar) screen_retriever_linux_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "ScreenRetrieverLinuxPlugin");
screen_retriever_linux_plugin_register_with_registrar(screen_retriever_linux_registrar);
diff --git a/mobile/apps/locker/linux/flutter/generated_plugins.cmake b/mobile/apps/locker/linux/flutter/generated_plugins.cmake
index 030f482592..e74554b504 100644
--- a/mobile/apps/locker/linux/flutter/generated_plugins.cmake
+++ b/mobile/apps/locker/linux/flutter/generated_plugins.cmake
@@ -8,6 +8,7 @@ list(APPEND FLUTTER_PLUGIN_LIST
gtk
local_auth_linux
open_file_linux
+ rive_native
screen_retriever_linux
sentry_flutter
sodium_libs
diff --git a/mobile/apps/locker/macos/Flutter/GeneratedPluginRegistrant.swift b/mobile/apps/locker/macos/Flutter/GeneratedPluginRegistrant.swift
index 2897404432..d072f3fece 100644
--- a/mobile/apps/locker/macos/Flutter/GeneratedPluginRegistrant.swift
+++ b/mobile/apps/locker/macos/Flutter/GeneratedPluginRegistrant.swift
@@ -13,6 +13,7 @@ import flutter_secure_storage_macos
import local_auth_darwin
import open_file_mac
import package_info_plus
+import rive_native
import screen_retriever_macos
import sentry_flutter
import share_plus
@@ -32,6 +33,7 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
LocalAuthPlugin.register(with: registry.registrar(forPlugin: "LocalAuthPlugin"))
OpenFilePlugin.register(with: registry.registrar(forPlugin: "OpenFilePlugin"))
FPPPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FPPPackageInfoPlusPlugin"))
+ RiveNativePlugin.register(with: registry.registrar(forPlugin: "RiveNativePlugin"))
ScreenRetrieverMacosPlugin.register(with: registry.registrar(forPlugin: "ScreenRetrieverMacosPlugin"))
SentryFlutterPlugin.register(with: registry.registrar(forPlugin: "SentryFlutterPlugin"))
SharePlusMacosPlugin.register(with: registry.registrar(forPlugin: "SharePlusMacosPlugin"))
diff --git a/mobile/apps/locker/macos/Podfile.lock b/mobile/apps/locker/macos/Podfile.lock
index 046c1a736b..515bb20f86 100644
--- a/mobile/apps/locker/macos/Podfile.lock
+++ b/mobile/apps/locker/macos/Podfile.lock
@@ -22,6 +22,8 @@ PODS:
- FlutterMacOS
- package_info_plus (0.0.1):
- FlutterMacOS
+ - rive_native (0.0.1):
+ - FlutterMacOS
- screen_retriever_macos (0.0.1):
- FlutterMacOS
- Sentry/HybridSDK (8.46.0)
@@ -59,6 +61,7 @@ DEPENDENCIES:
- local_auth_darwin (from `Flutter/ephemeral/.symlinks/plugins/local_auth_darwin/darwin`)
- open_file_mac (from `Flutter/ephemeral/.symlinks/plugins/open_file_mac/macos`)
- package_info_plus (from `Flutter/ephemeral/.symlinks/plugins/package_info_plus/macos`)
+ - rive_native (from `Flutter/ephemeral/.symlinks/plugins/rive_native/macos`)
- screen_retriever_macos (from `Flutter/ephemeral/.symlinks/plugins/screen_retriever_macos/macos`)
- sentry_flutter (from `Flutter/ephemeral/.symlinks/plugins/sentry_flutter/macos`)
- share_plus (from `Flutter/ephemeral/.symlinks/plugins/share_plus/macos`)
@@ -96,6 +99,8 @@ EXTERNAL SOURCES:
:path: Flutter/ephemeral/.symlinks/plugins/open_file_mac/macos
package_info_plus:
:path: Flutter/ephemeral/.symlinks/plugins/package_info_plus/macos
+ rive_native:
+ :path: Flutter/ephemeral/.symlinks/plugins/rive_native/macos
screen_retriever_macos:
:path: Flutter/ephemeral/.symlinks/plugins/screen_retriever_macos/macos
sentry_flutter:
@@ -127,6 +132,7 @@ SPEC CHECKSUMS:
local_auth_darwin: c3ee6cce0a8d56be34c8ccb66ba31f7f180aaebb
open_file_mac: 76f06c8597551249bdb5e8fd8827a98eae0f4585
package_info_plus: f0052d280d17aa382b932f399edf32507174e870
+ rive_native: 8a1f7b191cd1cfb55301e8d5028880e4ae788d56
screen_retriever_macos: 452e51764a9e1cdb74b3c541238795849f21557f
Sentry: da60d980b197a46db0b35ea12cb8f39af48d8854
sentry_flutter: 27892878729f42701297c628eb90e7c6529f3684
diff --git a/mobile/apps/locker/pubspec.yaml b/mobile/apps/locker/pubspec.yaml
index a8dc84ed62..e375ad4c0e 100644
--- a/mobile/apps/locker/pubspec.yaml
+++ b/mobile/apps/locker/pubspec.yaml
@@ -79,6 +79,7 @@ dependencies:
package_info_plus: 8.3.1
path: 1.9.1
path_provider: 2.1.5
+ rive: 0.14.0-dev.13
share_plus: 11.1.0
shared_preferences: 2.5.3
sqflite: 2.4.2
diff --git a/mobile/apps/locker/windows/flutter/generated_plugin_registrant.cc b/mobile/apps/locker/windows/flutter/generated_plugin_registrant.cc
index ce3538dc9e..03b2da7f7a 100644
--- a/mobile/apps/locker/windows/flutter/generated_plugin_registrant.cc
+++ b/mobile/apps/locker/windows/flutter/generated_plugin_registrant.cc
@@ -10,6 +10,7 @@
#include <file_saver/file_saver_plugin.h>
#include <flutter_secure_storage_windows/flutter_secure_storage_windows_plugin.h>
#include <local_auth_windows/local_auth_plugin.h>
+#include <rive_native/rive_native_plugin.h>
#include <screen_retriever_windows/screen_retriever_windows_plugin_c_api.h>
#include <sentry_flutter/sentry_flutter_plugin.h>
#include <share_plus/share_plus_windows_plugin_c_api.h>
@@ -27,6 +28,8 @@ void RegisterPlugins(flutter::PluginRegistry* registry) {
registry->GetRegistrarForPlugin("FlutterSecureStorageWindowsPlugin"));
LocalAuthPluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("LocalAuthPlugin"));
+ RiveNativePluginRegisterWithRegistrar(
+ registry->GetRegistrarForPlugin("RiveNativePlugin"));
ScreenRetrieverWindowsPluginCApiRegisterWithRegistrar(
registry->GetRegistrarForPlugin("ScreenRetrieverWindowsPluginCApi"));
SentryFlutterPluginRegisterWithRegistrar(
diff --git a/mobile/apps/locker/windows/flutter/generated_plugins.cmake b/mobile/apps/locker/windows/flutter/generated_plugins.cmake
index 77f2779d84..ac9efbf953 100644
--- a/mobile/apps/locker/windows/flutter/generated_plugins.cmake
+++ b/mobile/apps/locker/windows/flutter/generated_plugins.cmake
@@ -7,6 +7,7 @@ list(APPEND FLUTTER_PLUGIN_LIST
file_saver
flutter_secure_storage_windows
local_auth_windows
+ rive_native
screen_retriever_windows
sentry_flutter
share_plus