mirror of
https://github.com/twonlyapp/twonly-app.git
synced 2026-05-25 12:12:13 +00:00
bug fixes
This commit is contained in:
parent
1e6ce639cf
commit
9941c6e870
3 changed files with 21 additions and 12 deletions
|
|
@ -60,6 +60,15 @@ Future<bool> handleNewContactRequest(int fromUserId) async {
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> handleContactAccept(int fromUserId) async {
|
Future<void> handleContactAccept(int fromUserId) async {
|
||||||
|
final contact = await twonlyDB.contactsDao
|
||||||
|
.getContactByUserId(fromUserId)
|
||||||
|
.getSingleOrNull();
|
||||||
|
if (contact == null) return;
|
||||||
|
if (contact.requested || contact.deletedByUser) {
|
||||||
|
Log.error('User has never send an request. So ignore the Accept.');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
await twonlyDB.contactsDao.updateContact(
|
await twonlyDB.contactsDao.updateContact(
|
||||||
fromUserId,
|
fromUserId,
|
||||||
const ContactsCompanion(
|
const ContactsCompanion(
|
||||||
|
|
@ -68,17 +77,12 @@ Future<void> handleContactAccept(int fromUserId) async {
|
||||||
deletedByUser: Value(false),
|
deletedByUser: Value(false),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
final contact = await twonlyDB.contactsDao
|
await twonlyDB.groupsDao.createNewDirectChat(
|
||||||
.getContactByUserId(fromUserId)
|
fromUserId,
|
||||||
.getSingleOrNull();
|
GroupsCompanion(
|
||||||
if (contact != null) {
|
groupName: Value(getContactDisplayName(contact)),
|
||||||
await twonlyDB.groupsDao.createNewDirectChat(
|
),
|
||||||
fromUserId,
|
);
|
||||||
GroupsCompanion(
|
|
||||||
groupName: Value(getContactDisplayName(contact)),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<bool> handleContactRequest(
|
Future<bool> handleContactRequest(
|
||||||
|
|
|
||||||
|
|
@ -283,6 +283,8 @@ class _CameraPreviewViewState extends State<CameraPreviewView> {
|
||||||
await Future.delayed(const Duration(milliseconds: 1000));
|
await Future.delayed(const Duration(milliseconds: 1000));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!mounted) return;
|
||||||
|
|
||||||
await mc.cameraController?.pausePreview();
|
await mc.cameraController?.pausePreview();
|
||||||
if (!mounted) {
|
if (!mounted) {
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -85,6 +85,8 @@ class MainCameraController {
|
||||||
FaceFilterType _currentFilterType = FaceFilterType.none;
|
FaceFilterType _currentFilterType = FaceFilterType.none;
|
||||||
FaceFilterType get currentFilterType => _currentFilterType;
|
FaceFilterType get currentFilterType => _currentFilterType;
|
||||||
|
|
||||||
|
Future<void>? _pendingDisposal;
|
||||||
|
|
||||||
Future<void> closeCamera() async {
|
Future<void> closeCamera() async {
|
||||||
contactsVerified = {};
|
contactsVerified = {};
|
||||||
scannedNewProfiles = {};
|
scannedNewProfiles = {};
|
||||||
|
|
@ -96,7 +98,7 @@ class MainCameraController {
|
||||||
final cameraControllerTemp = cameraController;
|
final cameraControllerTemp = cameraController;
|
||||||
cameraController = null;
|
cameraController = null;
|
||||||
// prevents: CameraException(Disposed CameraController, buildPreview() was called on a disposed CameraController.)
|
// prevents: CameraException(Disposed CameraController, buildPreview() was called on a disposed CameraController.)
|
||||||
Future.delayed(const Duration(milliseconds: 100), () async {
|
_pendingDisposal = Future.delayed(const Duration(milliseconds: 100), () async {
|
||||||
await cameraControllerTemp?.dispose();
|
await cameraControllerTemp?.dispose();
|
||||||
});
|
});
|
||||||
initCameraStarted = false;
|
initCameraStarted = false;
|
||||||
|
|
@ -104,6 +106,7 @@ class MainCameraController {
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> selectCamera(int sCameraId, bool init) async {
|
Future<void> selectCamera(int sCameraId, bool init) async {
|
||||||
|
await _pendingDisposal;
|
||||||
initCameraStarted = true;
|
initCameraStarted = true;
|
||||||
|
|
||||||
if (AppEnvironment.cameras.isEmpty) {
|
if (AppEnvironment.cameras.isEmpty) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue