Collaboration UX Improvements #838

Collaboration UX Improvements
This commit is contained in:
Neeraj Gupta 2023-02-03 10:04:11 +05:30 committed by GitHub
commit 3587b6b622
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 22 additions and 14 deletions

View file

@ -16,13 +16,15 @@ extension CollectionFileActions on CollectionActions {
BuildContext bContext,
Collection collection,
SelectedFiles selectedFiles,
bool removingOthersFile,
) async {
final actionResult = await showActionSheet(
context: bContext,
buttons: [
ButtonWidget(
labelText: "Yes, remove",
buttonType: ButtonType.neutral,
labelText: "Remove",
buttonType:
removingOthersFile ? ButtonType.critical : ButtonType.neutral,
buttonSize: ButtonSize.large,
shouldStickToDarkTheme: true,
isInAlert: true,
@ -48,9 +50,11 @@ extension CollectionFileActions on CollectionActions {
isInAlert: true,
),
],
title: "Remove from album?",
body: "Selected items will be removed from this album. Items which are "
"only in this album will be moved to Uncategorized.",
title: removingOthersFile ? "Remove from album?" : null,
body: removingOthersFile
? "Some of the items you are removing were "
"added by other people, and you will lose access to them"
: "Selected items will be removed from this album",
actionSheetType: ActionSheetType.defaultActionSheet,
);
if (actionResult != null && actionResult == ButtonAction.error) {

View file

@ -26,10 +26,13 @@ class UserAvatarWidget extends StatelessWidget {
final displayChar = (user.name == null || user.name!.isEmpty)
? ((user.email.isEmpty) ? " " : user.email.substring(0, 1))
: user.name!.substring(0, 1);
final randomColor = colorScheme.avatarColors[
(user.id ?? 0).remainder(colorScheme.avatarColors.length)];
final Color decorationColor =
((user.id ?? -1) == currentUserID) ? Colors.black : randomColor;
Color decorationColor;
if (user.id == null || user.id! <= 0 || user.id == currentUserID) {
decorationColor = Colors.black;
} else {
decorationColor = colorScheme
.avatarColors[(user.id!).remainder(colorScheme.avatarColors.length)];
}
final avatarStyle = getAvatarStyle(context, type);
final double size = avatarStyle.item1;

View file

@ -316,10 +316,13 @@ class _FileSelectionActionWidgetState extends State<FileSelectionActionWidget> {
widget.selectedFiles
.unSelectAll(split.ownedByOtherUsers.toSet(), skipNotify: true);
}
final bool removingOthersFile =
isCollectionOwner && split.ownedByOtherUsers.isNotEmpty;
await collectionActions.showRemoveFromCollectionSheetV2(
context,
widget.collection!,
widget.selectedFiles,
removingOthersFile,
);
}

View file

@ -10,7 +10,6 @@ import 'package:photos/db/files_db.dart';
import 'package:photos/db/trash_db.dart';
import 'package:photos/events/files_updated_event.dart';
import 'package:photos/events/local_photos_updated_event.dart';
import 'package:photos/extensions/string_ext.dart';
import 'package:photos/models/collection.dart';
import 'package:photos/models/file.dart';
import 'package:photos/models/file_type.dart';
@ -128,11 +127,10 @@ class _ThumbnailWidgetState extends State<ThumbnailWidget> {
);
} else if (widget.file!.pubMagicMetadata!.uploaderName != null) {
contentChildren.add(
// Use uploadName hashCode as userID so that different uploader
// get avatar color
// Use -1 as userID for enforcing black avatar color
OwnerAvatarOverlayIcon(
User(
id: widget.file!.pubMagicMetadata!.uploaderName.sumAsciiValues,
id: -1,
email: '',
name: widget.file!.pubMagicMetadata!.uploaderName,
),

View file

@ -12,7 +12,7 @@ description: ente photos application
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 0.7.19+419
version: 0.7.20+420
environment:
sdk: '>=2.17.0 <3.0.0'