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