Skip to content

armgit / ente

Public Imported from GitHub
0

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

[mob][locker] integrate shared contacts display

Neeraj Gupta5bd13b194b2e
diff --git a/.github/workflows/locker-internal-release.yml b/.github/workflows/locker-internal-release.yml
index de092a65e4..2b33c98972 100644
--- a/.github/workflows/locker-internal-release.yml
+++ b/.github/workflows/locker-internal-release.yml
@@ -5,6 +5,7 @@ on:
env:
FLUTTER_VERSION: "3.32.8"
+ RUST_VERSION: "1.90.0"
permissions:
contents: write
@@ -35,6 +36,11 @@ jobs:
flutter-version: ${{ env.FLUTTER_VERSION }}
cache: true
+ - name: Install Rust ${{ env.RUST_VERSION }}
+ uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8
+ with:
+ toolchain: ${{ env.RUST_VERSION }}
+
- name: Generate strings localizations
run: flutter gen-l10n
working-directory: mobile/packages/strings
@@ -42,6 +48,13 @@ jobs:
- name: Resolve dependencies with lockfile enforcement
run: flutter pub get --enforce-lockfile
+ - name: Install Flutter Rust Bridge
+ run: cargo install flutter_rust_bridge_codegen
+
+ - name: Generate Rust bindings (Core package)
+ run: flutter_rust_bridge_codegen generate
+ working-directory: mobile/packages/rust
+
- name: Increment version code for build
run: |
CURRENT_VERSION=$(grep '^version:' pubspec.yaml | sed 's/version: //')
diff --git a/.github/workflows/locker-lint.yml b/.github/workflows/locker-lint.yml
index 60eab2071c..5d3878082b 100644
--- a/.github/workflows/locker-lint.yml
+++ b/.github/workflows/locker-lint.yml
@@ -5,10 +5,15 @@ on:
pull_request:
paths:
- "mobile/apps/locker/**"
+ - "mobile/packages/contacts/**"
+ - "mobile/packages/legacy/**"
+ - "mobile/packages/rust/**"
+ - "mobile/packages/sharing/**"
- ".github/workflows/locker-lint.yml"
env:
FLUTTER_VERSION: "3.32.8"
+ RUST_VERSION: "1.90.0"
permissions:
contents: read
@@ -36,6 +41,27 @@ jobs:
flutter-version: ${{ env.FLUTTER_VERSION }}
cache: true
+ - name: Install Rust ${{ env.RUST_VERSION }}
+ uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8
+ with:
+ toolchain: ${{ env.RUST_VERSION }}
+
+ - name: Cache Rust dependencies
+ uses: actions/cache@v4
+ with:
+ path: |
+ ~/.cargo/registry
+ ~/.cargo/git
+ mobile/packages/rust/rust/target
+ key: ${{ runner.os }}-cargo-locker-${{ hashFiles('mobile/packages/**/Cargo.lock') }}
+
+ - name: Install Flutter Rust Bridge
+ run: cargo install flutter_rust_bridge_codegen
+
+ - name: Generate Rust bindings (Core package)
+ run: flutter_rust_bridge_codegen generate
+ working-directory: mobile/packages/rust
+
- name: Generate strings localizations
run: flutter gen-l10n
working-directory: mobile/packages/strings
diff --git a/.github/workflows/locker-release.yml b/.github/workflows/locker-release.yml
index f3af2718a1..a55df6b485 100644
--- a/.github/workflows/locker-release.yml
+++ b/.github/workflows/locker-release.yml
@@ -10,6 +10,7 @@ on:
env:
FLUTTER_VERSION: "3.32.8"
+ RUST_VERSION: "1.90.0"
permissions:
contents: write
@@ -72,6 +73,11 @@ jobs:
flutter-version: ${{ env.FLUTTER_VERSION }}
cache: true
+ - name: Install Rust ${{ env.RUST_VERSION }}
+ uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8
+ with:
+ toolchain: ${{ env.RUST_VERSION }}
+
- name: Generate strings localizations
run: flutter gen-l10n
working-directory: mobile/packages/strings
@@ -79,6 +85,13 @@ jobs:
- name: Resolve dependencies with lockfile enforcement
run: flutter pub get --enforce-lockfile
+ - name: Install Flutter Rust Bridge
+ run: cargo install flutter_rust_bridge_codegen
+
+ - name: Generate Rust bindings (Core package)
+ run: flutter_rust_bridge_codegen generate
+ working-directory: mobile/packages/rust
+
- name: Setup keys
uses: timheuer/base64-to-file@v1
with:
diff --git a/.github/workflows/mobile-packages-lint.yml b/.github/workflows/mobile-packages-lint.yml
index 734786a9dd..a0796ace23 100644
--- a/.github/workflows/mobile-packages-lint.yml
+++ b/.github/workflows/mobile-packages-lint.yml
@@ -353,7 +353,7 @@ jobs:
cache: true
- name: Install Rust ${{ env.RUST_VERSION }}
- if: needs.detect-changes.outputs.lint_photos == 'true'
+ if: needs.detect-changes.outputs.lint_photos == 'true' || needs.detect-changes.outputs.lint_locker == 'true'
uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ env.RUST_VERSION }}
@@ -369,11 +369,11 @@ jobs:
key: ${{ runner.os }}-cargo-packages-${{ hashFiles('mobile/packages/**/Cargo.lock') }}
- name: Install Flutter Rust Bridge
- if: needs.detect-changes.outputs.lint_photos == 'true'
+ if: needs.detect-changes.outputs.lint_photos == 'true' || needs.detect-changes.outputs.lint_locker == 'true'
run: cargo install flutter_rust_bridge_codegen
- name: Generate Rust bindings (Core package)
- if: needs.detect-changes.outputs.lint_photos == 'true'
+ if: needs.detect-changes.outputs.lint_photos == 'true' || needs.detect-changes.outputs.lint_locker == 'true'
run: flutter_rust_bridge_codegen generate
working-directory: mobile/packages/rust
diff --git a/mobile/apps/locker/ios/Podfile.lock b/mobile/apps/locker/ios/Podfile.lock
index cf7a6f97c6..e6a8b9df14 100644
--- a/mobile/apps/locker/ios/Podfile.lock
+++ b/mobile/apps/locker/ios/Podfile.lock
@@ -37,6 +37,8 @@ PODS:
- DKPhotoGallery/Resource (0.0.19):
- SDWebImage
- SwiftyGif
+ - ente_rust (0.0.1):
+ - Flutter
- file_picker (0.0.1):
- DKImagePickerController/PhotoGallery
- Flutter
@@ -106,6 +108,7 @@ DEPENDENCIES:
- app_links (from `.symlinks/plugins/app_links/ios`)
- cupertino_http (from `.symlinks/plugins/cupertino_http/darwin`)
- device_info_plus (from `.symlinks/plugins/device_info_plus/ios`)
+ - ente_rust (from `.symlinks/plugins/ente_rust/ios`)
- file_picker (from `.symlinks/plugins/file_picker/ios`)
- file_saver (from `.symlinks/plugins/file_saver/ios`)
- Flutter (from `Flutter`)
@@ -146,6 +149,8 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/cupertino_http/darwin"
device_info_plus:
:path: ".symlinks/plugins/device_info_plus/ios"
+ ente_rust:
+ :path: ".symlinks/plugins/ente_rust/ios"
file_picker:
:path: ".symlinks/plugins/file_picker/ios"
file_saver:
@@ -199,6 +204,7 @@ SPEC CHECKSUMS:
device_info_plus: 21fcca2080fbcd348be798aa36c3e5ed849eefbe
DKImagePickerController: 946cec48c7873164274ecc4624d19e3da4c1ef3c
DKPhotoGallery: b3834fecb755ee09a593d7c9e389d8b5d6deed60
+ ente_rust: 9c976e3d083f0ce90f31693deb99629b28d8fe4c
file_picker: a0560bc09d61de87f12d246fc47d2119e6ef37be
file_saver: 6cdbcddd690cb02b0c1a0c225b37cd805c2bf8b6
Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
diff --git a/mobile/apps/locker/lib/app.dart b/mobile/apps/locker/lib/app.dart
index 4efe6d760c..65bbed6bf3 100644
--- a/mobile/apps/locker/lib/app.dart
+++ b/mobile/apps/locker/lib/app.dart
@@ -16,6 +16,7 @@ import 'package:locker/core/locale.dart';
import 'package:locker/l10n/l10n.dart';
import 'package:locker/services/collections/collections_service.dart';
import 'package:locker/services/configuration.dart';
+import 'package:locker/services/contacts_display_service.dart';
import "package:locker/services/update_service.dart";
import 'package:locker/ui/pages/home_page.dart';
import 'package:locker/ui/pages/onboarding_page.dart';
@@ -68,13 +69,19 @@ class _AppState extends State<App>
initTrayManager();
WidgetsBinding.instance.addObserver(this);
+ if (Configuration.instance.hasConfiguredAccount()) {
+ unawaited(LockerContactsDisplayService.ensureReady());
+ }
+
_signedOutEvent = Bus.instance.on<SignedOutEvent>().listen((event) {
+ unawaited(LockerContactsDisplayService.resetLocalState());
if (mounted) {
setState(() {});
}
});
_signedInEvent = Bus.instance.on<SignedInEvent>().listen((event) {
UserService.instance.getUserDetailsV2().ignore();
+ unawaited(LockerContactsDisplayService.ensureReady());
if (mounted) {
setState(() {});
}
diff --git a/mobile/apps/locker/lib/extensions/user_extension.dart b/mobile/apps/locker/lib/extensions/user_extension.dart
index 3c152667df..82245b9e90 100644
--- a/mobile/apps/locker/lib/extensions/user_extension.dart
+++ b/mobile/apps/locker/lib/extensions/user_extension.dart
@@ -1,12 +1 @@
-import "package:ente_sharing/models/user.dart";
-
-extension UserExtension on User {
- //Some initial users have name in name field.
- String? get displayName =>
- // ignore: deprecated_member_use_from_same_package, deprecated_member_use
- ((name?.isEmpty ?? true) ? null : name);
-
- String get nameOrEmail {
- return email.substring(0, email.indexOf("@"));
- }
-}
+export 'package:ente_sharing/extensions/user_extension.dart';
diff --git a/mobile/apps/locker/lib/main.dart b/mobile/apps/locker/lib/main.dart
index dadfc03abc..9043fbfefd 100644
--- a/mobile/apps/locker/lib/main.dart
+++ b/mobile/apps/locker/lib/main.dart
@@ -12,6 +12,7 @@ import 'package:ente_lock_screen/ui/lock_screen.dart';
import 'package:ente_logging/logging.dart';
import 'package:ente_network/network.dart';
import 'package:ente_pure_utils/ente_pure_utils.dart';
+import 'package:ente_rust/ente_rust.dart';
import "package:ente_strings/l10n/strings_localizations.dart";
import "package:ente_ui/theme/ente_theme_data.dart";
import "package:ente_ui/theme/theme_config.dart";
@@ -25,6 +26,7 @@ import 'package:locker/l10n/app_localizations.dart';
import 'package:locker/services/collections/collections_api_client.dart';
import 'package:locker/services/collections/collections_service.dart';
import 'package:locker/services/configuration.dart';
+import 'package:locker/services/contacts_display_service.dart';
import "package:locker/services/db/locker_db.dart";
import 'package:locker/services/favorites_service.dart';
import 'package:locker/services/files/download/service_locator.dart';
@@ -40,6 +42,8 @@ import 'package:tray_manager/tray_manager.dart';
import 'package:window_manager/window_manager.dart';
final _logger = Logger("main");
+bool _isRustInitialized = false;
+Future<void>? _rustInitFuture;
void main() async {
WidgetsFlutterBinding.ensureInitialized();
@@ -105,6 +109,7 @@ Future<void> _runInForeground() async {
return await _runWithLogs(() async {
_logger.info("Starting app in foreground");
try {
+ await _ensureRustInitialized();
await _init(false, via: 'mainMethod');
} catch (e, s) {
_logger.severe("Failed to init", e, s);
@@ -132,6 +137,25 @@ Future<void> _runInForeground() async {
});
}
+Future<void> _ensureRustInitialized() async {
+ if (_isRustInitialized) {
+ return;
+ }
+ final inFlightInit = _rustInitFuture;
+ if (inFlightInit != null) {
+ await inFlightInit;
+ return;
+ }
+ final initFuture = EnteRust.init();
+ _rustInitFuture = initFuture;
+ try {
+ await initFuture;
+ _isRustInitialized = true;
+ } finally {
+ _rustInitFuture = null;
+ }
+}
+
ThemeMode _themeMode(AdaptiveThemeMode? savedThemeMode) {
if (savedThemeMode == null) return ThemeMode.system;
if (savedThemeMode.isLight) return ThemeMode.light;
@@ -193,6 +217,10 @@ Future<void> _init(bool bool, {String? via}) async {
UserService.instance,
Configuration.instance,
);
+ await LockerContactsDisplayService.init(
+ preferences: preferences,
+ packageInfo: packageInfo,
+ );
} catch (e) {
_logger.severe("Error during initialization", e);
}
diff --git a/mobile/apps/locker/lib/services/contacts_display_service.dart b/mobile/apps/locker/lib/services/contacts_display_service.dart
new file mode 100644
index 0000000000..b246d446e0
--- /dev/null
+++ b/mobile/apps/locker/lib/services/contacts_display_service.dart
@@ -0,0 +1,66 @@
+import 'dart:async';
+
+import 'package:ente_contacts/contacts.dart' as contacts;
+import 'package:locker/services/configuration.dart';
+import 'package:logging/logging.dart';
+import 'package:package_info_plus/package_info_plus.dart';
+import 'package:shared_preferences/shared_preferences.dart';
+
+class LockerContactsDisplayService {
+ static final Logger _logger = Logger('LockerContactsDisplayService');
+ static PackageInfo? _packageInfo;
+
+ static Future<void> init({
+ required SharedPreferences preferences,
+ required PackageInfo packageInfo,
+ }) async {
+ contacts.ContactsDisplayService.instance.init(preferences: preferences);
+ _packageInfo = packageInfo;
+ unawaited(_warmup());
+ }
+
+ static Future<void> ensureReady() async {
+ final session = _buildSession();
+ if (session == null) {
+ return;
+ }
+ await contacts.ContactsDisplayService.instance.ensureReady(session);
+ }
+
+ static Future<void> resetLocalState() {
+ return contacts.ContactsDisplayService.instance.resetLocalState();
+ }
+
+ static Future<void> _warmup() async {
+ try {
+ await ensureReady();
+ } catch (error, stackTrace) {
+ _logger.warning(
+ 'Failed to warm shared contacts display cache',
+ error,
+ stackTrace,
+ );
+ }
+ }
+
+ static contacts.ContactsSession? _buildSession() {
+ final packageInfo = _packageInfo;
+ final token = Configuration.instance.getToken();
+ final userId = Configuration.instance.getUserID();
+ final accountKey = Configuration.instance.getKey();
+ if (packageInfo == null ||
+ token == null ||
+ userId == null ||
+ accountKey == null) {
+ return null;
+ }
+ return contacts.ContactsSession(
+ baseUrl: Configuration.instance.getHttpEndpoint(),
+ authToken: token,
+ userId: userId,
+ accountKey: accountKey,
+ clientPackage: packageInfo.packageName,
+ clientVersion: packageInfo.version,
+ );
+ }
+}
diff --git a/mobile/apps/locker/lib/ui/sharing/add_email_bottom_sheet.dart b/mobile/apps/locker/lib/ui/sharing/add_email_bottom_sheet.dart
index 591285d6e3..4146bea207 100644
--- a/mobile/apps/locker/lib/ui/sharing/add_email_bottom_sheet.dart
+++ b/mobile/apps/locker/lib/ui/sharing/add_email_bottom_sheet.dart
@@ -1,5 +1,7 @@
import "package:email_validator/email_validator.dart";
import "package:ente_accounts/services/user_service.dart";
+import 'package:ente_contacts/contacts.dart';
+import "package:ente_sharing/extensions/user_extension.dart";
import "package:ente_sharing/models/user.dart";
import "package:ente_sharing/user_avator_widget.dart";
import "package:ente_sharing/verify_identity_dialog.dart";
@@ -82,28 +84,32 @@ class _AddEmailSheetState extends State<AddEmailSheet> {
@override
Widget build(BuildContext context) {
- final colorScheme = getEnteColorScheme(context);
- final textTheme = getEnteTextTheme(context);
-
- return SingleChildScrollView(
- child: Column(
- mainAxisSize: MainAxisSize.min,
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- _buildEmailInputField(colorScheme, textTheme),
- if (_suggestedUsers.isNotEmpty) ...[
- const SizedBox(height: 20),
- _buildExistingContactsSection(colorScheme, textTheme),
- ],
- // _buildShareLaterCheckbox(colorScheme, textTheme),
- if (_shareLater) ...[
- const SizedBox(height: 12),
- _buildScheduleDateTimeRow(colorScheme, textTheme),
- ],
- const SizedBox(height: 20),
- _buildShareButton(),
- ],
- ),
+ return ValueListenableBuilder<int>(
+ valueListenable: ContactsDisplayService.instance.changes,
+ builder: (context, __, ___) {
+ final colorScheme = getEnteColorScheme(context);
+ final textTheme = getEnteTextTheme(context);
+
+ return SingleChildScrollView(
+ child: Column(
+ mainAxisSize: MainAxisSize.min,
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ _buildEmailInputField(colorScheme, textTheme),
+ if (_suggestedUsers.isNotEmpty) ...[
+ const SizedBox(height: 20),
+ _buildExistingContactsSection(colorScheme, textTheme),
+ ],
+ if (_shareLater) ...[
+ const SizedBox(height: 12),
+ _buildScheduleDateTimeRow(colorScheme, textTheme),
+ ],
+ const SizedBox(height: 20),
+ _buildShareButton(),
+ ],
+ ),
+ );
+ },
);
}
@@ -156,11 +162,14 @@ class _AddEmailSheetState extends State<AddEmailSheet> {
Widget _buildExistingContactsSection(colorScheme, textTheme) {
final filteredUsers = _suggestedUsers
.where(
- (user) => user.email
- .toLowerCase()
- .contains(_textController.text.trim().toLowerCase()),
+ (user) => user.matchesResolvedNameOrEmail(_textController.text),
)
- .toList();
+ .toList()
+ ..sort(
+ (a, b) => a.resolvedDisplayName.toLowerCase().compareTo(
+ b.resolvedDisplayName.toLowerCase(),
+ ),
+ );
if (filteredUsers.isEmpty) {
return const SizedBox.shrink();
@@ -204,7 +213,7 @@ class _AddEmailSheetState extends State<AddEmailSheet> {
),
MenuItemWidgetV2(
captionedTextWidget: CaptionedTextWidgetV2(
- title: user.email,
+ title: user.resolvedDisplayName,
),
leadingIconSize: 24.0,
leadingIconWidget: UserAvatarWidget(
@@ -481,6 +490,11 @@ class _AddEmailSheetState extends State<AddEmailSheet> {
}
suggestedUsers.sort((a, b) => a.email.compareTo(b.email));
+ suggestedUsers.sort(
+ (a, b) => a.resolvedDisplayName.toLowerCase().compareTo(
+ b.resolvedDisplayName.toLowerCase(),
+ ),
+ );
return suggestedUsers;
}
diff --git a/mobile/apps/locker/lib/ui/sharing/add_participant_page.dart b/mobile/apps/locker/lib/ui/sharing/add_participant_page.dart
index 511887e4d4..6fd251848e 100644
--- a/mobile/apps/locker/lib/ui/sharing/add_participant_page.dart
+++ b/mobile/apps/locker/lib/ui/sharing/add_participant_page.dart
@@ -1,4 +1,5 @@
import 'package:email_validator/email_validator.dart';
+import 'package:ente_contacts/contacts.dart';
import "package:ente_sharing/models/user.dart";
import "package:ente_sharing/user_avator_widget.dart";
import "package:ente_sharing/verify_identity_dialog.dart";
@@ -72,168 +73,174 @@ class _AddParticipantPage extends State<AddParticipantPage> {
@override
Widget build(BuildContext context) {
- final filterSuggestedUsers = _suggestedUsers
- .where(
- (element) =>
- (element.displayName ?? element.email).toLowerCase().contains(
- _textController.text.trim().toLowerCase(),
- ),
- )
- .toList();
- isKeypadOpen = MediaQuery.viewInsetsOf(context).bottom > 100;
- final enteTextTheme = getEnteTextTheme(context);
- final enteColorScheme = getEnteColorScheme(context);
- return Scaffold(
- resizeToAvoidBottomInset: isKeypadOpen,
- appBar: AppBar(
- title: Text(
- _getTitle(),
- ),
- ),
- body: Column(
- mainAxisAlignment: MainAxisAlignment.start,
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- const SizedBox(height: 12),
- Padding(
- padding: const EdgeInsets.symmetric(horizontal: 16.0),
- child: Text(
- context.l10n.addANewEmail,
- style: enteTextTheme.small
- .copyWith(color: enteColorScheme.textMuted),
+ return ValueListenableBuilder<int>(
+ valueListenable: ContactsDisplayService.instance.changes,
+ builder: (context, __, ___) {
+ final filterSuggestedUsers = _suggestedUsers
+ .where(
+ (element) =>
+ element.matchesResolvedNameOrEmail(_textController.text),
+ )
+ .toList()
+ ..sort(
+ (a, b) => a.resolvedDisplayName.toLowerCase().compareTo(
+ b.resolvedDisplayName.toLowerCase(),
+ ),
+ );
+ isKeypadOpen = MediaQuery.viewInsetsOf(context).bottom > 100;
+ final enteTextTheme = getEnteTextTheme(context);
+ final enteColorScheme = getEnteColorScheme(context);
+ return Scaffold(
+ resizeToAvoidBottomInset: isKeypadOpen,
+ appBar: AppBar(
+ title: Text(
+ _getTitle(),
),
),
- const SizedBox(height: 4),
- Padding(
- padding: const EdgeInsets.symmetric(horizontal: 16.0),
- child: _enterEmailField(),
- ),
- Expanded(
- child: Padding(
- padding: const EdgeInsets.symmetric(horizontal: 16.0),
- child: Column(
- children: [
- filterSuggestedUsers.isNotEmpty
- ? MenuSectionTitle(
- title: context.l10n.orPickAnExistingOne,
- )
- : const SizedBox.shrink(),
- Expanded(
- child: ListView.builder(
- physics: const BouncingScrollPhysics(),
- itemBuilder: (context, index) {
- if (index >= filterSuggestedUsers.length) {
- return Padding(
- padding: const EdgeInsets.symmetric(
- vertical: 8.0,
- ),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
+ body: Column(
+ mainAxisAlignment: MainAxisAlignment.start,
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ const SizedBox(height: 12),
+ Padding(
+ padding: const EdgeInsets.symmetric(horizontal: 16.0),
+ child: Text(
+ context.l10n.addANewEmail,
+ style: enteTextTheme.small
+ .copyWith(color: enteColorScheme.textMuted),
+ ),
+ ),
+ const SizedBox(height: 4),
+ Padding(
+ padding: const EdgeInsets.symmetric(horizontal: 16.0),
+ child: _enterEmailField(),
+ ),
+ Expanded(
+ child: Padding(
+ padding: const EdgeInsets.symmetric(horizontal: 16.0),
+ child: Column(
+ children: [
+ filterSuggestedUsers.isNotEmpty
+ ? MenuSectionTitle(
+ title: context.l10n.orPickAnExistingOne,
+ )
+ : const SizedBox.shrink(),
+ Expanded(
+ child: ListView.builder(
+ physics: const BouncingScrollPhysics(),
+ itemBuilder: (context, index) {
+ if (index >= filterSuggestedUsers.length) {
+ return Padding(
+ padding: const EdgeInsets.symmetric(
+ vertical: 8.0,
+ ),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ filterSuggestedUsers.isNotEmpty
+ ? MenuSectionDescriptionWidget(
+ content: context.l10n
+ .longPressAnEmailToVerifyEndToEndEncryption,
+ )
+ : const SizedBox.shrink(),
+ widget.actionTypesToShow.contains(
+ ActionTypesToShow.addCollaborator,
+ )
+ ? MenuSectionDescriptionWidget(
+ content: context.l10n
+ .collaboratorsCanAddFilesToTheSharedCollection,
+ )
+ : const SizedBox.shrink(),
+ ],
+ ),
+ );
+ }
+ final currentUser = filterSuggestedUsers[index];
+ return Column(
children: [
- filterSuggestedUsers.isNotEmpty
- ? MenuSectionDescriptionWidget(
- content: context.l10n
- .longPressAnEmailToVerifyEndToEndEncryption,
- )
- : const SizedBox.shrink(),
- widget.actionTypesToShow.contains(
- ActionTypesToShow.addCollaborator,
- )
- ? MenuSectionDescriptionWidget(
- content: context.l10n
- .collaboratorsCanAddFilesToTheSharedCollection,
- )
- : const SizedBox.shrink(),
- ],
- ),
- );
- }
- final currentUser = filterSuggestedUsers[index];
- return Column(
- children: [
- MenuItemWidget(
- key: ValueKey(
- currentUser.displayName ?? currentUser.email,
- ),
- captionedTextWidget: CaptionedTextWidget(
- title: currentUser.displayName ??
- currentUser.email,
- ),
- leadingIconSize: 24.0,
- leadingIconWidget: UserAvatarWidget(
- currentUser,
- type: AvatarType.mini,
- config: Configuration.instance,
- ),
- menuItemColor:
- getEnteColorScheme(context).fillFaint,
- pressedColor:
- getEnteColorScheme(context).fillFaint,
- trailingIcon:
- (_selectedEmails.contains(currentUser.email))
+ MenuItemWidget(
+ key: ValueKey(
+ '${currentUser.id ?? currentUser.email}:${currentUser.resolvedDisplayName}',
+ ),
+ captionedTextWidget: CaptionedTextWidget(
+ title: currentUser.resolvedDisplayName,
+ ),
+ leadingIconSize: 24.0,
+ leadingIconWidget: UserAvatarWidget(
+ currentUser,
+ type: AvatarType.mini,
+ config: Configuration.instance,
+ ),
+ menuItemColor:
+ getEnteColorScheme(context).fillFaint,
+ pressedColor:
+ getEnteColorScheme(context).fillFaint,
+ trailingIcon: (_selectedEmails
+ .contains(currentUser.email))
? Icons.check
: null,
- onTap: () async {
- textFieldFocusNode.unfocus();
- if (_selectedEmails
- .contains(currentUser.email)) {
- _selectedEmails.remove(currentUser.email);
- } else {
- _selectedEmails.add(currentUser.email);
- }
+ onTap: () async {
+ textFieldFocusNode.unfocus();
+ if (_selectedEmails
+ .contains(currentUser.email)) {
+ _selectedEmails.remove(currentUser.email);
+ } else {
+ _selectedEmails.add(currentUser.email);
+ }
- setState(() => {});
- // showShortToast(context, "yet to implement");
- },
- onLongPress: () {
- showVerifyIdentitySheet(
- context,
- self: false,
- email: currentUser.email,
- config: Configuration.instance,
- );
- },
- isTopBorderRadiusRemoved: index > 0,
- isBottomBorderRadiusRemoved:
- index < (filterSuggestedUsers.length - 1),
- ),
- (index == (filterSuggestedUsers.length - 1))
- ? const SizedBox.shrink()
- : DividerWidget(
- dividerType: DividerType.menu,
- bgColor:
- getEnteColorScheme(context).fillFaint,
- ),
- ],
- );
- },
- itemCount: filterSuggestedUsers.length + 1,
- ),
+ setState(() => {});
+ },
+ onLongPress: () {
+ showVerifyIdentitySheet(
+ context,
+ self: false,
+ email: currentUser.email,
+ config: Configuration.instance,
+ );
+ },
+ isTopBorderRadiusRemoved: index > 0,
+ isBottomBorderRadiusRemoved:
+ index < (filterSuggestedUsers.length - 1),
+ ),
+ (index == (filterSuggestedUsers.length - 1))
+ ? const SizedBox.shrink()
+ : DividerWidget(
+ dividerType: DividerType.menu,
+ bgColor: getEnteColorScheme(context)
+ .fillFaint,
+ ),
+ ],
+ );
+ },
+ itemCount: filterSuggestedUsers.length + 1,
+ ),
+ ),
+ ],
),
- ],
- ),
- ),
- ),
- SafeArea(
- child: Padding(
- padding: const EdgeInsets.only(
- top: 8,
- bottom: 8,
- left: 16,
- right: 16,
+ ),
),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.center,
- children: [
- const SizedBox(height: 8),
- ..._actionButtons(),
- const SizedBox(height: 12),
- ],
+ SafeArea(
+ child: Padding(
+ padding: const EdgeInsets.only(
+ top: 8,
+ bottom: 8,
+ left: 16,
+ right: 16,
+ ),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.center,
+ children: [
+ const SizedBox(height: 8),
+ ..._actionButtons(),
+ const SizedBox(height: 12),
+ ],
+ ),
+ ),
),
- ),
+ ],
),
- ],
- ),
+ );
+ },
);
}
@@ -441,14 +448,11 @@ class _AddParticipantPage extends State<AddParticipantPage> {
final List<User> suggestedUsers =
CollectionService.instance.getRelevantContacts();
- if (_textController.text.trim().isNotEmpty) {
- suggestedUsers.removeWhere(
- (element) => !(element.displayName ?? element.email)
- .toLowerCase()
- .contains(_textController.text.trim().toLowerCase()),
- );
- }
- suggestedUsers.sort((a, b) => a.email.compareTo(b.email));
+ suggestedUsers.sort(
+ (a, b) => a.resolvedDisplayName.toLowerCase().compareTo(
+ b.resolvedDisplayName.toLowerCase(),
+ ),
+ );
return suggestedUsers;
}
diff --git a/mobile/apps/locker/lib/ui/sharing/album_participants_page.dart b/mobile/apps/locker/lib/ui/sharing/album_participants_page.dart
index 8e5e4fdf91..6670e8287f 100644
--- a/mobile/apps/locker/lib/ui/sharing/album_participants_page.dart
+++ b/mobile/apps/locker/lib/ui/sharing/album_participants_page.dart
@@ -1,3 +1,4 @@
+import 'package:ente_contacts/contacts.dart';
import 'package:ente_pure_utils/ente_pure_utils.dart';
import "package:ente_sharing/models/user.dart";
import "package:ente_sharing/user_avator_widget.dart";
@@ -68,244 +69,261 @@ class _AlbumParticipantsPageState extends State<AlbumParticipantsPage> {
@override
Widget build(BuildContext context) {
- final isOwner =
- widget.collection.owner.id == Configuration.instance.getUserID();
- final colorScheme = getEnteColorScheme(context);
- final currentUserID = Configuration.instance.getUserID()!;
- final int participants = 1 + widget.collection.getSharees().length;
- final User owner = widget.collection.owner;
- if (owner.id == currentUserID && owner.email == "") {
- owner.email = Configuration.instance.getEmail()!;
- }
- final splitResult =
- widget.collection.getSharees().splitMatch((x) => x.isViewer);
- final List<User> viewers = splitResult.matched;
- viewers.sort((a, b) => a.email.compareTo(b.email));
- final List<User> collaborators = splitResult.unmatched;
- collaborators.sort((a, b) => a.email.compareTo(b.email));
+ return ValueListenableBuilder<int>(
+ valueListenable: ContactsDisplayService.instance.changes,
+ builder: (context, __, ___) {
+ final isOwner =
+ widget.collection.owner.id == Configuration.instance.getUserID();
+ final colorScheme = getEnteColorScheme(context);
+ final currentUserID = Configuration.instance.getUserID()!;
+ final int participants = 1 + widget.collection.getSharees().length;
+ final User owner = widget.collection.owner;
+ if (owner.id == currentUserID && owner.email == "") {
+ owner.email = Configuration.instance.getEmail()!;
+ }
+ final splitResult =
+ widget.collection.getSharees().splitMatch((x) => x.isViewer);
+ final List<User> viewers = splitResult.matched;
+ viewers.sort(
+ (a, b) => a.resolvedDisplayName.toLowerCase().compareTo(
+ b.resolvedDisplayName.toLowerCase(),
+ ),
+ );
+ final List<User> collaborators = splitResult.unmatched;
+ collaborators.sort(
+ (a, b) => a.resolvedDisplayName.toLowerCase().compareTo(
+ b.resolvedDisplayName.toLowerCase(),
+ ),
+ );
- return Scaffold(
- body: CustomScrollView(
- primary: false,
- slivers: <Widget>[
- TitleBarWidget(
- flexibleSpaceTitle: TitleBarTitleWidget(
- title: widget.collection.displayName,
- ),
- flexibleSpaceCaption:
- context.l10n.albumParticipantsCount(participants),
- ),
- SliverList(
- delegate: SliverChildBuilderDelegate(
- (context, index) {
- return Padding(
- padding: const EdgeInsets.only(top: 20, left: 16, right: 16),
- child: Column(
- children: [
- Column(
+ return Scaffold(
+ body: CustomScrollView(
+ primary: false,
+ slivers: <Widget>[
+ TitleBarWidget(
+ flexibleSpaceTitle: TitleBarTitleWidget(
+ title: widget.collection.displayName,
+ ),
+ flexibleSpaceCaption:
+ context.l10n.albumParticipantsCount(participants),
+ ),
+ SliverList(
+ delegate: SliverChildBuilderDelegate(
+ (context, index) {
+ return Padding(
+ padding:
+ const EdgeInsets.only(top: 20, left: 16, right: 16),
+ child: Column(
children: [
- MenuSectionTitle(
- title: context.l10n.albumOwner,
- iconData: Icons.admin_panel_settings_outlined,
- ),
- MenuItemWidget(
- captionedTextWidget: CaptionedTextWidget(
- title: isOwner
- ? context.l10n.you
- : _nameIfAvailableElseEmail(
- widget.collection.owner,
- ),
- makeTextBold: isOwner,
- ),
- leadingIconWidget: UserAvatarWidget(
- owner,
- currentUserID: currentUserID,
- config: Configuration.instance,
- ),
- leadingIconSize: 24,
- menuItemColor: colorScheme.fillFaint,
- singleBorderRadius: 8,
- isGestureDetectorDisabled: true,
+ Column(
+ children: [
+ MenuSectionTitle(
+ title: context.l10n.albumOwner,
+ iconData: Icons.admin_panel_settings_outlined,
+ ),
+ MenuItemWidget(
+ captionedTextWidget: CaptionedTextWidget(
+ title: isOwner
+ ? context.l10n.you
+ : _resolvedNameOrEmail(
+ widget.collection.owner,
+ ),
+ makeTextBold: isOwner,
+ ),
+ leadingIconWidget: UserAvatarWidget(
+ owner,
+ currentUserID: currentUserID,
+ config: Configuration.instance,
+ ),
+ leadingIconSize: 24,
+ menuItemColor: colorScheme.fillFaint,
+ singleBorderRadius: 8,
+ isGestureDetectorDisabled: true,
+ ),
+ ],
),
],
),
- ],
- ),
- );
- },
- childCount: 1,
- ),
- ),
- SliverPadding(
- padding: const EdgeInsets.only(top: 20, left: 16, right: 16),
- sliver: SliverList(
- delegate: SliverChildBuilderDelegate(
- (context, index) {
- if (index == 0 && (isOwner || collaborators.isNotEmpty)) {
- return MenuSectionTitle(
- title: context.l10n.collaborator,
- iconData: Icons.edit_outlined,
);
- } else if (index > 0 && index <= collaborators.length) {
- final listIndex = index - 1;
- final currentUser = collaborators[listIndex];
- final isSameAsLoggedInUser =
- currentUserID == currentUser.id;
- final isLastItem =
- !isOwner && index == collaborators.length;
- return Column(
- children: [
- MenuItemWidget(
+ },
+ childCount: 1,
+ ),
+ ),
+ SliverPadding(
+ padding: const EdgeInsets.only(top: 20, left: 16, right: 16),
+ sliver: SliverList(
+ delegate: SliverChildBuilderDelegate(
+ (context, index) {
+ if (index == 0 && (isOwner || collaborators.isNotEmpty)) {
+ return MenuSectionTitle(
+ title: context.l10n.collaborator,
+ iconData: Icons.edit_outlined,
+ );
+ } else if (index > 0 && index <= collaborators.length) {
+ final listIndex = index - 1;
+ final currentUser = collaborators[listIndex];
+ final isSameAsLoggedInUser =
+ currentUserID == currentUser.id;
+ final isLastItem =
+ !isOwner && index == collaborators.length;
+ return Column(
+ children: [
+ MenuItemWidget(
+ captionedTextWidget: CaptionedTextWidget(
+ title: isSameAsLoggedInUser
+ ? context.l10n.you
+ : _resolvedNameOrEmail(currentUser),
+ makeTextBold: isSameAsLoggedInUser,
+ ),
+ leadingIconSize: 24.0,
+ leadingIconWidget: UserAvatarWidget(
+ currentUser,
+ type: AvatarType.mini,
+ currentUserID: currentUserID,
+ config: Configuration.instance,
+ ),
+ menuItemColor:
+ getEnteColorScheme(context).fillFaint,
+ trailingIcon:
+ isOwner ? Icons.chevron_right : null,
+ trailingIconIsMuted: true,
+ onTap: isOwner
+ ? () async {
+ if (isOwner) {
+ // ignore: unawaited_futures
+ _navigateToManageUser(currentUser);
+ }
+ }
+ : null,
+ isTopBorderRadiusRemoved: listIndex > 0,
+ isBottomBorderRadiusRemoved: !isLastItem,
+ singleBorderRadius: 8,
+ ),
+ isLastItem
+ ? const SizedBox.shrink()
+ : DividerWidget(
+ dividerType: DividerType.menu,
+ bgColor:
+ getEnteColorScheme(context).fillFaint,
+ ),
+ ],
+ );
+ } else if (index == (1 + collaborators.length) &&
+ isOwner) {
+ return MenuItemWidget(
captionedTextWidget: CaptionedTextWidget(
- title: isSameAsLoggedInUser
- ? context.l10n.you
- : _nameIfAvailableElseEmail(currentUser),
- makeTextBold: isSameAsLoggedInUser,
- ),
- leadingIconSize: 24.0,
- leadingIconWidget: UserAvatarWidget(
- currentUser,
- type: AvatarType.mini,
- currentUserID: currentUserID,
- config: Configuration.instance,
+ title: collaborators.isNotEmpty
+ ? context.l10n.addMore
+ : context.l10n.addCollaborator,
+ makeTextBold: true,
),
+ leadingIcon: Icons.add_outlined,
menuItemColor: getEnteColorScheme(context).fillFaint,
- trailingIcon: isOwner ? Icons.chevron_right : null,
- trailingIconIsMuted: true,
- onTap: isOwner
- ? () async {
- if (isOwner) {
- // ignore: unawaited_futures
- _navigateToManageUser(currentUser);
- }
- }
- : null,
- isTopBorderRadiusRemoved: listIndex > 0,
- isBottomBorderRadiusRemoved: !isLastItem,
+ onTap: () async {
+ // ignore: unawaited_futures
+ _navigateToAddUser(false);
+ },
+ isTopBorderRadiusRemoved: collaborators.isNotEmpty,
singleBorderRadius: 8,
- ),
- isLastItem
- ? const SizedBox.shrink()
- : DividerWidget(
- dividerType: DividerType.menu,
- bgColor: getEnteColorScheme(context).fillFaint,
- ),
- ],
- );
- } else if (index == (1 + collaborators.length) && isOwner) {
- return MenuItemWidget(
- captionedTextWidget: CaptionedTextWidget(
- title: collaborators.isNotEmpty
- ? context.l10n.addMore
- : context.l10n.addCollaborator,
- makeTextBold: true,
- ),
- leadingIcon: Icons.add_outlined,
- menuItemColor: getEnteColorScheme(context).fillFaint,
- onTap: () async {
- // ignore: unawaited_futures
- _navigateToAddUser(false);
- },
- isTopBorderRadiusRemoved: collaborators.isNotEmpty,
- singleBorderRadius: 8,
- );
- }
- return const SizedBox.shrink();
- },
- childCount: 1 + collaborators.length + 1,
+ );
+ }
+ return const SizedBox.shrink();
+ },
+ childCount: 1 + collaborators.length + 1,
+ ),
+ ),
),
- ),
- ),
- SliverPadding(
- padding: const EdgeInsets.only(top: 24, left: 16, right: 16),
- sliver: SliverList(
- delegate: SliverChildBuilderDelegate(
- (context, index) {
- if (index == 0 && (isOwner || viewers.isNotEmpty)) {
- return MenuSectionTitle(
- title: context.l10n.viewer,
- iconData: Icons.photo_outlined,
- );
- } else if (index > 0 && index <= viewers.length) {
- final listIndex = index - 1;
- final currentUser = viewers[listIndex];
- final isSameAsLoggedInUser =
- currentUserID == currentUser.id;
- final isLastItem = !isOwner && index == viewers.length;
- return Column(
- children: [
- MenuItemWidget(
+ SliverPadding(
+ padding: const EdgeInsets.only(top: 24, left: 16, right: 16),
+ sliver: SliverList(
+ delegate: SliverChildBuilderDelegate(
+ (context, index) {
+ if (index == 0 && (isOwner || viewers.isNotEmpty)) {
+ return MenuSectionTitle(
+ title: context.l10n.viewer,
+ iconData: Icons.photo_outlined,
+ );
+ } else if (index > 0 && index <= viewers.length) {
+ final listIndex = index - 1;
+ final currentUser = viewers[listIndex];
+ final isSameAsLoggedInUser =
+ currentUserID == currentUser.id;
+ final isLastItem = !isOwner && index == viewers.length;
+ return Column(
+ children: [
+ MenuItemWidget(
+ captionedTextWidget: CaptionedTextWidget(
+ title: isSameAsLoggedInUser
+ ? context.l10n.you
+ : _resolvedNameOrEmail(currentUser),
+ makeTextBold: isSameAsLoggedInUser,
+ ),
+ leadingIconSize: 24.0,
+ leadingIconWidget: UserAvatarWidget(
+ currentUser,
+ type: AvatarType.mini,
+ currentUserID: currentUserID,
+ config: Configuration.instance,
+ ),
+ menuItemColor:
+ getEnteColorScheme(context).fillFaint,
+ trailingIcon:
+ isOwner ? Icons.chevron_right : null,
+ trailingIconIsMuted: true,
+ onTap: isOwner
+ ? () async {
+ if (isOwner) {
+ // ignore: unawaited_futures
+ _navigateToManageUser(currentUser);
+ }
+ }
+ : null,
+ isTopBorderRadiusRemoved: listIndex > 0,
+ isBottomBorderRadiusRemoved: !isLastItem,
+ singleBorderRadius: 8,
+ ),
+ isLastItem
+ ? const SizedBox.shrink()
+ : DividerWidget(
+ dividerType: DividerType.menu,
+ bgColor:
+ getEnteColorScheme(context).fillFaint,
+ ),
+ ],
+ );
+ } else if (index == (1 + viewers.length) && isOwner) {
+ return MenuItemWidget(
captionedTextWidget: CaptionedTextWidget(
- title: isSameAsLoggedInUser
- ? context.l10n.you
- : _nameIfAvailableElseEmail(currentUser),
- makeTextBold: isSameAsLoggedInUser,
- ),
- leadingIconSize: 24.0,
- leadingIconWidget: UserAvatarWidget(
- currentUser,
- type: AvatarType.mini,
- currentUserID: currentUserID,
- config: Configuration.instance,
+ title: viewers.isNotEmpty
+ ? context.l10n.addMore
+ : context.l10n.addViewer,
+ makeTextBold: true,
),
+ leadingIcon: Icons.add_outlined,
menuItemColor: getEnteColorScheme(context).fillFaint,
- trailingIcon: isOwner ? Icons.chevron_right : null,
- trailingIconIsMuted: true,
- onTap: isOwner
- ? () async {
- if (isOwner) {
- // ignore: unawaited_futures
- _navigateToManageUser(currentUser);
- }
- }
- : null,
- isTopBorderRadiusRemoved: listIndex > 0,
- isBottomBorderRadiusRemoved: !isLastItem,
+ onTap: () async {
+ // ignore: unawaited_futures
+ _navigateToAddUser(true);
+ },
+ isTopBorderRadiusRemoved: viewers.isNotEmpty,
singleBorderRadius: 8,
- ),
- isLastItem
- ? const SizedBox.shrink()
- : DividerWidget(
- dividerType: DividerType.menu,
- bgColor: getEnteColorScheme(context).fillFaint,
- ),
- ],
- );
- } else if (index == (1 + viewers.length) && isOwner) {
- return MenuItemWidget(
- captionedTextWidget: CaptionedTextWidget(
- title: viewers.isNotEmpty
- ? context.l10n.addMore
- : context.l10n.addViewer,
- makeTextBold: true,
- ),
- leadingIcon: Icons.add_outlined,
- menuItemColor: getEnteColorScheme(context).fillFaint,
- onTap: () async {
- // ignore: unawaited_futures
- _navigateToAddUser(true);
- },
- isTopBorderRadiusRemoved: viewers.isNotEmpty,
- singleBorderRadius: 8,
- );
- }
- return const SizedBox.shrink();
- },
- childCount: 1 + viewers.length + 1,
+ );
+ }
+ return const SizedBox.shrink();
+ },
+ childCount: 1 + viewers.length + 1,
+ ),
+ ),
),
- ),
+ const SliverToBoxAdapter(child: SizedBox(height: 72)),
+ ],
),
- const SliverToBoxAdapter(child: SizedBox(height: 72)),
- ],
- ),
+ );
+ },
);
}
- String _nameIfAvailableElseEmail(User user) {
- final name = user.displayName;
- if (name != null && name.isNotEmpty) {
- return name;
- }
- return user.email;
+ String _resolvedNameOrEmail(User user) {
+ return user.resolvedDisplayName;
}
}
diff --git a/mobile/apps/locker/lib/ui/sharing/manage_album_participant.dart b/mobile/apps/locker/lib/ui/sharing/manage_album_participant.dart
index 11fb21b367..f3176e1593 100644
--- a/mobile/apps/locker/lib/ui/sharing/manage_album_participant.dart
+++ b/mobile/apps/locker/lib/ui/sharing/manage_album_participant.dart
@@ -1,3 +1,4 @@
+import 'package:ente_contacts/contacts.dart';
import "package:ente_sharing/models/user.dart";
import "package:ente_ui/components/buttons/button_widget.dart";
import "package:ente_ui/components/captioned_text_widget.dart";
@@ -41,148 +42,154 @@ class _ManageIndividualParticipantState
@override
Widget build(BuildContext context) {
- final colorScheme = getEnteColorScheme(context);
- final textTheme = getEnteTextTheme(context);
- bool isConvertToViewSuccess = false;
- return Scaffold(
- appBar: AppBar(),
- body: Padding(
- padding: const EdgeInsets.symmetric(horizontal: 16.0),
- child: Column(
- mainAxisAlignment: MainAxisAlignment.start,
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- SafeArea(
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- const SizedBox(
- height: 12,
+ return ValueListenableBuilder<int>(
+ valueListenable: ContactsDisplayService.instance.changes,
+ builder: (context, __, ___) {
+ final colorScheme = getEnteColorScheme(context);
+ final textTheme = getEnteTextTheme(context);
+ bool isConvertToViewSuccess = false;
+ return Scaffold(
+ appBar: AppBar(),
+ body: Padding(
+ padding: const EdgeInsets.symmetric(horizontal: 16.0),
+ child: Column(
+ mainAxisAlignment: MainAxisAlignment.start,
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ SafeArea(
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ const SizedBox(
+ height: 12,
+ ),
+ TitleBarTitleWidget(
+ title: context.l10n.manage,
+ ),
+ Text(
+ widget.user.resolvedDisplayName,
+ textAlign: TextAlign.left,
+ style: textTheme.small
+ .copyWith(color: colorScheme.textMuted),
+ ),
+ ],
),
- TitleBarTitleWidget(
- title: context.l10n.manage,
+ ),
+ const SizedBox(height: 12),
+ MenuSectionTitle(title: context.l10n.addedAs),
+ MenuItemWidget(
+ captionedTextWidget: CaptionedTextWidget(
+ title: context.l10n.collaborator,
),
- Text(
- widget.user.email,
- textAlign: TextAlign.left,
- style:
- textTheme.small.copyWith(color: colorScheme.textMuted),
- ),
- ],
- ),
- ),
- const SizedBox(height: 12),
- MenuSectionTitle(title: context.l10n.addedAs),
- MenuItemWidget(
- captionedTextWidget: CaptionedTextWidget(
- title: context.l10n.collaborator,
- ),
- leadingIcon: Icons.edit_outlined,
- menuItemColor: getEnteColorScheme(context).fillFaint,
- trailingIcon: widget.user.isCollaborator ? Icons.check : null,
- onTap: widget.user.isCollaborator
- ? null
- : () async {
- final result =
- await collectionActions.addEmailToCollection(
- context,
- widget.collection,
- widget.user.email,
- CollectionParticipantRole.collaborator,
- );
- if (result && mounted) {
- widget.user.role = CollectionParticipantRole
- .collaborator
- .toStringVal();
- setState(() => {});
- }
- },
- isBottomBorderRadiusRemoved: true,
- ),
- DividerWidget(
- dividerType: DividerType.menu,
- bgColor: getEnteColorScheme(context).fillFaint,
- ),
- MenuItemWidget(
- captionedTextWidget: CaptionedTextWidget(
- title: context.l10n.viewer,
- ),
- leadingIcon: Icons.photo_outlined,
- leadingIconColor: getEnteColorScheme(context).strokeBase,
- menuItemColor: getEnteColorScheme(context).fillFaint,
- trailingIcon: widget.user.isViewer ? Icons.check : null,
- showOnlyLoadingState: true,
- onTap: widget.user.isViewer
- ? null
- : () async {
- final actionResult = await showChoiceActionSheet(
- context,
- title: context.l10n.changePermissions,
- firstButtonLabel: context.l10n.yesConvertToViewer,
- body:
- context.l10n.cannotAddMoreFilesAfterBecomingViewer(
- widget.user.displayName ?? widget.user.email,
- ),
- isCritical: true,
- );
- if (actionResult?.action != null) {
- if (actionResult!.action == ButtonAction.first) {
- try {
- isConvertToViewSuccess =
- await collectionActions.addEmailToCollection(
- context,
- widget.collection,
- widget.user.email,
- CollectionParticipantRole.viewer,
- );
- } catch (e) {
- await showGenericErrorDialog(
- context: context,
- error: e,
- );
- }
- if (isConvertToViewSuccess && mounted) {
- // reset value
- isConvertToViewSuccess = false;
- widget.user.role =
- CollectionParticipantRole.viewer.toStringVal();
+ leadingIcon: Icons.edit_outlined,
+ menuItemColor: getEnteColorScheme(context).fillFaint,
+ trailingIcon: widget.user.isCollaborator ? Icons.check : null,
+ onTap: widget.user.isCollaborator
+ ? null
+ : () async {
+ final result =
+ await collectionActions.addEmailToCollection(
+ context,
+ widget.collection,
+ widget.user.email,
+ CollectionParticipantRole.collaborator,
+ );
+ if (result && mounted) {
+ widget.user.role = CollectionParticipantRole
+ .collaborator
+ .toStringVal();
setState(() => {});
}
- }
- }
- },
- isTopBorderRadiusRemoved: true,
- ),
- MenuSectionDescriptionWidget(
- content: context.l10n.collaboratorsCanAddFilesToTheSharedAlbum,
- ),
- const SizedBox(height: 24),
- MenuSectionTitle(title: context.l10n.removeParticipant),
- MenuItemWidget(
- captionedTextWidget: CaptionedTextWidget(
- title: context.l10n.remove,
- textColor: warning500,
- makeTextBold: true,
- ),
- leadingIcon: Icons.not_interested_outlined,
- leadingIconColor: warning500,
- menuItemColor: getEnteColorScheme(context).fillFaint,
- surfaceExecutionStates: false,
- onTap: () async {
- final result = await collectionActions.removeParticipant(
- context,
- widget.collection,
- widget.user,
- );
+ },
+ isBottomBorderRadiusRemoved: true,
+ ),
+ DividerWidget(
+ dividerType: DividerType.menu,
+ bgColor: getEnteColorScheme(context).fillFaint,
+ ),
+ MenuItemWidget(
+ captionedTextWidget: CaptionedTextWidget(
+ title: context.l10n.viewer,
+ ),
+ leadingIcon: Icons.photo_outlined,
+ leadingIconColor: getEnteColorScheme(context).strokeBase,
+ menuItemColor: getEnteColorScheme(context).fillFaint,
+ trailingIcon: widget.user.isViewer ? Icons.check : null,
+ showOnlyLoadingState: true,
+ onTap: widget.user.isViewer
+ ? null
+ : () async {
+ final actionResult = await showChoiceActionSheet(
+ context,
+ title: context.l10n.changePermissions,
+ firstButtonLabel: context.l10n.yesConvertToViewer,
+ body: context.l10n
+ .cannotAddMoreFilesAfterBecomingViewer(
+ widget.user.resolvedDisplayName,
+ ),
+ isCritical: true,
+ );
+ if (actionResult?.action != null) {
+ if (actionResult!.action == ButtonAction.first) {
+ try {
+ isConvertToViewSuccess = await collectionActions
+ .addEmailToCollection(
+ context,
+ widget.collection,
+ widget.user.email,
+ CollectionParticipantRole.viewer,
+ );
+ } catch (e) {
+ await showGenericErrorDialog(
+ context: context,
+ error: e,
+ );
+ }
+ if (isConvertToViewSuccess && mounted) {
+ isConvertToViewSuccess = false;
+ widget.user.role = CollectionParticipantRole
+ .viewer
+ .toStringVal();
+ setState(() => {});
+ }
+ }
+ }
+ },
+ isTopBorderRadiusRemoved: true,
+ ),
+ MenuSectionDescriptionWidget(
+ content:
+ context.l10n.collaboratorsCanAddFilesToTheSharedAlbum,
+ ),
+ const SizedBox(height: 24),
+ MenuSectionTitle(title: context.l10n.removeParticipant),
+ MenuItemWidget(
+ captionedTextWidget: CaptionedTextWidget(
+ title: context.l10n.remove,
+ textColor: warning500,
+ makeTextBold: true,
+ ),
+ leadingIcon: Icons.not_interested_outlined,
+ leadingIconColor: warning500,
+ menuItemColor: getEnteColorScheme(context).fillFaint,
+ surfaceExecutionStates: false,
+ onTap: () async {
+ final result = await collectionActions.removeParticipant(
+ context,
+ widget.collection,
+ widget.user,
+ );
- if ((result) && mounted) {
- Navigator.of(context).pop(true);
- }
- },
+ if ((result) && mounted) {
+ Navigator.of(context).pop(true);
+ }
+ },
+ ),
+ ],
),
- ],
- ),
- ),
+ ),
+ );
+ },
);
}
}
diff --git a/mobile/apps/locker/lib/ui/sharing/share_collection_bottom_sheet.dart b/mobile/apps/locker/lib/ui/sharing/share_collection_bottom_sheet.dart
index 13ec779ae0..bc3b1f4e44 100644
--- a/mobile/apps/locker/lib/ui/sharing/share_collection_bottom_sheet.dart
+++ b/mobile/apps/locker/lib/ui/sharing/share_collection_bottom_sheet.dart
@@ -1,3 +1,4 @@
+import 'package:ente_contacts/contacts.dart';
import "package:ente_sharing/models/user.dart";
import "package:ente_sharing/user_avator_widget.dart";
import "package:ente_ui/components/alert_bottom_sheet.dart";
@@ -66,35 +67,40 @@ class _ShareCollectionSheetState extends State<ShareCollectionSheet> {
@override
Widget build(BuildContext context) {
- final colorScheme = getEnteColorScheme(context);
- final textTheme = getEnteTextTheme(context);
-
- return Column(
- mainAxisSize: MainAxisSize.min,
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- _buildShareesList(colorScheme, textTheme),
- if (_isOwner) ...[
- const SizedBox(height: 20),
- SizedBox(
- width: double.infinity,
- child: GradientButton(
- text: context.l10n.addEmail,
- onTap: () async {
- await showAddEmailSheet(
- context,
- collection: widget.collection,
- onShareAdded: () {
- if (mounted) {
- setState(() {});
- }
+ return ValueListenableBuilder<int>(
+ valueListenable: ContactsDisplayService.instance.changes,
+ builder: (context, __, ___) {
+ final colorScheme = getEnteColorScheme(context);
+ final textTheme = getEnteTextTheme(context);
+
+ return Column(
+ mainAxisSize: MainAxisSize.min,
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ _buildShareesList(colorScheme, textTheme),
+ if (_isOwner) ...[
+ const SizedBox(height: 20),
+ SizedBox(
+ width: double.infinity,
+ child: GradientButton(
+ text: context.l10n.addEmail,
+ onTap: () async {
+ await showAddEmailSheet(
+ context,
+ collection: widget.collection,
+ onShareAdded: () {
+ if (mounted) {
+ setState(() {});
+ }
+ },
+ );
},
- );
- },
- ),
- ),
- ],
- ],
+ ),
+ ),
+ ],
+ ],
+ );
+ },
);
}
@@ -150,7 +156,7 @@ class _ShareCollectionSheetState extends State<ShareCollectionSheet> {
),
MenuItemWidgetV2(
captionedTextWidget: CaptionedTextWidgetV2(
- title: user.email,
+ title: user.resolvedDisplayName,
),
leadingIconSize: 24,
leadingIconWidget: UserAvatarWidget(
@@ -353,7 +359,7 @@ class _ShareCollectionSheetState extends State<ShareCollectionSheet> {
context,
title: context.l10n.changePermissions,
message: context.l10n.cannotAddMoreFilesAfterBecomingViewer(
- user.displayName ?? user.email,
+ user.resolvedDisplayName,
),
buttons: [
SizedBox(
@@ -393,7 +399,7 @@ class _ShareCollectionSheetState extends State<ShareCollectionSheet> {
context,
title: context.l10n.removeWithQuestionMark,
message: context.l10n.removeParticipantBody(
- user.displayName ?? user.email,
+ user.resolvedDisplayName,
),
assetPath: "assets/warning-grey.png",
buttons: [
diff --git a/mobile/apps/locker/lib/ui/sharing/share_collection_page.dart b/mobile/apps/locker/lib/ui/sharing/share_collection_page.dart
index 4a2210382a..46aeba89ee 100644
--- a/mobile/apps/locker/lib/ui/sharing/share_collection_page.dart
+++ b/mobile/apps/locker/lib/ui/sharing/share_collection_page.dart
@@ -1,3 +1,4 @@
+import 'package:ente_contacts/contacts.dart';
import 'package:ente_pure_utils/ente_pure_utils.dart';
import "package:ente_sharing/models/user.dart";
import "package:ente_sharing/user_avator_widget.dart";
@@ -338,8 +339,11 @@ class EmailItemWidget extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.start,
children: [
MenuItemWidget(
- captionedTextWidget: CaptionedTextWidget(
- title: user?.displayName ?? user?.email ?? '',
+ captionedTextWidget: ValueListenableBuilder<int>(
+ valueListenable: ContactsDisplayService.instance.changes,
+ builder: (context, __, ___) => CaptionedTextWidget(
+ title: user?.resolvedDisplayName ?? '',
+ ),
),
leadingIconWidget: UserAvatarWidget(
collection.getSharees().first,
diff --git a/mobile/apps/locker/linux/flutter/generated_plugins.cmake b/mobile/apps/locker/linux/flutter/generated_plugins.cmake
index a193fb26ff..9c70bf7e7d 100644
--- a/mobile/apps/locker/linux/flutter/generated_plugins.cmake
+++ b/mobile/apps/locker/linux/flutter/generated_plugins.cmake
@@ -17,6 +17,7 @@ list(APPEND FLUTTER_PLUGIN_LIST
)
list(APPEND FLUTTER_FFI_PLUGIN_LIST
+ ente_rust
jni
)
diff --git a/mobile/apps/locker/pubspec.lock b/mobile/apps/locker/pubspec.lock
index 0e3d9601bc..53e2234108 100644
--- a/mobile/apps/locker/pubspec.lock
+++ b/mobile/apps/locker/pubspec.lock
@@ -89,6 +89,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.1.2"
+ build_cli_annotations:
+ dependency: transitive
+ description:
+ name: build_cli_annotations
+ sha256: e563c2e01de8974566a1998410d3f6f03521788160a02503b0b1f1a46c7b3d95
+ url: "https://pub.dev"
+ source: hosted
+ version: "2.1.1"
characters:
dependency: transitive
description:
@@ -262,6 +270,13 @@ packages:
relative: true
source: path
version: "1.0.0"
+ ente_contacts:
+ dependency: "direct main"
+ description:
+ path: "../../packages/contacts"
+ relative: true
+ source: path
+ version: "1.0.0"
ente_crypto_api:
dependency: "direct main"
description:
@@ -334,6 +349,13 @@ packages:
relative: true
source: path
version: "1.0.0"
+ ente_rust:
+ dependency: "direct main"
+ description:
+ path: "../../packages/rust"
+ relative: true
+ source: path
+ version: "0.0.1"
ente_sharing:
dependency: "direct main"
description:
@@ -573,6 +595,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.0.31"
+ flutter_rust_bridge:
+ dependency: transitive
+ description:
+ name: flutter_rust_bridge
+ sha256: e87d6b9ee934dcd24a128ccb2bd91905d2d5fe5c06245d6a8f5477d4907a437a
+ url: "https://pub.dev"
+ source: hosted
+ version: "2.12.0"
flutter_secure_storage:
dependency: transitive
description:
@@ -1332,6 +1362,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.5.6"
+ sqflite_common_ffi:
+ dependency: transitive
+ description:
+ name: sqflite_common_ffi
+ sha256: "9faa2fedc5385ef238ce772589f7718c24cdddd27419b609bb9c6f703ea27988"
+ url: "https://pub.dev"
+ source: hosted
+ version: "2.3.6"
sqflite_darwin:
dependency: transitive
description:
@@ -1348,6 +1386,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.4.0"
+ sqlite3:
+ dependency: transitive
+ description:
+ name: sqlite3
+ sha256: "3145bd74dcdb4fd6f5c6dda4d4e4490a8087d7f286a14dee5d37087290f0f8a2"
+ url: "https://pub.dev"
+ source: hosted
+ version: "2.9.4"
stack_trace:
dependency: transitive
description:
diff --git a/mobile/apps/locker/pubspec.yaml b/mobile/apps/locker/pubspec.yaml
index dadbdf9739..ad2a2fa305 100644
--- a/mobile/apps/locker/pubspec.yaml
+++ b/mobile/apps/locker/pubspec.yaml
@@ -22,6 +22,8 @@ dependencies:
path: ../../packages/base
ente_configuration:
path: ../../packages/configuration
+ ente_contacts:
+ path: ../../packages/contacts
ente_crypto_api:
path: ../../packages/ente_crypto_api
ente_crypto_dart_adapter:
@@ -40,6 +42,8 @@ dependencies:
path: ../../packages/network
ente_pure_utils:
path: ../../packages/ente_pure_utils
+ ente_rust:
+ path: ../../packages/rust
ente_sharing:
path: ../../packages/sharing
ente_strings:
diff --git a/mobile/apps/locker/windows/flutter/generated_plugins.cmake b/mobile/apps/locker/windows/flutter/generated_plugins.cmake
index ddd64f7ebe..c7920d1eb5 100644
--- a/mobile/apps/locker/windows/flutter/generated_plugins.cmake
+++ b/mobile/apps/locker/windows/flutter/generated_plugins.cmake
@@ -19,6 +19,7 @@ list(APPEND FLUTTER_PLUGIN_LIST
)
list(APPEND FLUTTER_FFI_PLUGIN_LIST
+ ente_rust
jni
)
diff --git a/mobile/packages/legacy/lib/pages/emergency_page.dart b/mobile/packages/legacy/lib/pages/emergency_page.dart
index 6a8620b1ed..6a355b1b86 100644
--- a/mobile/packages/legacy/lib/pages/emergency_page.dart
+++ b/mobile/packages/legacy/lib/pages/emergency_page.dart
@@ -1,6 +1,7 @@
import "dart:async";
import "package:ente_configuration/base_configuration.dart";
+import "package:ente_contacts/contacts.dart";
import "package:ente_legacy/components/gradient_button.dart";
import "package:ente_legacy/components/invite_reject_bottom_sheet.dart";
import "package:ente_legacy/components/trusted_contact_bottom_sheet.dart";
@@ -8,6 +9,7 @@ import "package:ente_legacy/models/emergency_models.dart";
import "package:ente_legacy/pages/other_contact_page.dart";
import "package:ente_legacy/pages/select_contact_page.dart";
import "package:ente_legacy/services/emergency_service.dart";
+import "package:ente_sharing/extensions/user_extension.dart";
import "package:ente_sharing/user_avator_widget.dart";
import "package:ente_strings/ente_strings.dart";
import "package:ente_ui/components/alert_bottom_sheet.dart";
@@ -25,10 +27,7 @@ import 'package:flutter/material.dart';
class EmergencyPage extends StatefulWidget {
final BaseConfiguration config;
- const EmergencyPage({
- required this.config,
- super.key,
- });
+ const EmergencyPage({required this.config, super.key});
@override
State<EmergencyPage> createState() => _EmergencyPageState();
@@ -43,12 +42,9 @@ class _EmergencyPageState extends State<EmergencyPage> {
void initState() {
super.initState();
currentUserID = widget.config.getUserID()!;
- Future.delayed(
- const Duration(seconds: 0),
- () async {
- unawaited(_fetchData());
- },
- );
+ Future.delayed(const Duration(seconds: 0), () async {
+ unawaited(_fetchData());
+ });
}
Future<void> _fetchData() async {
@@ -61,347 +57,348 @@ class _EmergencyPageState extends State<EmergencyPage> {
});
}
} catch (e) {
- showShortToast(
- context,
- context.strings.somethingWentWrong,
- );
+ showShortToast(context, context.strings.somethingWentWrong);
}
}
@override
Widget build(BuildContext context) {
- final colorScheme = getEnteColorScheme(context);
- final textTheme = getEnteTextTheme(context);
- final List<EmergencyContact> othersTrustedContacts =
- info?.othersEmergencyContact ?? [];
- final List<EmergencyContact> trustedContacts = info?.contacts ?? [];
+ return ValueListenableBuilder<int>(
+ valueListenable: ContactsDisplayService.instance.changes,
+ builder: (context, __, ___) {
+ final colorScheme = getEnteColorScheme(context);
+ final textTheme = getEnteTextTheme(context);
+ final List<EmergencyContact> othersTrustedContacts =
+ info?.othersEmergencyContact ?? [];
+ final List<EmergencyContact> trustedContacts = info?.contacts ?? [];
- return Scaffold(
- appBar: AppBar(
- toolbarHeight: 48,
- leadingWidth: 48,
- leading: GestureDetector(
- onTap: () {
- Navigator.pop(context);
- },
- child: const Icon(
- Icons.arrow_back_outlined,
- ),
- ),
- ),
- body: CustomScrollView(
- slivers: [
- SliverToBoxAdapter(
- child: Padding(
- padding: const EdgeInsets.symmetric(horizontal: 16),
- child: TitleBarTitleWidget(
- title: context.strings.legacy,
- ),
- ),
- ),
- SliverToBoxAdapter(
- child: Padding(
- padding: const EdgeInsets.symmetric(horizontal: 16),
- child: Text(
- context.strings.legacyPageDesc,
- style: textTheme.smallMuted,
- ),
+ return Scaffold(
+ appBar: AppBar(
+ toolbarHeight: 48,
+ leadingWidth: 48,
+ leading: GestureDetector(
+ onTap: () {
+ Navigator.pop(context);
+ },
+ child: const Icon(Icons.arrow_back_outlined),
),
),
- if (info == null)
- const SliverFillRemaining(
- hasScrollBody: false,
- child: Center(
- child: EnteLoadingWidget(),
- ),
- ),
- if (info != null && info!.recoverSessions.isNotEmpty)
- SliverPadding(
- padding: const EdgeInsets.only(
- top: 20,
- left: 16,
- right: 16,
- ),
- sliver: SliverList(
- delegate: SliverChildBuilderDelegate(
- (context, index) {
- if (index == 0) {
- return Padding(
- padding: const EdgeInsets.only(bottom: 16.0),
- child: _WarningBanner(
- text: context.strings.recoveryWarning,
- ),
- );
- }
- final listIndex = index - 1;
- final RecoverySessions recoverSession =
- info!.recoverSessions[listIndex];
- final isLastItem =
- listIndex == info!.recoverSessions.length - 1;
- return Column(
- children: [
- MenuItemWidgetV2(
- captionedTextWidget: CaptionedTextWidgetV2(
- title: recoverSession.emergencyContact.email,
- textStyle: textTheme.small.copyWith(
- color: colorScheme.warning500,
- fontWeight: recoverSession.status.isNotEmpty
- ? FontWeight.bold
- : null,
- ),
- ),
- leadingIconSize: 24.0,
- surfaceExecutionStates: false,
- alwaysShowSuccessState: false,
- leadingIconWidget: UserAvatarWidget(
- recoverSession.emergencyContact,
- type: AvatarType.mini,
- currentUserID: currentUserID,
- config: widget.config,
- ),
- menuItemColor: colorScheme.fillFaint,
- trailingIcon: Icons.chevron_right,
- trailingIconIsMuted: true,
- onTap: () async {
- await showRejectRecoveryDialog(recoverSession);
- },
- isTopBorderRadiusRemoved: listIndex > 0,
- isBottomBorderRadiusRemoved: !isLastItem,
- isFirstItem: listIndex == 0,
- isLastItem: isLastItem,
- ),
- if (!isLastItem)
- DividerWidget(
- dividerType: DividerType.menu,
- bgColor: colorScheme.fillFaint,
- ),
- ],
- );
- },
- childCount: 1 + info!.recoverSessions.length,
+ body: CustomScrollView(
+ slivers: [
+ SliverToBoxAdapter(
+ child: Padding(
+ padding: const EdgeInsets.symmetric(horizontal: 16),
+ child: TitleBarTitleWidget(title: context.strings.legacy),
),
),
- ),
- if (info != null)
- SliverPadding(
- padding: const EdgeInsets.only(
- top: 16,
- left: 16,
- right: 16,
- bottom: 8,
+ SliverToBoxAdapter(
+ child: Padding(
+ padding: const EdgeInsets.symmetric(horizontal: 16),
+ child: Text(
+ context.strings.legacyPageDesc,
+ style: textTheme.smallMuted,
+ ),
+ ),
),
- sliver: SliverList(
- delegate: SliverChildBuilderDelegate(
- (context, index) {
- if (index == 0 && trustedContacts.isNotEmpty) {
- return MenuSectionTitle(
- title: context.strings.trustedContacts,
- );
- } else if (index > 0 && index <= trustedContacts.length) {
- final listIndex = index - 1;
- final contact = trustedContacts[listIndex];
- final isLastItem =
- listIndex == trustedContacts.length - 1;
- return Column(
- children: [
- MenuItemWidgetV2(
- captionedTextWidget: CaptionedTextWidgetV2(
- title: contact.emergencyContact.email,
- textStyle: textTheme.small
- .copyWith(color: colorScheme.textMuted),
- trailingTitleWidget: contact.isPendingInvite()
- ? Image.asset(
- "assets/warning-yellow.png",
- width: 20,
- height: 20,
- )
- : null,
- ),
- leadingIconSize: 24.0,
- surfaceExecutionStates: false,
- alwaysShowSuccessState: false,
- leadingIconWidget: UserAvatarWidget(
- contact.emergencyContact,
- type: AvatarType.mini,
- currentUserID: currentUserID,
- config: widget.config,
- ),
- menuItemColor: colorScheme.fillFaint,
- trailingIcon: Icons.chevron_right,
- trailingIconIsMuted: true,
- onTap: () async {
- await showRevokeOrRemoveDialog(context, contact);
- },
- isTopBorderRadiusRemoved: listIndex > 0,
- isBottomBorderRadiusRemoved: !isLastItem,
- isFirstItem: listIndex == 0,
- isLastItem: isLastItem,
- ),
- if (!isLastItem)
- DividerWidget(
- dividerType: DividerType.menu,
- bgColor: colorScheme.fillFaint,
+ if (info == null)
+ const SliverFillRemaining(
+ hasScrollBody: false,
+ child: Center(child: EnteLoadingWidget()),
+ ),
+ if (info != null && info!.recoverSessions.isNotEmpty)
+ SliverPadding(
+ padding: const EdgeInsets.only(top: 20, left: 16, right: 16),
+ sliver: SliverList(
+ delegate: SliverChildBuilderDelegate(
+ (context, index) {
+ if (index == 0) {
+ return Padding(
+ padding: const EdgeInsets.only(bottom: 16.0),
+ child: _WarningBanner(
+ text: context.strings.recoveryWarning,
),
- ],
- );
- } else if (index == (1 + trustedContacts.length)) {
- if (trustedContacts.isEmpty) {
+ );
+ }
+ final listIndex = index - 1;
+ final RecoverySessions recoverSession =
+ info!.recoverSessions[listIndex];
+ final isLastItem =
+ listIndex == info!.recoverSessions.length - 1;
return Column(
children: [
- SizedBox(
- height: 200,
- width: 200,
- child: Image.asset(
- "assets/legacy.png",
- width: 200,
- height: 200,
+ MenuItemWidgetV2(
+ captionedTextWidget: CaptionedTextWidgetV2(
+ title: recoverSession
+ .emergencyContact.resolvedDisplayName,
+ textStyle: textTheme.small.copyWith(
+ color: colorScheme.warning500,
+ fontWeight: recoverSession.status.isNotEmpty
+ ? FontWeight.bold
+ : null,
+ ),
),
- ),
- Text(
- context.strings.legacyPageDesc2,
- style: textTheme.smallMuted,
- ),
- const SizedBox(height: 16),
- GradientButton(
- text: context.strings.addTrustedContact,
+ leadingIconSize: 24.0,
+ surfaceExecutionStates: false,
+ alwaysShowSuccessState: false,
+ leadingIconWidget: UserAvatarWidget(
+ recoverSession.emergencyContact,
+ type: AvatarType.mini,
+ currentUserID: currentUserID,
+ config: widget.config,
+ ),
+ menuItemColor: colorScheme.fillFaint,
+ trailingIcon: Icons.chevron_right,
+ trailingIconIsMuted: true,
onTap: () async {
- final result = await showAddContactSheet(
- context,
- emergencyInfo: info!,
- config: widget.config,
- );
- if (result == true) {
- unawaited(_fetchData());
- }
+ await showRejectRecoveryDialog(recoverSession);
},
+ isTopBorderRadiusRemoved: listIndex > 0,
+ isBottomBorderRadiusRemoved: !isLastItem,
+ isFirstItem: listIndex == 0,
+ isLastItem: isLastItem,
),
+ if (!isLastItem)
+ DividerWidget(
+ dividerType: DividerType.menu,
+ bgColor: colorScheme.fillFaint,
+ ),
],
);
- }
- return Column(
- children: [
- const SizedBox(height: 20),
- GradientButton(
- text: context.strings.addTrustedContact,
- onTap: () async {
- final result = await showAddContactSheet(
- context,
- emergencyInfo: info!,
- config: widget.config,
- );
- if (result == true) {
- unawaited(_fetchData());
- }
- },
- ),
- ],
- );
- }
- return const SizedBox.shrink();
- },
- childCount: 1 + trustedContacts.length + 1,
+ },
+ childCount: 1 + info!.recoverSessions.length,
+ ),
+ ),
),
- ),
- ),
- if (info != null && info!.othersEmergencyContact.isNotEmpty)
- SliverPadding(
- padding: const EdgeInsets.only(top: 0, left: 16, right: 16),
- sliver: SliverList(
- delegate: SliverChildBuilderDelegate(
- (context, index) {
- if (index == 0 && (othersTrustedContacts.isNotEmpty)) {
- return Column(
- children: [
- const Padding(
- padding: EdgeInsets.symmetric(vertical: 8),
- child: DividerWidget(
- dividerType: DividerType.solid,
- ),
- ),
- MenuSectionTitle(
- title: context.strings.legacyAccounts,
- ),
- ],
- );
- } else if (index > 0 &&
- index <= othersTrustedContacts.length) {
- final listIndex = index - 1;
- final currentUser = othersTrustedContacts[listIndex];
- final isLastItem = index == othersTrustedContacts.length;
- return Column(
- children: [
- MenuItemWidgetV2(
- captionedTextWidget: CaptionedTextWidgetV2(
- title: currentUser.user.email,
- textStyle: textTheme.small.copyWith(
- color: colorScheme.textMuted,
- fontWeight: FontWeight.w500,
- ),
- trailingTitleWidget: currentUser.isPendingInvite()
- ? Image.asset(
- "assets/warning-yellow.png",
- width: 20,
- height: 20,
- )
- : null,
- ),
- leadingIconSize: 24.0,
- surfaceExecutionStates: false,
- alwaysShowSuccessState: false,
- leadingIconWidget: UserAvatarWidget(
- currentUser.user,
- type: AvatarType.mini,
- currentUserID: currentUserID,
- config: widget.config,
- ),
- menuItemColor: colorScheme.fillFaint,
- trailingIcon: Icons.chevron_right,
- trailingIconIsMuted: true,
- onTap: () async {
- if (currentUser.isPendingInvite()) {
- await showAcceptOrDeclineDialog(
- context,
- currentUser,
- );
- } else {
- await Navigator.of(context).push(
- MaterialPageRoute(
- builder: (BuildContext context) {
- return OtherContactPage(
- contact: currentUser,
- emergencyInfo: info!,
- config: widget.config,
- );
- },
+ if (info != null)
+ SliverPadding(
+ padding: const EdgeInsets.only(
+ top: 16,
+ left: 16,
+ right: 16,
+ bottom: 8,
+ ),
+ sliver: SliverList(
+ delegate: SliverChildBuilderDelegate(
+ (context, index) {
+ if (index == 0 && trustedContacts.isNotEmpty) {
+ return MenuSectionTitle(
+ title: context.strings.trustedContacts,
+ );
+ } else if (index > 0 &&
+ index <= trustedContacts.length) {
+ final listIndex = index - 1;
+ final contact = trustedContacts[listIndex];
+ final isLastItem =
+ listIndex == trustedContacts.length - 1;
+ return Column(
+ children: [
+ MenuItemWidgetV2(
+ captionedTextWidget: CaptionedTextWidgetV2(
+ title: contact
+ .emergencyContact.resolvedDisplayName,
+ textStyle: textTheme.small.copyWith(
+ color: colorScheme.textMuted,
),
- );
- if (mounted) {
- unawaited(_fetchData());
- }
- }
- },
- isTopBorderRadiusRemoved: listIndex > 0,
- isBottomBorderRadiusRemoved: !isLastItem,
- isFirstItem: listIndex == 0,
- isLastItem: isLastItem,
- ),
- isLastItem
- ? const SizedBox.shrink()
- : DividerWidget(
+ trailingTitleWidget: contact.isPendingInvite()
+ ? Image.asset(
+ "assets/warning-yellow.png",
+ width: 20,
+ height: 20,
+ )
+ : null,
+ ),
+ leadingIconSize: 24.0,
+ surfaceExecutionStates: false,
+ alwaysShowSuccessState: false,
+ leadingIconWidget: UserAvatarWidget(
+ contact.emergencyContact,
+ type: AvatarType.mini,
+ currentUserID: currentUserID,
+ config: widget.config,
+ ),
+ menuItemColor: colorScheme.fillFaint,
+ trailingIcon: Icons.chevron_right,
+ trailingIconIsMuted: true,
+ onTap: () async {
+ await showRevokeOrRemoveDialog(
+ context,
+ contact,
+ );
+ },
+ isTopBorderRadiusRemoved: listIndex > 0,
+ isBottomBorderRadiusRemoved: !isLastItem,
+ isFirstItem: listIndex == 0,
+ isLastItem: isLastItem,
+ ),
+ if (!isLastItem)
+ DividerWidget(
dividerType: DividerType.menu,
bgColor: colorScheme.fillFaint,
),
- ],
- );
- }
- return const SizedBox.shrink();
- },
- childCount: 1 + othersTrustedContacts.length + 1,
+ ],
+ );
+ } else if (index == (1 + trustedContacts.length)) {
+ if (trustedContacts.isEmpty) {
+ return Column(
+ children: [
+ SizedBox(
+ height: 200,
+ width: 200,
+ child: Image.asset(
+ "assets/legacy.png",
+ width: 200,
+ height: 200,
+ ),
+ ),
+ Text(
+ context.strings.legacyPageDesc2,
+ style: textTheme.smallMuted,
+ ),
+ const SizedBox(height: 16),
+ GradientButton(
+ text: context.strings.addTrustedContact,
+ onTap: () async {
+ final result = await showAddContactSheet(
+ context,
+ emergencyInfo: info!,
+ config: widget.config,
+ );
+ if (result == true) {
+ unawaited(_fetchData());
+ }
+ },
+ ),
+ ],
+ );
+ }
+ return Column(
+ children: [
+ const SizedBox(height: 20),
+ GradientButton(
+ text: context.strings.addTrustedContact,
+ onTap: () async {
+ final result = await showAddContactSheet(
+ context,
+ emergencyInfo: info!,
+ config: widget.config,
+ );
+ if (result == true) {
+ unawaited(_fetchData());
+ }
+ },
+ ),
+ ],
+ );
+ }
+ return const SizedBox.shrink();
+ },
+ childCount: 1 + trustedContacts.length + 1,
+ ),
+ ),
),
- ),
- ),
- ],
- ),
+ if (info != null && info!.othersEmergencyContact.isNotEmpty)
+ SliverPadding(
+ padding: const EdgeInsets.only(top: 0, left: 16, right: 16),
+ sliver: SliverList(
+ delegate: SliverChildBuilderDelegate(
+ (context, index) {
+ if (index == 0 && (othersTrustedContacts.isNotEmpty)) {
+ return Column(
+ children: [
+ const Padding(
+ padding: EdgeInsets.symmetric(vertical: 8),
+ child: DividerWidget(
+ dividerType: DividerType.solid,
+ ),
+ ),
+ MenuSectionTitle(
+ title: context.strings.legacyAccounts,
+ ),
+ ],
+ );
+ } else if (index > 0 &&
+ index <= othersTrustedContacts.length) {
+ final listIndex = index - 1;
+ final currentUser = othersTrustedContacts[listIndex];
+ final isLastItem =
+ index == othersTrustedContacts.length;
+ return Column(
+ children: [
+ MenuItemWidgetV2(
+ captionedTextWidget: CaptionedTextWidgetV2(
+ title: currentUser.user.resolvedDisplayName,
+ textStyle: textTheme.small.copyWith(
+ color: colorScheme.textMuted,
+ fontWeight: FontWeight.w500,
+ ),
+ trailingTitleWidget:
+ currentUser.isPendingInvite()
+ ? Image.asset(
+ "assets/warning-yellow.png",
+ width: 20,
+ height: 20,
+ )
+ : null,
+ ),
+ leadingIconSize: 24.0,
+ surfaceExecutionStates: false,
+ alwaysShowSuccessState: false,
+ leadingIconWidget: UserAvatarWidget(
+ currentUser.user,
+ type: AvatarType.mini,
+ currentUserID: currentUserID,
+ config: widget.config,
+ ),
+ menuItemColor: colorScheme.fillFaint,
+ trailingIcon: Icons.chevron_right,
+ trailingIconIsMuted: true,
+ onTap: () async {
+ if (currentUser.isPendingInvite()) {
+ await showAcceptOrDeclineDialog(
+ context,
+ currentUser,
+ );
+ } else {
+ await Navigator.of(context).push(
+ MaterialPageRoute(
+ builder: (BuildContext context) {
+ return OtherContactPage(
+ contact: currentUser,
+ emergencyInfo: info!,
+ config: widget.config,
+ );
+ },
+ ),
+ );
+ if (mounted) {
+ unawaited(_fetchData());
+ }
+ }
+ },
+ isTopBorderRadiusRemoved: listIndex > 0,
+ isBottomBorderRadiusRemoved: !isLastItem,
+ isFirstItem: listIndex == 0,
+ isLastItem: isLastItem,
+ ),
+ isLastItem
+ ? const SizedBox.shrink()
+ : DividerWidget(
+ dividerType: DividerType.menu,
+ bgColor: colorScheme.fillFaint,
+ ),
+ ],
+ );
+ }
+ return const SizedBox.shrink();
+ },
+ childCount: 1 + othersTrustedContacts.length + 1,
+ ),
+ ),
+ ),
+ ],
+ ),
+ );
+ },
);
}
@@ -409,10 +406,7 @@ class _EmergencyPageState extends State<EmergencyPage> {
BuildContext context,
EmergencyContact contact,
) async {
- final result = await showTrustedContactSheet(
- context,
- contact: contact,
- );
+ final result = await showTrustedContactSheet(context, contact: contact);
if (result?.action == TrustedContactAction.revoke) {
final isPending = contact.isPendingInvite();
@@ -441,8 +435,10 @@ class _EmergencyPageState extends State<EmergencyPage> {
);
if (confirmed == true) {
- await EmergencyContactService.instance
- .updateContact(contact, ContactState.userRevokedContact);
+ await EmergencyContactService.instance.updateContact(
+ contact,
+ ContactState.userRevokedContact,
+ );
info?.contacts.remove(contact);
if (mounted) {
setState(() {});
@@ -456,8 +452,9 @@ class _EmergencyPageState extends State<EmergencyPage> {
final success = await EmergencyContactService.instance
.updateRecoveryNotice(contact, selectedDays);
if (success) {
- final updatedContact =
- contact.copyWith(recoveryNoticeInDays: selectedDays);
+ final updatedContact = contact.copyWith(
+ recoveryNoticeInDays: selectedDays,
+ );
final index = info?.contacts.indexOf(contact);
if (index != null && index >= 0) {
info?.contacts[index] = updatedContact;
@@ -518,18 +515,23 @@ class _EmergencyPageState extends State<EmergencyPage> {
);
if (result == "accept") {
- await EmergencyContactService.instance
- .updateContact(contact, ContactState.contactAccepted);
- final updatedContact =
- contact.copyWith(state: ContactState.contactAccepted);
+ await EmergencyContactService.instance.updateContact(
+ contact,
+ ContactState.contactAccepted,
+ );
+ final updatedContact = contact.copyWith(
+ state: ContactState.contactAccepted,
+ );
info?.othersEmergencyContact.remove(contact);
info?.othersEmergencyContact.add(updatedContact);
if (mounted) {
setState(() {});
}
} else if (result == "decline") {
- await EmergencyContactService.instance
- .updateContact(contact, ContactState.contactDenied);
+ await EmergencyContactService.instance.updateContact(
+ contact,
+ ContactState.contactDenied,
+ );
info?.othersEmergencyContact.remove(contact);
if (mounted) {
setState(() {});
@@ -603,9 +605,7 @@ class _WarningBanner extends StatelessWidget {
Expanded(
child: Text(
text,
- style: textTheme.bodyBold.copyWith(
- color: colorScheme.warning400,
- ),
+ style: textTheme.bodyBold.copyWith(color: colorScheme.warning400),
),
),
],
diff --git a/mobile/packages/legacy/lib/pages/select_contact_page.dart b/mobile/packages/legacy/lib/pages/select_contact_page.dart
index 74e3fe7e24..c317c097b3 100644
--- a/mobile/packages/legacy/lib/pages/select_contact_page.dart
+++ b/mobile/packages/legacy/lib/pages/select_contact_page.dart
@@ -1,10 +1,12 @@
import "package:email_validator/email_validator.dart";
import "package:ente_accounts/services/user_service.dart";
import "package:ente_configuration/base_configuration.dart";
+import "package:ente_contacts/contacts.dart";
import "package:ente_legacy/components/gradient_button.dart";
import "package:ente_legacy/components/recovery_date_selector.dart";
import "package:ente_legacy/models/emergency_models.dart";
import "package:ente_legacy/services/emergency_service.dart";
+import "package:ente_sharing/extensions/user_extension.dart";
import "package:ente_sharing/models/user.dart";
import "package:ente_sharing/user_avator_widget.dart";
import "package:ente_sharing/verify_identity_dialog.dart";
@@ -31,10 +33,7 @@ Future<bool?> showAddContactSheet(
title: context.strings.addTrustedContact,
headerSpacing: 20,
isKeyboardAware: true,
- child: AddContactSheet(
- emergencyInfo: emergencyInfo,
- config: config,
- ),
+ child: AddContactSheet(emergencyInfo: emergencyInfo, config: config),
);
}
@@ -73,69 +72,74 @@ class _AddContactSheetState extends State<AddContactSheet> {
@override
Widget build(BuildContext context) {
- final colorScheme = getEnteColorScheme(context);
- final textTheme = getEnteTextTheme(context);
- final List<User> suggestedUsers = _getSuggestedUser();
- final bool canAdd = selectedEmail.isNotEmpty || _emailIsValid;
+ return ValueListenableBuilder<int>(
+ valueListenable: ContactsDisplayService.instance.changes,
+ builder: (context, __, ___) {
+ final colorScheme = getEnteColorScheme(context);
+ final textTheme = getEnteTextTheme(context);
+ final List<User> suggestedUsers = _getSuggestedUser();
+ final bool canAdd = selectedEmail.isNotEmpty || _emailIsValid;
- return SingleChildScrollView(
- child: Column(
- mainAxisSize: MainAxisSize.min,
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- _buildEmailInputRow(colorScheme),
- if (suggestedUsers.isNotEmpty) ...[
- const SizedBox(height: 20),
- _buildExistingContactsSection(
- suggestedUsers,
- colorScheme,
- textTheme,
- ),
- ],
- const SizedBox(height: 20),
- Column(
+ return SingleChildScrollView(
+ child: Column(
+ mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
- Text(
- context.strings.chooseARecoveryTime,
- style: textTheme.bodyMuted,
+ _buildEmailInputRow(colorScheme),
+ if (suggestedUsers.isNotEmpty) ...[
+ const SizedBox(height: 20),
+ _buildExistingContactsSection(
+ suggestedUsers,
+ colorScheme,
+ textTheme,
+ ),
+ ],
+ const SizedBox(height: 20),
+ Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Text(
+ context.strings.chooseARecoveryTime,
+ style: textTheme.bodyMuted,
+ ),
+ const SizedBox(height: 12),
+ RecoveryDateSelector(
+ selectedDays: _selectedRecoveryDays,
+ onDaysChanged: (days) {
+ setState(() {
+ _selectedRecoveryDays = days;
+ });
+ },
+ ),
+ ],
),
- const SizedBox(height: 12),
- RecoveryDateSelector(
- selectedDays: _selectedRecoveryDays,
- onDaysChanged: (days) {
- setState(() {
- _selectedRecoveryDays = days;
- });
- },
+ const SizedBox(height: 20),
+ GradientButton(
+ text: context.strings.addTrustedContact,
+ onTap: canAdd ? _onAddContactTap : null,
),
- ],
- ),
- const SizedBox(height: 20),
- GradientButton(
- text: context.strings.addTrustedContact,
- onTap: canAdd ? _onAddContactTap : null,
- ),
- const SizedBox(height: 12),
- Center(
- child: GestureDetector(
- onTap: _onVerifyTap,
- child: Text(
- context.strings.verifyIDLabel,
- style: textTheme.bodyBold.copyWith(
- color: canAdd
- ? getEnteColorScheme(context).primary700
- : getEnteColorScheme(context).textMuted,
- decoration: TextDecoration.underline,
- decorationColor: canAdd
- ? getEnteColorScheme(context).primary700
- : getEnteColorScheme(context).textMuted,
+ const SizedBox(height: 12),
+ Center(
+ child: GestureDetector(
+ onTap: _onVerifyTap,
+ child: Text(
+ context.strings.verifyIDLabel,
+ style: textTheme.bodyBold.copyWith(
+ color: canAdd
+ ? getEnteColorScheme(context).primary700
+ : getEnteColorScheme(context).textMuted,
+ decoration: TextDecoration.underline,
+ decorationColor: canAdd
+ ? getEnteColorScheme(context).primary700
+ : getEnteColorScheme(context).textMuted,
+ ),
+ ),
),
),
- ),
+ ],
),
- ],
- ),
+ );
+ },
);
}
@@ -216,7 +220,7 @@ class _AddContactSheetState extends State<AddContactSheet> {
final isLast = index == suggestedUsers.length - 1;
return MenuItemWidgetV2(
captionedTextWidget: CaptionedTextWidgetV2(
- title: user.email,
+ title: user.resolvedDisplayName,
textStyle: textTheme.small.copyWith(
color: colorScheme.textMuted,
),
@@ -362,10 +366,7 @@ class _AddContactSheetState extends State<AddContactSheet> {
return showAlertBottomSheet<bool>(
context,
title: context.strings.warning,
- message: context.strings.confirmAddingTrustedContact(
- email,
- recoveryDays,
- ),
+ message: context.strings.confirmAddingTrustedContact(email, recoveryDays),
assetPath: "assets/warning-blue.png",
buttons: [
GradientButton(
@@ -424,12 +425,14 @@ class _AddContactSheetState extends State<AddContactSheet> {
// Filter by search text
if (_textController.text.trim().isNotEmpty) {
suggestedUsers.removeWhere(
- (element) => !element.email
- .toLowerCase()
- .contains(_textController.text.trim().toLowerCase()),
+ (element) => !element.matchesResolvedNameOrEmail(_textController.text),
);
}
- suggestedUsers.sort((a, b) => a.email.compareTo(b.email));
+ suggestedUsers.sort(
+ (a, b) => a.resolvedDisplayName.toLowerCase().compareTo(
+ b.resolvedDisplayName.toLowerCase(),
+ ),
+ );
return suggestedUsers;
}
diff --git a/mobile/packages/legacy/pubspec.lock b/mobile/packages/legacy/pubspec.lock
index 7d7131eeb9..51438d6850 100644
--- a/mobile/packages/legacy/pubspec.lock
+++ b/mobile/packages/legacy/pubspec.lock
@@ -73,6 +73,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.1.2"
+ build_cli_annotations:
+ dependency: transitive
+ description:
+ name: build_cli_annotations
+ sha256: e563c2e01de8974566a1998410d3f6f03521788160a02503b0b1f1a46c7b3d95
+ url: "https://pub.dev"
+ source: hosted
+ version: "2.1.1"
characters:
dependency: transitive
description:
@@ -198,6 +206,13 @@ packages:
relative: true
source: path
version: "1.0.0"
+ ente_contacts:
+ dependency: "direct main"
+ description:
+ path: "../contacts"
+ relative: true
+ source: path
+ version: "1.0.0"
ente_crypto_api:
dependency: "direct main"
description:
@@ -240,6 +255,13 @@ packages:
relative: true
source: path
version: "1.0.0"
+ ente_rust:
+ dependency: transitive
+ description:
+ path: "../rust"
+ relative: true
+ source: path
+ version: "0.0.1"
ente_sharing:
dependency: "direct main"
description:
@@ -447,6 +469,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.0.31"
+ flutter_rust_bridge:
+ dependency: transitive
+ description:
+ name: flutter_rust_bridge
+ sha256: e87d6b9ee934dcd24a128ccb2bd91905d2d5fe5c06245d6a8f5477d4907a437a
+ url: "https://pub.dev"
+ source: hosted
+ version: "2.12.0"
flutter_secure_storage:
dependency: transitive
description:
@@ -529,6 +559,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "8.2.14"
+ freezed_annotation:
+ dependency: transitive
+ description:
+ name: freezed_annotation
+ sha256: "7294967ff0a6d98638e7acb774aac3af2550777accd8149c90af5b014e6d44d8"
+ url: "https://pub.dev"
+ source: hosted
+ version: "3.1.0"
gtk:
dependency: transitive
description:
@@ -1046,6 +1084,62 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.10.1"
+ sqflite:
+ dependency: transitive
+ description:
+ name: sqflite
+ sha256: e2297b1da52f127bc7a3da11439985d9b536f75070f3325e62ada69a5c585d03
+ url: "https://pub.dev"
+ source: hosted
+ version: "2.4.2"
+ sqflite_android:
+ dependency: transitive
+ description:
+ name: sqflite_android
+ sha256: "2b3070c5fa881839f8b402ee4a39c1b4d561704d4ebbbcfb808a119bc2a1701b"
+ url: "https://pub.dev"
+ source: hosted
+ version: "2.4.1"
+ sqflite_common:
+ dependency: transitive
+ description:
+ name: sqflite_common
+ sha256: "6ef422a4525ecc601db6c0a2233ff448c731307906e92cabc9ba292afaae16a6"
+ url: "https://pub.dev"
+ source: hosted
+ version: "2.5.6"
+ sqflite_common_ffi:
+ dependency: transitive
+ description:
+ name: sqflite_common_ffi
+ sha256: "9faa2fedc5385ef238ce772589f7718c24cdddd27419b609bb9c6f703ea27988"
+ url: "https://pub.dev"
+ source: hosted
+ version: "2.3.6"
+ sqflite_darwin:
+ dependency: transitive
+ description:
+ name: sqflite_darwin
+ sha256: "279832e5cde3fe99e8571879498c9211f3ca6391b0d818df4e17d9fff5c6ccb3"
+ url: "https://pub.dev"
+ source: hosted
+ version: "2.4.2"
+ sqflite_platform_interface:
+ dependency: transitive
+ description:
+ name: sqflite_platform_interface
+ sha256: "8dd4515c7bdcae0a785b0062859336de775e8c65db81ae33dd5445f35be61920"
+ url: "https://pub.dev"
+ source: hosted
+ version: "2.4.0"
+ sqlite3:
+ dependency: transitive
+ description:
+ name: sqlite3
+ sha256: "3145bd74dcdb4fd6f5c6dda4d4e4490a8087d7f286a14dee5d37087290f0f8a2"
+ url: "https://pub.dev"
+ source: hosted
+ version: "2.9.4"
stack_trace:
dependency: transitive
description:
@@ -1086,6 +1180,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "8.1.0"
+ synchronized:
+ dependency: transitive
+ description:
+ name: synchronized
+ sha256: c254ade258ec8282947a0acbbc90b9575b4f19673533ee46f2f6e9b3aeefd7c0
+ url: "https://pub.dev"
+ source: hosted
+ version: "3.4.0"
term_glyph:
dependency: transitive
description:
diff --git a/mobile/packages/legacy/pubspec.yaml b/mobile/packages/legacy/pubspec.yaml
index 694b7f8f16..819b63911e 100644
--- a/mobile/packages/legacy/pubspec.yaml
+++ b/mobile/packages/legacy/pubspec.yaml
@@ -16,6 +16,8 @@ dependencies:
path: ../base
ente_configuration:
path: ../configuration
+ ente_contacts:
+ path: ../contacts
ente_crypto_api:
path: ../ente_crypto_api
ente_network:
diff --git a/mobile/packages/sharing/lib/extensions/user_extension.dart b/mobile/packages/sharing/lib/extensions/user_extension.dart
index 3c152667df..b76762b016 100644
--- a/mobile/packages/sharing/lib/extensions/user_extension.dart
+++ b/mobile/packages/sharing/lib/extensions/user_extension.dart
@@ -1,3 +1,4 @@
+import 'package:ente_contacts/contacts.dart';
import "package:ente_sharing/models/user.dart";
extension UserExtension on User {
@@ -9,4 +10,40 @@ extension UserExtension on User {
String get nameOrEmail {
return email.substring(0, email.indexOf("@"));
}
+
+ String get resolvedDisplayName {
+ final savedName = ContactsDisplayService.instance.getCachedSavedName(
+ contactUserId: id,
+ email: email,
+ );
+ if (savedName != null) {
+ return savedName;
+ }
+ final currentDisplayName = displayName?.trim();
+ if (currentDisplayName != null && currentDisplayName.isNotEmpty) {
+ return currentDisplayName;
+ }
+ return resolvedEmail;
+ }
+
+ String get resolvedEmail {
+ final savedEmail = ContactsDisplayService.instance.getCachedResolvedEmail(
+ contactUserId: id,
+ email: email,
+ );
+ if (savedEmail != null) {
+ return savedEmail;
+ }
+ return email;
+ }
+
+ bool matchesResolvedNameOrEmail(String query) {
+ final normalizedQuery = query.trim().toLowerCase();
+ if (normalizedQuery.isEmpty) {
+ return true;
+ }
+ return resolvedDisplayName.toLowerCase().contains(normalizedQuery) ||
+ resolvedEmail.toLowerCase().contains(normalizedQuery) ||
+ email.toLowerCase().contains(normalizedQuery);
+ }
}
diff --git a/mobile/packages/sharing/lib/resolved_user_builder.dart b/mobile/packages/sharing/lib/resolved_user_builder.dart
new file mode 100644
index 0000000000..de8c5a3a84
--- /dev/null
+++ b/mobile/packages/sharing/lib/resolved_user_builder.dart
@@ -0,0 +1,30 @@
+import 'package:ente_contacts/contacts.dart';
+import 'package:ente_sharing/extensions/user_extension.dart';
+import 'package:ente_sharing/models/user.dart';
+import 'package:flutter/widgets.dart';
+
+typedef ResolvedUserWidgetBuilder = Widget Function(
+ BuildContext context,
+ String displayName,
+ String actualEmail,
+);
+
+class ResolvedUserBuilder extends StatelessWidget {
+ final User user;
+ final ResolvedUserWidgetBuilder builder;
+
+ const ResolvedUserBuilder({
+ super.key,
+ required this.user,
+ required this.builder,
+ });
+
+ @override
+ Widget build(BuildContext context) {
+ return ValueListenableBuilder<int>(
+ valueListenable: ContactsDisplayService.instance.changes,
+ builder: (context, __, ___) =>
+ builder(context, user.resolvedDisplayName, user.email),
+ );
+ }
+}
diff --git a/mobile/packages/sharing/lib/user_avator_widget.dart b/mobile/packages/sharing/lib/user_avator_widget.dart
index 979cbf8005..c3869f459c 100644
--- a/mobile/packages/sharing/lib/user_avator_widget.dart
+++ b/mobile/packages/sharing/lib/user_avator_widget.dart
@@ -1,7 +1,11 @@
-import "package:ente_configuration/base_configuration.dart";
-import "package:ente_sharing/extensions/user_extension.dart";
-import "package:ente_sharing/models/user.dart";
-import "package:ente_ui/theme/ente_theme.dart";
+import 'dart:async';
+import 'dart:typed_data';
+
+import 'package:ente_configuration/base_configuration.dart';
+import 'package:ente_contacts/contacts.dart';
+import 'package:ente_sharing/extensions/user_extension.dart';
+import 'package:ente_sharing/models/user.dart';
+import 'package:ente_ui/theme/ente_theme.dart';
import 'package:flutter/material.dart';
import 'package:tuple/tuple.dart';
@@ -25,84 +29,118 @@ class UserAvatarWidget extends StatefulWidget {
@override
State<UserAvatarWidget> createState() => _UserAvatarWidgetState();
+
static const strokeWidth = 1.0;
}
class _UserAvatarWidgetState extends State<UserAvatarWidget> {
+ @override
+ void initState() {
+ super.initState();
+ _preloadProfilePictureIfPossible();
+ }
+
+ @override
+ void didUpdateWidget(covariant UserAvatarWidget oldWidget) {
+ super.didUpdateWidget(oldWidget);
+ if (oldWidget.user.id != widget.user.id ||
+ oldWidget.user.email != widget.user.email) {
+ _preloadProfilePictureIfPossible();
+ }
+ }
+
+ void _preloadProfilePictureIfPossible() {
+ final displayService = ContactsDisplayService.instance;
+ if (displayService.hasResolvedProfilePicture(
+ contactUserId: widget.user.id,
+ email: widget.user.email,
+ )) {
+ return;
+ }
+ if (displayService.getCachedContact(
+ contactUserId: widget.user.id,
+ email: widget.user.email,
+ ) ==
+ null) {
+ return;
+ }
+ unawaited(
+ displayService.getProfilePictureBytes(
+ contactUserId: widget.user.id,
+ email: widget.user.email,
+ ),
+ );
+ }
+
@override
Widget build(BuildContext context) {
final double size = getAvatarSize(widget.type);
- return SizedBox(
- height: size,
- width: size,
- child: _FirstLetterCircularAvatar(
- user: widget.user,
- currentUserID: widget.currentUserID,
- thumbnailView: widget.thumbnailView,
- type: widget.type,
- config: widget.config,
- ),
+ return ValueListenableBuilder<int>(
+ valueListenable: ContactsDisplayService.instance.changes,
+ builder: (context, __, ___) {
+ _preloadProfilePictureIfPossible();
+ return SizedBox(
+ height: size,
+ width: size,
+ child: _CircularAvatar(
+ user: widget.user,
+ type: widget.type,
+ config: widget.config,
+ ),
+ );
+ },
);
}
}
-class _FirstLetterCircularAvatar extends StatefulWidget {
+class _CircularAvatar extends StatelessWidget {
final User user;
- final int currentUserID;
- final bool thumbnailView;
final AvatarType type;
final BaseConfiguration config;
- const _FirstLetterCircularAvatar({
+
+ const _CircularAvatar({
required this.user,
- required this.currentUserID,
- required this.thumbnailView,
required this.type,
required this.config,
});
- @override
- State<_FirstLetterCircularAvatar> createState() =>
- _FirstLetterCircularAvatarState();
-}
-
-class _FirstLetterCircularAvatarState
- extends State<_FirstLetterCircularAvatar> {
@override
Widget build(BuildContext context) {
+ final profilePictureBytes =
+ ContactsDisplayService.instance.getCachedProfilePictureBytes(
+ contactUserId: user.id,
+ email: user.email,
+ );
+ final avatarStyle = _getAvatarStyle(context, type);
+ final double size = avatarStyle.item1;
+ if (profilePictureBytes != null) {
+ return _CirclePhotoAvatar(bytes: profilePictureBytes, size: size);
+ }
+
final colorScheme = getEnteColorScheme(context);
+ final displayLabel = user.resolvedDisplayName;
final displayChar =
- (widget.user.displayName == null || widget.user.displayName!.isEmpty)
- ? ((widget.user.email.isEmpty)
- ? " "
- : widget.user.email.substring(0, 1))
- : widget.user.displayName!.substring(0, 1);
+ displayLabel.isEmpty ? " " : displayLabel.substring(0, 1);
+ final avatarSeed = user.resolvedEmail;
Color decorationColor;
- if ((widget.user.id != null && widget.user.id! < 0) ||
- widget.user.email == widget.config.getEmail()) {
+ if ((user.id != null && user.id! < 0) || user.email == config.getEmail()) {
decorationColor = Colors.black;
} else {
- decorationColor = colorScheme.avatarColors[(widget.user.email.length)
- .remainder(colorScheme.avatarColors.length)];
+ decorationColor = colorScheme.avatarColors[avatarSeed.length.remainder(
+ colorScheme.avatarColors.length,
+ )];
}
- final avatarStyle = getAvatarStyle(context, widget.type);
- final double size = avatarStyle.item1;
- final TextStyle textStyle = avatarStyle.item2;
- return SizedBox(
- height: size,
- width: size,
- child: CircleAvatar(
- backgroundColor: decorationColor,
- child: Text(
- displayChar.toUpperCase(),
- // fixed color
- style: textStyle.copyWith(color: Colors.white),
- ),
+ return CircleAvatar(
+ backgroundColor: decorationColor,
+ child: Text(
+ displayChar.toUpperCase(),
+ style: avatarStyle.item2.copyWith(color: Colors.white),
),
);
}
- Tuple2<double, TextStyle> getAvatarStyle(
+ Tuple2<double, TextStyle> _getAvatarStyle(
BuildContext context,
AvatarType type,
) {
@@ -120,9 +158,7 @@ class _FirstLetterCircularAvatarState
}
}
-double getAvatarSize(
- AvatarType type,
-) {
+double getAvatarSize(AvatarType type) {
switch (type) {
case AvatarType.small:
return 32.0;
@@ -138,11 +174,8 @@ double getAvatarSize(
class FirstLetterUserAvatar extends StatefulWidget {
final User user;
final BaseConfiguration config;
- const FirstLetterUserAvatar(
- this.user, {
- super.key,
- required this.config,
- });
+
+ const FirstLetterUserAvatar(this.user, {super.key, required this.config});
@override
State<FirstLetterUserAvatar> createState() => _FirstLetterUserAvatarState();
@@ -157,39 +190,107 @@ class _FirstLetterUserAvatarState extends State<FirstLetterUserAvatar> {
super.initState();
user = widget.user;
currentUserEmail = widget.config.getEmail();
+ _preloadProfilePictureIfPossible();
}
@override
void didUpdateWidget(covariant FirstLetterUserAvatar oldWidget) {
super.didUpdateWidget(oldWidget);
if (oldWidget.user != widget.user) {
- setState(() {
- user = widget.user;
- });
+ user = widget.user;
+ _preloadProfilePictureIfPossible();
}
}
+ void _preloadProfilePictureIfPossible() {
+ final displayService = ContactsDisplayService.instance;
+ if (displayService.hasResolvedProfilePicture(
+ contactUserId: user.id,
+ email: user.email,
+ )) {
+ return;
+ }
+ if (displayService.getCachedContact(
+ contactUserId: user.id,
+ email: user.email,
+ ) ==
+ null) {
+ return;
+ }
+ unawaited(
+ displayService.getProfilePictureBytes(
+ contactUserId: user.id,
+ email: user.email,
+ ),
+ );
+ }
+
@override
Widget build(BuildContext context) {
- final colorScheme = getEnteColorScheme(context);
- final displayChar = (user.displayName == null || user.displayName!.isEmpty)
- ? ((user.email.isEmpty) ? " " : user.email.substring(0, 1))
- : user.displayName!.substring(0, 1);
- Color decorationColor;
- if ((widget.user.id != null && widget.user.id! < 0) ||
- user.email == currentUserEmail) {
- decorationColor = Colors.black;
- } else {
- decorationColor = colorScheme.avatarColors[
- (user.email.length).remainder(colorScheme.avatarColors.length)];
- }
- return Container(
- color: decorationColor,
- child: Center(
- child: Text(
- displayChar.toUpperCase(),
- style: getEnteTextTheme(context).small.copyWith(color: Colors.white),
- ),
+ return ValueListenableBuilder<int>(
+ valueListenable: ContactsDisplayService.instance.changes,
+ builder: (context, __, ___) {
+ _preloadProfilePictureIfPossible();
+ final profilePictureBytes =
+ ContactsDisplayService.instance.getCachedProfilePictureBytes(
+ contactUserId: user.id,
+ email: user.email,
+ );
+ if (profilePictureBytes != null) {
+ return Image.memory(
+ profilePictureBytes,
+ fit: BoxFit.cover,
+ gaplessPlayback: true,
+ );
+ }
+
+ final colorScheme = getEnteColorScheme(context);
+ final displayLabel = user.resolvedDisplayName;
+ final displayChar =
+ displayLabel.isEmpty ? " " : displayLabel.substring(0, 1);
+ final avatarSeed = user.resolvedEmail;
+ Color decorationColor;
+ if ((user.id != null && user.id! < 0) ||
+ user.email == currentUserEmail) {
+ decorationColor = Colors.black;
+ } else {
+ decorationColor =
+ colorScheme.avatarColors[avatarSeed.length.remainder(
+ colorScheme.avatarColors.length,
+ )];
+ }
+
+ return Container(
+ color: decorationColor,
+ child: Center(
+ child: Text(
+ displayChar.toUpperCase(),
+ style: getEnteTextTheme(
+ context,
+ ).small.copyWith(color: Colors.white),
+ ),
+ ),
+ );
+ },
+ );
+ }
+}
+
+class _CirclePhotoAvatar extends StatelessWidget {
+ final Uint8List bytes;
+ final double size;
+
+ const _CirclePhotoAvatar({required this.bytes, required this.size});
+
+ @override
+ Widget build(BuildContext context) {
+ return ClipOval(
+ child: Image.memory(
+ bytes,
+ width: size,
+ height: size,
+ fit: BoxFit.cover,
+ gaplessPlayback: true,
),
);
}
diff --git a/mobile/packages/sharing/pubspec.lock b/mobile/packages/sharing/pubspec.lock
index 99bfe437f6..4f23b197a8 100644
--- a/mobile/packages/sharing/pubspec.lock
+++ b/mobile/packages/sharing/pubspec.lock
@@ -73,6 +73,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.1.2"
+ build_cli_annotations:
+ dependency: transitive
+ description:
+ name: build_cli_annotations
+ sha256: e563c2e01de8974566a1998410d3f6f03521788160a02503b0b1f1a46c7b3d95
+ url: "https://pub.dev"
+ source: hosted
+ version: "2.1.1"
characters:
dependency: transitive
description:
@@ -198,6 +206,13 @@ packages:
relative: true
source: path
version: "1.0.0"
+ ente_contacts:
+ dependency: "direct main"
+ description:
+ path: "../contacts"
+ relative: true
+ source: path
+ version: "1.0.0"
ente_crypto_api:
dependency: "direct main"
description:
@@ -240,6 +255,13 @@ packages:
relative: true
source: path
version: "1.0.0"
+ ente_rust:
+ dependency: transitive
+ description:
+ path: "../rust"
+ relative: true
+ source: path
+ version: "0.0.1"
ente_strings:
dependency: "direct main"
description:
@@ -440,6 +462,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.0.31"
+ flutter_rust_bridge:
+ dependency: transitive
+ description:
+ name: flutter_rust_bridge
+ sha256: e87d6b9ee934dcd24a128ccb2bd91905d2d5fe5c06245d6a8f5477d4907a437a
+ url: "https://pub.dev"
+ source: hosted
+ version: "2.12.0"
flutter_secure_storage:
dependency: transitive
description:
@@ -522,6 +552,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "8.2.14"
+ freezed_annotation:
+ dependency: transitive
+ description:
+ name: freezed_annotation
+ sha256: "7294967ff0a6d98638e7acb774aac3af2550777accd8149c90af5b014e6d44d8"
+ url: "https://pub.dev"
+ source: hosted
+ version: "3.1.0"
gtk:
dependency: transitive
description:
@@ -1039,6 +1077,62 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.10.1"
+ sqflite:
+ dependency: transitive
+ description:
+ name: sqflite
+ sha256: e2297b1da52f127bc7a3da11439985d9b536f75070f3325e62ada69a5c585d03
+ url: "https://pub.dev"
+ source: hosted
+ version: "2.4.2"
+ sqflite_android:
+ dependency: transitive
+ description:
+ name: sqflite_android
+ sha256: "2b3070c5fa881839f8b402ee4a39c1b4d561704d4ebbbcfb808a119bc2a1701b"
+ url: "https://pub.dev"
+ source: hosted
+ version: "2.4.1"
+ sqflite_common:
+ dependency: transitive
+ description:
+ name: sqflite_common
+ sha256: "6ef422a4525ecc601db6c0a2233ff448c731307906e92cabc9ba292afaae16a6"
+ url: "https://pub.dev"
+ source: hosted
+ version: "2.5.6"
+ sqflite_common_ffi:
+ dependency: transitive
+ description:
+ name: sqflite_common_ffi
+ sha256: "9faa2fedc5385ef238ce772589f7718c24cdddd27419b609bb9c6f703ea27988"
+ url: "https://pub.dev"
+ source: hosted
+ version: "2.3.6"
+ sqflite_darwin:
+ dependency: transitive
+ description:
+ name: sqflite_darwin
+ sha256: "279832e5cde3fe99e8571879498c9211f3ca6391b0d818df4e17d9fff5c6ccb3"
+ url: "https://pub.dev"
+ source: hosted
+ version: "2.4.2"
+ sqflite_platform_interface:
+ dependency: transitive
+ description:
+ name: sqflite_platform_interface
+ sha256: "8dd4515c7bdcae0a785b0062859336de775e8c65db81ae33dd5445f35be61920"
+ url: "https://pub.dev"
+ source: hosted
+ version: "2.4.0"
+ sqlite3:
+ dependency: transitive
+ description:
+ name: sqlite3
+ sha256: "3145bd74dcdb4fd6f5c6dda4d4e4490a8087d7f286a14dee5d37087290f0f8a2"
+ url: "https://pub.dev"
+ source: hosted
+ version: "2.9.4"
stack_trace:
dependency: transitive
description:
@@ -1079,6 +1173,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "8.1.0"
+ synchronized:
+ dependency: transitive
+ description:
+ name: synchronized
+ sha256: c254ade258ec8282947a0acbbc90b9575b4f19673533ee46f2f6e9b3aeefd7c0
+ url: "https://pub.dev"
+ source: hosted
+ version: "3.4.0"
term_glyph:
dependency: transitive
description:
diff --git a/mobile/packages/sharing/pubspec.yaml b/mobile/packages/sharing/pubspec.yaml
index 24cb06c354..ca034d418c 100644
--- a/mobile/packages/sharing/pubspec.yaml
+++ b/mobile/packages/sharing/pubspec.yaml
@@ -17,6 +17,8 @@ dependencies:
path: ../accounts
ente_configuration:
path: ../configuration
+ ente_contacts:
+ path: ../contacts
ente_crypto_api:
path: ../ente_crypto_api
ente_network:
diff --git a/mobile/packages/sharing/test/user_avator_widget_test.dart b/mobile/packages/sharing/test/user_avator_widget_test.dart
new file mode 100644
index 0000000000..f6b3d634a0
--- /dev/null
+++ b/mobile/packages/sharing/test/user_avator_widget_test.dart
@@ -0,0 +1,178 @@
+import 'dart:typed_data';
+
+import 'package:ente_configuration/base_configuration.dart';
+import 'package:ente_contacts/contacts.dart';
+import 'package:ente_sharing/models/user.dart';
+import 'package:ente_sharing/resolved_user_builder.dart';
+import 'package:ente_sharing/user_avator_widget.dart';
+import 'package:flutter/material.dart';
+import 'package:flutter_test/flutter_test.dart';
+
+void main() {
+ TestWidgetsFlutterBinding.ensureInitialized();
+
+ late ContactsDisplayService displayService;
+
+ setUp(() async {
+ displayService = ContactsDisplayService.instance;
+ await displayService.debugReset(clearLocalState: false);
+ });
+
+ tearDown(() async {
+ await displayService.debugReset();
+ });
+
+ testWidgets('user avatar prefers saved contact photo over initials', (
+ tester,
+ ) async {
+ displayService.debugHydrateContacts(
+ const [
+ ContactRecord(
+ id: 'ct_1',
+ contactUserId: 7,
+ email: '[email protected]',
+ data: ContactData(contactUserId: 7, name: 'Alice'),
+ profilePictureAttachmentId: 'att_1',
+ isDeleted: false,
+ createdAt: 1,
+ updatedAt: 2,
+ ),
+ ],
+ notify: false,
+ );
+ displayService.debugSetProfilePictureBytes(
+ contactUserId: 7,
+ bytes: _validPngBytes(),
+ notify: false,
+ );
+
+ await tester.pumpWidget(
+ MaterialApp(
+ home: Scaffold(
+ body: UserAvatarWidget(
+ User(id: 7, email: '[email protected]'),
+ config: _TestConfiguration(),
+ ),
+ ),
+ ),
+ );
+
+ expect(find.byType(Image), findsOneWidget);
+ expect(find.text('A'), findsNothing);
+ });
+
+ testWidgets('resolved user builder refreshes when contacts hydrate', (
+ tester,
+ ) async {
+ await tester.pumpWidget(
+ MaterialApp(
+ home: Scaffold(
+ body: ResolvedUserBuilder(
+ user: User(id: 7, email: '[email protected]'),
+ builder: (context, displayName, _) => Text(displayName),
+ ),
+ ),
+ ),
+ );
+
+ expect(find.text('[email protected]'), findsOneWidget);
+
+ displayService.debugHydrateContacts(const [
+ ContactRecord(
+ id: 'ct_1',
+ contactUserId: 7,
+ email: '[email protected]',
+ data: ContactData(contactUserId: 7, name: 'Alice'),
+ profilePictureAttachmentId: null,
+ isDeleted: false,
+ createdAt: 1,
+ updatedAt: 2,
+ ),
+ ]);
+ await tester.pump();
+
+ expect(find.text('Alice'), findsOneWidget);
+ });
+}
+
+class _TestConfiguration extends BaseConfiguration {
+ @override
+ String? getEmail() => '[email protected]';
+
+ @override
+ int? getUserID() => 1;
+}
+
+Uint8List _validPngBytes() {
+ return Uint8List.fromList(const [
+ 137,
+ 80,
+ 78,
+ 71,
+ 13,
+ 10,
+ 26,
+ 10,
+ 0,
+ 0,
+ 0,
+ 13,
+ 73,
+ 72,
+ 68,
+ 82,
+ 0,
+ 0,
+ 0,
+ 1,
+ 0,
+ 0,
+ 0,
+ 1,
+ 8,
+ 6,
+ 0,
+ 0,
+ 0,
+ 31,
+ 21,
+ 196,
+ 137,
+ 0,
+ 0,
+ 0,
+ 13,
+ 73,
+ 68,
+ 65,
+ 84,
+ 120,
+ 156,
+ 99,
+ 248,
+ 255,
+ 255,
+ 63,
+ 0,
+ 5,
+ 254,
+ 2,
+ 254,
+ 167,
+ 53,
+ 129,
+ 132,
+ 0,
+ 0,
+ 0,
+ 0,
+ 73,
+ 69,
+ 78,
+ 68,
+ 174,
+ 66,
+ 96,
+ 130,
+ ]);
+}