Skip to content

armgit / ente

Public Imported from GitHub
0

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

Add Locker document scanner changelog

AmanRajSinghMourya8592fdeb7a0d
diff --git a/mobile/apps/locker/assets/2.0x/whats_new_illustration.png b/mobile/apps/locker/assets/2.0x/whats_new_illustration.png
new file mode 100644
index 0000000000..0625a4f0e8
Binary files /dev/null and b/mobile/apps/locker/assets/2.0x/whats_new_illustration.png differ
diff --git a/mobile/apps/locker/assets/3.0x/whats_new_illustration.png b/mobile/apps/locker/assets/3.0x/whats_new_illustration.png
new file mode 100644
index 0000000000..14f65b7e10
Binary files /dev/null and b/mobile/apps/locker/assets/3.0x/whats_new_illustration.png differ
diff --git a/mobile/apps/locker/assets/whats_new_illustration.png b/mobile/apps/locker/assets/whats_new_illustration.png
new file mode 100644
index 0000000000..6c009e0f9d
Binary files /dev/null and b/mobile/apps/locker/assets/whats_new_illustration.png differ
diff --git a/mobile/apps/locker/lib/services/update_service.dart b/mobile/apps/locker/lib/services/update_service.dart
index 642978411f..ebe7df62ba 100644
--- a/mobile/apps/locker/lib/services/update_service.dart
+++ b/mobile/apps/locker/lib/services/update_service.dart
@@ -16,7 +16,7 @@ class UpdateService {
static const String _updateNotificationsEnabledKey =
"update_notifications_enabled";
static const String kChangeLogShownVersionKey = "update_change_log_key";
- static const int currentChangeLogVersion = 1;
+ static const int currentChangeLogVersion = 2;
static const String _lockerIndependentPackageName =
"io.ente.locker.independent";
static const String _lockerIndependentPackagePrefix =
diff --git a/mobile/apps/locker/lib/ui/settings/pages/debug_settings_page.dart b/mobile/apps/locker/lib/ui/settings/pages/debug_settings_page.dart
new file mode 100644
index 0000000000..1bb6023f6a
--- /dev/null
+++ b/mobile/apps/locker/lib/ui/settings/pages/debug_settings_page.dart
@@ -0,0 +1,22 @@
+import "package:ente_components/ente_components.dart";
+import "package:flutter/material.dart";
+import "package:hugeicons/hugeicons.dart";
+import "package:locker/ui/settings/widgets/change_log_sheet.dart";
+
+class DebugSettingsPage extends StatelessWidget {
+ const DebugSettingsPage({super.key});
+
+ @override
+ Widget build(BuildContext context) {
+ return SettingsPageScaffold(
+ title: "Debug",
+ children: [
+ SettingsItem(
+ title: "Show change log",
+ icon: HugeIcons.strokeRoundedInformationCircle,
+ onTap: () => showChangeLogSheet(context),
+ ),
+ ],
+ );
+ }
+}
diff --git a/mobile/apps/locker/lib/ui/settings/settings_page.dart b/mobile/apps/locker/lib/ui/settings/settings_page.dart
index 206dd10f5a..d11bbec8fc 100644
--- a/mobile/apps/locker/lib/ui/settings/settings_page.dart
+++ b/mobile/apps/locker/lib/ui/settings/settings_page.dart
@@ -9,9 +9,11 @@ import "package:ente_ui/components/settings/social_icons_row.dart";
import "package:flutter/foundation.dart";
import "package:flutter/material.dart";
import "package:hugeicons/hugeicons.dart";
+import "package:locker/services/feature_flag_service.dart";
import "package:locker/services/review_service.dart";
import "package:locker/ui/settings/pages/about_page.dart";
import "package:locker/ui/settings/pages/account_settings_page.dart";
+import "package:locker/ui/settings/pages/debug_settings_page.dart";
import "package:locker/ui/settings/pages/general_settings_page.dart";
import "package:locker/ui/settings/pages/security_settings_page.dart";
import "package:locker/ui/settings/pages/support_page.dart";
@@ -106,6 +108,15 @@ class SettingsWidget extends StatelessWidget {
const SizedBox(height: 24),
const Center(child: SocialIconsRow()),
const AppVersionWidget(),
+ if (hasLoggedIn &&
+ (FeatureFlagService.instance.internalUser || kDebugMode)) ...[
+ SettingsItem(
+ icon: HugeIcons.strokeRoundedBug02,
+ title: "Debug",
+ onTap: () => _navigateTo(context, const DebugSettingsPage()),
+ ),
+ const SizedBox(height: 16),
+ ],
]);
return Column(
diff --git a/mobile/apps/locker/lib/ui/settings/widgets/change_log_sheet.dart b/mobile/apps/locker/lib/ui/settings/widgets/change_log_sheet.dart
index 74ef361277..2edeab7c64 100644
--- a/mobile/apps/locker/lib/ui/settings/widgets/change_log_sheet.dart
+++ b/mobile/apps/locker/lib/ui/settings/widgets/change_log_sheet.dart
@@ -1,107 +1,149 @@
import "package:ente_components/ente_components.dart";
+import "package:ente_strings/ente_strings.dart";
import "package:flutter/material.dart";
+import "package:hugeicons/hugeicons.dart";
import "package:locker/ui/settings/widgets/change_log_strings.dart";
-class _ChangeLogEntry {
- final String title;
- final String description;
-
- const _ChangeLogEntry(this.title, this.description);
-}
-
Future<void> showChangeLogSheet(BuildContext context) {
final strings = ChangeLogStrings.forLocale(Localizations.localeOf(context));
return showBottomSheetComponent<void>(
context: context,
- builder: (sheetContext) => BottomSheetComponent(
- title: strings.sheetTitle,
- content: _ChangeLogSheetBody(strings: strings),
+ builder: (_) => _ChangeLogSheet(strings: strings),
+ );
+}
+
+class _ChangeLogSheet extends StatefulWidget {
+ final ChangeLogStrings strings;
+
+ const _ChangeLogSheet({required this.strings});
+
+ @override
+ State<_ChangeLogSheet> createState() => _ChangeLogSheetState();
+}
+
+class _ChangeLogSheetState extends State<_ChangeLogSheet> {
+ final ScrollController _scrollController = ScrollController();
+
+ @override
+ void dispose() {
+ _scrollController.dispose();
+ super.dispose();
+ }
+
+ @override
+ Widget build(BuildContext context) {
+ final colors = context.componentColors;
+ return BottomSheetComponent(
+ header: _ChangeLogHeader(title: context.strings.whatsNew),
+ crossAxisAlignment: CrossAxisAlignment.stretch,
+ actionsTopSpacing: Spacing.lg,
+ content: Flexible(
+ child: ScrollbarTheme(
+ data: ScrollbarTheme.of(context).copyWith(
+ thumbColor: WidgetStatePropertyAll(colors.fillDarkest),
+ trackColor: WidgetStatePropertyAll(colors.fillDark),
+ trackBorderColor: const WidgetStatePropertyAll(Colors.transparent),
+ ),
+ child: Scrollbar(
+ controller: _scrollController,
+ thumbVisibility: true,
+ trackVisibility: true,
+ thickness: 5,
+ radius: const Radius.circular(39),
+ child: ListView.separated(
+ controller: _scrollController,
+ shrinkWrap: true,
+ physics: const BouncingScrollPhysics(),
+ padding: const EdgeInsets.only(right: Spacing.lg),
+ itemBuilder: (context, index) => _ChangeLogEntryTile(
+ title: widget.strings.entries[index].title,
+ description: widget.strings.entries[index].description,
+ ),
+ separatorBuilder: (_, _) => const SizedBox(height: Spacing.lg),
+ itemCount: widget.strings.entries.length,
+ ),
+ ),
+ ),
+ ),
actions: [
ButtonComponent(
- label: strings.continueLabel,
- onTap: () => Navigator.of(sheetContext).pop(),
+ variant: ButtonComponentVariant.primary,
+ size: ButtonComponentSize.large,
+ label: context.strings.continueLabel,
+ shouldSurfaceExecutionStates: false,
+ onTap: () => Navigator.of(context).pop(),
),
],
- ),
- );
+ );
+ }
}
-class _ChangeLogSheetBody extends StatelessWidget {
- final ChangeLogStrings strings;
+class _ChangeLogEntryTile extends StatelessWidget {
+ final String title;
+ final String description;
- const _ChangeLogSheetBody({required this.strings});
+ const _ChangeLogEntryTile({required this.title, required this.description});
@override
Widget build(BuildContext context) {
final colors = context.componentColors;
- final maxHeight = MediaQuery.sizeOf(context).height * 0.5;
- final entries =
- <_ChangeLogEntry>[
- _ChangeLogEntry(strings.title1, strings.desc1),
- _ChangeLogEntry(strings.title2, strings.desc2),
- _ChangeLogEntry(strings.title3, strings.desc3),
- ]
- .where(
- (entry) =>
- entry.title.trim().isNotEmpty ||
- entry.description.trim().isNotEmpty,
- )
- .toList(growable: false);
return Column(
- mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
- strings.sheetSubtitle,
- style: TextStyles.body.copyWith(color: colors.textLight),
+ title,
+ textAlign: TextAlign.left,
+ style: TextStyles.large.copyWith(color: colors.textBase),
),
- const SizedBox(height: 16),
- ConstrainedBox(
- constraints: BoxConstraints(maxHeight: maxHeight),
- child: ListView.separated(
- shrinkWrap: true,
- physics: const BouncingScrollPhysics(),
- itemBuilder: (context, index) {
- final entry = entries[index];
- return _ChangeLogEntryTile(entry: entry);
- },
- separatorBuilder: (_, _) => const SizedBox(height: 12),
- itemCount: entries.length,
- ),
+ const SizedBox(height: Spacing.md),
+ Text(
+ description,
+ textAlign: TextAlign.left,
+ style: TextStyles.body.copyWith(color: colors.textLight),
),
],
);
}
}
-class _ChangeLogEntryTile extends StatelessWidget {
- final _ChangeLogEntry entry;
+class _ChangeLogHeader extends StatelessWidget {
+ const _ChangeLogHeader({required this.title});
- const _ChangeLogEntryTile({required this.entry});
+ final String title;
@override
Widget build(BuildContext context) {
final colors = context.componentColors;
-
- return Container(
- width: double.infinity,
- padding: const EdgeInsets.all(14),
- decoration: BoxDecoration(
- color: colors.fillLight,
- borderRadius: BorderRadius.circular(12),
- ),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text(entry.title, style: TextStyles.bodyBold),
- const SizedBox(height: 6),
- Text(
- entry.description,
- style: TextStyles.body.copyWith(color: colors.textLight),
+ return Column(
+ crossAxisAlignment: CrossAxisAlignment.stretch,
+ children: [
+ Align(
+ alignment: Alignment.centerRight,
+ child: IconButtonComponent(
+ tooltip: "Close",
+ variant: IconButtonComponentVariant.circular,
+ shouldSurfaceExecutionStates: false,
+ icon: const HugeIcon(
+ icon: HugeIcons.strokeRoundedCancel01,
+ size: IconSizes.small,
+ ),
+ onTap: () => Navigator.of(context).pop(),
),
- ],
- ),
+ ),
+ const SizedBox(height: Spacing.xs),
+ Image.asset(
+ "assets/whats_new_illustration.png",
+ width: 115,
+ height: 108,
+ ),
+ const SizedBox(height: Spacing.sm),
+ Text(
+ title,
+ textAlign: TextAlign.center,
+ style: TextStyles.display2.copyWith(color: colors.textBase),
+ ),
+ ],
);
}
}
diff --git a/mobile/apps/locker/lib/ui/settings/widgets/change_log_strings.dart b/mobile/apps/locker/lib/ui/settings/widgets/change_log_strings.dart
index 02205a8aec..06568ab2fd 100644
--- a/mobile/apps/locker/lib/ui/settings/widgets/change_log_strings.dart
+++ b/mobile/apps/locker/lib/ui/settings/widgets/change_log_strings.dart
@@ -1,27 +1,9 @@
import "dart:ui";
class ChangeLogStrings {
- final String sheetTitle;
- final String sheetSubtitle;
- final String continueLabel;
- final String title1;
- final String desc1;
- final String title2;
- final String desc2;
- final String title3;
- final String desc3;
+ final List<ChangeLogEntryStrings> entries;
- const ChangeLogStrings({
- required this.sheetTitle,
- required this.sheetSubtitle,
- required this.continueLabel,
- required this.title1,
- required this.desc1,
- required this.title2,
- required this.desc2,
- required this.title3,
- required this.desc3,
- });
+ const ChangeLogStrings({required this.entries});
static ChangeLogStrings forLocale(Locale locale) {
final key = locale.countryCode != null && locale.countryCode!.isNotEmpty
@@ -35,17 +17,20 @@ class ChangeLogStrings {
static const Map<String, ChangeLogStrings> _translations = {
"en": ChangeLogStrings(
- sheetTitle: "What's new",
- sheetSubtitle: "",
- continueLabel: "Continue",
- title1: "Share collections as a link",
- desc1:
- "You can now share any collection as a link. This includes password protection, device limits, and link expiry.",
- title2: "Keep items offline",
- desc2:
- "Keep your important items available locally for offline use. They stay encrypted on your device and are decrypted only when you open them in Locker.",
- title3: "",
- desc3: "",
+ entries: [
+ ChangeLogEntryStrings(
+ title: "Document scanner",
+ description:
+ "Locker can now scan paper documents. Point the camera at a page and save it as a PDF, straight into the collection you pick.",
+ ),
+ ],
),
};
}
+
+class ChangeLogEntryStrings {
+ final String title;
+ final String description;
+
+ const ChangeLogEntryStrings({required this.title, required this.description});
+}