mirror of
https://github.com/twonlyapp/twonly-app.git
synced 2026-04-18 14:22:53 +00:00
New: Adds a link if the image contains a QR code
Some checks are pending
Flutter analyze & test / flutter_analyze_and_test (push) Waiting to run
Some checks are pending
Flutter analyze & test / flutter_analyze_and_test (push) Waiting to run
This commit is contained in:
parent
371ebda666
commit
54bdbea858
4 changed files with 19 additions and 3 deletions
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
## 0.0.98
|
## 0.0.98
|
||||||
|
|
||||||
|
- New: Adds a link if the image contains a QR code
|
||||||
- Improve: Video compression with progress updates
|
- Improve: Video compression with progress updates
|
||||||
- Improve: Show message "Flames restored"
|
- Improve: Show message "Flames restored"
|
||||||
- Improve: Show toast message if user was added via QR
|
- Improve: Show toast message if user was added via QR
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'package:flutter/foundation.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_localizations/flutter_localizations.dart';
|
import 'package:flutter_localizations/flutter_localizations.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
|
@ -188,7 +187,7 @@ class _AppMainWidgetState extends State<AppMainWidget> {
|
||||||
if (_showDatabaseMigration) {
|
if (_showDatabaseMigration) {
|
||||||
child = const Center(child: Text('Please reinstall twonly.'));
|
child = const Center(child: Text('Please reinstall twonly.'));
|
||||||
} else if (_isUserCreated) {
|
} else if (_isUserCreated) {
|
||||||
if (gUser.twonlySafeBackup == null && !_skipBackup && kReleaseMode) {
|
if (gUser.twonlySafeBackup == null && !_skipBackup) {
|
||||||
child = SetupBackupView(
|
child = SetupBackupView(
|
||||||
callBack: () {
|
callBack: () {
|
||||||
_skipBackup = true;
|
_skipBackup = true;
|
||||||
|
|
|
||||||
|
|
@ -46,6 +46,9 @@ void main() async {
|
||||||
}
|
}
|
||||||
|
|
||||||
unawaited(performTwonlySafeBackup());
|
unawaited(performTwonlySafeBackup());
|
||||||
|
} else {
|
||||||
|
Log.info('User is not yet register. Ensure all local data is removed.');
|
||||||
|
await deleteLocalUserData();
|
||||||
}
|
}
|
||||||
|
|
||||||
globalApplicationCacheDirectory = (await getApplicationCacheDirectory()).path;
|
globalApplicationCacheDirectory = (await getApplicationCacheDirectory()).path;
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
import 'package:camera/camera.dart';
|
import 'package:camera/camera.dart';
|
||||||
|
import 'package:clock/clock.dart';
|
||||||
import 'package:collection/collection.dart';
|
import 'package:collection/collection.dart';
|
||||||
import 'package:drift/drift.dart' show Value;
|
import 'package:drift/drift.dart' show Value;
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
@ -45,10 +46,11 @@ class MainCameraController {
|
||||||
|
|
||||||
bool isSharePreviewIsShown = false;
|
bool isSharePreviewIsShown = false;
|
||||||
bool isVideoRecording = false;
|
bool isVideoRecording = false;
|
||||||
|
DateTime? timeSharedLinkWasSetWithQr;
|
||||||
|
|
||||||
Uri? sharedLinkForPreview;
|
Uri? sharedLinkForPreview;
|
||||||
|
|
||||||
void setSharedLinkForPreview(Uri url) {
|
void setSharedLinkForPreview(Uri? url) {
|
||||||
sharedLinkForPreview = url;
|
sharedLinkForPreview = url;
|
||||||
setState();
|
setState();
|
||||||
}
|
}
|
||||||
|
|
@ -279,11 +281,22 @@ class MainCameraController {
|
||||||
);
|
);
|
||||||
customPaint = CustomPaint(painter: painter);
|
customPaint = CustomPaint(painter: painter);
|
||||||
|
|
||||||
|
if (barcodes.isEmpty && timeSharedLinkWasSetWithQr != null) {
|
||||||
|
if (timeSharedLinkWasSetWithQr!
|
||||||
|
.isAfter(DateTime.now().subtract(const Duration(seconds: 2)))) {
|
||||||
|
setSharedLinkForPreview(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for (final barcode in barcodes) {
|
for (final barcode in barcodes) {
|
||||||
if (barcode.displayValue != null) {
|
if (barcode.displayValue != null) {
|
||||||
if (barcode.displayValue!.startsWith('http://') ||
|
if (barcode.displayValue!.startsWith('http://') ||
|
||||||
barcode.displayValue!.startsWith('https://')) {
|
barcode.displayValue!.startsWith('https://')) {
|
||||||
scannedUrl = barcode.displayValue;
|
scannedUrl = barcode.displayValue;
|
||||||
|
if (sharedLinkForPreview == null) {
|
||||||
|
timeSharedLinkWasSetWithQr = clock.now();
|
||||||
|
setSharedLinkForPreview(Uri.parse(scannedUrl!));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (barcode.rawBytes == null) continue;
|
if (barcode.rawBytes == null) continue;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue