π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
rejig
Manav Rathi9327cb114c49
diff --git a/web/packages/gallery/components/FileInfo.tsx b/web/packages/gallery/components/FileInfo.tsxindex a9bbfa4ba3..d81d721dfe 100644--- a/web/packages/gallery/components/FileInfo.tsx+++ b/web/packages/gallery/components/FileInfo.tsx@@ -665,11 +665,8 @@ const CreationTime: React.FC<CreationTimeProps> = ({}) => {const { onGenericError } = useBaseContext();- const [loading, setLoading] = useState(false);- const [isInEditMode, setIsInEditMode] = useState(false);-- const openEditMode = () => setIsInEditMode(true);- const closeEditMode = () => setIsInEditMode(false);+ const [isEditing, setIsEditing] = useState(false);+ const [isSaving, setIsSaving] = useState(false);const originalDate = fileCreationPhotoDate(file,@@ -677,9 +674,13 @@ const CreationTime: React.FC<CreationTimeProps> = ({);const saveEdits = async (pickedTime: ParsedMetadataDate) => {- try {- setLoading(true);- if (isInEditMode) {+ setIsEditing(false);+ setIsSaving(true);++ const { dateTime, timestamp: editedTime } = pickedTime;+ if (editedTime != originalDate.getTime()) {+ // If not same as before.+ try {// [Note: Don't modify offsetTime when editing date via picker]//// Use the updated date time (both in its canonical dateTime@@ -692,26 +693,18 @@ const CreationTime: React.FC<CreationTimeProps> = ({// editor, we can provide functionality for the user to edit the// associated offset, but right now it is not even surfaced, so// don't also potentially overwrite it.- const { dateTime, timestamp } = pickedTime;- if (timestamp == originalDate.getTime()) {- // Same as before.- closeEditMode();- return;- }-await updateRemotePublicMagicMetadata(file, {dateTime,- editedTime: timestamp,+ editedTime,});scheduleUpdate();+ } catch (e) {+ onGenericError(e);}- } catch (e) {- onGenericError(e);- } finally {- closeEditMode();- setLoading(false);}++ setIsSaving(false);};return (@@ -722,16 +715,18 @@ const CreationTime: React.FC<CreationTimeProps> = ({caption={formattedTime(originalDate)}trailingButton={allowEdits && (- <EditButton onClick={openEditMode} loading={loading} />+ <EditButton+ onClick={() => setIsEditing(true)}+ loading={isSaving}+ />)}/>- {isInEditMode && (+ {isEditing && (<FileDateTimePickerinitialValue={originalDate}- disabled={loading}onAccept={saveEdits}- onClose={closeEditMode}+ onDidClose={() => setIsEditing(false)}/>)}</>diff --git a/web/packages/new/photos/components/FileDateTimePicker.tsx b/web/packages/new/photos/components/FileDateTimePicker.tsxindex beade12cfb..329bfd6061 100644--- a/web/packages/new/photos/components/FileDateTimePicker.tsx+++ b/web/packages/new/photos/components/FileDateTimePicker.tsx@@ -15,19 +15,17 @@ interface FileDateTimePickerProps {* If not provided, the current date/time is used.*/initialValue?: Date;- /**- * If true, then the picker shows provided date/time but doesn't allow- * editing it.- */- disabled?: boolean;/*** Callback invoked when the user makes and confirms a date/time.*/onAccept: (date: ParsedMetadataDate) => void;/*** Optional callback invoked when the picker has been closed.+ *+ * > Note: This is only informational, for the caller to update their state.+ * > The picker has already been closed at this point.*/- onClose?: () => void;+ onDidClose?: () => void;}/**@@ -47,9 +45,8 @@ interface FileDateTimePickerProps {*/export const FileDateTimePicker: React.FC<FileDateTimePickerProps> = ({initialValue,- disabled,onAccept,- onClose,+ onDidClose,}) => {const [open, setOpen] = useState(true);const [value, setValue] = useState<Dayjs | null>(dayjs(initialValue));@@ -61,8 +58,9 @@ export const FileDateTimePicker: React.FC<FileDateTimePickerProps> = ({};const handleClose = () => {+ console.log("handleClose");setOpen(false);- onClose?.();+ onDidClose?.();};return (@@ -73,7 +71,6 @@ export const FileDateTimePicker: React.FC<FileDateTimePickerProps> = ({open={open}onClose={handleClose}onOpen={() => setOpen(true)}- disabled={disabled}disableFuture={true}/* The dialog grows too big on the default portrait mode withour theme customizations. So we instead use the landscape