mirror of
https://github.com/twonlyapp/twonly-app.git
synced 2026-05-25 10:52:12 +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 {
|
||||
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(
|
||||
fromUserId,
|
||||
const ContactsCompanion(
|
||||
|
|
@ -68,10 +77,6 @@ Future<void> handleContactAccept(int fromUserId) async {
|
|||
deletedByUser: Value(false),
|
||||
),
|
||||
);
|
||||
final contact = await twonlyDB.contactsDao
|
||||
.getContactByUserId(fromUserId)
|
||||
.getSingleOrNull();
|
||||
if (contact != null) {
|
||||
await twonlyDB.groupsDao.createNewDirectChat(
|
||||
fromUserId,
|
||||
GroupsCompanion(
|
||||
|
|
@ -79,7 +84,6 @@ Future<void> handleContactAccept(int fromUserId) async {
|
|||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Future<bool> handleContactRequest(
|
||||
int fromUserId,
|
||||
|
|
|
|||
|
|
@ -283,6 +283,8 @@ class _CameraPreviewViewState extends State<CameraPreviewView> {
|
|||
await Future.delayed(const Duration(milliseconds: 1000));
|
||||
}
|
||||
|
||||
if (!mounted) return;
|
||||
|
||||
await mc.cameraController?.pausePreview();
|
||||
if (!mounted) {
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -85,6 +85,8 @@ class MainCameraController {
|
|||
FaceFilterType _currentFilterType = FaceFilterType.none;
|
||||
FaceFilterType get currentFilterType => _currentFilterType;
|
||||
|
||||
Future<void>? _pendingDisposal;
|
||||
|
||||
Future<void> closeCamera() async {
|
||||
contactsVerified = {};
|
||||
scannedNewProfiles = {};
|
||||
|
|
@ -96,7 +98,7 @@ class MainCameraController {
|
|||
final cameraControllerTemp = cameraController;
|
||||
cameraController = null;
|
||||
// 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();
|
||||
});
|
||||
initCameraStarted = false;
|
||||
|
|
@ -104,6 +106,7 @@ class MainCameraController {
|
|||
}
|
||||
|
||||
Future<void> selectCamera(int sCameraId, bool init) async {
|
||||
await _pendingDisposal;
|
||||
initCameraStarted = true;
|
||||
|
||||
if (AppEnvironment.cameras.isEmpty) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue