Skip to content

armgit / ente

Public Imported from GitHub
0

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

[mob][photos] Add gesture interaction on grant permission screen and local photo sync screen to send logs

ashilkn75448d5e5a7a
diff --git a/mobile/lib/main.dart b/mobile/lib/main.dart
index c2c3a38fa6..459a6d041e 100644
--- a/mobile/lib/main.dart
+++ b/mobile/lib/main.dart
@@ -201,7 +201,7 @@ Future<void> _init(bool isBackground, {String via = ''}) async {
Future.delayed(const Duration(seconds: 15), () {
if (!initComplete && !isBackground) {
_logger.severe("Stuck on splash screen for >= 15 seconds");
- sendLogsForInit(
+ triggerSendLogs(
"Stuck on splash screen for >= 15 seconds on ${Platform.operatingSystem}",
null,
diff --git a/mobile/lib/ui/home/grant_permissions_widget.dart b/mobile/lib/ui/home/grant_permissions_widget.dart
index ab6aff07ba..3139d27c1d 100644
--- a/mobile/lib/ui/home/grant_permissions_widget.dart
+++ b/mobile/lib/ui/home/grant_permissions_widget.dart
@@ -1,73 +1,105 @@
+import "dart:async";
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:photo_manager/photo_manager.dart';
import "package:photos/generated/l10n.dart";
import 'package:photos/services/sync_service.dart';
+import "package:photos/theme/ente_theme.dart";
+import "package:photos/utils/debouncer.dart";
+import "package:photos/utils/email_util.dart";
import "package:photos/utils/photo_manager_util.dart";
import "package:styled_text/styled_text.dart";
-class GrantPermissionsWidget extends StatelessWidget {
- const GrantPermissionsWidget({Key? key}) : super(key: key);
+class GrantPermissionsWidget extends StatefulWidget {
+ const GrantPermissionsWidget({super.key});
+
+ @override
+ State<GrantPermissionsWidget> createState() => _GrantPermissionsWidgetState();
+}
+
+class _GrantPermissionsWidgetState extends State<GrantPermissionsWidget> {
+ final _debouncer = Debouncer(const Duration(milliseconds: 500));
+
+ @override
+ void dispose() {
+ _debouncer.cancelDebounceTimer();
+ super.dispose();
+ }
+
@override
Widget build(BuildContext context) {
final isLightMode = Theme.of(context).brightness == Brightness.light;
return Scaffold(
body: SingleChildScrollView(
- child: Padding(
- padding: const EdgeInsets.only(top: 20, bottom: 120),
- child: Column(
- children: [
- const SizedBox(
- height: 24,
- ),
- Center(
- child: Stack(
- alignment: Alignment.center,
- children: [
- isLightMode
- ? Image.asset(
- 'assets/loading_photos_background.png',
- color: Colors.white.withOpacity(0.4),
- colorBlendMode: BlendMode.modulate,
- )
- : Image.asset(
- 'assets/loading_photos_background_dark.png',
- ),
- Center(
- child: Column(
- children: [
- const SizedBox(height: 42),
- Image.asset(
- "assets/gallery_locked.png",
- height: 160,
- ),
- ],
+ child: GestureDetector(
+ behavior: HitTestBehavior.opaque,
+ onScaleEnd: (details) {
+ _debouncer.run(() async {
+ unawaited(
+ triggerSendLogs(
+ "Stuck on grant permission screen on ${Platform.operatingSystem}",
+ null,
+ ),
+ );
+ });
+ },
+ child: Padding(
+ padding: const EdgeInsets.only(top: 20, bottom: 120),
+ child: Column(
+ children: [
+ const SizedBox(
+ height: 24,
+ ),
+ Center(
+ child: Stack(
+ alignment: Alignment.center,
+ children: [
+ isLightMode
+ ? Image.asset(
+ 'assets/loading_photos_background.png',
+ color: Colors.white.withOpacity(0.4),
+ colorBlendMode: BlendMode.modulate,
+ )
+ : Image.asset(
+ 'assets/loading_photos_background_dark.png',
+ ),
+ Center(
+ child: Column(
+ children: [
+ const SizedBox(height: 42),
+ Image.asset(
+ "assets/gallery_locked.png",
+ height: 160,
+ ),
+ ],
+ ),
),
- ),
- ],
+ ],
+ ),
),
- ),
- const SizedBox(height: 36),
- Padding(
- padding: const EdgeInsets.fromLTRB(40, 0, 40, 0),
- child: StyledText(
- text: S.of(context).entePhotosPerm,
- style: Theme.of(context)
- .textTheme
- .headlineSmall!
- .copyWith(fontWeight: FontWeight.w700),
- tags: {
- 'i': StyledTextTag(
- style: Theme.of(context)
- .textTheme
- .headlineSmall!
- .copyWith(fontWeight: FontWeight.w400),
- ),
- },
+ const SizedBox(height: 36),
+ Padding(
+ padding: const EdgeInsets.fromLTRB(40, 0, 40, 0),
+ child: StyledText(
+ text: S.of(context).entePhotosPerm,
+ style: Theme.of(context)
+ .textTheme
+ .headlineSmall!
+ .copyWith(fontWeight: FontWeight.w700),
+ tags: {
+ 'i': StyledTextTag(
+ style: Theme.of(context)
+ .textTheme
+ .headlineSmall!
+ .copyWith(fontWeight: FontWeight.w400),
+ ),
+ },
+ ),
),
- ),
- ],
+ ],
+ ),
),
),
),
@@ -75,7 +107,7 @@ class GrantPermissionsWidget extends StatelessWidget {
decoration: BoxDecoration(
boxShadow: [
BoxShadow(
- color: Theme.of(context).colorScheme.background,
+ color: getEnteColorScheme(context).backgroundBase,
spreadRadius: 190,
blurRadius: 30,
offset: const Offset(0, 170),
diff --git a/mobile/lib/ui/home/loading_photos_widget.dart b/mobile/lib/ui/home/loading_photos_widget.dart
index 1eeddc4b8a..8f7d2f95ff 100644
--- a/mobile/lib/ui/home/loading_photos_widget.dart
+++ b/mobile/lib/ui/home/loading_photos_widget.dart
@@ -11,10 +11,12 @@ import "package:photos/generated/l10n.dart";
import 'package:photos/services/local_sync_service.dart';
import 'package:photos/ui/common/bottom_shadow.dart';
import 'package:photos/ui/settings/backup/backup_folder_selection_page.dart';
+import "package:photos/utils/debouncer.dart";
+import "package:photos/utils/email_util.dart";
import 'package:photos/utils/navigation_util.dart';
class LoadingPhotosWidget extends StatefulWidget {
- const LoadingPhotosWidget({Key? key}) : super(key: key);
+ const LoadingPhotosWidget({super.key});
@override
State<LoadingPhotosWidget> createState() => _LoadingPhotosWidgetState();
@@ -29,6 +31,7 @@ class _LoadingPhotosWidgetState extends State<LoadingPhotosWidget> {
initialPage: 0,
);
final List<String> _messages = [];
+ final _debouncer = Debouncer(const Duration(milliseconds: 500));
@override
void initState() {
@@ -81,6 +84,7 @@ class _LoadingPhotosWidgetState extends State<LoadingPhotosWidget> {
void dispose() {
_firstImportEvent.cancel();
_importProgressEvent.cancel();
+ _debouncer.cancelDebounceTimer();
super.dispose();
}
@@ -91,87 +95,102 @@ class _LoadingPhotosWidgetState extends State<LoadingPhotosWidget> {
return Scaffold(
body: SingleChildScrollView(
child: Center(
- child: Padding(
- padding: const EdgeInsets.symmetric(horizontal: 20),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.center,
- children: [
- Stack(
- alignment: Alignment.center,
- children: [
- isLightMode
- ? Image.asset(
- 'assets/loading_photos_background.png',
- color: Colors.white.withOpacity(0.5),
- colorBlendMode: BlendMode.modulate,
- )
- : Image.asset(
- 'assets/loading_photos_background_dark.png',
- color: Colors.white.withOpacity(0.25),
- colorBlendMode: BlendMode.modulate,
+ child: GestureDetector(
+ behavior: HitTestBehavior.opaque,
+ onScaleEnd: (details) {
+ _debouncer.run(() async {
+ unawaited(
+ triggerSendLogs(
+ "Stuck on loading local photos screen on ${Platform.operatingSystem}",
+ null,
+ ),
+ );
+ });
+ },
+ child: Padding(
+ padding: const EdgeInsets.symmetric(horizontal: 20),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.center,
+ children: [
+ Stack(
+ alignment: Alignment.center,
+ children: [
+ isLightMode
+ ? Image.asset(
+ 'assets/loading_photos_background.png',
+ color: Colors.white.withOpacity(0.5),
+ colorBlendMode: BlendMode.modulate,
+ )
+ : Image.asset(
+ 'assets/loading_photos_background_dark.png',
+ color: Colors.white.withOpacity(0.25),
+ colorBlendMode: BlendMode.modulate,
+ ),
+ Column(
+ children: [
+ const SizedBox(height: 24),
+ Lottie.asset(
+ 'assets/loadingGalleryLottie.json',
+ height: 400,
),
- Column(
- children: [
- const SizedBox(height: 24),
- Lottie.asset(
- 'assets/loadingGalleryLottie.json',
- height: 400,
- ),
- ],
- ),
- ],
- ),
- Text(
- _loadingMessage,
- style: TextStyle(
- color: Theme.of(context).colorScheme.subTextColor,
+ ],
+ ),
+ ],
),
- ),
- const SizedBox(height: 54),
- Column(
- children: [
- Row(
- mainAxisAlignment: MainAxisAlignment.start,
- children: [
- Text(
- S.of(context).didYouKnow,
- style: Theme.of(context)
- .textTheme
- .titleLarge!
- .copyWith(
- color: Theme.of(context).colorScheme.greenText,
- ),
- ),
- ],
- ),
- const SizedBox(
- height: 16,
+ Text(
+ _loadingMessage,
+ style: TextStyle(
+ color: Theme.of(context).colorScheme.subTextColor,
),
- SizedBox(
- height: 175,
- child: Stack(
+ ),
+ const SizedBox(height: 54),
+ Column(
+ children: [
+ Row(
+ mainAxisAlignment: MainAxisAlignment.start,
children: [
- PageView.builder(
- scrollDirection: Axis.vertical,
- controller: _pageController,
- itemBuilder: (context, index) {
- return _getMessage(_messages[index]);
- },
- itemCount: _messages.length,
- physics: const NeverScrollableScrollPhysics(),
- ),
- const Positioned(
- bottom: 0,
- left: 0,
- right: 0,
- child: BottomShadowWidget(),
+ Text(
+ S.of(context).didYouKnow,
+ style: Theme.of(context)
+ .textTheme
+ .titleLarge!
+ .copyWith(
+ color:
+ Theme.of(context).colorScheme.greenText,
+ ),
),
],
),
- ),
- ],
- ),
- ],
+ const SizedBox(
+ height: 16,
+ ),
+ SizedBox(
+ height: 175,
+ child: Stack(
+ children: [
+ PageView.builder(
+ scrollDirection: Axis.vertical,
+ controller: _pageController,
+ itemBuilder: (context, index) {
+ return _getMessage(_messages[index]);
+ },
+ itemCount: _messages.length,
+ physics: const NeverScrollableScrollPhysics(),
+ ),
+ const Positioned(
+ bottom: 0,
+ left: 0,
+ right: 0,
+ child: BottomShadowWidget(),
+ ),
+ ],
+ ),
+ ),
+ ],
+ ),
+ ],
+ ),
),
),
),
diff --git a/mobile/lib/utils/email_util.dart b/mobile/lib/utils/email_util.dart
index c500516ca0..639e870672 100644
--- a/mobile/lib/utils/email_util.dart
+++ b/mobile/lib/utils/email_util.dart
@@ -123,7 +123,7 @@ Future<void> _sendLogs(
}
}
-Future<void> sendLogsForInit(
+Future<void> triggerSendLogs(
String toEmail,
String? subject,
String? body,