mirror of
https://github.com/twonlyapp/twonly-app.git
synced 2026-01-15 13:08:42 +00:00
fixing lints errors
This commit is contained in:
parent
2eb9fd2f00
commit
2c22067a54
18 changed files with 69 additions and 62 deletions
|
|
@ -52,7 +52,7 @@ class _AppState extends State<App> with WidgetsBindingObserver {
|
||||||
Future setUserPlan() async {
|
Future setUserPlan() async {
|
||||||
final user = await getUser();
|
final user = await getUser();
|
||||||
globalBestFriendUserId = -1;
|
globalBestFriendUserId = -1;
|
||||||
if (user != null && context.mounted) {
|
if (user != null && mounted) {
|
||||||
if (user.myBestFriendContactId != null) {
|
if (user.myBestFriendContactId != null) {
|
||||||
final contact = await twonlyDB.contactsDao
|
final contact = await twonlyDB.contactsDao
|
||||||
.getContactByUserId(user.myBestFriendContactId!)
|
.getContactByUserId(user.myBestFriendContactId!)
|
||||||
|
|
@ -63,7 +63,9 @@ class _AppState extends State<App> with WidgetsBindingObserver {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
context.read<CustomChangeProvider>().updatePlan(user.subscriptionPlan);
|
if (mounted) {
|
||||||
|
context.read<CustomChangeProvider>().updatePlan(user.subscriptionPlan);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@ import 'package:cryptography_plus/cryptography_plus.dart';
|
||||||
import 'package:logging/logging.dart';
|
import 'package:logging/logging.dart';
|
||||||
import 'package:twonly/src/model/protobuf/api/client_to_server.pb.dart'
|
import 'package:twonly/src/model/protobuf/api/client_to_server.pb.dart'
|
||||||
as client;
|
as client;
|
||||||
|
import 'package:twonly/src/utils/log.dart';
|
||||||
import 'package:twonly/src/utils/storage.dart';
|
import 'package:twonly/src/utils/storage.dart';
|
||||||
|
|
||||||
Map<int, DateTime> downloadStartedForMediaReceived = {};
|
Map<int, DateTime> downloadStartedForMediaReceived = {};
|
||||||
|
|
@ -143,7 +144,8 @@ Future startDownloadMedia(Message message, bool force) async {
|
||||||
response.asStream().listen((http.StreamedResponse r) {
|
response.asStream().listen((http.StreamedResponse r) {
|
||||||
r.stream.listen((List<int> chunk) {
|
r.stream.listen((List<int> chunk) {
|
||||||
// Display percentage of completion
|
// Display percentage of completion
|
||||||
print('downloadPercentage: ${downloaded / (r.contentLength ?? 0) * 100}');
|
Log.info(
|
||||||
|
'downloadPercentage: ${downloaded / (r.contentLength ?? 0) * 100}');
|
||||||
|
|
||||||
chunks.add(chunk);
|
chunks.add(chunk);
|
||||||
downloaded += chunk.length;
|
downloaded += chunk.length;
|
||||||
|
|
@ -160,7 +162,8 @@ Future startDownloadMedia(Message message, bool force) async {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Display percentage of completion
|
// Display percentage of completion
|
||||||
print('downloadPercentage: ${downloaded / (r.contentLength ?? 0) * 100}');
|
Log.info(
|
||||||
|
'downloadPercentage: ${downloaded / (r.contentLength ?? 0) * 100}');
|
||||||
|
|
||||||
// Save the file
|
// Save the file
|
||||||
final Uint8List bytes = Uint8List(r.contentLength ?? 0);
|
final Uint8List bytes = Uint8List(r.contentLength ?? 0);
|
||||||
|
|
@ -203,9 +206,9 @@ Future handleEncryptedFile(Message msg, {Uint8List? encryptedBytesTmp}) async {
|
||||||
var imageBytes = Uint8List.fromList(plaintextBytes);
|
var imageBytes = Uint8List.fromList(plaintextBytes);
|
||||||
|
|
||||||
if (content.isVideo) {
|
if (content.isVideo) {
|
||||||
final splited = extractUint8Lists(imageBytes);
|
final extractedBytes = extractUint8Lists(imageBytes);
|
||||||
imageBytes = splited[0];
|
imageBytes = extractedBytes[0];
|
||||||
await writeMediaFile(msg.messageId, "mp4", splited[1]);
|
await writeMediaFile(msg.messageId, "mp4", extractedBytes[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
await writeMediaFile(msg.messageId, "png", imageBytes);
|
await writeMediaFile(msg.messageId, "png", imageBytes);
|
||||||
|
|
@ -272,7 +275,7 @@ Future<void> deleteMediaFile(int mediaId, String type) async {
|
||||||
await file.delete();
|
await file.delete();
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
Logger("media_received.dart").shout("Erro deleting: $e");
|
Logger("media_received.dart").shout("Error deleting: $e");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -131,7 +131,6 @@ Future<Uint8List> addOrModifyImageToUpload(
|
||||||
|
|
||||||
/// in case the media file was already encrypted of even uploaded
|
/// in case the media file was already encrypted of even uploaded
|
||||||
/// remove the data so it will be done again.
|
/// remove the data so it will be done again.
|
||||||
/// TODO: when the uploadTokens are already set notify the server...
|
|
||||||
await twonlyDB.mediaUploadsDao.updateMediaUpload(
|
await twonlyDB.mediaUploadsDao.updateMediaUpload(
|
||||||
mediaUploadId,
|
mediaUploadId,
|
||||||
MediaUploadsCompanion(
|
MediaUploadsCompanion(
|
||||||
|
|
|
||||||
|
|
@ -2,10 +2,10 @@ import 'dart:convert';
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
import 'dart:typed_data';
|
import 'dart:typed_data';
|
||||||
import 'package:libsignal_protocol_dart/libsignal_protocol_dart.dart';
|
import 'package:libsignal_protocol_dart/libsignal_protocol_dart.dart';
|
||||||
import 'package:logging/logging.dart';
|
|
||||||
import 'package:twonly/src/model/json/message.dart';
|
import 'package:twonly/src/model/json/message.dart';
|
||||||
import 'package:twonly/src/database/signal/connect_signal_protocol_store.dart';
|
import 'package:twonly/src/database/signal/connect_signal_protocol_store.dart';
|
||||||
import 'package:twonly/src/services/signal/utils.signal.dart';
|
import 'package:twonly/src/services/signal/utils.signal.dart';
|
||||||
|
import 'package:twonly/src/utils/log.dart';
|
||||||
import 'package:twonly/src/utils/misc.dart';
|
import 'package:twonly/src/utils/misc.dart';
|
||||||
|
|
||||||
Future<Uint8List?> signalEncryptMessage(int target, MessageJson msg) async {
|
Future<Uint8List?> signalEncryptMessage(int target, MessageJson msg) async {
|
||||||
|
|
@ -24,7 +24,7 @@ Future<Uint8List?> signalEncryptMessage(int target, MessageJson msg) async {
|
||||||
|
|
||||||
return b.takeBytes();
|
return b.takeBytes();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
Logger("utils/signal").shout(e.toString());
|
Log.error(e.toString());
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -38,7 +38,7 @@ Future<MessageJson?> signalDecryptMessage(int source, Uint8List msg) async {
|
||||||
|
|
||||||
List<Uint8List>? msgs = removeLastXBytes(msg, 4);
|
List<Uint8List>? msgs = removeLastXBytes(msg, 4);
|
||||||
if (msgs == null) {
|
if (msgs == null) {
|
||||||
Logger("utils/signal").shout("Message requires at least 4 bytes.");
|
Log.error("Message requires at least 4 bytes.");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
Uint8List body = msgs[0];
|
Uint8List body = msgs[0];
|
||||||
|
|
@ -51,14 +51,13 @@ Future<MessageJson?> signalDecryptMessage(int source, Uint8List msg) async {
|
||||||
SignalMessage signalMsg = SignalMessage.fromSerialized(body);
|
SignalMessage signalMsg = SignalMessage.fromSerialized(body);
|
||||||
plaintext = await session.decryptFromSignal(signalMsg);
|
plaintext = await session.decryptFromSignal(signalMsg);
|
||||||
} else {
|
} else {
|
||||||
Logger("utils/signal").shout("Type not known: $type");
|
Log.error("Type not known: $type");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
MessageJson dectext =
|
return MessageJson.fromJson(
|
||||||
MessageJson.fromJson(jsonDecode(utf8.decode(gzip.decode(plaintext))));
|
jsonDecode(utf8.decode(gzip.decode(plaintext))));
|
||||||
return dectext;
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
Logger("utils/signal").shout(e.toString());
|
Log.error(e.toString());
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -64,7 +64,7 @@ class SaveToGalleryButtonState extends State<SaveToGalleryButton> {
|
||||||
} else {
|
} else {
|
||||||
memoryPath += ".png";
|
memoryPath += ".png";
|
||||||
Uint8List? imageBytes = await widget.getMergedImage();
|
Uint8List? imageBytes = await widget.getMergedImage();
|
||||||
if (imageBytes == null || !context.mounted) return;
|
if (imageBytes == null || !mounted) return;
|
||||||
await File(memoryPath).writeAsBytes(imageBytes);
|
await File(memoryPath).writeAsBytes(imageBytes);
|
||||||
res = await saveImageToGallery(imageBytes);
|
res = await saveImageToGallery(imageBytes);
|
||||||
}
|
}
|
||||||
|
|
@ -72,7 +72,7 @@ class SaveToGalleryButtonState extends State<SaveToGalleryButton> {
|
||||||
setState(() {
|
setState(() {
|
||||||
_imageSaved = true;
|
_imageSaved = true;
|
||||||
});
|
});
|
||||||
} else {
|
} else if (mounted && context.mounted) {
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
SnackBar(
|
SnackBar(
|
||||||
content: Text(res),
|
content: Text(res),
|
||||||
|
|
|
||||||
|
|
@ -204,7 +204,9 @@ class _CameraPreviewViewState extends State<CameraPreviewView> {
|
||||||
|
|
||||||
Future<void> updateScaleFactor(double newScale) async {
|
Future<void> updateScaleFactor(double newScale) async {
|
||||||
if (selectedCameraDetails.scaleFactor == newScale ||
|
if (selectedCameraDetails.scaleFactor == newScale ||
|
||||||
cameraController == null) return;
|
cameraController == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
await cameraController?.setZoomLevel(newScale.clamp(
|
await cameraController?.setZoomLevel(newScale.clamp(
|
||||||
selectedCameraDetails.minAvailableZoom,
|
selectedCameraDetails.minAvailableZoom,
|
||||||
selectedCameraDetails.maxAvailableZoom));
|
selectedCameraDetails.maxAvailableZoom));
|
||||||
|
|
@ -253,7 +255,7 @@ class _CameraPreviewViewState extends State<CameraPreviewView> {
|
||||||
}
|
}
|
||||||
|
|
||||||
await cameraController?.pausePreview();
|
await cameraController?.pausePreview();
|
||||||
if (!context.mounted) return;
|
if (!mounted) return;
|
||||||
|
|
||||||
cameraController?.setFlashMode(
|
cameraController?.setFlashMode(
|
||||||
selectedCameraDetails.isFlashOn ? FlashMode.always : FlashMode.off);
|
selectedCameraDetails.isFlashOn ? FlashMode.always : FlashMode.off);
|
||||||
|
|
@ -286,13 +288,13 @@ class _CameraPreviewViewState extends State<CameraPreviewView> {
|
||||||
reverseTransitionDuration: Duration.zero,
|
reverseTransitionDuration: Duration.zero,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
if (context.mounted) {
|
if (mounted) {
|
||||||
setState(() {
|
setState(() {
|
||||||
sharePreviewIsShown = false;
|
sharePreviewIsShown = false;
|
||||||
showSelfieFlash = false;
|
showSelfieFlash = false;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (!context.mounted) return true;
|
if (!mounted) return true;
|
||||||
// shouldReturn is null when the user used the back button
|
// shouldReturn is null when the user used the back button
|
||||||
if (shouldReturn != null && shouldReturn) {
|
if (shouldReturn != null && shouldReturn) {
|
||||||
// ignore: use_build_context_synchronously
|
// ignore: use_build_context_synchronously
|
||||||
|
|
@ -348,8 +350,9 @@ class _CameraPreviewViewState extends State<CameraPreviewView> {
|
||||||
}
|
}
|
||||||
|
|
||||||
Future startVideoRecording() async {
|
Future startVideoRecording() async {
|
||||||
if (cameraController != null && cameraController!.value.isRecordingVideo)
|
if (cameraController != null && cameraController!.value.isRecordingVideo) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
if (hasAudioPermission && videoWithAudio) {
|
if (hasAudioPermission && videoWithAudio) {
|
||||||
await widget.selectCamera(
|
await widget.selectCamera(
|
||||||
selectedCameraDetails.cameraId,
|
selectedCameraDetails.cameraId,
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@ class _EmojisState extends State<Emojis> {
|
||||||
user.lastUsedEditorEmojis!.toSet().toList();
|
user.lastUsedEditorEmojis!.toSet().toList();
|
||||||
}
|
}
|
||||||
await updateUser(user);
|
await updateUser(user);
|
||||||
if (!context.mounted) return;
|
if (!mounted) return;
|
||||||
Navigator.pop(
|
Navigator.pop(
|
||||||
context,
|
context,
|
||||||
EmojiLayerData(
|
EmojiLayerData(
|
||||||
|
|
|
||||||
|
|
@ -320,7 +320,7 @@ class _ShareImageEditorView extends State<ShareImageEditorView> {
|
||||||
}
|
}
|
||||||
Future<Uint8List?> imageBytes = getMergedImage();
|
Future<Uint8List?> imageBytes = getMergedImage();
|
||||||
videoController?.pause();
|
videoController?.pause();
|
||||||
if (isDisposed || !context.mounted) return;
|
if (isDisposed || !mounted) return;
|
||||||
bool? wasSend = await Navigator.push(
|
bool? wasSend = await Navigator.push(
|
||||||
context,
|
context,
|
||||||
MaterialPageRoute(
|
MaterialPageRoute(
|
||||||
|
|
@ -336,7 +336,7 @@ class _ShareImageEditorView extends State<ShareImageEditorView> {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
if (wasSend != null && wasSend && context.mounted) {
|
if (wasSend != null && wasSend && mounted) {
|
||||||
// ignore: use_build_context_synchronously
|
// ignore: use_build_context_synchronously
|
||||||
Navigator.pop(context, true);
|
Navigator.pop(context, true);
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -404,11 +404,13 @@ class _ShareImageEditorView extends State<ShareImageEditorView> {
|
||||||
setState(() {
|
setState(() {
|
||||||
sendingOrLoadingImage = false;
|
sendingOrLoadingImage = false;
|
||||||
});
|
});
|
||||||
await Navigator.push(context, MaterialPageRoute(builder: (context) {
|
if (mounted) {
|
||||||
return SubscriptionView(
|
await Navigator.push(context, MaterialPageRoute(builder: (context) {
|
||||||
redirectError: err,
|
return SubscriptionView(
|
||||||
);
|
redirectError: err,
|
||||||
}));
|
);
|
||||||
|
}));
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
Future imageHandler =
|
Future imageHandler =
|
||||||
addOrModifyImageToUpload(mediaUploadId!, imageBytes);
|
addOrModifyImageToUpload(mediaUploadId!, imageBytes);
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ import 'package:flutter/services.dart';
|
||||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
import 'package:twonly/src/providers/connection.provider.dart';
|
import 'package:twonly/src/providers/connection.provider.dart';
|
||||||
|
import 'package:twonly/src/services/signal/session.signal.dart';
|
||||||
import 'package:twonly/src/views/components/alert_dialog.dart';
|
import 'package:twonly/src/views/components/alert_dialog.dart';
|
||||||
import 'package:twonly/src/database/daos/contacts_dao.dart';
|
import 'package:twonly/src/database/daos/contacts_dao.dart';
|
||||||
import 'package:twonly/src/database/tables/messages_table.dart';
|
import 'package:twonly/src/database/tables/messages_table.dart';
|
||||||
|
|
@ -16,8 +17,6 @@ import 'package:twonly/src/views/components/headline.dart';
|
||||||
import 'package:twonly/src/views/components/initialsavatar.dart';
|
import 'package:twonly/src/views/components/initialsavatar.dart';
|
||||||
import 'package:twonly/src/model/json/message.dart';
|
import 'package:twonly/src/model/json/message.dart';
|
||||||
import 'package:twonly/src/services/api/messages.dart';
|
import 'package:twonly/src/services/api/messages.dart';
|
||||||
// ignore: library_prefixes
|
|
||||||
import 'package:twonly/src/services/signal/utils.signal.dart' as SignalHelper;
|
|
||||||
import 'package:twonly/src/utils/storage.dart';
|
import 'package:twonly/src/utils/storage.dart';
|
||||||
import 'package:twonly/src/views/settings/subscription/subscription_view.dart';
|
import 'package:twonly/src/views/settings/subscription/subscription_view.dart';
|
||||||
|
|
||||||
|
|
@ -92,7 +91,7 @@ class _SearchUsernameView extends State<AddNewUserView> {
|
||||||
);
|
);
|
||||||
|
|
||||||
if (added > 0) {
|
if (added > 0) {
|
||||||
if (await SignalHelper.addNewContact(res.value.userdata)) {
|
if (await createNewSignalSession(res.value.userdata)) {
|
||||||
// before notifying the other party, add
|
// before notifying the other party, add
|
||||||
await setupNotificationWithUsers();
|
await setupNotificationWithUsers();
|
||||||
await encryptAndSendMessageAsync(
|
await encryptAndSendMessageAsync(
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ import 'dart:io';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:twonly/globals.dart';
|
import 'package:twonly/globals.dart';
|
||||||
import 'package:twonly/src/services/api/media_send.dart' as send;
|
import 'package:twonly/src/services/api/media_send.dart' as send;
|
||||||
|
import 'package:twonly/src/utils/log.dart';
|
||||||
import 'package:twonly/src/views/components/message_send_state_icon.dart';
|
import 'package:twonly/src/views/components/message_send_state_icon.dart';
|
||||||
import 'package:twonly/src/database/twonly_database.dart';
|
import 'package:twonly/src/database/twonly_database.dart';
|
||||||
import 'package:twonly/src/database/tables/messages_table.dart';
|
import 'package:twonly/src/database/tables/messages_table.dart';
|
||||||
|
|
@ -108,7 +109,7 @@ class _InChatMediaViewerState extends State<InChatMediaViewer> {
|
||||||
image = imagePath;
|
image = imagePath;
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
print("Not found: $imagePath");
|
Log.error("file not found: $imagePath");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,6 @@ class _MediaViewerViewState extends State<MediaViewerView> {
|
||||||
|
|
||||||
bool imageSaved = false;
|
bool imageSaved = false;
|
||||||
bool imageSaving = false;
|
bool imageSaving = false;
|
||||||
bool isMounted = true;
|
|
||||||
|
|
||||||
StreamSubscription<Message?>? downloadStateListener;
|
StreamSubscription<Message?>? downloadStateListener;
|
||||||
|
|
||||||
|
|
@ -85,7 +84,6 @@ class _MediaViewerViewState extends State<MediaViewerView> {
|
||||||
_subscription.cancel();
|
_subscription.cancel();
|
||||||
downloadStateListener?.cancel();
|
downloadStateListener?.cancel();
|
||||||
videoController?.dispose();
|
videoController?.dispose();
|
||||||
isMounted = false;
|
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -120,7 +118,7 @@ class _MediaViewerViewState extends State<MediaViewerView> {
|
||||||
}
|
}
|
||||||
|
|
||||||
Future nextMediaOrExit() async {
|
Future nextMediaOrExit() async {
|
||||||
if (!isMounted) return;
|
if (!mounted) return;
|
||||||
videoController?.dispose();
|
videoController?.dispose();
|
||||||
nextMediaTimer?.cancel();
|
nextMediaTimer?.cancel();
|
||||||
progressTimer?.cancel();
|
progressTimer?.cancel();
|
||||||
|
|
@ -135,7 +133,7 @@ class _MediaViewerViewState extends State<MediaViewerView> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (allMediaFiles.isEmpty || allMediaFiles.length == 1) {
|
if (allMediaFiles.isEmpty || allMediaFiles.length == 1) {
|
||||||
if (isMounted) {
|
if (mounted) {
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -145,7 +143,7 @@ class _MediaViewerViewState extends State<MediaViewerView> {
|
||||||
}
|
}
|
||||||
|
|
||||||
Future loadCurrentMediaFile({bool showTwonly = false}) async {
|
Future loadCurrentMediaFile({bool showTwonly = false}) async {
|
||||||
if (!isMounted) return;
|
if (!mounted) return;
|
||||||
if (!context.mounted || allMediaFiles.isEmpty) return nextMediaOrExit();
|
if (!context.mounted || allMediaFiles.isEmpty) return nextMediaOrExit();
|
||||||
await _noScreenshot.screenshotOff();
|
await _noScreenshot.screenshotOff();
|
||||||
|
|
||||||
|
|
@ -181,7 +179,7 @@ class _MediaViewerViewState extends State<MediaViewerView> {
|
||||||
if (updated.downloadState == DownloadState.downloaded) {
|
if (updated.downloadState == DownloadState.downloaded) {
|
||||||
downloadStateListener?.cancel();
|
downloadStateListener?.cancel();
|
||||||
await handleNextDownloadedMedia(updated, showTwonly);
|
await handleNextDownloadedMedia(updated, showTwonly);
|
||||||
// start downloading all the other possibile missing media files.
|
// start downloading all the other possible missing media files.
|
||||||
tryDownloadAllMediaFiles(force: true);
|
tryDownloadAllMediaFiles(force: true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -443,7 +441,7 @@ class _MediaViewerViewState extends State<MediaViewerView> {
|
||||||
return CameraSendToView(widget.contact);
|
return CameraSendToView(widget.contact);
|
||||||
},
|
},
|
||||||
));
|
));
|
||||||
if (isMounted && maxShowTime != gMediaShowInfinite) {
|
if (mounted && maxShowTime != gMediaShowInfinite) {
|
||||||
nextMediaOrExit();
|
nextMediaOrExit();
|
||||||
} else {
|
} else {
|
||||||
videoController?.play();
|
videoController?.play();
|
||||||
|
|
|
||||||
|
|
@ -4,12 +4,12 @@ import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||||
import 'package:libsignal_protocol_dart/libsignal_protocol_dart.dart';
|
import 'package:libsignal_protocol_dart/libsignal_protocol_dart.dart';
|
||||||
import 'package:qr_flutter/qr_flutter.dart';
|
import 'package:qr_flutter/qr_flutter.dart';
|
||||||
import 'package:twonly/globals.dart';
|
import 'package:twonly/globals.dart';
|
||||||
|
import 'package:twonly/src/services/signal/session.signal.dart';
|
||||||
import 'package:twonly/src/views/components/format_long_string.dart';
|
import 'package:twonly/src/views/components/format_long_string.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:twonly/src/database/daos/contacts_dao.dart';
|
import 'package:twonly/src/database/daos/contacts_dao.dart';
|
||||||
import 'package:twonly/src/database/twonly_database.dart';
|
import 'package:twonly/src/database/twonly_database.dart';
|
||||||
import 'package:twonly/src/utils/misc.dart';
|
import 'package:twonly/src/utils/misc.dart';
|
||||||
import 'package:twonly/src/services/signal/utils.signal.dart';
|
|
||||||
import 'package:url_launcher/url_launcher.dart';
|
import 'package:url_launcher/url_launcher.dart';
|
||||||
|
|
||||||
class ContactVerifyView extends StatefulWidget {
|
class ContactVerifyView extends StatefulWidget {
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,6 @@ class MemoriesViewState extends State<MemoriesView> {
|
||||||
List<MemoryItem> galleryItems = [];
|
List<MemoryItem> galleryItems = [];
|
||||||
Map<String, List<int>> orderedByMonth = {};
|
Map<String, List<int>> orderedByMonth = {};
|
||||||
List<String> months = [];
|
List<String> months = [];
|
||||||
bool mounted = true;
|
|
||||||
StreamSubscription<List<Message>>? messageSub;
|
StreamSubscription<List<Message>>? messageSub;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|
@ -32,7 +31,6 @@ class MemoriesViewState extends State<MemoriesView> {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
mounted = false;
|
|
||||||
messageSub?.cancel();
|
messageSub?.cancel();
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -70,7 +70,7 @@ class _MemoriesPhotoSliderViewState extends State<MemoriesPhotoSliderView> {
|
||||||
setState(() {});
|
setState(() {});
|
||||||
await send.purgeSendMediaFiles();
|
await send.purgeSendMediaFiles();
|
||||||
await received.purgeReceivedMediaFiles();
|
await received.purgeReceivedMediaFiles();
|
||||||
if (context.mounted) {
|
if (mounted) {
|
||||||
Navigator.pop(context, true);
|
Navigator.pop(context, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@ class _ContactUsState extends State<ContactUsView> {
|
||||||
'feedback': feedbackFull,
|
'feedback': feedbackFull,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
if (!context.mounted) return;
|
if (!mounted) return;
|
||||||
|
|
||||||
if (response.statusCode == 200) {
|
if (response.statusCode == 200) {
|
||||||
// Handle successful response
|
// Handle successful response
|
||||||
|
|
|
||||||
|
|
@ -67,10 +67,12 @@ class _DiagnosticsViewState extends State<DiagnosticsView> {
|
||||||
|
|
||||||
if (result.status != ShareResultStatus.success) {
|
if (result.status != ShareResultStatus.success) {
|
||||||
Clipboard.setData(ClipboardData(text: logText));
|
Clipboard.setData(ClipboardData(text: logText));
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
if (context.mounted) {
|
||||||
const SnackBar(
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
content: Text('Log copied to clipboard!')),
|
const SnackBar(
|
||||||
);
|
content: Text('Log copied to clipboard!')),
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
child: const Text('Share debug log'),
|
child: const Text('Share debug log'),
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,6 @@ class _FAQPageState extends State<FAQPage> {
|
||||||
final response = await http.get(Uri.parse("$domain/faq.json"));
|
final response = await http.get(Uri.parse("$domain/faq.json"));
|
||||||
|
|
||||||
if (response.statusCode == 200) {
|
if (response.statusCode == 200) {
|
||||||
_locale = Localizations.localeOf(context).languageCode;
|
|
||||||
setState(() {
|
setState(() {
|
||||||
_faqData = json.decode(utf8.decode(response.bodyBytes));
|
_faqData = json.decode(utf8.decode(response.bodyBytes));
|
||||||
noInternet = false;
|
noInternet = false;
|
||||||
|
|
|
||||||
|
|
@ -46,9 +46,11 @@ class _ManageSubscriptionViewState extends State<ManageSubscriptionView> {
|
||||||
Future toggleRenewalOption() async {
|
Future toggleRenewalOption() async {
|
||||||
Result res = await apiService.updatePlanOptions(!autoRenewal!);
|
Result res = await apiService.updatePlanOptions(!autoRenewal!);
|
||||||
if (res.isError) {
|
if (res.isError) {
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
if (mounted) {
|
||||||
SnackBar(content: Text(errorCodeToText(context, res.error))),
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
);
|
SnackBar(content: Text(errorCodeToText(context, res.error))),
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
await initAsync(true);
|
await initAsync(true);
|
||||||
}
|
}
|
||||||
|
|
@ -88,12 +90,12 @@ class _ManageSubscriptionViewState extends State<ManageSubscriptionView> {
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
SizedBox(height: 20),
|
// SizedBox(height: 20),
|
||||||
Divider(),
|
// Divider(),
|
||||||
ListTile(
|
// ListTile(
|
||||||
title: Text("Kündigen"),
|
// title: Text("Cancel subscription"),
|
||||||
onTap: () async {},
|
// onTap: () async {},
|
||||||
),
|
// ),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue