🐛 Bug fixes
This commit is contained in:
parent
b39c8c770e
commit
d968169e42
@ -35,9 +35,7 @@ class ChatProvider extends ChangeNotifier {
|
||||
scheme: ori.scheme.replaceFirst('http', 'ws'),
|
||||
host: ori.host,
|
||||
path: ori.path,
|
||||
queryParameters: {
|
||||
'tk': Uri.encodeComponent(auth.client!.credentials.accessToken)
|
||||
},
|
||||
queryParameters: {'tk': Uri.encodeComponent(auth.client!.credentials.accessToken)},
|
||||
);
|
||||
|
||||
final channel = WebSocketChannel.connect(uri);
|
||||
@ -80,8 +78,7 @@ class ChatProvider extends ChangeNotifier {
|
||||
}
|
||||
}
|
||||
|
||||
bool handleCallJoin(Call call, Channel channel,
|
||||
{Function? onUpdate, Function? onDispose}) {
|
||||
bool handleCallJoin(Call call, Channel channel, {Function? onUpdate, Function? onDispose}) {
|
||||
if (currentCall != null) return false;
|
||||
|
||||
currentCall = ChatCallInstance(
|
||||
@ -151,8 +148,7 @@ class ChatCallInstance {
|
||||
});
|
||||
|
||||
void init() {
|
||||
subscription =
|
||||
Hardware.instance.onDeviceChange.stream.listen(revertDevices);
|
||||
subscription = Hardware.instance.onDeviceChange.stream.listen(revertDevices);
|
||||
room = Room();
|
||||
listener = room.createListener();
|
||||
Hardware.instance.enumerateDevices().then(revertDevices);
|
||||
@ -179,8 +175,7 @@ class ChatCallInstance {
|
||||
throw Exception('unauthorized');
|
||||
}
|
||||
|
||||
var uri = getRequestUri(
|
||||
'messaging', '/api/channels/${channel.alias}/calls/ongoing/token');
|
||||
var uri = getRequestUri('messaging', '/api/channels/${channel.alias}/calls/ongoing/token');
|
||||
|
||||
var res = await auth.client!.post(uri);
|
||||
if (res.statusCode == 200) {
|
||||
@ -233,12 +228,10 @@ class ChatCallInstance {
|
||||
useiOSBroadcastExtension: true,
|
||||
params: VideoParameters(
|
||||
dimensions: VideoDimensionsPresets.h1080_169,
|
||||
encoding:
|
||||
VideoEncoding(maxBitrate: 3 * 1000 * 1000, maxFramerate: 30),
|
||||
encoding: VideoEncoding(maxBitrate: 3 * 1000 * 1000, maxFramerate: 30),
|
||||
),
|
||||
),
|
||||
defaultCameraCaptureOptions:
|
||||
CameraCaptureOptions(maxFrameRate: 30, params: videoParameters),
|
||||
defaultCameraCaptureOptions: CameraCaptureOptions(maxFrameRate: 30, params: videoParameters),
|
||||
),
|
||||
fastConnectOptions: FastConnectOptions(
|
||||
microphone: TrackOption(track: audioTrack),
|
||||
@ -271,8 +264,7 @@ class ChatCallInstance {
|
||||
room.addListener(onRoomDidUpdate);
|
||||
setupRoomListeners(context);
|
||||
sortParticipants();
|
||||
WidgetsBindingCompatible.instance
|
||||
?.addPostFrameCallback((_) => autoPublish(context));
|
||||
WidgetsBindingCompatible.instance?.addPostFrameCallback((_) => autoPublish(context));
|
||||
|
||||
if (lkPlatformIsMobile()) {
|
||||
Hardware.instance.setSpeakerphoneOn(true);
|
||||
@ -347,8 +339,7 @@ class ChatCallInstance {
|
||||
}
|
||||
|
||||
// First joined people first
|
||||
return a.participant.joinedAt.millisecondsSinceEpoch -
|
||||
b.participant.joinedAt.millisecondsSinceEpoch;
|
||||
return a.participant.joinedAt.millisecondsSinceEpoch - b.participant.joinedAt.millisecondsSinceEpoch;
|
||||
});
|
||||
|
||||
ParticipantTrack localTrack = ParticipantTrack(
|
||||
@ -357,8 +348,7 @@ class ChatCallInstance {
|
||||
isScreenShare: false,
|
||||
);
|
||||
if (room.localParticipant != null) {
|
||||
final localParticipantTracks =
|
||||
room.localParticipant?.videoTrackPublications;
|
||||
final localParticipantTracks = room.localParticipant?.videoTrackPublications;
|
||||
if (localParticipantTracks != null) {
|
||||
for (var t in localParticipantTracks) {
|
||||
localTrack.videoTrack = t.track;
|
||||
@ -371,8 +361,7 @@ class ChatCallInstance {
|
||||
if (focusTrack == null) {
|
||||
focusTrack = participantTracks.first;
|
||||
} else {
|
||||
final idx = participantTracks
|
||||
.indexWhere((x) => focusTrack!.participant.sid == x.participant.sid);
|
||||
final idx = participantTracks.indexWhere((x) => focusTrack!.participant.sid == x.participant.sid);
|
||||
focusTrack = participantTracks[idx];
|
||||
}
|
||||
|
||||
|
@ -108,18 +108,12 @@ class _ChannelEditorScreenState extends State<ChannelEditorScreen> {
|
||||
child: Text(AppLocalizations.of(context)!.apply.toUpperCase()),
|
||||
),
|
||||
],
|
||||
child: Center(
|
||||
child: Container(
|
||||
constraints: const BoxConstraints(maxWidth: 640),
|
||||
child: Column(
|
||||
children: [
|
||||
_isSubmitting
|
||||
? const LinearProgressIndicator().animate().scaleX()
|
||||
: Container(),
|
||||
_isSubmitting ? const LinearProgressIndicator().animate().scaleX() : Container(),
|
||||
ListTile(
|
||||
title: Text(AppLocalizations.of(context)!.chatChannelUsage),
|
||||
subtitle:
|
||||
Text(AppLocalizations.of(context)!.chatChannelUsageCaption),
|
||||
subtitle: Text(AppLocalizations.of(context)!.chatChannelUsageCaption),
|
||||
leading: const CircleAvatar(
|
||||
backgroundColor: Colors.teal,
|
||||
child: Icon(Icons.tag, color: Colors.white),
|
||||
@ -127,8 +121,7 @@ class _ChannelEditorScreenState extends State<ChannelEditorScreen> {
|
||||
),
|
||||
const Divider(thickness: 0.3),
|
||||
Container(
|
||||
padding:
|
||||
const EdgeInsets.symmetric(horizontal: 16, vertical: 2),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 2),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
@ -136,18 +129,15 @@ class _ChannelEditorScreenState extends State<ChannelEditorScreen> {
|
||||
autofocus: true,
|
||||
controller: _aliasController,
|
||||
decoration: InputDecoration.collapsed(
|
||||
hintText: AppLocalizations.of(context)!
|
||||
.chatChannelAliasLabel,
|
||||
hintText: AppLocalizations.of(context)!.chatChannelAliasLabel,
|
||||
),
|
||||
onTapOutside: (_) =>
|
||||
FocusManager.instance.primaryFocus?.unfocus(),
|
||||
onTapOutside: (_) => FocusManager.instance.primaryFocus?.unfocus(),
|
||||
),
|
||||
),
|
||||
TextButton(
|
||||
style: TextButton.styleFrom(
|
||||
shape: const CircleBorder(),
|
||||
visualDensity:
|
||||
const VisualDensity(horizontal: -2, vertical: -2),
|
||||
visualDensity: const VisualDensity(horizontal: -2, vertical: -2),
|
||||
),
|
||||
onPressed: () => randomizeAlias(),
|
||||
child: const Icon(Icons.refresh),
|
||||
@ -157,24 +147,20 @@ class _ChannelEditorScreenState extends State<ChannelEditorScreen> {
|
||||
),
|
||||
const Divider(thickness: 0.3),
|
||||
Container(
|
||||
padding:
|
||||
const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
||||
child: TextField(
|
||||
autocorrect: true,
|
||||
controller: _nameController,
|
||||
decoration: InputDecoration.collapsed(
|
||||
hintText:
|
||||
AppLocalizations.of(context)!.chatChannelNameLabel,
|
||||
hintText: AppLocalizations.of(context)!.chatChannelNameLabel,
|
||||
),
|
||||
onTapOutside: (_) =>
|
||||
FocusManager.instance.primaryFocus?.unfocus(),
|
||||
onTapOutside: (_) => FocusManager.instance.primaryFocus?.unfocus(),
|
||||
),
|
||||
),
|
||||
const Divider(thickness: 0.3),
|
||||
Expanded(
|
||||
child: Container(
|
||||
padding:
|
||||
const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
|
||||
child: TextField(
|
||||
minLines: 5,
|
||||
maxLines: null,
|
||||
@ -182,19 +168,15 @@ class _ChannelEditorScreenState extends State<ChannelEditorScreen> {
|
||||
keyboardType: TextInputType.multiline,
|
||||
controller: _descriptionController,
|
||||
decoration: InputDecoration.collapsed(
|
||||
hintText: AppLocalizations.of(context)!
|
||||
.chatChannelDescriptionLabel,
|
||||
hintText: AppLocalizations.of(context)!.chatChannelDescriptionLabel,
|
||||
),
|
||||
onTapOutside: (_) =>
|
||||
FocusManager.instance.primaryFocus?.unfocus(),
|
||||
onTapOutside: (_) => FocusManager.instance.primaryFocus?.unfocus(),
|
||||
),
|
||||
),
|
||||
),
|
||||
widget.editing != null ? editingBanner : Container(),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -10,6 +10,7 @@ import 'package:solian/providers/auth.dart';
|
||||
import 'package:solian/providers/chat.dart';
|
||||
import 'package:solian/router.dart';
|
||||
import 'package:solian/utils/service_url.dart';
|
||||
import 'package:solian/widgets/chat/channel_action.dart';
|
||||
import 'package:solian/widgets/chat/maintainer.dart';
|
||||
import 'package:solian/widgets/chat/message.dart';
|
||||
import 'package:solian/widgets/chat/message_action.dart';
|
||||
@ -24,10 +25,25 @@ class ChatScreen extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final chat = context.watch<ChatProvider>();
|
||||
|
||||
return IndentWrapper(
|
||||
title: AppLocalizations.of(context)!.post,
|
||||
title: chat.focusChannel?.name ?? 'Loading...',
|
||||
noSafeArea: true,
|
||||
hideDrawer: true,
|
||||
appBarActions: chat.focusChannel != null
|
||||
? [
|
||||
ChannelCallAction(
|
||||
call: chat.ongoingCall,
|
||||
channel: chat.focusChannel!,
|
||||
onUpdate: () => chat.fetchChannel(chat.focusChannel!.alias),
|
||||
),
|
||||
ChannelManageAction(
|
||||
channel: chat.focusChannel!,
|
||||
onUpdate: () => chat.fetchChannel(chat.focusChannel!.alias),
|
||||
),
|
||||
]
|
||||
: [],
|
||||
child: ChatScreenWidget(
|
||||
alias: alias,
|
||||
),
|
||||
|
@ -4,9 +4,11 @@ import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:solian/models/channel.dart';
|
||||
import 'package:solian/providers/auth.dart';
|
||||
import 'package:solian/providers/chat.dart';
|
||||
import 'package:solian/router.dart';
|
||||
import 'package:solian/screens/chat/chat.dart';
|
||||
import 'package:solian/utils/service_url.dart';
|
||||
import 'package:solian/widgets/chat/channel_action.dart';
|
||||
import 'package:solian/widgets/chat/chat_new.dart';
|
||||
import 'package:solian/widgets/empty.dart';
|
||||
import 'package:solian/widgets/exts.dart';
|
||||
@ -27,12 +29,26 @@ class _ChatIndexScreenState extends State<ChatIndexScreen> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final chat = context.watch<ChatProvider>();
|
||||
|
||||
final screenWidth = MediaQuery.of(context).size.width;
|
||||
final isLargeScreen = screenWidth >= 600;
|
||||
|
||||
return IndentWrapper(
|
||||
title: AppLocalizations.of(context)!.chat,
|
||||
appBarActions: const [NotificationButton()],
|
||||
appBarActions: chat.focusChannel != null
|
||||
? [
|
||||
ChannelCallAction(
|
||||
call: chat.ongoingCall,
|
||||
channel: chat.focusChannel!,
|
||||
onUpdate: () => chat.fetchChannel(chat.focusChannel!.alias),
|
||||
),
|
||||
ChannelManageAction(
|
||||
channel: chat.focusChannel!,
|
||||
onUpdate: () => chat.fetchChannel(chat.focusChannel!.alias),
|
||||
),
|
||||
]
|
||||
: [const NotificationButton()],
|
||||
fixedAppBarColor: isLargeScreen,
|
||||
child: isLargeScreen
|
||||
? Row(
|
||||
|
Loading…
Reference in New Issue
Block a user