Skip to content

armgit / ente

Public Imported from GitHub
0

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

Fix library sharing interaction regressions

Neeraj Guptac6bdb4d51b27
diff --git a/mobile/apps/photos/lib/ui/sharing/library_sharing/library_sharing_controller.dart b/mobile/apps/photos/lib/ui/sharing/library_sharing/library_sharing_controller.dart
index 2ef933fd22..2fdda6fa97 100644
--- a/mobile/apps/photos/lib/ui/sharing/library_sharing/library_sharing_controller.dart
+++ b/mobile/apps/photos/lib/ui/sharing/library_sharing/library_sharing_controller.dart
@@ -47,6 +47,7 @@ class LibrarySharingController extends ChangeNotifier {
!_isLoading &&
_loadError == null &&
(_selectionMode != null || isFirstTime);
+ bool get selectsAlbumsOnTap => _selectionMode != null || hasSelection;
bool get hasSelection => _selectedRoles.isNotEmpty;
int get selectedCount => _selectedRoles.length;
int get selectedActiveShareCount =>
diff --git a/mobile/apps/photos/lib/ui/sharing/library_sharing/library_sharing_page.dart b/mobile/apps/photos/lib/ui/sharing/library_sharing/library_sharing_page.dart
index f4cf61cb71..0fcf065e90 100644
--- a/mobile/apps/photos/lib/ui/sharing/library_sharing/library_sharing_page.dart
+++ b/mobile/apps/photos/lib/ui/sharing/library_sharing/library_sharing_page.dart
@@ -227,7 +227,7 @@ class _LibrarySharingPageState extends State<LibrarySharingPage> {
albums,
tag: 'library_sharing_${_recipient.userID}',
selectionCallbacks: (
- isSelectionModeActive: _controller.isSelecting,
+ isSelectionModeActive: _controller.selectsAlbumsOnTap,
isSelected: _controller.isSelected,
toggle: _toggleAlbumSelection,
),
diff --git a/mobile/apps/photos/test/ui/sharing/library_sharing_controller_test.dart b/mobile/apps/photos/test/ui/sharing/library_sharing_controller_test.dart
index 3031ca3478..5e81971673 100644
--- a/mobile/apps/photos/test/ui/sharing/library_sharing_controller_test.dart
+++ b/mobile/apps/photos/test/ui/sharing/library_sharing_controller_test.dart
@@ -7,6 +7,25 @@ import 'package:photos/ui/sharing/library_sharing/library_sharing_controller.dar
import 'library_sharing_test_helpers.dart';
void main() {
+ test('first-time tap selection starts after an album is selected', () async {
+ final repository = FakeLibrarySharingRepository([
+ librarySharingTestAlbum(1),
+ ]);
+ final controller = LibrarySharingController(
+ recipient: librarySharingTestRecipient,
+ repository: repository,
+ );
+ await controller.load();
+
+ expect(controller.selectsAlbumsOnTap, isFalse);
+
+ controller.toggleSelection(repository.albums.single);
+ expect(controller.selectsAlbumsOnTap, isTrue);
+
+ controller.clearSelection();
+ expect(controller.selectsAlbumsOnTap, isFalse);
+ });
+
test('shares a new album and returns to the shared overview', () async {
final repository = FakeLibrarySharingRepository([
librarySharingTestAlbum(
diff --git a/mobile/apps/photos/test/ui/sharing/library_sharing_page_test.dart b/mobile/apps/photos/test/ui/sharing/library_sharing_page_test.dart
index 0ef1f1b6ee..b51e32790d 100644
--- a/mobile/apps/photos/test/ui/sharing/library_sharing_page_test.dart
+++ b/mobile/apps/photos/test/ui/sharing/library_sharing_page_test.dart
@@ -1,11 +1,12 @@
import 'dart:async';
+import 'dart:ui' show Tristate;
import 'package:ente_components/ente_components.dart';
+import 'package:ente_strings/ente_strings.dart';
import 'package:flutter/material.dart';
-import 'package:flutter/semantics.dart' show SemanticsAction, SemanticsFlag;
+import 'package:flutter/semantics.dart' show SemanticsAction;
import 'package:flutter_test/flutter_test.dart';
import 'package:photos/ente_theme_data.dart';
-import 'package:ente_strings/ente_strings.dart';
import 'package:photos/models/collection/collection.dart';
import 'package:photos/ui/sharing/library_sharing/library_sharing_controller.dart';
import 'package:photos/ui/sharing/library_sharing/library_sharing_page.dart';
@@ -424,8 +425,7 @@ void main() {
var semanticsData = tester
.getSemantics(selectionControls)
.getSemanticsData();
- expect(semanticsData.hasFlag(SemanticsFlag.hasExpandedState), isTrue);
- expect(semanticsData.hasFlag(SemanticsFlag.isExpanded), isTrue);
+ expect(semanticsData.flagsCollection.isExpanded, Tristate.isTrue);
expect(semanticsData.hasAction(SemanticsAction.collapse), isTrue);
expect(semanticsData.hasAction(SemanticsAction.expand), isFalse);
@@ -437,7 +437,7 @@ void main() {
await tester.pumpAndSettle();
expect(isExpanded(), isFalse);
semanticsData = tester.getSemantics(selectionControls).getSemanticsData();
- expect(semanticsData.hasFlag(SemanticsFlag.isExpanded), isFalse);
+ expect(semanticsData.flagsCollection.isExpanded, Tristate.isFalse);
expect(semanticsData.hasAction(SemanticsAction.expand), isTrue);
expect(semanticsData.hasAction(SemanticsAction.collapse), isFalse);
semantics.dispose();
diff --git a/mobile/packages/ente_components/lib/components/app_bar_component.dart b/mobile/packages/ente_components/lib/components/app_bar_component.dart
index 70dc9f4426..840e42609f 100644
--- a/mobile/packages/ente_components/lib/components/app_bar_component.dart
+++ b/mobile/packages/ente_components/lib/components/app_bar_component.dart
@@ -1076,6 +1076,7 @@ class _MovingHeaderTitle extends StatelessWidget {
),
);
return Stack(
+ clipBehavior: Clip.none,
children: [
Positioned(
left: 0,