🐛 Bug fixes on creating call
This commit is contained in:
@ -69,9 +69,9 @@ class _ChatRoomScreenState extends State<ChatRoomScreen> {
|
||||
{},
|
||||
);
|
||||
_otherMember = _channel!.members?.cast<SnChannelMember?>().firstWhere(
|
||||
(ele) => ele?.accountId != ua.user?.id,
|
||||
orElse: () => null,
|
||||
);
|
||||
(ele) => ele?.accountId != ua.user?.id,
|
||||
orElse: () => null,
|
||||
);
|
||||
}
|
||||
} catch (err) {
|
||||
if (!mounted) return;
|
||||
@ -90,6 +90,8 @@ class _ChatRoomScreenState extends State<ChatRoomScreen> {
|
||||
'/cgi/im/channels/${_messageController.channel!.keyPath}/calls/ongoing',
|
||||
options: Options(
|
||||
validateStatus: (status) => status != null && status < 500,
|
||||
receiveTimeout: const Duration(seconds: 60),
|
||||
sendTimeout: const Duration(seconds: 60),
|
||||
),
|
||||
);
|
||||
if (resp.statusCode == 200) {
|
||||
@ -97,6 +99,7 @@ class _ChatRoomScreenState extends State<ChatRoomScreen> {
|
||||
}
|
||||
} catch (err) {
|
||||
if (!mounted) return;
|
||||
print((err as DioException).response?.data);
|
||||
context.showErrorDialog(err);
|
||||
} finally {
|
||||
setState(() => _isCalling = false);
|
||||
@ -115,10 +118,12 @@ class _ChatRoomScreenState extends State<ChatRoomScreen> {
|
||||
receiveTimeout: const Duration(seconds: 30),
|
||||
),
|
||||
);
|
||||
log(jsonDecode(resp.data));
|
||||
} catch (err) {
|
||||
if (!mounted) return;
|
||||
context.showErrorDialog(err);
|
||||
if (_ongoingCall == null) {
|
||||
// ignore the error because the call is already ongoing
|
||||
context.showErrorDialog(err);
|
||||
}
|
||||
} finally {
|
||||
setState(() => _isCalling = false);
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ import 'dart:io';
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:dismissible_page/dismissible_page.dart';
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:file_saver/file_saver.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:gal/gal.dart';
|
||||
@ -83,7 +84,14 @@ class _AttachmentZoomViewState extends State<AttachmentZoomView> {
|
||||
|
||||
bool isSuccess = false;
|
||||
try {
|
||||
await Gal.putImage(imagePath, album: 'Solar Network');
|
||||
if (!kIsWeb && (Platform.isAndroid || Platform.isIOS)) {
|
||||
await Gal.putImage(imagePath, album: 'Solar Network');
|
||||
} else {
|
||||
await FileSaver.instance.saveFile(
|
||||
name: item.name,
|
||||
file: File(imagePath),
|
||||
);
|
||||
}
|
||||
setState(() {
|
||||
isSuccess = true;
|
||||
_isDownloading = false;
|
||||
|
@ -2,6 +2,7 @@ import 'dart:io';
|
||||
import 'dart:math' as math;
|
||||
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:file_saver/file_saver.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
@ -97,17 +98,21 @@ class PostItem extends StatelessWidget {
|
||||
if (kIsWeb) return;
|
||||
|
||||
final directory = await getTemporaryDirectory();
|
||||
final imagePath = await File(
|
||||
final imageFile = await File(
|
||||
'${directory.path}/sn-share-via-image-${DateTime.now().millisecondsSinceEpoch}.png',
|
||||
).create();
|
||||
await imagePath.writeAsBytes(capturedImage);
|
||||
await imageFile.writeAsBytes(capturedImage);
|
||||
|
||||
await Share.shareXFiles(
|
||||
[XFile(imagePath.path)],
|
||||
sharePositionOrigin: box!.localToGlobal(Offset.zero) & box.size,
|
||||
);
|
||||
if(!kIsWeb && (Platform.isAndroid || Platform.isIOS)) {
|
||||
await Share.shareXFiles(
|
||||
[XFile(imageFile.path)],
|
||||
sharePositionOrigin: box!.localToGlobal(Offset.zero) & box.size,
|
||||
);
|
||||
} else {
|
||||
await FileSaver.instance.saveFile(name: 'Solar Network Post #${data.id}', file: imageFile);
|
||||
}
|
||||
|
||||
await imagePath.delete();
|
||||
await imageFile.delete();
|
||||
}
|
||||
|
||||
@override
|
||||
|
Reference in New Issue
Block a user