mirror of
https://github.com/twonlyapp/twonly-app.git
synced 2026-09-01 07:04:07 +00:00
some smaller fixes
This commit is contained in:
parent
35133d2ebb
commit
25bc253b91
2 changed files with 28 additions and 26 deletions
|
|
@ -1,4 +1,5 @@
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
import 'dart:isolate';
|
||||||
import 'dart:math';
|
import 'dart:math';
|
||||||
|
|
||||||
import 'package:clock/clock.dart';
|
import 'package:clock/clock.dart';
|
||||||
|
|
@ -6,7 +7,6 @@ import 'package:convert/convert.dart';
|
||||||
import 'package:crypto/crypto.dart';
|
import 'package:crypto/crypto.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:flutter_image_compress/flutter_image_compress.dart';
|
|
||||||
import 'package:gal/gal.dart';
|
import 'package:gal/gal.dart';
|
||||||
import 'package:image/image.dart' as img;
|
import 'package:image/image.dart' as img;
|
||||||
import 'package:intl/intl.dart';
|
import 'package:intl/intl.dart';
|
||||||
|
|
@ -44,41 +44,41 @@ Future<String?> saveImageToGallery(
|
||||||
|
|
||||||
if (createdAt != null) {
|
if (createdAt != null) {
|
||||||
try {
|
try {
|
||||||
final image = img.decodeImage(imageBytes);
|
bytesToProcess = await Isolate.run(() {
|
||||||
if (image != null) {
|
final image = img.decodeImage(imageBytes);
|
||||||
final formattedDate = DateFormat(
|
if (image != null) {
|
||||||
'yyyy:MM:dd HH:mm:ss',
|
final formattedDate = DateFormat(
|
||||||
).format(createdAt);
|
'yyyy:MM:dd HH:mm:ss',
|
||||||
image.exif.imageIfd[0x0132] = img.IfdValueAscii(
|
).format(createdAt);
|
||||||
formattedDate,
|
image.exif.imageIfd[0x0132] = img.IfdValueAscii(
|
||||||
); // DateTime
|
formattedDate,
|
||||||
image.exif.exifIfd[0x9003] = img.IfdValueAscii(
|
); // DateTime
|
||||||
formattedDate,
|
image.exif.exifIfd[0x9003] = img.IfdValueAscii(
|
||||||
); // DateTimeOriginal
|
formattedDate,
|
||||||
image.exif.exifIfd[0x9004] = img.IfdValueAscii(
|
); // DateTimeOriginal
|
||||||
formattedDate,
|
image.exif.exifIfd[0x9004] = img.IfdValueAscii(
|
||||||
); // DateTimeDigitized
|
formattedDate,
|
||||||
|
); // DateTimeDigitized
|
||||||
|
|
||||||
bytesToProcess = img.encodeJpg(image);
|
return img.encodeJpg(image);
|
||||||
}
|
}
|
||||||
|
return imageBytes;
|
||||||
|
});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
Log.error(e);
|
Log.error(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final jpgImages = await FlutterImageCompress.compressWithList(
|
|
||||||
// ignore: avoid_redundant_argument_values
|
|
||||||
format: CompressFormat.jpeg,
|
|
||||||
bytesToProcess,
|
|
||||||
quality: 100,
|
|
||||||
keepExif: true,
|
|
||||||
);
|
|
||||||
final hasAccess = await Gal.hasAccess(toAlbum: true);
|
final hasAccess = await Gal.hasAccess(toAlbum: true);
|
||||||
if (!hasAccess) {
|
if (!hasAccess) {
|
||||||
await Gal.requestAccess(toAlbum: true);
|
await Gal.requestAccess(toAlbum: true);
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
await Gal.putImageBytes(jpgImages, album: 'twonly', name: name ?? 'image');
|
await Gal.putImageBytes(
|
||||||
|
bytesToProcess,
|
||||||
|
album: 'twonly',
|
||||||
|
name: name ?? 'image',
|
||||||
|
);
|
||||||
return null;
|
return null;
|
||||||
} on GalException catch (e) {
|
} on GalException catch (e) {
|
||||||
Log.error(e);
|
Log.error(e);
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,9 @@ class _MissingBackupCompState extends State<MissingBackupComp> {
|
||||||
builder: (context, snapshot) {
|
builder: (context, snapshot) {
|
||||||
final user = userService.currentUser;
|
final user = userService.currentUser;
|
||||||
|
|
||||||
if (user.currentSetupPage != null || user.isBackupEnabled) {
|
if (user.currentSetupPage != null ||
|
||||||
|
user.isBackupEnabled ||
|
||||||
|
user.passwordLessRecovery != null) {
|
||||||
return const SizedBox.shrink();
|
return const SizedBox.shrink();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue