mirror of
https://gitlab.com/famedly/fluffychat.git
synced 2024-11-23 20:49:26 +01:00
Merge branch 'malin/addRequireTrailingCommasRule' into 'main'
refactor: Added and applied require_trailing_commas linter rule See merge request famedly/fluffychat!1091
This commit is contained in:
commit
e461cb1f53
@ -8,6 +8,7 @@ linter:
|
|||||||
- prefer_final_locals
|
- prefer_final_locals
|
||||||
- prefer_final_in_for_each
|
- prefer_final_in_for_each
|
||||||
- sort_pub_dependencies
|
- sort_pub_dependencies
|
||||||
|
- require_trailing_commas
|
||||||
|
|
||||||
analyzer:
|
analyzer:
|
||||||
errors:
|
errors:
|
||||||
|
@ -145,12 +145,14 @@ void main() {
|
|||||||
await tester.waitFor(
|
await tester.waitFor(
|
||||||
find.descendant(
|
find.descendant(
|
||||||
of: find.byType(InvitationSelectionView),
|
of: find.byType(InvitationSelectionView),
|
||||||
matching: find.byType(TextField)),
|
matching: find.byType(TextField),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
await tester.enterText(
|
await tester.enterText(
|
||||||
find.descendant(
|
find.descendant(
|
||||||
of: find.byType(InvitationSelectionView),
|
of: find.byType(InvitationSelectionView),
|
||||||
matching: find.byType(TextField)),
|
matching: find.byType(TextField),
|
||||||
|
),
|
||||||
Users.user2.name,
|
Users.user2.name,
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -160,14 +162,17 @@ void main() {
|
|||||||
await Future.delayed(const Duration(milliseconds: 1000));
|
await Future.delayed(const Duration(milliseconds: 1000));
|
||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
|
|
||||||
await tester.tap(find
|
await tester.tap(
|
||||||
|
find
|
||||||
.descendant(
|
.descendant(
|
||||||
of: find.descendant(
|
of: find.descendant(
|
||||||
of: find.byType(InvitationSelectionView),
|
of: find.byType(InvitationSelectionView),
|
||||||
matching: find.byType(ListTile),
|
matching: find.byType(ListTile),
|
||||||
),
|
),
|
||||||
matching: find.text(Users.user2.name))
|
matching: find.text(Users.user2.name),
|
||||||
.last);
|
)
|
||||||
|
.last,
|
||||||
|
);
|
||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
|
|
||||||
await tester.waitFor(find.maybeUppercaseText('Yes'));
|
await tester.waitFor(find.maybeUppercaseText('Yes'));
|
||||||
|
@ -144,7 +144,8 @@ extension DefaultFlowExtensions on WidgetTester {
|
|||||||
do {
|
do {
|
||||||
if (DateTime.now().isAfter(end)) {
|
if (DateTime.now().isAfter(end)) {
|
||||||
throw Exception(
|
throw Exception(
|
||||||
'Timed out waiting for HomeserverPicker or ChatListViewBody');
|
'Timed out waiting for HomeserverPicker or ChatListViewBody',
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
await pumpAndSettle();
|
await pumpAndSettle();
|
||||||
|
@ -71,7 +71,8 @@ abstract class AppConfig {
|
|||||||
} catch (e) {
|
} catch (e) {
|
||||||
Logs().w(
|
Logs().w(
|
||||||
'Invalid color in config.json! Please make sure to define the color in this format: "0xffdd0000"',
|
'Invalid color in config.json! Please make sure to define the color in this format: "0xffdd0000"',
|
||||||
e);
|
e,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (json['application_name'] is String) {
|
if (json['application_name'] is String) {
|
||||||
|
@ -70,7 +70,10 @@ class AppRoutes {
|
|||||||
widget: const ChatDetails(),
|
widget: const ChatDetails(),
|
||||||
stackedRoutes: _chatDetailsRoutes,
|
stackedRoutes: _chatDetailsRoutes,
|
||||||
),
|
),
|
||||||
VWidget(path: ':roomid', widget: const Chat(), stackedRoutes: [
|
VWidget(
|
||||||
|
path: ':roomid',
|
||||||
|
widget: const Chat(),
|
||||||
|
stackedRoutes: [
|
||||||
VWidget(
|
VWidget(
|
||||||
path: 'encryption',
|
path: 'encryption',
|
||||||
widget: const ChatEncryptionSettings(),
|
widget: const ChatEncryptionSettings(),
|
||||||
@ -84,7 +87,8 @@ class AppRoutes {
|
|||||||
widget: const ChatDetails(),
|
widget: const ChatDetails(),
|
||||||
stackedRoutes: _chatDetailsRoutes,
|
stackedRoutes: _chatDetailsRoutes,
|
||||||
),
|
),
|
||||||
]),
|
],
|
||||||
|
),
|
||||||
VWidget(
|
VWidget(
|
||||||
path: '/settings',
|
path: '/settings',
|
||||||
widget: const Settings(),
|
widget: const Settings(),
|
||||||
@ -277,7 +281,8 @@ class AppRoutes {
|
|||||||
widget: const SignupPage(),
|
widget: const SignupPage(),
|
||||||
buildTransition: _fadeTransition,
|
buildTransition: _fadeTransition,
|
||||||
),
|
),
|
||||||
]),
|
],
|
||||||
|
),
|
||||||
VWidget(
|
VWidget(
|
||||||
path: 'logs',
|
path: 'logs',
|
||||||
widget: const LogViewer(),
|
widget: const LogViewer(),
|
||||||
@ -368,7 +373,8 @@ class AppRoutes {
|
|||||||
widget: const SignupPage(),
|
widget: const SignupPage(),
|
||||||
buildTransition: _fadeTransition,
|
buildTransition: _fadeTransition,
|
||||||
),
|
),
|
||||||
]),
|
],
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
VWidget(
|
VWidget(
|
||||||
|
@ -95,7 +95,8 @@ class AddStoryController extends State<AddStoryPage> {
|
|||||||
bytes: bytes,
|
bytes: bytes,
|
||||||
name: picked.name,
|
name: picked.name,
|
||||||
);
|
);
|
||||||
});
|
},
|
||||||
|
);
|
||||||
|
|
||||||
setState(() {
|
setState(() {
|
||||||
image = matrixFile.result;
|
image = matrixFile.result;
|
||||||
|
@ -99,19 +99,23 @@ class InviteStoryPageState extends State<InviteStoryPage> {
|
|||||||
final error = snapshot.error;
|
final error = snapshot.error;
|
||||||
if (error != null) {
|
if (error != null) {
|
||||||
return Center(
|
return Center(
|
||||||
child: Text(error.toLocalizedString(context)));
|
child: Text(error.toLocalizedString(context)),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
return const Center(
|
return const Center(
|
||||||
child: CircularProgressIndicator.adaptive());
|
child: CircularProgressIndicator.adaptive(),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
_undecided = contacts.map((u) => u.id).toSet();
|
_undecided = contacts.map((u) => u.id).toSet();
|
||||||
return ListView.builder(
|
return ListView.builder(
|
||||||
itemCount: contacts.length,
|
itemCount: contacts.length,
|
||||||
itemBuilder: (context, i) => SwitchListTile.adaptive(
|
itemBuilder: (context, i) => SwitchListTile.adaptive(
|
||||||
value: _invite.contains(contacts[i].id),
|
value: _invite.contains(contacts[i].id),
|
||||||
onChanged: (b) => setState(() => b
|
onChanged: (b) => setState(
|
||||||
|
() => b
|
||||||
? _invite.add(contacts[i].id)
|
? _invite.add(contacts[i].id)
|
||||||
: _invite.remove(contacts[i].id)),
|
: _invite.remove(contacts[i].id),
|
||||||
|
),
|
||||||
secondary: Avatar(
|
secondary: Avatar(
|
||||||
mxContent: contacts[i].avatarUrl,
|
mxContent: contacts[i].avatarUrl,
|
||||||
name: contacts[i].calcDisplayname(),
|
name: contacts[i].calcDisplayname(),
|
||||||
@ -119,7 +123,8 @@ class InviteStoryPageState extends State<InviteStoryPage> {
|
|||||||
title: Text(contacts[i].calcDisplayname()),
|
title: Text(contacts[i].calcDisplayname()),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}),
|
},
|
||||||
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
@ -39,16 +39,19 @@ class ArchiveView extends StatelessWidget {
|
|||||||
child: Text(
|
child: Text(
|
||||||
L10n.of(context)!.oopsSomethingWentWrong,
|
L10n.of(context)!.oopsSomethingWentWrong,
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
));
|
),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
if (!snapshot.hasData) {
|
if (!snapshot.hasData) {
|
||||||
return const Center(
|
return const Center(
|
||||||
child: CircularProgressIndicator.adaptive(strokeWidth: 2));
|
child: CircularProgressIndicator.adaptive(strokeWidth: 2),
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
archive = snapshot.data;
|
archive = snapshot.data;
|
||||||
if (archive == null || archive!.isEmpty) {
|
if (archive == null || archive!.isEmpty) {
|
||||||
return const Center(
|
return const Center(
|
||||||
child: Icon(Icons.archive_outlined, size: 80));
|
child: Icon(Icons.archive_outlined, size: 80),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
return ListView.builder(
|
return ListView.builder(
|
||||||
itemCount: archive!.length,
|
itemCount: archive!.length,
|
||||||
|
@ -246,7 +246,8 @@ class BootstrapDialogState extends State<BootstrapDialog> {
|
|||||||
body: Center(
|
body: Center(
|
||||||
child: ConstrainedBox(
|
child: ConstrainedBox(
|
||||||
constraints: const BoxConstraints(
|
constraints: const BoxConstraints(
|
||||||
maxWidth: FluffyThemes.columnWidth * 1.5),
|
maxWidth: FluffyThemes.columnWidth * 1.5,
|
||||||
|
),
|
||||||
child: ListView(
|
child: ListView(
|
||||||
padding: const EdgeInsets.all(16.0),
|
padding: const EdgeInsets.all(16.0),
|
||||||
children: [
|
children: [
|
||||||
@ -258,7 +259,8 @@ class BootstrapDialogState extends State<BootstrapDialog> {
|
|||||||
color: Theme.of(context).colorScheme.primary,
|
color: Theme.of(context).colorScheme.primary,
|
||||||
),
|
),
|
||||||
subtitle: Text(
|
subtitle: Text(
|
||||||
L10n.of(context)!.pleaseEnterRecoveryKeyDescription),
|
L10n.of(context)!.pleaseEnterRecoveryKeyDescription,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
const Divider(height: 32),
|
const Divider(height: 32),
|
||||||
TextField(
|
TextField(
|
||||||
@ -274,10 +276,9 @@ class BootstrapDialogState extends State<BootstrapDialog> {
|
|||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
contentPadding: const EdgeInsets.all(16),
|
contentPadding: const EdgeInsets.all(16),
|
||||||
hintStyle: TextStyle(
|
hintStyle: TextStyle(
|
||||||
fontFamily: Theme.of(context)
|
fontFamily:
|
||||||
.textTheme
|
Theme.of(context).textTheme.bodyLarge?.fontFamily,
|
||||||
.bodyLarge
|
),
|
||||||
?.fontFamily),
|
|
||||||
hintText: L10n.of(context)!.recoveryKey,
|
hintText: L10n.of(context)!.recoveryKey,
|
||||||
errorText: _recoveryKeyInputError,
|
errorText: _recoveryKeyInputError,
|
||||||
),
|
),
|
||||||
@ -307,8 +308,7 @@ class BootstrapDialogState extends State<BootstrapDialog> {
|
|||||||
keyOrPassphrase: key,
|
keyOrPassphrase: key,
|
||||||
);
|
);
|
||||||
Logs().d('SSSS unlocked');
|
Logs().d('SSSS unlocked');
|
||||||
await bootstrap
|
await bootstrap.client.encryption!.crossSigning
|
||||||
.client.encryption!.crossSigning
|
|
||||||
.selfSign(
|
.selfSign(
|
||||||
keyOrPassphrase: key,
|
keyOrPassphrase: key,
|
||||||
);
|
);
|
||||||
@ -316,22 +316,28 @@ class BootstrapDialogState extends State<BootstrapDialog> {
|
|||||||
await bootstrap.openExistingSsss();
|
await bootstrap.openExistingSsss();
|
||||||
} catch (e, s) {
|
} catch (e, s) {
|
||||||
Logs().w('Unable to unlock SSSS', e, s);
|
Logs().w('Unable to unlock SSSS', e, s);
|
||||||
setState(() => _recoveryKeyInputError =
|
setState(
|
||||||
L10n.of(context)!.oopsSomethingWentWrong);
|
() => _recoveryKeyInputError =
|
||||||
|
L10n.of(context)!.oopsSomethingWentWrong,
|
||||||
|
);
|
||||||
} finally {
|
} finally {
|
||||||
setState(
|
setState(
|
||||||
() => _recoveryKeyInputLoading = false);
|
() => _recoveryKeyInputLoading = false,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}),
|
},
|
||||||
|
),
|
||||||
const SizedBox(height: 16),
|
const SizedBox(height: 16),
|
||||||
Row(children: [
|
Row(
|
||||||
|
children: [
|
||||||
const Expanded(child: Divider()),
|
const Expanded(child: Divider()),
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.all(12.0),
|
padding: const EdgeInsets.all(12.0),
|
||||||
child: Text(L10n.of(context)!.or),
|
child: Text(L10n.of(context)!.or),
|
||||||
),
|
),
|
||||||
const Expanded(child: Divider()),
|
const Expanded(child: Divider()),
|
||||||
]),
|
],
|
||||||
|
),
|
||||||
const SizedBox(height: 16),
|
const SizedBox(height: 16),
|
||||||
ElevatedButton.icon(
|
ElevatedButton.icon(
|
||||||
icon: const Icon(Icons.cast_connected_outlined),
|
icon: const Icon(Icons.cast_connected_outlined),
|
||||||
@ -408,11 +414,13 @@ class BootstrapDialogState extends State<BootstrapDialog> {
|
|||||||
case BootstrapState.error:
|
case BootstrapState.error:
|
||||||
titleText = L10n.of(context)!.oopsSomethingWentWrong;
|
titleText = L10n.of(context)!.oopsSomethingWentWrong;
|
||||||
body = const Icon(Icons.error_outline, color: Colors.red, size: 40);
|
body = const Icon(Icons.error_outline, color: Colors.red, size: 40);
|
||||||
buttons.add(AdaptiveFlatButton(
|
buttons.add(
|
||||||
|
AdaptiveFlatButton(
|
||||||
label: L10n.of(context)!.close,
|
label: L10n.of(context)!.close,
|
||||||
onPressed: () =>
|
onPressed: () =>
|
||||||
Navigator.of(context, rootNavigator: false).pop<bool>(false),
|
Navigator.of(context, rootNavigator: false).pop<bool>(false),
|
||||||
));
|
),
|
||||||
|
);
|
||||||
break;
|
break;
|
||||||
case BootstrapState.done:
|
case BootstrapState.done:
|
||||||
titleText = L10n.of(context)!.everythingReady;
|
titleText = L10n.of(context)!.everythingReady;
|
||||||
@ -423,11 +431,13 @@ class BootstrapDialogState extends State<BootstrapDialog> {
|
|||||||
Text(L10n.of(context)!.yourChatBackupHasBeenSetUp),
|
Text(L10n.of(context)!.yourChatBackupHasBeenSetUp),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
buttons.add(AdaptiveFlatButton(
|
buttons.add(
|
||||||
|
AdaptiveFlatButton(
|
||||||
label: L10n.of(context)!.close,
|
label: L10n.of(context)!.close,
|
||||||
onPressed: () =>
|
onPressed: () =>
|
||||||
Navigator.of(context, rootNavigator: false).pop<bool>(false),
|
Navigator.of(context, rootNavigator: false).pop<bool>(false),
|
||||||
));
|
),
|
||||||
|
);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -75,7 +75,8 @@ class AddWidgetTileState extends State<AddWidgetTile> {
|
|||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
SnackBar(content: Text(L10n.of(context)!.errorAddingWidget)));
|
SnackBar(content: Text(L10n.of(context)!.errorAddingWidget)),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,12 +26,15 @@ class AddWidgetTileView extends StatelessWidget {
|
|||||||
'm.jitsi': Text(L10n.of(context)!.widgetJitsi),
|
'm.jitsi': Text(L10n.of(context)!.widgetJitsi),
|
||||||
'm.video': Text(L10n.of(context)!.widgetVideo),
|
'm.video': Text(L10n.of(context)!.widgetVideo),
|
||||||
'm.custom': Text(L10n.of(context)!.widgetCustom),
|
'm.custom': Text(L10n.of(context)!.widgetCustom),
|
||||||
}.map((key, value) => MapEntry(
|
}.map(
|
||||||
|
(key, value) => MapEntry(
|
||||||
key,
|
key,
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 4.0),
|
padding: const EdgeInsets.symmetric(horizontal: 4.0),
|
||||||
child: value,
|
child: value,
|
||||||
))),
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
onValueChanged: controller.setWidgetType,
|
onValueChanged: controller.setWidgetType,
|
||||||
),
|
),
|
||||||
Padding(
|
Padding(
|
||||||
|
@ -82,10 +82,12 @@ class ChatController extends State<Chat> {
|
|||||||
|
|
||||||
final matrixFiles = <MatrixFile>[];
|
final matrixFiles = <MatrixFile>[];
|
||||||
for (var i = 0; i < bytesList.result!.length; i++) {
|
for (var i = 0; i < bytesList.result!.length; i++) {
|
||||||
matrixFiles.add(MatrixFile(
|
matrixFiles.add(
|
||||||
|
MatrixFile(
|
||||||
bytes: bytesList.result![i],
|
bytes: bytesList.result![i],
|
||||||
name: details.files[i].name,
|
name: details.files[i].name,
|
||||||
).detectFileType);
|
).detectFileType,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
await showDialog(
|
await showDialog(
|
||||||
@ -139,7 +141,8 @@ class ChatController extends State<Chat> {
|
|||||||
final userId = room?.directChatMatrixID;
|
final userId = room?.directChatMatrixID;
|
||||||
if (room == null || userId == null) {
|
if (room == null || userId == null) {
|
||||||
throw Exception(
|
throw Exception(
|
||||||
'Try to recreate a room with is not a DM room. This should not be possible from the UI!');
|
'Try to recreate a room with is not a DM room. This should not be possible from the UI!',
|
||||||
|
);
|
||||||
}
|
}
|
||||||
final success = await showFutureLoadingDialog(
|
final success = await showFutureLoadingDialog(
|
||||||
context: context,
|
context: context,
|
||||||
@ -150,7 +153,8 @@ class ChatController extends State<Chat> {
|
|||||||
await room.leave();
|
await room.leave();
|
||||||
await waitForSync;
|
await waitForSync;
|
||||||
return await client.startDirectChat(userId);
|
return await client.startDirectChat(userId);
|
||||||
});
|
},
|
||||||
|
);
|
||||||
final roomId = success.result;
|
final roomId = success.result;
|
||||||
if (roomId == null) return;
|
if (roomId == null) return;
|
||||||
VRouter.of(context).toSegments(['rooms', roomId]);
|
VRouter.of(context).toSegments(['rooms', roomId]);
|
||||||
@ -160,7 +164,8 @@ class ChatController extends State<Chat> {
|
|||||||
final room = this.room;
|
final room = this.room;
|
||||||
if (room == null) {
|
if (room == null) {
|
||||||
throw Exception(
|
throw Exception(
|
||||||
'Leave room button clicked while room is null. This should not be possible from the UI!');
|
'Leave room button clicked while room is null. This should not be possible from the UI!',
|
||||||
|
);
|
||||||
}
|
}
|
||||||
final success = await showFutureLoadingDialog(
|
final success = await showFutureLoadingDialog(
|
||||||
context: context,
|
context: context,
|
||||||
@ -327,10 +332,12 @@ class ChatController extends State<Chat> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ignore: unawaited_futures
|
// ignore: unawaited_futures
|
||||||
room!.sendTextEvent(sendController.text,
|
room!.sendTextEvent(
|
||||||
|
sendController.text,
|
||||||
inReplyTo: replyEvent,
|
inReplyTo: replyEvent,
|
||||||
editEventId: editEvent?.eventId,
|
editEventId: editEvent?.eventId,
|
||||||
parseCommands: parseCommands);
|
parseCommands: parseCommands,
|
||||||
|
);
|
||||||
sendController.value = TextEditingValue(
|
sendController.value = TextEditingValue(
|
||||||
text: pendingText,
|
text: pendingText,
|
||||||
selection: const TextSelection.collapsed(offset: 0),
|
selection: const TextSelection.collapsed(offset: 0),
|
||||||
@ -354,10 +361,12 @@ class ChatController extends State<Chat> {
|
|||||||
useRootNavigator: false,
|
useRootNavigator: false,
|
||||||
builder: (c) => SendFileDialog(
|
builder: (c) => SendFileDialog(
|
||||||
files: result
|
files: result
|
||||||
.map((xfile) => MatrixFile(
|
.map(
|
||||||
|
(xfile) => MatrixFile(
|
||||||
bytes: xfile.toUint8List(),
|
bytes: xfile.toUint8List(),
|
||||||
name: xfile.fileName!,
|
name: xfile.fileName!,
|
||||||
).detectFileType)
|
).detectFileType,
|
||||||
|
)
|
||||||
.toList(),
|
.toList(),
|
||||||
room: room!,
|
room: room!,
|
||||||
),
|
),
|
||||||
@ -375,10 +384,12 @@ class ChatController extends State<Chat> {
|
|||||||
useRootNavigator: false,
|
useRootNavigator: false,
|
||||||
builder: (c) => SendFileDialog(
|
builder: (c) => SendFileDialog(
|
||||||
files: result
|
files: result
|
||||||
.map((xfile) => MatrixFile(
|
.map(
|
||||||
|
(xfile) => MatrixFile(
|
||||||
bytes: xfile.toUint8List(),
|
bytes: xfile.toUint8List(),
|
||||||
name: xfile.fileName!,
|
name: xfile.fileName!,
|
||||||
).detectFileType)
|
).detectFileType,
|
||||||
|
)
|
||||||
.toList(),
|
.toList(),
|
||||||
room: room!,
|
room: room!,
|
||||||
),
|
),
|
||||||
@ -538,7 +549,8 @@ class ChatController extends State<Chat> {
|
|||||||
if (copyString.isNotEmpty) copyString += '\n\n';
|
if (copyString.isNotEmpty) copyString += '\n\n';
|
||||||
copyString += event.getDisplayEvent(timeline!).calcLocalizedBodyFallback(
|
copyString += event.getDisplayEvent(timeline!).calcLocalizedBodyFallback(
|
||||||
MatrixLocals(L10n.of(context)!),
|
MatrixLocals(L10n.of(context)!),
|
||||||
withSenderNamePrefix: true);
|
withSenderNamePrefix: true,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
return copyString;
|
return copyString;
|
||||||
}
|
}
|
||||||
@ -572,7 +584,8 @@ class ChatController extends State<Chat> {
|
|||||||
key: 0,
|
key: 0,
|
||||||
label: L10n.of(context)!.inoffensive,
|
label: L10n.of(context)!.inoffensive,
|
||||||
),
|
),
|
||||||
]);
|
],
|
||||||
|
);
|
||||||
if (score == null) return;
|
if (score == null) return;
|
||||||
final reason = await showTextInputDialog(
|
final reason = await showTextInputDialog(
|
||||||
useRootNavigator: false,
|
useRootNavigator: false,
|
||||||
@ -580,7 +593,8 @@ class ChatController extends State<Chat> {
|
|||||||
title: L10n.of(context)!.whyDoYouWantToReportThis,
|
title: L10n.of(context)!.whyDoYouWantToReportThis,
|
||||||
okLabel: L10n.of(context)!.ok,
|
okLabel: L10n.of(context)!.ok,
|
||||||
cancelLabel: L10n.of(context)!.cancel,
|
cancelLabel: L10n.of(context)!.cancel,
|
||||||
textFields: [DialogTextField(hintText: L10n.of(context)!.reason)]);
|
textFields: [DialogTextField(hintText: L10n.of(context)!.reason)],
|
||||||
|
);
|
||||||
if (reason == null || reason.single.isEmpty) return;
|
if (reason == null || reason.single.isEmpty) return;
|
||||||
final result = await showFutureLoadingDialog(
|
final result = await showFutureLoadingDialog(
|
||||||
context: context,
|
context: context,
|
||||||
@ -597,7 +611,8 @@ class ChatController extends State<Chat> {
|
|||||||
selectedEvents.clear();
|
selectedEvents.clear();
|
||||||
});
|
});
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
SnackBar(content: Text(L10n.of(context)!.contentHasBeenReported)));
|
SnackBar(content: Text(L10n.of(context)!.contentHasBeenReported)),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void redactEventsAction() async {
|
void redactEventsAction() async {
|
||||||
@ -620,7 +635,8 @@ class ChatController extends State<Chat> {
|
|||||||
} else {
|
} else {
|
||||||
final client = currentRoomBundle.firstWhere(
|
final client = currentRoomBundle.firstWhere(
|
||||||
(cl) => selectedEvents.first.senderId == cl!.userID,
|
(cl) => selectedEvents.first.senderId == cl!.userID,
|
||||||
orElse: () => null);
|
orElse: () => null,
|
||||||
|
);
|
||||||
if (client == null) {
|
if (client == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -630,7 +646,8 @@ class ChatController extends State<Chat> {
|
|||||||
} else {
|
} else {
|
||||||
await event.remove();
|
await event.remove();
|
||||||
}
|
}
|
||||||
});
|
},
|
||||||
|
);
|
||||||
}
|
}
|
||||||
setState(() {
|
setState(() {
|
||||||
showEmojiPicker = false;
|
showEmojiPicker = false;
|
||||||
@ -740,7 +757,8 @@ class ChatController extends State<Chat> {
|
|||||||
eventIndex =
|
eventIndex =
|
||||||
timeline!.events.indexWhere((e) => e.eventId == eventId);
|
timeline!.events.indexWhere((e) => e.eventId == eventId);
|
||||||
}
|
}
|
||||||
});
|
},
|
||||||
|
);
|
||||||
}
|
}
|
||||||
if (!mounted) {
|
if (!mounted) {
|
||||||
return;
|
return;
|
||||||
@ -811,7 +829,8 @@ class ChatController extends State<Chat> {
|
|||||||
sendController
|
sendController
|
||||||
..text = sendController.text.characters.skipLast(1).toString()
|
..text = sendController.text.characters.skipLast(1).toString()
|
||||||
..selection = TextSelection.fromPosition(
|
..selection = TextSelection.fromPosition(
|
||||||
TextPosition(offset: sendController.text.length));
|
TextPosition(offset: sendController.text.length),
|
||||||
|
);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -847,7 +866,8 @@ class ChatController extends State<Chat> {
|
|||||||
void editSelectedEventAction() {
|
void editSelectedEventAction() {
|
||||||
final client = currentRoomBundle.firstWhere(
|
final client = currentRoomBundle.firstWhere(
|
||||||
(cl) => selectedEvents.first.senderId == cl!.userID,
|
(cl) => selectedEvents.first.senderId == cl!.userID,
|
||||||
orElse: () => null);
|
orElse: () => null,
|
||||||
|
);
|
||||||
if (client == null) {
|
if (client == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -855,10 +875,12 @@ class ChatController extends State<Chat> {
|
|||||||
setState(() {
|
setState(() {
|
||||||
pendingText = sendController.text;
|
pendingText = sendController.text;
|
||||||
editEvent = selectedEvents.first;
|
editEvent = selectedEvents.first;
|
||||||
inputText = sendController.text = editEvent!
|
inputText = sendController.text =
|
||||||
.getDisplayEvent(timeline!)
|
editEvent!.getDisplayEvent(timeline!).calcLocalizedBodyFallback(
|
||||||
.calcLocalizedBodyFallback(MatrixLocals(L10n.of(context)!),
|
MatrixLocals(L10n.of(context)!),
|
||||||
withSenderNamePrefix: false, hideReply: true);
|
withSenderNamePrefix: false,
|
||||||
|
hideReply: true,
|
||||||
|
);
|
||||||
selectedEvents.clear();
|
selectedEvents.clear();
|
||||||
});
|
});
|
||||||
inputFocus.requestFocus();
|
inputFocus.requestFocus();
|
||||||
@ -881,10 +903,12 @@ class ChatController extends State<Chat> {
|
|||||||
}
|
}
|
||||||
final result = await showFutureLoadingDialog(
|
final result = await showFutureLoadingDialog(
|
||||||
context: context,
|
context: context,
|
||||||
future: () => room!.client.joinRoom(room!
|
future: () => room!.client.joinRoom(
|
||||||
|
room!
|
||||||
.getState(EventTypes.RoomTombstone)!
|
.getState(EventTypes.RoomTombstone)!
|
||||||
.parsedTombstoneContent
|
.parsedTombstoneContent
|
||||||
.replacementRoom),
|
.replacementRoom,
|
||||||
|
),
|
||||||
);
|
);
|
||||||
await showFutureLoadingDialog(
|
await showFutureLoadingDialog(
|
||||||
context: context,
|
context: context,
|
||||||
@ -1079,7 +1103,8 @@ class ChatController extends State<Chat> {
|
|||||||
final success = await showFutureLoadingDialog(
|
final success = await showFutureLoadingDialog(
|
||||||
context: context,
|
context: context,
|
||||||
future: () =>
|
future: () =>
|
||||||
Matrix.of(context).voipPlugin!.voip.requestTurnServerCredentials());
|
Matrix.of(context).voipPlugin!.voip.requestTurnServerCredentials(),
|
||||||
|
);
|
||||||
if (success.result != null) {
|
if (success.result != null) {
|
||||||
final voipPlugin = Matrix.of(context).voipPlugin;
|
final voipPlugin = Matrix.of(context).voipPlugin;
|
||||||
try {
|
try {
|
||||||
|
@ -86,7 +86,8 @@ class ChatEventList extends StatelessWidget {
|
|||||||
index: i - 1,
|
index: i - 1,
|
||||||
controller: controller.scrollController,
|
controller: controller.scrollController,
|
||||||
child: event.isVisibleInGui
|
child: event.isVisibleInGui
|
||||||
? Message(event,
|
? Message(
|
||||||
|
event,
|
||||||
onSwipe: (direction) =>
|
onSwipe: (direction) =>
|
||||||
controller.replyAction(replyTo: event),
|
controller.replyAction(replyTo: event),
|
||||||
onInfoTab: controller.showEventInfo,
|
onInfoTab: controller.showEventInfo,
|
||||||
@ -108,7 +109,8 @@ class ChatEventList extends StatelessWidget {
|
|||||||
timeline: controller.timeline!,
|
timeline: controller.timeline!,
|
||||||
nextEvent: i < controller.timeline!.events.length
|
nextEvent: i < controller.timeline!.events.length
|
||||||
? controller.timeline!.events[i]
|
? controller.timeline!.events[i]
|
||||||
: null)
|
: null,
|
||||||
|
)
|
||||||
: Container(),
|
: Container(),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
@ -300,7 +300,8 @@ class _ChatAccountPicker extends StatelessWidget {
|
|||||||
builder: (context, snapshot) => PopupMenuButton<String>(
|
builder: (context, snapshot) => PopupMenuButton<String>(
|
||||||
onSelected: _popupMenuButtonSelected,
|
onSelected: _popupMenuButtonSelected,
|
||||||
itemBuilder: (BuildContext context) => clients
|
itemBuilder: (BuildContext context) => clients
|
||||||
.map((client) => PopupMenuItem<String>(
|
.map(
|
||||||
|
(client) => PopupMenuItem<String>(
|
||||||
value: client!.userID,
|
value: client!.userID,
|
||||||
child: FutureBuilder<Profile>(
|
child: FutureBuilder<Profile>(
|
||||||
future: client.fetchOwnProfile(),
|
future: client.fetchOwnProfile(),
|
||||||
@ -311,12 +312,12 @@ class _ChatAccountPicker extends StatelessWidget {
|
|||||||
client.userID!.localpart,
|
client.userID!.localpart,
|
||||||
size: 20,
|
size: 20,
|
||||||
),
|
),
|
||||||
title:
|
title: Text(snapshot.data?.displayName ?? client.userID!),
|
||||||
Text(snapshot.data?.displayName ?? client.userID!),
|
|
||||||
contentPadding: const EdgeInsets.all(0),
|
contentPadding: const EdgeInsets.all(0),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
))
|
),
|
||||||
|
)
|
||||||
.toList(),
|
.toList(),
|
||||||
child: Avatar(
|
child: Avatar(
|
||||||
mxContent: snapshot.data?.avatarUrl,
|
mxContent: snapshot.data?.avatarUrl,
|
||||||
|
@ -53,7 +53,8 @@ class ChatView extends StatelessWidget {
|
|||||||
icon: Icon(Icons.adaptive.share),
|
icon: Icon(Icons.adaptive.share),
|
||||||
tooltip: L10n.of(context)!.share,
|
tooltip: L10n.of(context)!.share,
|
||||||
onPressed: () => controller.saveSelectedEvent(context),
|
onPressed: () => controller.saveSelectedEvent(context),
|
||||||
)),
|
),
|
||||||
|
),
|
||||||
if (controller.canRedactSelectedEvents)
|
if (controller.canRedactSelectedEvents)
|
||||||
IconButton(
|
IconButton(
|
||||||
icon: const Icon(Icons.delete_outlined),
|
icon: const Icon(Icons.delete_outlined),
|
||||||
@ -155,7 +156,9 @@ class ChatView extends StatelessWidget {
|
|||||||
|
|
||||||
if (controller.room!.membership == Membership.invite) {
|
if (controller.room!.membership == Membership.invite) {
|
||||||
showFutureLoadingDialog(
|
showFutureLoadingDialog(
|
||||||
context: context, future: () => controller.room!.join());
|
context: context,
|
||||||
|
future: () => controller.room!.join(),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
final bottomSheetPadding = FluffyThemes.isColumnMode(context) ? 16.0 : 8.0;
|
final bottomSheetPadding = FluffyThemes.isColumnMode(context) ? 16.0 : 8.0;
|
||||||
final colorScheme = Theme.of(context).colorScheme;
|
final colorScheme = Theme.of(context).colorScheme;
|
||||||
@ -254,8 +257,9 @@ class ChatView extends StatelessWidget {
|
|||||||
builder: (context) {
|
builder: (context) {
|
||||||
if (controller.timeline == null) {
|
if (controller.timeline == null) {
|
||||||
return const Center(
|
return const Center(
|
||||||
child: CircularProgressIndicator
|
child:
|
||||||
.adaptive(strokeWidth: 2),
|
CircularProgressIndicator.adaptive(
|
||||||
|
strokeWidth: 2,),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -263,7 +267,8 @@ class ChatView extends StatelessWidget {
|
|||||||
controller: controller,
|
controller: controller,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
)),
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
if (controller.room!.canSendDefaultMessages &&
|
if (controller.room!.canSendDefaultMessages &&
|
||||||
controller.room!.membership == Membership.join)
|
controller.room!.membership == Membership.join)
|
||||||
@ -274,7 +279,8 @@ class ChatView extends StatelessWidget {
|
|||||||
right: bottomSheetPadding,
|
right: bottomSheetPadding,
|
||||||
),
|
),
|
||||||
constraints: const BoxConstraints(
|
constraints: const BoxConstraints(
|
||||||
maxWidth: FluffyThemes.columnWidth * 2.5),
|
maxWidth: FluffyThemes.columnWidth * 2.5,
|
||||||
|
),
|
||||||
alignment: Alignment.center,
|
alignment: Alignment.center,
|
||||||
child: Material(
|
child: Material(
|
||||||
borderRadius: const BorderRadius.only(
|
borderRadius: const BorderRadius.only(
|
||||||
@ -324,7 +330,8 @@ class ChatView extends StatelessWidget {
|
|||||||
onPressed:
|
onPressed:
|
||||||
controller.recreateChat,
|
controller.recreateChat,
|
||||||
label: Text(
|
label: Text(
|
||||||
L10n.of(context)!.reopenChat),
|
L10n.of(context)!.reopenChat,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
@ -15,15 +15,18 @@ class EditWidgetsDialog extends StatelessWidget {
|
|||||||
return SimpleDialog(
|
return SimpleDialog(
|
||||||
title: Text(L10n.of(context)!.editWidgets),
|
title: Text(L10n.of(context)!.editWidgets),
|
||||||
children: [
|
children: [
|
||||||
...room.widgets.map((e) => ListTile(
|
...room.widgets.map(
|
||||||
|
(e) => ListTile(
|
||||||
title: Text(e.name ?? e.type),
|
title: Text(e.name ?? e.type),
|
||||||
leading: IconButton(
|
leading: IconButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
room.deleteWidget(e.id!);
|
room.deleteWidget(e.id!);
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
},
|
},
|
||||||
icon: const Icon(Icons.delete)),
|
icon: const Icon(Icons.delete),
|
||||||
)),
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
AddWidgetTile(room: room),
|
AddWidgetTile(room: room),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
@ -26,21 +26,21 @@ class EncryptionButton extends StatelessWidget {
|
|||||||
? L10n.of(context)!.encrypted
|
? L10n.of(context)!.encrypted
|
||||||
: L10n.of(context)!.encryptionNotEnabled,
|
: L10n.of(context)!.encryptionNotEnabled,
|
||||||
icon: Icon(
|
icon: Icon(
|
||||||
room.encrypted
|
room.encrypted ? Icons.lock_outlined : Icons.lock_open_outlined,
|
||||||
? Icons.lock_outlined
|
|
||||||
: Icons.lock_open_outlined,
|
|
||||||
size: 20,
|
size: 20,
|
||||||
color: room.joinRules != JoinRules.public &&
|
color: room.joinRules != JoinRules.public && !room.encrypted
|
||||||
!room.encrypted
|
|
||||||
? Colors.red
|
? Colors.red
|
||||||
: room.joinRules != JoinRules.public &&
|
: room.joinRules != JoinRules.public &&
|
||||||
snapshot.data ==
|
snapshot.data ==
|
||||||
EncryptionHealthState.unverifiedDevices
|
EncryptionHealthState.unverifiedDevices
|
||||||
? Colors.orange
|
? Colors.orange
|
||||||
: null),
|
: null,
|
||||||
|
),
|
||||||
onPressed: () => VRouter.of(context)
|
onPressed: () => VRouter.of(context)
|
||||||
.toSegments(['rooms', room.id, 'encryption']),
|
.toSegments(['rooms', room.id, 'encryption']),
|
||||||
));
|
),
|
||||||
});
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -54,7 +54,8 @@ class EventInfoDialog extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
title: Text(L10n.of(context)!.sender),
|
title: Text(L10n.of(context)!.sender),
|
||||||
subtitle: Text(
|
subtitle: Text(
|
||||||
'${event.senderFromMemoryOrFallback.calcDisplayname()} [${event.senderId}]'),
|
'${event.senderFromMemoryOrFallback.calcDisplayname()} [${event.senderId}]',
|
||||||
|
),
|
||||||
),
|
),
|
||||||
ListTile(
|
ListTile(
|
||||||
title: Text(L10n.of(context)!.time),
|
title: Text(L10n.of(context)!.time),
|
||||||
|
@ -69,7 +69,8 @@ class AudioPlayerState extends State<AudioPlayerWidget> {
|
|||||||
if (!kIsWeb) {
|
if (!kIsWeb) {
|
||||||
final tempDir = await getTemporaryDirectory();
|
final tempDir = await getTemporaryDirectory();
|
||||||
final fileName = Uri.encodeComponent(
|
final fileName = Uri.encodeComponent(
|
||||||
widget.event.attachmentOrThumbnailMxcUrl()!.pathSegments.last);
|
widget.event.attachmentOrThumbnailMxcUrl()!.pathSegments.last,
|
||||||
|
);
|
||||||
file = File('${tempDir.path}/${fileName}_${matrixFile.name}');
|
file = File('${tempDir.path}/${fileName}_${matrixFile.name}');
|
||||||
await file.writeAsBytes(matrixFile.bytes);
|
await file.writeAsBytes(matrixFile.bytes);
|
||||||
}
|
}
|
||||||
@ -224,11 +225,14 @@ class AudioPlayerState extends State<AudioPlayerWidget> {
|
|||||||
for (var i = 0; i < AudioPlayerWidget.wavesCount; i++)
|
for (var i = 0; i < AudioPlayerWidget.wavesCount; i++)
|
||||||
Expanded(
|
Expanded(
|
||||||
child: InkWell(
|
child: InkWell(
|
||||||
onTap: () => audioPlayer?.seek(Duration(
|
onTap: () => audioPlayer?.seek(
|
||||||
|
Duration(
|
||||||
milliseconds:
|
milliseconds:
|
||||||
(maxPosition / AudioPlayerWidget.wavesCount)
|
(maxPosition / AudioPlayerWidget.wavesCount)
|
||||||
.round() *
|
.round() *
|
||||||
i)),
|
i,
|
||||||
|
),
|
||||||
|
),
|
||||||
child: Container(
|
child: Container(
|
||||||
height: 32,
|
height: 32,
|
||||||
alignment: Alignment.center,
|
alignment: Alignment.center,
|
||||||
@ -240,7 +244,8 @@ class AudioPlayerState extends State<AudioPlayerWidget> {
|
|||||||
color: widget.color,
|
color: widget.color,
|
||||||
borderRadius: BorderRadius.circular(64),
|
borderRadius: BorderRadius.circular(64),
|
||||||
),
|
),
|
||||||
height: 32 * (waveform[i] / 1024)),
|
height: 32 * (waveform[i] / 1024),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -38,9 +38,14 @@ class HtmlMessage extends StatelessWidget {
|
|||||||
// miss-matching tags, and this way we actually correctly identify what we want to strip and, well,
|
// miss-matching tags, and this way we actually correctly identify what we want to strip and, well,
|
||||||
// strip it.
|
// strip it.
|
||||||
final renderHtml = html.replaceAll(
|
final renderHtml = html.replaceAll(
|
||||||
RegExp('<mx-reply>.*</mx-reply>',
|
RegExp(
|
||||||
caseSensitive: false, multiLine: false, dotAll: true),
|
'<mx-reply>.*</mx-reply>',
|
||||||
'');
|
caseSensitive: false,
|
||||||
|
multiLine: false,
|
||||||
|
dotAll: true,
|
||||||
|
),
|
||||||
|
'',
|
||||||
|
);
|
||||||
|
|
||||||
// there is no need to pre-validate the html, as we validate it while rendering
|
// there is no need to pre-validate the html, as we validate it while rendering
|
||||||
|
|
||||||
@ -61,8 +66,12 @@ class HtmlMessage extends StatelessWidget {
|
|||||||
maxLines: maxLines,
|
maxLines: maxLines,
|
||||||
onLinkTap: (url) => UrlLauncher(context, url).launchUrl(),
|
onLinkTap: (url) => UrlLauncher(context, url).launchUrl(),
|
||||||
onPillTap: (url) => UrlLauncher(context, url).launchUrl(),
|
onPillTap: (url) => UrlLauncher(context, url).launchUrl(),
|
||||||
getMxcUrl: (String mxc, double? width, double? height,
|
getMxcUrl: (
|
||||||
{bool? animated = false}) {
|
String mxc,
|
||||||
|
double? width,
|
||||||
|
double? height, {
|
||||||
|
bool? animated = false,
|
||||||
|
}) {
|
||||||
final ratio = MediaQuery.of(context).devicePixelRatio;
|
final ratio = MediaQuery.of(context).devicePixelRatio;
|
||||||
return Uri.parse(mxc)
|
return Uri.parse(mxc)
|
||||||
.getThumbnail(
|
.getThumbnail(
|
||||||
@ -77,7 +86,8 @@ class HtmlMessage extends StatelessWidget {
|
|||||||
onImageTap: (String mxc) => showDialog(
|
onImageTap: (String mxc) => showDialog(
|
||||||
context: Matrix.of(context).navigatorContext,
|
context: Matrix.of(context).navigatorContext,
|
||||||
useRootNavigator: false,
|
useRootNavigator: false,
|
||||||
builder: (_) => ImageViewer(Event(
|
builder: (_) => ImageViewer(
|
||||||
|
Event(
|
||||||
type: EventTypes.Message,
|
type: EventTypes.Message,
|
||||||
content: <String, dynamic>{
|
content: <String, dynamic>{
|
||||||
'body': mxc,
|
'body': mxc,
|
||||||
@ -87,7 +97,10 @@ class HtmlMessage extends StatelessWidget {
|
|||||||
senderId: room.client.userID!,
|
senderId: room.client.userID!,
|
||||||
originServerTs: DateTime.now(),
|
originServerTs: DateTime.now(),
|
||||||
eventId: 'fake_event',
|
eventId: 'fake_event',
|
||||||
room: room))),
|
room: room,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
setCodeLanguage: (String key, String value) async {
|
setCodeLanguage: (String key, String value) async {
|
||||||
await matrix.store.setItem('${SettingKeys.codeLanguage}.$key', value);
|
await matrix.store.setItem('${SettingKeys.codeLanguage}.$key', value);
|
||||||
},
|
},
|
||||||
|
@ -27,8 +27,9 @@ class Message extends StatelessWidget {
|
|||||||
final bool selected;
|
final bool selected;
|
||||||
final Timeline timeline;
|
final Timeline timeline;
|
||||||
|
|
||||||
const Message(this.event,
|
const Message(
|
||||||
{this.nextEvent,
|
this.event, {
|
||||||
|
this.nextEvent,
|
||||||
this.longPressSelect = false,
|
this.longPressSelect = false,
|
||||||
this.onSelect,
|
this.onSelect,
|
||||||
this.onInfoTab,
|
this.onInfoTab,
|
||||||
@ -37,8 +38,8 @@ class Message extends StatelessWidget {
|
|||||||
required this.onSwipe,
|
required this.onSwipe,
|
||||||
this.selected = false,
|
this.selected = false,
|
||||||
required this.timeline,
|
required this.timeline,
|
||||||
Key? key})
|
Key? key,
|
||||||
: super(key: key);
|
}) : super(key: key);
|
||||||
|
|
||||||
/// Indicates wheither the user may use a mouse instead
|
/// Indicates wheither the user may use a mouse instead
|
||||||
/// of touchscreen.
|
/// of touchscreen.
|
||||||
@ -126,13 +127,15 @@ class Message extends StatelessWidget {
|
|||||||
height: 16 * AppConfig.bubbleSizeFactor,
|
height: 16 * AppConfig.bubbleSizeFactor,
|
||||||
child: event.status == EventStatus.sending
|
child: event.status == EventStatus.sending
|
||||||
? const CircularProgressIndicator.adaptive(
|
? const CircularProgressIndicator.adaptive(
|
||||||
strokeWidth: 2)
|
strokeWidth: 2,
|
||||||
|
)
|
||||||
: event.status == EventStatus.error
|
: event.status == EventStatus.error
|
||||||
? const Icon(Icons.error, color: Colors.red)
|
? const Icon(Icons.error, color: Colors.red)
|
||||||
: null,
|
: null,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
))
|
),
|
||||||
|
)
|
||||||
: FutureBuilder<User?>(
|
: FutureBuilder<User?>(
|
||||||
future: event.fetchSenderUser(),
|
future: event.fetchSenderUser(),
|
||||||
builder: (context, snapshot) {
|
builder: (context, snapshot) {
|
||||||
@ -142,7 +145,8 @@ class Message extends StatelessWidget {
|
|||||||
name: user.calcDisplayname(),
|
name: user.calcDisplayname(),
|
||||||
onTap: () => onAvatarTab!(event),
|
onTap: () => onAvatarTab!(event),
|
||||||
);
|
);
|
||||||
}),
|
},
|
||||||
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
@ -171,7 +175,8 @@ class Message extends StatelessWidget {
|
|||||||
: displayname.lightColorText),
|
: displayname.lightColorText),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}),
|
},
|
||||||
|
),
|
||||||
),
|
),
|
||||||
Container(
|
Container(
|
||||||
alignment: alignment,
|
alignment: alignment,
|
||||||
@ -198,7 +203,8 @@ class Message extends StatelessWidget {
|
|||||||
? EdgeInsets.zero
|
? EdgeInsets.zero
|
||||||
: EdgeInsets.all(16 * AppConfig.bubbleSizeFactor),
|
: EdgeInsets.all(16 * AppConfig.bubbleSizeFactor),
|
||||||
constraints: const BoxConstraints(
|
constraints: const BoxConstraints(
|
||||||
maxWidth: FluffyThemes.columnWidth * 1.5),
|
maxWidth: FluffyThemes.columnWidth * 1.5,
|
||||||
|
),
|
||||||
child: Stack(
|
child: Stack(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Column(
|
Column(
|
||||||
@ -233,11 +239,14 @@ class Message extends StatelessWidget {
|
|||||||
child: AbsorbPointer(
|
child: AbsorbPointer(
|
||||||
child: Container(
|
child: Container(
|
||||||
margin: EdgeInsets.symmetric(
|
margin: EdgeInsets.symmetric(
|
||||||
vertical: 4.0 *
|
vertical:
|
||||||
AppConfig.bubbleSizeFactor),
|
4.0 * AppConfig.bubbleSizeFactor,
|
||||||
child: ReplyContent(replyEvent,
|
),
|
||||||
|
child: ReplyContent(
|
||||||
|
replyEvent,
|
||||||
ownMessage: ownMessage,
|
ownMessage: ownMessage,
|
||||||
timeline: timeline),
|
timeline: timeline,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@ -249,10 +258,13 @@ class Message extends StatelessWidget {
|
|||||||
onInfoTab: onInfoTab,
|
onInfoTab: onInfoTab,
|
||||||
),
|
),
|
||||||
if (event.hasAggregatedEvents(
|
if (event.hasAggregatedEvents(
|
||||||
timeline, RelationshipTypes.edit))
|
timeline,
|
||||||
|
RelationshipTypes.edit,
|
||||||
|
))
|
||||||
Padding(
|
Padding(
|
||||||
padding: EdgeInsets.only(
|
padding: EdgeInsets.only(
|
||||||
top: 4.0 * AppConfig.bubbleSizeFactor),
|
top: 4.0 * AppConfig.bubbleSizeFactor,
|
||||||
|
),
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
@ -301,7 +313,8 @@ class Message extends StatelessWidget {
|
|||||||
Padding(
|
Padding(
|
||||||
padding: displayTime
|
padding: displayTime
|
||||||
? EdgeInsets.symmetric(
|
? EdgeInsets.symmetric(
|
||||||
vertical: 8.0 * AppConfig.bubbleSizeFactor)
|
vertical: 8.0 * AppConfig.bubbleSizeFactor,
|
||||||
|
)
|
||||||
: EdgeInsets.zero,
|
: EdgeInsets.zero,
|
||||||
child: Center(
|
child: Center(
|
||||||
child: Material(
|
child: Material(
|
||||||
@ -311,7 +324,8 @@ class Message extends StatelessWidget {
|
|||||||
.colorScheme
|
.colorScheme
|
||||||
.background
|
.background
|
||||||
.withOpacity(0.33),
|
.withOpacity(0.33),
|
||||||
borderRadius: BorderRadius.circular(AppConfig.borderRadius / 2),
|
borderRadius:
|
||||||
|
BorderRadius.circular(AppConfig.borderRadius / 2),
|
||||||
clipBehavior: Clip.antiAlias,
|
clipBehavior: Clip.antiAlias,
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.all(6.0),
|
padding: const EdgeInsets.all(6.0),
|
||||||
@ -320,7 +334,8 @@ class Message extends StatelessWidget {
|
|||||||
style: TextStyle(fontSize: 14 * AppConfig.fontSizeFactor),
|
style: TextStyle(fontSize: 14 * AppConfig.fontSizeFactor),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
)),
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
row,
|
row,
|
||||||
if (event.hasAggregatedEvents(timeline, RelationshipTypes.reaction))
|
if (event.hasAggregatedEvents(timeline, RelationshipTypes.reaction))
|
||||||
|
@ -27,21 +27,27 @@ class MessageContent extends StatelessWidget {
|
|||||||
final Color textColor;
|
final Color textColor;
|
||||||
final void Function(Event)? onInfoTab;
|
final void Function(Event)? onInfoTab;
|
||||||
|
|
||||||
const MessageContent(this.event,
|
const MessageContent(
|
||||||
{this.onInfoTab, Key? key, required this.textColor})
|
this.event, {
|
||||||
: super(key: key);
|
this.onInfoTab,
|
||||||
|
Key? key,
|
||||||
|
required this.textColor,
|
||||||
|
}) : super(key: key);
|
||||||
|
|
||||||
void _verifyOrRequestKey(BuildContext context) async {
|
void _verifyOrRequestKey(BuildContext context) async {
|
||||||
final l10n = L10n.of(context)!;
|
final l10n = L10n.of(context)!;
|
||||||
if (event.content['can_request_session'] != true) {
|
if (event.content['can_request_session'] != true) {
|
||||||
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
|
SnackBar(
|
||||||
content: Text(
|
content: Text(
|
||||||
event.type == EventTypes.Encrypted
|
event.type == EventTypes.Encrypted
|
||||||
? l10n.needPantalaimonWarning
|
? l10n.needPantalaimonWarning
|
||||||
: event.calcLocalizedBodyFallback(
|
: event.calcLocalizedBodyFallback(
|
||||||
MatrixLocals(l10n),
|
MatrixLocals(l10n),
|
||||||
),
|
),
|
||||||
)));
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final client = Matrix.of(context).client;
|
final client = Matrix.of(context).client;
|
||||||
@ -216,27 +222,32 @@ class MessageContent extends StatelessWidget {
|
|||||||
future: event.redactedBecause?.fetchSenderUser(),
|
future: event.redactedBecause?.fetchSenderUser(),
|
||||||
builder: (context, snapshot) {
|
builder: (context, snapshot) {
|
||||||
return _ButtonContent(
|
return _ButtonContent(
|
||||||
label: L10n.of(context)!.redactedAnEvent(snapshot.data
|
label: L10n.of(context)!.redactedAnEvent(
|
||||||
?.calcDisplayname() ??
|
snapshot.data?.calcDisplayname() ??
|
||||||
event.senderFromMemoryOrFallback.calcDisplayname()),
|
event.senderFromMemoryOrFallback.calcDisplayname(),
|
||||||
|
),
|
||||||
icon: const Icon(Icons.delete_outlined),
|
icon: const Icon(Icons.delete_outlined),
|
||||||
textColor: buttonTextColor,
|
textColor: buttonTextColor,
|
||||||
onPressed: () => onInfoTab!(event),
|
onPressed: () => onInfoTab!(event),
|
||||||
);
|
);
|
||||||
});
|
},
|
||||||
|
);
|
||||||
}
|
}
|
||||||
final bigEmotes = event.onlyEmotes &&
|
final bigEmotes = event.onlyEmotes &&
|
||||||
event.numberEmotes > 0 &&
|
event.numberEmotes > 0 &&
|
||||||
event.numberEmotes <= 10;
|
event.numberEmotes <= 10;
|
||||||
return FutureBuilder<String>(
|
return FutureBuilder<String>(
|
||||||
future: event.calcLocalizedBody(MatrixLocals(L10n.of(context)!),
|
future: event.calcLocalizedBody(
|
||||||
hideReply: true),
|
MatrixLocals(L10n.of(context)!),
|
||||||
|
hideReply: true,
|
||||||
|
),
|
||||||
builder: (context, snapshot) {
|
builder: (context, snapshot) {
|
||||||
return LinkText(
|
return LinkText(
|
||||||
text: snapshot.data ??
|
text: snapshot.data ??
|
||||||
event.calcLocalizedBodyFallback(
|
event.calcLocalizedBodyFallback(
|
||||||
MatrixLocals(L10n.of(context)!),
|
MatrixLocals(L10n.of(context)!),
|
||||||
hideReply: true),
|
hideReply: true,
|
||||||
|
),
|
||||||
textStyle: TextStyle(
|
textStyle: TextStyle(
|
||||||
color: textColor,
|
color: textColor,
|
||||||
fontSize: bigEmotes ? fontSize * 3 : fontSize,
|
fontSize: bigEmotes ? fontSize * 3 : fontSize,
|
||||||
@ -251,7 +262,8 @@ class MessageContent extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
onLinkTap: (url) => UrlLauncher(context, url).launchUrl(),
|
onLinkTap: (url) => UrlLauncher(context, url).launchUrl(),
|
||||||
);
|
);
|
||||||
});
|
},
|
||||||
|
);
|
||||||
}
|
}
|
||||||
case EventTypes.CallInvite:
|
case EventTypes.CallInvite:
|
||||||
return FutureBuilder<User?>(
|
return FutureBuilder<User?>(
|
||||||
@ -260,12 +272,14 @@ class MessageContent extends StatelessWidget {
|
|||||||
return _ButtonContent(
|
return _ButtonContent(
|
||||||
label: L10n.of(context)!.startedACall(
|
label: L10n.of(context)!.startedACall(
|
||||||
snapshot.data?.calcDisplayname() ??
|
snapshot.data?.calcDisplayname() ??
|
||||||
event.senderFromMemoryOrFallback.calcDisplayname()),
|
event.senderFromMemoryOrFallback.calcDisplayname(),
|
||||||
|
),
|
||||||
icon: const Icon(Icons.phone_outlined),
|
icon: const Icon(Icons.phone_outlined),
|
||||||
textColor: buttonTextColor,
|
textColor: buttonTextColor,
|
||||||
onPressed: () => onInfoTab!(event),
|
onPressed: () => onInfoTab!(event),
|
||||||
);
|
);
|
||||||
});
|
},
|
||||||
|
);
|
||||||
default:
|
default:
|
||||||
return FutureBuilder<User?>(
|
return FutureBuilder<User?>(
|
||||||
future: event.fetchSenderUser(),
|
future: event.fetchSenderUser(),
|
||||||
@ -274,12 +288,14 @@ class MessageContent extends StatelessWidget {
|
|||||||
label: L10n.of(context)!.userSentUnknownEvent(
|
label: L10n.of(context)!.userSentUnknownEvent(
|
||||||
snapshot.data?.calcDisplayname() ??
|
snapshot.data?.calcDisplayname() ??
|
||||||
event.senderFromMemoryOrFallback.calcDisplayname(),
|
event.senderFromMemoryOrFallback.calcDisplayname(),
|
||||||
event.type),
|
event.type,
|
||||||
|
),
|
||||||
icon: const Icon(Icons.info_outlined),
|
icon: const Icon(Icons.info_outlined),
|
||||||
textColor: buttonTextColor,
|
textColor: buttonTextColor,
|
||||||
onPressed: () => onInfoTab!(event),
|
onPressed: () => onInfoTab!(event),
|
||||||
);
|
);
|
||||||
});
|
},
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -46,7 +46,10 @@ class MessageReactions extends StatelessWidget {
|
|||||||
|
|
||||||
final reactionList = reactionMap.values.toList();
|
final reactionList = reactionMap.values.toList();
|
||||||
reactionList.sort((a, b) => b.count - a.count > 0 ? 1 : -1);
|
reactionList.sort((a, b) => b.count - a.count > 0 ? 1 : -1);
|
||||||
return Wrap(spacing: 4.0, runSpacing: 4.0, children: [
|
return Wrap(
|
||||||
|
spacing: 4.0,
|
||||||
|
runSpacing: 4.0,
|
||||||
|
children: [
|
||||||
...reactionList
|
...reactionList
|
||||||
.map(
|
.map(
|
||||||
(r) => _Reaction(
|
(r) => _Reaction(
|
||||||
@ -55,9 +58,11 @@ class MessageReactions extends StatelessWidget {
|
|||||||
reacted: r.reacted,
|
reacted: r.reacted,
|
||||||
onTap: () {
|
onTap: () {
|
||||||
if (r.reacted) {
|
if (r.reacted) {
|
||||||
final evt = allReactionEvents.firstWhereOrNull((e) =>
|
final evt = allReactionEvents.firstWhereOrNull(
|
||||||
|
(e) =>
|
||||||
e.senderId == e.room.client.userID &&
|
e.senderId == e.room.client.userID &&
|
||||||
e.content['m.relates_to']['key'] == r.key);
|
e.content['m.relates_to']['key'] == r.key,
|
||||||
|
);
|
||||||
if (evt != null) {
|
if (evt != null) {
|
||||||
showFutureLoadingDialog(
|
showFutureLoadingDialog(
|
||||||
context: context,
|
context: context,
|
||||||
@ -84,7 +89,8 @@ class MessageReactions extends StatelessWidget {
|
|||||||
child: CircularProgressIndicator.adaptive(strokeWidth: 1),
|
child: CircularProgressIndicator.adaptive(strokeWidth: 1),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
]);
|
],
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -121,11 +127,13 @@ class _Reaction extends StatelessWidget {
|
|||||||
height: fontSize,
|
height: fontSize,
|
||||||
),
|
),
|
||||||
const SizedBox(width: 4),
|
const SizedBox(width: 4),
|
||||||
Text(count.toString(),
|
Text(
|
||||||
|
count.toString(),
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: textColor,
|
color: textColor,
|
||||||
fontSize: DefaultTextStyle.of(context).style.fontSize,
|
fontSize: DefaultTextStyle.of(context).style.fontSize,
|
||||||
)),
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
@ -133,11 +141,13 @@ class _Reaction extends StatelessWidget {
|
|||||||
if (renderKey.length > 10) {
|
if (renderKey.length > 10) {
|
||||||
renderKey = renderKey.getRange(0, 9) + Characters('…');
|
renderKey = renderKey.getRange(0, 9) + Characters('…');
|
||||||
}
|
}
|
||||||
content = Text('$renderKey $count',
|
content = Text(
|
||||||
|
'$renderKey $count',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: textColor,
|
color: textColor,
|
||||||
fontSize: DefaultTextStyle.of(context).style.fontSize,
|
fontSize: DefaultTextStyle.of(context).style.fontSize,
|
||||||
));
|
),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
return InkWell(
|
return InkWell(
|
||||||
onTap: () => onTap != null ? onTap!() : null,
|
onTap: () => onTap != null ? onTap!() : null,
|
||||||
|
@ -98,7 +98,8 @@ class ReplyContent extends StatelessWidget {
|
|||||||
fontSize: fontSize,
|
fontSize: fontSize,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}),
|
},
|
||||||
|
),
|
||||||
replyBody,
|
replyBody,
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
@ -40,7 +40,8 @@ class StateMessage extends StatelessWidget {
|
|||||||
event.redacted ? TextDecoration.lineThrough : null,
|
event.redacted ? TextDecoration.lineThrough : null,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}),
|
},
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
@ -9,9 +9,11 @@ class VerificationRequestContent extends StatelessWidget {
|
|||||||
final Event event;
|
final Event event;
|
||||||
final Timeline timeline;
|
final Timeline timeline;
|
||||||
|
|
||||||
const VerificationRequestContent(
|
const VerificationRequestContent({
|
||||||
{required this.event, required this.timeline, Key? key})
|
required this.event,
|
||||||
: super(key: key);
|
required this.timeline,
|
||||||
|
Key? key,
|
||||||
|
}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@ -43,18 +45,22 @@ class VerificationRequestContent extends StatelessWidget {
|
|||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Icon(Icons.lock_outlined,
|
Icon(
|
||||||
|
Icons.lock_outlined,
|
||||||
color: canceled
|
color: canceled
|
||||||
? Colors.red
|
? Colors.red
|
||||||
: (fullyDone ? Colors.green : Colors.grey)),
|
: (fullyDone ? Colors.green : Colors.grey),
|
||||||
|
),
|
||||||
const SizedBox(width: 8),
|
const SizedBox(width: 8),
|
||||||
Text(canceled
|
Text(
|
||||||
|
canceled
|
||||||
? 'Error ${cancel.first.content.tryGet<String>('code')}: ${cancel.first.content.tryGet<String>('reason')}'
|
? 'Error ${cancel.first.content.tryGet<String>('code')}: ${cancel.first.content.tryGet<String>('reason')}'
|
||||||
: (fullyDone
|
: (fullyDone
|
||||||
? L10n.of(context)!.verifySuccess
|
? L10n.of(context)!.verifySuccess
|
||||||
: (started
|
: (started
|
||||||
? L10n.of(context)!.loadingPleaseWait
|
? L10n.of(context)!.loadingPleaseWait
|
||||||
: L10n.of(context)!.newVerificationRequest)))
|
: L10n.of(context)!.newVerificationRequest)),
|
||||||
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -39,7 +39,8 @@ class EventVideoPlayerState extends State<EventVideoPlayer> {
|
|||||||
} else {
|
} else {
|
||||||
final tempDir = await getTemporaryDirectory();
|
final tempDir = await getTemporaryDirectory();
|
||||||
final fileName = Uri.encodeComponent(
|
final fileName = Uri.encodeComponent(
|
||||||
widget.event.attachmentOrThumbnailMxcUrl()!.pathSegments.last);
|
widget.event.attachmentOrThumbnailMxcUrl()!.pathSegments.last,
|
||||||
|
);
|
||||||
final file = File('${tempDir.path}/${fileName}_${videoFile.name}');
|
final file = File('${tempDir.path}/${fileName}_${videoFile.name}');
|
||||||
if (await file.exists() == false) {
|
if (await file.exists() == false) {
|
||||||
await file.writeAsBytes(videoFile.bytes);
|
await file.writeAsBytes(videoFile.bytes);
|
||||||
@ -62,13 +63,17 @@ class EventVideoPlayerState extends State<EventVideoPlayer> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
} on MatrixConnectionException catch (e) {
|
} on MatrixConnectionException catch (e) {
|
||||||
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
|
SnackBar(
|
||||||
content: Text(e.toLocalizedString(context)),
|
content: Text(e.toLocalizedString(context)),
|
||||||
));
|
),
|
||||||
|
);
|
||||||
} catch (e, s) {
|
} catch (e, s) {
|
||||||
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
|
SnackBar(
|
||||||
content: Text(e.toLocalizedString(context)),
|
content: Text(e.toLocalizedString(context)),
|
||||||
));
|
),
|
||||||
|
);
|
||||||
Logs().w('Error while playing video', e, s);
|
Logs().w('Error while playing video', e, s);
|
||||||
} finally {
|
} finally {
|
||||||
// Workaround for Chewie needs time to get the aspectRatio
|
// Workaround for Chewie needs time to get the aspectRatio
|
||||||
@ -120,14 +125,16 @@ class EventVideoPlayerState extends State<EventVideoPlayer> {
|
|||||||
width: 24,
|
width: 24,
|
||||||
height: 24,
|
height: 24,
|
||||||
child: CircularProgressIndicator.adaptive(
|
child: CircularProgressIndicator.adaptive(
|
||||||
strokeWidth: 2),
|
strokeWidth: 2,
|
||||||
|
),
|
||||||
)
|
)
|
||||||
: const Icon(Icons.download_outlined),
|
: const Icon(Icons.download_outlined),
|
||||||
label: Text(
|
label: Text(
|
||||||
_isDownloading
|
_isDownloading
|
||||||
? L10n.of(context)!.loadingPleaseWait
|
? L10n.of(context)!.loadingPleaseWait
|
||||||
: L10n.of(context)!.videoWithSize(
|
: L10n.of(context)!.videoWithSize(
|
||||||
widget.event.sizeString ?? '?MB'),
|
widget.event.sizeString ?? '?MB',
|
||||||
|
),
|
||||||
),
|
),
|
||||||
onPressed: _isDownloading ? null : _downloadAction,
|
onPressed: _isDownloading ? null : _downloadAction,
|
||||||
),
|
),
|
||||||
|
@ -117,8 +117,10 @@ class InputBar extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
// aside of emote packs, also propose normal (tm) unicode emojis
|
// aside of emote packs, also propose normal (tm) unicode emojis
|
||||||
final matchingUnicodeEmojis = Emoji.all()
|
final matchingUnicodeEmojis = Emoji.all()
|
||||||
.where((element) => [element.name, ...element.keywords]
|
.where(
|
||||||
.any((element) => element.toLowerCase().contains(emoteSearch)))
|
(element) => [element.name, ...element.keywords]
|
||||||
|
.any((element) => element.toLowerCase().contains(emoteSearch)),
|
||||||
|
)
|
||||||
.toList();
|
.toList();
|
||||||
// sort by the index of the search term in the name in order to have
|
// sort by the index of the search term in the name in order to have
|
||||||
// best matches first
|
// best matches first
|
||||||
@ -186,12 +188,14 @@ class InputBar extends StatelessWidget {
|
|||||||
.toLowerCase()
|
.toLowerCase()
|
||||||
.contains(roomSearch)) ||
|
.contains(roomSearch)) ||
|
||||||
(state.content['alt_aliases'] is List &&
|
(state.content['alt_aliases'] is List &&
|
||||||
state.content['alt_aliases'].any((l) =>
|
state.content['alt_aliases'].any(
|
||||||
|
(l) =>
|
||||||
l is String &&
|
l is String &&
|
||||||
l
|
l
|
||||||
.split(':')[0]
|
.split(':')[0]
|
||||||
.toLowerCase()
|
.toLowerCase()
|
||||||
.contains(roomSearch))))) ||
|
.contains(roomSearch),
|
||||||
|
)))) ||
|
||||||
(r.name.toLowerCase().contains(roomSearch))) {
|
(r.name.toLowerCase().contains(roomSearch))) {
|
||||||
ret.add({
|
ret.add({
|
||||||
'type': 'room',
|
'type': 'room',
|
||||||
@ -226,8 +230,10 @@ class InputBar extends StatelessWidget {
|
|||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Text('/$command',
|
Text(
|
||||||
style: const TextStyle(fontFamily: 'monospace')),
|
'/$command',
|
||||||
|
style: const TextStyle(fontFamily: 'monospace'),
|
||||||
|
),
|
||||||
Text(
|
Text(
|
||||||
hint,
|
hint,
|
||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
@ -273,8 +279,8 @@ class InputBar extends StatelessWidget {
|
|||||||
child: suggestion['pack_avatar_url'] != null
|
child: suggestion['pack_avatar_url'] != null
|
||||||
? Avatar(
|
? Avatar(
|
||||||
mxContent: Uri.tryParse(
|
mxContent: Uri.tryParse(
|
||||||
suggestion.tryGet<String>('pack_avatar_url') ??
|
suggestion.tryGet<String>('pack_avatar_url') ?? '',
|
||||||
''),
|
),
|
||||||
name: suggestion.tryGet<String>('pack_display_name'),
|
name: suggestion.tryGet<String>('pack_display_name'),
|
||||||
size: size * 0.9,
|
size: size * 0.9,
|
||||||
client: client,
|
client: client,
|
||||||
@ -397,7 +403,8 @@ class InputBar extends StatelessWidget {
|
|||||||
actions: !useShortCuts
|
actions: !useShortCuts
|
||||||
? {}
|
? {}
|
||||||
: {
|
: {
|
||||||
NewLineIntent: CallbackAction(onInvoke: (i) {
|
NewLineIntent: CallbackAction(
|
||||||
|
onInvoke: (i) {
|
||||||
final val = controller!.value;
|
final val = controller!.value;
|
||||||
final selection = val.selection.start;
|
final selection = val.selection.start;
|
||||||
final messageWithoutNewLine =
|
final messageWithoutNewLine =
|
||||||
@ -409,11 +416,14 @@ class InputBar extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
return null;
|
return null;
|
||||||
}),
|
},
|
||||||
SubmitLineIntent: CallbackAction(onInvoke: (i) {
|
),
|
||||||
|
SubmitLineIntent: CallbackAction(
|
||||||
|
onInvoke: (i) {
|
||||||
onSubmitted!(controller!.text);
|
onSubmitted!(controller!.text);
|
||||||
return null;
|
return null;
|
||||||
}),
|
},
|
||||||
|
),
|
||||||
},
|
},
|
||||||
child: TypeAheadField<Map<String, String?>>(
|
child: TypeAheadField<Map<String, String?>>(
|
||||||
direction: AxisDirection.up,
|
direction: AxisDirection.up,
|
||||||
|
@ -18,14 +18,17 @@ class PinnedEvents extends StatelessWidget {
|
|||||||
const PinnedEvents(this.controller, {Key? key}) : super(key: key);
|
const PinnedEvents(this.controller, {Key? key}) : super(key: key);
|
||||||
|
|
||||||
Future<void> _displayPinnedEventsDialog(
|
Future<void> _displayPinnedEventsDialog(
|
||||||
BuildContext context, List<Event?> events) async {
|
BuildContext context,
|
||||||
|
List<Event?> events,
|
||||||
|
) async {
|
||||||
final eventId = events.length == 1
|
final eventId = events.length == 1
|
||||||
? events.single?.eventId
|
? events.single?.eventId
|
||||||
: await showConfirmationDialog<String>(
|
: await showConfirmationDialog<String>(
|
||||||
context: context,
|
context: context,
|
||||||
title: L10n.of(context)!.pinMessage,
|
title: L10n.of(context)!.pinMessage,
|
||||||
actions: events
|
actions: events
|
||||||
.map((event) => AlertDialogAction(
|
.map(
|
||||||
|
(event) => AlertDialogAction(
|
||||||
key: event?.eventId ?? '',
|
key: event?.eventId ?? '',
|
||||||
label: event?.calcLocalizedBodyFallback(
|
label: event?.calcLocalizedBodyFallback(
|
||||||
MatrixLocals(L10n.of(context)!),
|
MatrixLocals(L10n.of(context)!),
|
||||||
@ -33,8 +36,10 @@ class PinnedEvents extends StatelessWidget {
|
|||||||
hideReply: true,
|
hideReply: true,
|
||||||
) ??
|
) ??
|
||||||
'UNKNOWN',
|
'UNKNOWN',
|
||||||
))
|
),
|
||||||
.toList());
|
)
|
||||||
|
.toList(),
|
||||||
|
);
|
||||||
|
|
||||||
if (eventId != null) controller.scrollToEventId(eventId);
|
if (eventId != null) controller.scrollToEventId(eventId);
|
||||||
}
|
}
|
||||||
@ -106,9 +111,8 @@ class PinnedEvents extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
maxLines: 2,
|
maxLines: 2,
|
||||||
textStyle: TextStyle(
|
textStyle: TextStyle(
|
||||||
color: Theme.of(context)
|
color:
|
||||||
.colorScheme
|
Theme.of(context).colorScheme.onSurfaceVariant,
|
||||||
.onSurfaceVariant,
|
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
fontSize: fontSize,
|
fontSize: fontSize,
|
||||||
decoration: event.redacted
|
decoration: event.redacted
|
||||||
@ -116,25 +120,25 @@ class PinnedEvents extends StatelessWidget {
|
|||||||
: null,
|
: null,
|
||||||
),
|
),
|
||||||
linkStyle: TextStyle(
|
linkStyle: TextStyle(
|
||||||
color: Theme.of(context)
|
color:
|
||||||
.colorScheme
|
Theme.of(context).colorScheme.onSurfaceVariant,
|
||||||
.onSurfaceVariant,
|
|
||||||
fontSize: fontSize,
|
fontSize: fontSize,
|
||||||
decoration: TextDecoration.underline,
|
decoration: TextDecoration.underline,
|
||||||
decorationColor: Theme.of(context)
|
decorationColor:
|
||||||
.colorScheme
|
Theme.of(context).colorScheme.onSurfaceVariant,
|
||||||
.onSurfaceVariant,
|
|
||||||
),
|
),
|
||||||
onLinkTap: (url) =>
|
onLinkTap: (url) =>
|
||||||
UrlLauncher(context, url).launchUrl(),
|
UrlLauncher(context, url).launchUrl(),
|
||||||
);
|
);
|
||||||
}),
|
},
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
});
|
},
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,37 +26,45 @@ class ReactionsPicker extends StatelessWidget {
|
|||||||
height: (display) ? 56 : 0,
|
height: (display) ? 56 : 0,
|
||||||
child: Material(
|
child: Material(
|
||||||
color: Colors.transparent,
|
color: Colors.transparent,
|
||||||
child: Builder(builder: (context) {
|
child: Builder(
|
||||||
|
builder: (context) {
|
||||||
if (!display) {
|
if (!display) {
|
||||||
return Container();
|
return Container();
|
||||||
}
|
}
|
||||||
final proposals = proposeEmojis(
|
final proposals = proposeEmojis(
|
||||||
controller.selectedEvents.first.plaintextBody,
|
controller.selectedEvents.first.plaintextBody,
|
||||||
number: 25,
|
number: 25,
|
||||||
languageCodes: EmojiProposalLanguageCodes.values.toSet());
|
languageCodes: EmojiProposalLanguageCodes.values.toSet(),
|
||||||
|
);
|
||||||
final emojis = proposals.isNotEmpty
|
final emojis = proposals.isNotEmpty
|
||||||
? proposals.map((e) => e.char).toList()
|
? proposals.map((e) => e.char).toList()
|
||||||
: List<String>.from(AppEmojis.emojis);
|
: List<String>.from(AppEmojis.emojis);
|
||||||
final allReactionEvents = controller.selectedEvents.first
|
final allReactionEvents = controller.selectedEvents.first
|
||||||
.aggregatedEvents(
|
.aggregatedEvents(
|
||||||
controller.timeline!, RelationshipTypes.reaction)
|
controller.timeline!,
|
||||||
.where((event) =>
|
RelationshipTypes.reaction,
|
||||||
|
)
|
||||||
|
.where(
|
||||||
|
(event) =>
|
||||||
event.senderId == event.room.client.userID &&
|
event.senderId == event.room.client.userID &&
|
||||||
event.type == 'm.reaction');
|
event.type == 'm.reaction',
|
||||||
|
);
|
||||||
|
|
||||||
for (final event in allReactionEvents) {
|
for (final event in allReactionEvents) {
|
||||||
try {
|
try {
|
||||||
emojis.remove(event.content['m.relates_to']['key']);
|
emojis.remove(event.content['m.relates_to']['key']);
|
||||||
} catch (_) {}
|
} catch (_) {}
|
||||||
}
|
}
|
||||||
return Row(children: [
|
return Row(
|
||||||
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Container(
|
child: Container(
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: Theme.of(context).secondaryHeaderColor,
|
color: Theme.of(context).secondaryHeaderColor,
|
||||||
borderRadius: const BorderRadius.only(
|
borderRadius: const BorderRadius.only(
|
||||||
bottomRight:
|
bottomRight: Radius.circular(AppConfig.borderRadius),
|
||||||
Radius.circular(AppConfig.borderRadius))),
|
),
|
||||||
|
),
|
||||||
padding: const EdgeInsets.only(right: 1),
|
padding: const EdgeInsets.only(right: 1),
|
||||||
child: ListView.builder(
|
child: ListView.builder(
|
||||||
scrollDirection: Axis.horizontal,
|
scrollDirection: Axis.horizontal,
|
||||||
@ -74,7 +82,9 @@ class ReactionsPicker extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
))),
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
InkWell(
|
InkWell(
|
||||||
borderRadius: BorderRadius.circular(8),
|
borderRadius: BorderRadius.circular(8),
|
||||||
child: Container(
|
child: Container(
|
||||||
@ -88,9 +98,12 @@ class ReactionsPicker extends StatelessWidget {
|
|||||||
child: const Icon(Icons.add_outlined),
|
child: const Icon(Icons.add_outlined),
|
||||||
),
|
),
|
||||||
onTap: () =>
|
onTap: () =>
|
||||||
controller.pickEmojiReactionAction(allReactionEvents))
|
controller.pickEmojiReactionAction(allReactionEvents),
|
||||||
]);
|
)
|
||||||
}),
|
],
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -130,7 +130,8 @@ class RecordingDialogState extends State<RecordingDialog> {
|
|||||||
.take(26)
|
.take(26)
|
||||||
.toList()
|
.toList()
|
||||||
.reversed
|
.reversed
|
||||||
.map((amplitude) => Container(
|
.map(
|
||||||
|
(amplitude) => Container(
|
||||||
margin: const EdgeInsets.only(left: 2),
|
margin: const EdgeInsets.only(left: 2),
|
||||||
width: 4,
|
width: 4,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
@ -138,7 +139,9 @@ class RecordingDialogState extends State<RecordingDialog> {
|
|||||||
borderRadius:
|
borderRadius:
|
||||||
BorderRadius.circular(AppConfig.borderRadius),
|
BorderRadius.circular(AppConfig.borderRadius),
|
||||||
),
|
),
|
||||||
height: maxDecibalWidth * (amplitude / 100)))
|
height: maxDecibalWidth * (amplitude / 100),
|
||||||
|
),
|
||||||
|
)
|
||||||
.toList(),
|
.toList(),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -33,10 +33,14 @@ class ReplyDisplay extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: controller.replyEvent != null
|
child: controller.replyEvent != null
|
||||||
? ReplyContent(controller.replyEvent!,
|
? ReplyContent(
|
||||||
timeline: controller.timeline!)
|
controller.replyEvent!,
|
||||||
: _EditContent(controller.editEvent
|
timeline: controller.timeline!,
|
||||||
?.getDisplayEvent(controller.timeline!)),
|
)
|
||||||
|
: _EditContent(
|
||||||
|
controller.editEvent
|
||||||
|
?.getDisplayEvent(controller.timeline!),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@ -83,7 +87,8 @@ class _EditContent extends StatelessWidget {
|
|||||||
color: Theme.of(context).textTheme.bodyMedium!.color,
|
color: Theme.of(context).textTheme.bodyMedium!.color,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}),
|
},
|
||||||
|
),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,8 @@ class SendFileDialogState extends State<SendFileDialog> {
|
|||||||
future: () async {
|
future: () async {
|
||||||
file = await file.resizeVideo();
|
file = await file.resizeVideo();
|
||||||
thumbnail = await file.getVideoThumbnail();
|
thumbnail = await file.getVideoThumbnail();
|
||||||
});
|
},
|
||||||
|
);
|
||||||
}
|
}
|
||||||
final scaffoldMessenger = ScaffoldMessenger.of(context);
|
final scaffoldMessenger = ScaffoldMessenger.of(context);
|
||||||
widget.room
|
widget.room
|
||||||
@ -79,7 +80,9 @@ class SendFileDialogState extends State<SendFileDialog> {
|
|||||||
}
|
}
|
||||||
Widget contentWidget;
|
Widget contentWidget;
|
||||||
if (allFilesAreImages) {
|
if (allFilesAreImages) {
|
||||||
contentWidget = Column(mainAxisSize: MainAxisSize.min, children: <Widget>[
|
contentWidget = Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: <Widget>[
|
||||||
Flexible(
|
Flexible(
|
||||||
child: Image.memory(
|
child: Image.memory(
|
||||||
widget.files.first.bytes,
|
widget.files.first.bytes,
|
||||||
@ -98,7 +101,8 @@ class SendFileDialogState extends State<SendFileDialog> {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
]);
|
],
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
contentWidget = Text('$fileName ($sizeString)');
|
contentWidget = Text('$fileName ($sizeString)');
|
||||||
}
|
}
|
||||||
|
@ -28,12 +28,13 @@ class StickerPickerDialogState extends State<StickerPickerDialog> {
|
|||||||
final pack = stickerPacks[packSlugs[packIndex]]!;
|
final pack = stickerPacks[packSlugs[packIndex]]!;
|
||||||
final filteredImagePackImageEntried = pack.images.entries.toList();
|
final filteredImagePackImageEntried = pack.images.entries.toList();
|
||||||
if (searchFilter?.isNotEmpty ?? false) {
|
if (searchFilter?.isNotEmpty ?? false) {
|
||||||
filteredImagePackImageEntried.removeWhere((e) =>
|
filteredImagePackImageEntried.removeWhere(
|
||||||
!(e.key.toLowerCase().contains(searchFilter!.toLowerCase()) ||
|
(e) => !(e.key.toLowerCase().contains(searchFilter!.toLowerCase()) ||
|
||||||
(e.value.body
|
(e.value.body
|
||||||
?.toLowerCase()
|
?.toLowerCase()
|
||||||
.contains(searchFilter!.toLowerCase()) ??
|
.contains(searchFilter!.toLowerCase()) ??
|
||||||
false)));
|
false)),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
final imageKeys =
|
final imageKeys =
|
||||||
filteredImagePackImageEntried.map((e) => e.key).toList();
|
filteredImagePackImageEntried.map((e) => e.key).toList();
|
||||||
@ -57,7 +58,8 @@ class StickerPickerDialogState extends State<StickerPickerDialog> {
|
|||||||
GridView.builder(
|
GridView.builder(
|
||||||
itemCount: imageKeys.length,
|
itemCount: imageKeys.length,
|
||||||
gridDelegate: const SliverGridDelegateWithMaxCrossAxisExtent(
|
gridDelegate: const SliverGridDelegateWithMaxCrossAxisExtent(
|
||||||
maxCrossAxisExtent: 100),
|
maxCrossAxisExtent: 100,
|
||||||
|
),
|
||||||
shrinkWrap: true,
|
shrinkWrap: true,
|
||||||
physics: const NeverScrollableScrollPhysics(),
|
physics: const NeverScrollableScrollPhysics(),
|
||||||
itemBuilder: (BuildContext context, int imageIndex) {
|
itemBuilder: (BuildContext context, int imageIndex) {
|
||||||
@ -130,7 +132,8 @@ class StickerPickerDialogState extends State<StickerPickerDialog> {
|
|||||||
delegate: SliverChildBuilderDelegate(
|
delegate: SliverChildBuilderDelegate(
|
||||||
packBuilder,
|
packBuilder,
|
||||||
childCount: packSlugs.length,
|
childCount: packSlugs.length,
|
||||||
)),
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -58,7 +58,8 @@ class ChatDetailsController extends State<ChatDetails> {
|
|||||||
);
|
);
|
||||||
if (success.error == null) {
|
if (success.error == null) {
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
SnackBar(content: Text(L10n.of(context)!.displaynameHasBeenChanged)));
|
SnackBar(content: Text(L10n.of(context)!.displaynameHasBeenChanged)),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -212,8 +213,11 @@ class ChatDetailsController extends State<ChatDetails> {
|
|||||||
future: () => room.setDescription(input.single),
|
future: () => room.setDescription(input.single),
|
||||||
);
|
);
|
||||||
if (success.error == null) {
|
if (success.error == null) {
|
||||||
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
content: Text(L10n.of(context)!.groupDescriptionHasBeenChanged)));
|
SnackBar(
|
||||||
|
content: Text(L10n.of(context)!.groupDescriptionHasBeenChanged),
|
||||||
|
),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -325,7 +329,9 @@ class ChatDetailsController extends State<ChatDetails> {
|
|||||||
void requestMoreMembersAction() async {
|
void requestMoreMembersAction() async {
|
||||||
final room = Matrix.of(context).client.getRoomById(roomId!);
|
final room = Matrix.of(context).client.getRoomById(roomId!);
|
||||||
final participants = await showFutureLoadingDialog(
|
final participants = await showFutureLoadingDialog(
|
||||||
context: context, future: () => room!.requestParticipants());
|
context: context,
|
||||||
|
future: () => room!.requestParticipants(),
|
||||||
|
);
|
||||||
if (participants.error == null) {
|
if (participants.error == null) {
|
||||||
setState(() => members = participants.result);
|
setState(() => members = participants.result);
|
||||||
}
|
}
|
||||||
|
@ -69,16 +69,17 @@ class ChatDetailsView extends StatelessWidget {
|
|||||||
icon: Icon(Icons.adaptive.share_outlined),
|
icon: Icon(Icons.adaptive.share_outlined),
|
||||||
onPressed: () => FluffyShare.share(
|
onPressed: () => FluffyShare.share(
|
||||||
AppConfig.inviteLinkPrefix + room.canonicalAlias,
|
AppConfig.inviteLinkPrefix + room.canonicalAlias,
|
||||||
context),
|
context,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
ChatSettingsPopupMenu(room, false)
|
ChatSettingsPopupMenu(room, false)
|
||||||
],
|
],
|
||||||
title: Text(
|
title: Text(
|
||||||
room.getLocalizedDisplayname(
|
room.getLocalizedDisplayname(
|
||||||
MatrixLocals(L10n.of(context)!)),
|
MatrixLocals(L10n.of(context)!),
|
||||||
),
|
),
|
||||||
backgroundColor:
|
),
|
||||||
Theme.of(context).appBarTheme.backgroundColor,
|
backgroundColor: Theme.of(context).appBarTheme.backgroundColor,
|
||||||
flexibleSpace: FlexibleSpaceBar(
|
flexibleSpace: FlexibleSpaceBar(
|
||||||
background: ContentBanner(
|
background: ContentBanner(
|
||||||
mxContent: room.avatar,
|
mxContent: room.avatar,
|
||||||
@ -114,8 +115,7 @@ class ChatDetailsView extends StatelessWidget {
|
|||||||
title: Text(
|
title: Text(
|
||||||
L10n.of(context)!.groupDescription,
|
L10n.of(context)!.groupDescription,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color:
|
color: Theme.of(context).colorScheme.secondary,
|
||||||
Theme.of(context).colorScheme.secondary,
|
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -123,7 +123,8 @@ class ChatDetailsView extends StatelessWidget {
|
|||||||
if (room.topic.isNotEmpty)
|
if (room.topic.isNotEmpty)
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.symmetric(
|
padding: const EdgeInsets.symmetric(
|
||||||
horizontal: 16.0),
|
horizontal: 16.0,
|
||||||
|
),
|
||||||
child: LinkText(
|
child: LinkText(
|
||||||
text: room.topic.isEmpty
|
text: room.topic.isEmpty
|
||||||
? L10n.of(context)!.addGroupDescription
|
? L10n.of(context)!.addGroupDescription
|
||||||
@ -151,47 +152,53 @@ class ChatDetailsView extends StatelessWidget {
|
|||||||
title: Text(
|
title: Text(
|
||||||
L10n.of(context)!.settings,
|
L10n.of(context)!.settings,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color:
|
color: Theme.of(context).colorScheme.secondary,
|
||||||
Theme.of(context).colorScheme.secondary,
|
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
trailing: Icon(controller.displaySettings
|
trailing: Icon(
|
||||||
|
controller.displaySettings
|
||||||
? Icons.keyboard_arrow_down_outlined
|
? Icons.keyboard_arrow_down_outlined
|
||||||
: Icons.keyboard_arrow_right_outlined),
|
: Icons.keyboard_arrow_right_outlined,
|
||||||
|
),
|
||||||
onTap: controller.toggleDisplaySettings,
|
onTap: controller.toggleDisplaySettings,
|
||||||
),
|
),
|
||||||
if (controller.displaySettings) ...[
|
if (controller.displaySettings) ...[
|
||||||
if (room.canSendEvent('m.room.name'))
|
if (room.canSendEvent('m.room.name'))
|
||||||
ListTile(
|
ListTile(
|
||||||
leading: CircleAvatar(
|
leading: CircleAvatar(
|
||||||
backgroundColor: Theme.of(context)
|
backgroundColor:
|
||||||
.scaffoldBackgroundColor,
|
Theme.of(context).scaffoldBackgroundColor,
|
||||||
foregroundColor: iconColor,
|
foregroundColor: iconColor,
|
||||||
child: const Icon(
|
child: const Icon(
|
||||||
Icons.people_outline_outlined),
|
Icons.people_outline_outlined,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
title: Text(
|
||||||
|
L10n.of(context)!.changeTheNameOfTheGroup,
|
||||||
|
),
|
||||||
|
subtitle: Text(
|
||||||
|
room.getLocalizedDisplayname(
|
||||||
|
MatrixLocals(L10n.of(context)!),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
title: Text(L10n.of(context)!
|
|
||||||
.changeTheNameOfTheGroup),
|
|
||||||
subtitle: Text(room.getLocalizedDisplayname(
|
|
||||||
MatrixLocals(L10n.of(context)!))),
|
|
||||||
onTap: controller.setDisplaynameAction,
|
onTap: controller.setDisplaynameAction,
|
||||||
),
|
),
|
||||||
if (room.joinRules == JoinRules.public)
|
if (room.joinRules == JoinRules.public)
|
||||||
ListTile(
|
ListTile(
|
||||||
leading: CircleAvatar(
|
leading: CircleAvatar(
|
||||||
backgroundColor: Theme.of(context)
|
backgroundColor:
|
||||||
.scaffoldBackgroundColor,
|
Theme.of(context).scaffoldBackgroundColor,
|
||||||
foregroundColor: iconColor,
|
foregroundColor: iconColor,
|
||||||
child: const Icon(Icons.link_outlined),
|
child: const Icon(Icons.link_outlined),
|
||||||
),
|
),
|
||||||
onTap: controller.editAliases,
|
onTap: controller.editAliases,
|
||||||
title:
|
title: Text(L10n.of(context)!.editRoomAliases),
|
||||||
Text(L10n.of(context)!.editRoomAliases),
|
|
||||||
subtitle: Text(
|
subtitle: Text(
|
||||||
(room.canonicalAlias.isNotEmpty)
|
(room.canonicalAlias.isNotEmpty)
|
||||||
? room.canonicalAlias
|
? room.canonicalAlias
|
||||||
: L10n.of(context)!.none),
|
: L10n.of(context)!.none,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
ListTile(
|
ListTile(
|
||||||
leading: CircleAvatar(
|
leading: CircleAvatar(
|
||||||
@ -199,11 +206,11 @@ class ChatDetailsView extends StatelessWidget {
|
|||||||
Theme.of(context).scaffoldBackgroundColor,
|
Theme.of(context).scaffoldBackgroundColor,
|
||||||
foregroundColor: iconColor,
|
foregroundColor: iconColor,
|
||||||
child: const Icon(
|
child: const Icon(
|
||||||
Icons.insert_emoticon_outlined),
|
Icons.insert_emoticon_outlined,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
title: Text(L10n.of(context)!.emoteSettings),
|
title: Text(L10n.of(context)!.emoteSettings),
|
||||||
subtitle:
|
subtitle: Text(L10n.of(context)!.setCustomEmotes),
|
||||||
Text(L10n.of(context)!.setCustomEmotes),
|
|
||||||
onTap: controller.goToEmoteSettings,
|
onTap: controller.goToEmoteSettings,
|
||||||
),
|
),
|
||||||
PopupMenuButton(
|
PopupMenuButton(
|
||||||
@ -213,81 +220,99 @@ class ChatDetailsView extends StatelessWidget {
|
|||||||
if (room.canChangeJoinRules)
|
if (room.canChangeJoinRules)
|
||||||
PopupMenuItem<JoinRules>(
|
PopupMenuItem<JoinRules>(
|
||||||
value: JoinRules.public,
|
value: JoinRules.public,
|
||||||
child: Text(JoinRules.public
|
child: Text(
|
||||||
.getLocalizedString(
|
JoinRules.public.getLocalizedString(
|
||||||
MatrixLocals(L10n.of(context)!))),
|
MatrixLocals(L10n.of(context)!),
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
if (room.canChangeJoinRules)
|
if (room.canChangeJoinRules)
|
||||||
PopupMenuItem<JoinRules>(
|
PopupMenuItem<JoinRules>(
|
||||||
value: JoinRules.invite,
|
value: JoinRules.invite,
|
||||||
child: Text(JoinRules.invite
|
child: Text(
|
||||||
.getLocalizedString(
|
JoinRules.invite.getLocalizedString(
|
||||||
MatrixLocals(L10n.of(context)!))),
|
MatrixLocals(L10n.of(context)!),
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
child: ListTile(
|
child: ListTile(
|
||||||
leading: CircleAvatar(
|
leading: CircleAvatar(
|
||||||
backgroundColor: Theme.of(context)
|
backgroundColor:
|
||||||
.scaffoldBackgroundColor,
|
Theme.of(context).scaffoldBackgroundColor,
|
||||||
foregroundColor: iconColor,
|
foregroundColor: iconColor,
|
||||||
child: const Icon(Icons.shield_outlined)),
|
child: const Icon(Icons.shield_outlined),
|
||||||
title: Text(L10n.of(context)!
|
),
|
||||||
.whoIsAllowedToJoinThisGroup),
|
title: Text(
|
||||||
|
L10n.of(context)!.whoIsAllowedToJoinThisGroup,
|
||||||
|
),
|
||||||
subtitle: Text(
|
subtitle: Text(
|
||||||
room.joinRules?.getLocalizedString(
|
room.joinRules?.getLocalizedString(
|
||||||
MatrixLocals(L10n.of(context)!)) ??
|
MatrixLocals(L10n.of(context)!),
|
||||||
|
) ??
|
||||||
L10n.of(context)!.none,
|
L10n.of(context)!.none,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
PopupMenuButton(
|
PopupMenuButton(
|
||||||
onSelected:
|
onSelected: controller.setHistoryVisibilityAction,
|
||||||
controller.setHistoryVisibilityAction,
|
|
||||||
itemBuilder: (BuildContext context) =>
|
itemBuilder: (BuildContext context) =>
|
||||||
<PopupMenuEntry<HistoryVisibility>>[
|
<PopupMenuEntry<HistoryVisibility>>[
|
||||||
if (room.canChangeHistoryVisibility)
|
if (room.canChangeHistoryVisibility)
|
||||||
PopupMenuItem<HistoryVisibility>(
|
PopupMenuItem<HistoryVisibility>(
|
||||||
value: HistoryVisibility.invited,
|
value: HistoryVisibility.invited,
|
||||||
child: Text(HistoryVisibility.invited
|
child: Text(
|
||||||
|
HistoryVisibility.invited
|
||||||
.getLocalizedString(
|
.getLocalizedString(
|
||||||
MatrixLocals(L10n.of(context)!))),
|
MatrixLocals(L10n.of(context)!),
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
if (room.canChangeHistoryVisibility)
|
if (room.canChangeHistoryVisibility)
|
||||||
PopupMenuItem<HistoryVisibility>(
|
PopupMenuItem<HistoryVisibility>(
|
||||||
value: HistoryVisibility.joined,
|
value: HistoryVisibility.joined,
|
||||||
child: Text(HistoryVisibility.joined
|
child: Text(
|
||||||
|
HistoryVisibility.joined
|
||||||
.getLocalizedString(
|
.getLocalizedString(
|
||||||
MatrixLocals(L10n.of(context)!))),
|
MatrixLocals(L10n.of(context)!),
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
if (room.canChangeHistoryVisibility)
|
if (room.canChangeHistoryVisibility)
|
||||||
PopupMenuItem<HistoryVisibility>(
|
PopupMenuItem<HistoryVisibility>(
|
||||||
value: HistoryVisibility.shared,
|
value: HistoryVisibility.shared,
|
||||||
child: Text(HistoryVisibility.shared
|
child: Text(
|
||||||
|
HistoryVisibility.shared
|
||||||
.getLocalizedString(
|
.getLocalizedString(
|
||||||
MatrixLocals(L10n.of(context)!))),
|
MatrixLocals(L10n.of(context)!),
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
if (room.canChangeHistoryVisibility)
|
if (room.canChangeHistoryVisibility)
|
||||||
PopupMenuItem<HistoryVisibility>(
|
PopupMenuItem<HistoryVisibility>(
|
||||||
value: HistoryVisibility.worldReadable,
|
value: HistoryVisibility.worldReadable,
|
||||||
child: Text(HistoryVisibility
|
child: Text(
|
||||||
.worldReadable
|
HistoryVisibility.worldReadable
|
||||||
.getLocalizedString(
|
.getLocalizedString(
|
||||||
MatrixLocals(L10n.of(context)!))),
|
MatrixLocals(L10n.of(context)!),
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
child: ListTile(
|
child: ListTile(
|
||||||
leading: CircleAvatar(
|
leading: CircleAvatar(
|
||||||
backgroundColor: Theme.of(context)
|
backgroundColor:
|
||||||
.scaffoldBackgroundColor,
|
Theme.of(context).scaffoldBackgroundColor,
|
||||||
foregroundColor: iconColor,
|
foregroundColor: iconColor,
|
||||||
child:
|
child: const Icon(Icons.visibility_outlined),
|
||||||
const Icon(Icons.visibility_outlined),
|
),
|
||||||
|
title: Text(
|
||||||
|
L10n.of(context)!.visibilityOfTheChatHistory,
|
||||||
),
|
),
|
||||||
title: Text(L10n.of(context)!
|
|
||||||
.visibilityOfTheChatHistory),
|
|
||||||
subtitle: Text(
|
subtitle: Text(
|
||||||
room.historyVisibility?.getLocalizedString(
|
room.historyVisibility?.getLocalizedString(
|
||||||
MatrixLocals(L10n.of(context)!)) ??
|
MatrixLocals(L10n.of(context)!),
|
||||||
|
) ??
|
||||||
L10n.of(context)!.none,
|
L10n.of(context)!.none,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -301,9 +326,11 @@ class ChatDetailsView extends StatelessWidget {
|
|||||||
PopupMenuItem<GuestAccess>(
|
PopupMenuItem<GuestAccess>(
|
||||||
value: GuestAccess.canJoin,
|
value: GuestAccess.canJoin,
|
||||||
child: Text(
|
child: Text(
|
||||||
GuestAccess.canJoin
|
GuestAccess.canJoin.getLocalizedString(
|
||||||
.getLocalizedString(MatrixLocals(
|
MatrixLocals(
|
||||||
L10n.of(context)!)),
|
L10n.of(context)!,
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
if (room.canChangeGuestAccess)
|
if (room.canChangeGuestAccess)
|
||||||
@ -311,8 +338,11 @@ class ChatDetailsView extends StatelessWidget {
|
|||||||
value: GuestAccess.forbidden,
|
value: GuestAccess.forbidden,
|
||||||
child: Text(
|
child: Text(
|
||||||
GuestAccess.forbidden
|
GuestAccess.forbidden
|
||||||
.getLocalizedString(MatrixLocals(
|
.getLocalizedString(
|
||||||
L10n.of(context)!)),
|
MatrixLocals(
|
||||||
|
L10n.of(context)!,
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@ -322,13 +352,16 @@ class ChatDetailsView extends StatelessWidget {
|
|||||||
.scaffoldBackgroundColor,
|
.scaffoldBackgroundColor,
|
||||||
foregroundColor: iconColor,
|
foregroundColor: iconColor,
|
||||||
child: const Icon(
|
child: const Icon(
|
||||||
Icons.person_add_alt_1_outlined),
|
Icons.person_add_alt_1_outlined,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
title: Text(
|
||||||
|
L10n.of(context)!.areGuestsAllowedToJoin,
|
||||||
),
|
),
|
||||||
title: Text(L10n.of(context)!
|
|
||||||
.areGuestsAllowedToJoin),
|
|
||||||
subtitle: Text(
|
subtitle: Text(
|
||||||
room.guestAccess.getLocalizedString(
|
room.guestAccess.getLocalizedString(
|
||||||
MatrixLocals(L10n.of(context)!)),
|
MatrixLocals(L10n.of(context)!),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -336,13 +369,15 @@ class ChatDetailsView extends StatelessWidget {
|
|||||||
title:
|
title:
|
||||||
Text(L10n.of(context)!.editChatPermissions),
|
Text(L10n.of(context)!.editChatPermissions),
|
||||||
subtitle: Text(
|
subtitle: Text(
|
||||||
L10n.of(context)!.whoCanPerformWhichAction),
|
L10n.of(context)!.whoCanPerformWhichAction,
|
||||||
|
),
|
||||||
leading: CircleAvatar(
|
leading: CircleAvatar(
|
||||||
backgroundColor:
|
backgroundColor:
|
||||||
Theme.of(context).scaffoldBackgroundColor,
|
Theme.of(context).scaffoldBackgroundColor,
|
||||||
foregroundColor: iconColor,
|
foregroundColor: iconColor,
|
||||||
child: const Icon(
|
child: const Icon(
|
||||||
Icons.edit_attributes_outlined),
|
Icons.edit_attributes_outlined,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
onTap: () =>
|
onTap: () =>
|
||||||
VRouter.of(context).to('permissions'),
|
VRouter.of(context).to('permissions'),
|
||||||
@ -353,19 +388,18 @@ class ChatDetailsView extends StatelessWidget {
|
|||||||
title: Text(
|
title: Text(
|
||||||
actualMembersCount > 1
|
actualMembersCount > 1
|
||||||
? L10n.of(context)!.countParticipants(
|
? L10n.of(context)!.countParticipants(
|
||||||
actualMembersCount.toString())
|
actualMembersCount.toString(),
|
||||||
|
)
|
||||||
: L10n.of(context)!.emptyChat,
|
: L10n.of(context)!.emptyChat,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color:
|
color: Theme.of(context).colorScheme.secondary,
|
||||||
Theme.of(context).colorScheme.secondary,
|
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
room.canInvite
|
room.canInvite
|
||||||
? ListTile(
|
? ListTile(
|
||||||
title:
|
title: Text(L10n.of(context)!.inviteContact),
|
||||||
Text(L10n.of(context)!.inviteContact),
|
|
||||||
leading: CircleAvatar(
|
leading: CircleAvatar(
|
||||||
backgroundColor:
|
backgroundColor:
|
||||||
Theme.of(context).primaryColor,
|
Theme.of(context).primaryColor,
|
||||||
@ -373,8 +407,7 @@ class ChatDetailsView extends StatelessWidget {
|
|||||||
radius: Avatar.defaultSize / 2,
|
radius: Avatar.defaultSize / 2,
|
||||||
child: const Icon(Icons.add_outlined),
|
child: const Icon(Icons.add_outlined),
|
||||||
),
|
),
|
||||||
onTap: () =>
|
onTap: () => VRouter.of(context).to('invite'),
|
||||||
VRouter.of(context).to('invite'),
|
|
||||||
)
|
)
|
||||||
: Container(),
|
: Container(),
|
||||||
],
|
],
|
||||||
@ -382,11 +415,13 @@ class ChatDetailsView extends StatelessWidget {
|
|||||||
: i < controller.members!.length + 1
|
: i < controller.members!.length + 1
|
||||||
? ParticipantListItem(controller.members![i - 1])
|
? ParticipantListItem(controller.members![i - 1])
|
||||||
: ListTile(
|
: ListTile(
|
||||||
title: Text(L10n.of(context)!
|
title: Text(
|
||||||
.loadCountMoreParticipants(
|
L10n.of(context)!.loadCountMoreParticipants(
|
||||||
(actualMembersCount -
|
(actualMembersCount -
|
||||||
controller.members!.length)
|
controller.members!.length)
|
||||||
.toString())),
|
.toString(),
|
||||||
|
),
|
||||||
|
),
|
||||||
leading: CircleAvatar(
|
leading: CircleAvatar(
|
||||||
backgroundColor:
|
backgroundColor:
|
||||||
Theme.of(context).scaffoldBackgroundColor,
|
Theme.of(context).scaffoldBackgroundColor,
|
||||||
@ -401,6 +436,7 @@ class ChatDetailsView extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
});
|
},
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -51,7 +51,8 @@ class ParticipantListItem extends StatelessWidget {
|
|||||||
borderRadius: BorderRadius.circular(8),
|
borderRadius: BorderRadius.circular(8),
|
||||||
border: Border.all(
|
border: Border.all(
|
||||||
color: Theme.of(context).colorScheme.primary,
|
color: Theme.of(context).colorScheme.primary,
|
||||||
)),
|
),
|
||||||
|
),
|
||||||
child: Text(
|
child: Text(
|
||||||
permissionBatch,
|
permissionBatch,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
|
@ -20,19 +20,19 @@ class ChatEncryptionSettingsView extends StatelessWidget {
|
|||||||
final room = controller.room;
|
final room = controller.room;
|
||||||
return StreamBuilder<Object>(
|
return StreamBuilder<Object>(
|
||||||
stream: room.client.onSync.stream.where(
|
stream: room.client.onSync.stream.where(
|
||||||
(s) => s.rooms?.join?[room.id] != null || s.deviceLists != null),
|
(s) => s.rooms?.join?[room.id] != null || s.deviceLists != null,
|
||||||
|
),
|
||||||
builder: (context, _) => Scaffold(
|
builder: (context, _) => Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
leading: IconButton(
|
leading: IconButton(
|
||||||
icon: const Icon(Icons.close_outlined),
|
icon: const Icon(Icons.close_outlined),
|
||||||
onPressed: () => VRouter.of(context)
|
onPressed: () =>
|
||||||
.toSegments(['rooms', controller.roomId!]),
|
VRouter.of(context).toSegments(['rooms', controller.roomId!]),
|
||||||
),
|
),
|
||||||
title: Text(L10n.of(context)!.endToEndEncryption),
|
title: Text(L10n.of(context)!.endToEndEncryption),
|
||||||
actions: [
|
actions: [
|
||||||
TextButton(
|
TextButton(
|
||||||
onPressed: () =>
|
onPressed: () => launchUrlString(AppConfig.encryptionTutorial),
|
||||||
launchUrlString(AppConfig.encryptionTutorial),
|
|
||||||
child: Text(L10n.of(context)!.help),
|
child: Text(L10n.of(context)!.help),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@ -43,9 +43,9 @@ class ChatEncryptionSettingsView extends StatelessWidget {
|
|||||||
secondary: CircleAvatar(
|
secondary: CircleAvatar(
|
||||||
foregroundColor:
|
foregroundColor:
|
||||||
Theme.of(context).colorScheme.onPrimaryContainer,
|
Theme.of(context).colorScheme.onPrimaryContainer,
|
||||||
backgroundColor:
|
backgroundColor: Theme.of(context).colorScheme.primaryContainer,
|
||||||
Theme.of(context).colorScheme.primaryContainer,
|
child: const Icon(Icons.lock_outlined),
|
||||||
child: const Icon(Icons.lock_outlined)),
|
),
|
||||||
title: Text(L10n.of(context)!.encryptThisChat),
|
title: Text(L10n.of(context)!.encryptThisChat),
|
||||||
value: room.encrypted,
|
value: room.encrypted,
|
||||||
onChanged: controller.enableEncryption,
|
onChanged: controller.enableEncryption,
|
||||||
@ -81,20 +81,22 @@ class ChatEncryptionSettingsView extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
StreamBuilder(
|
StreamBuilder(
|
||||||
stream: room.onUpdate.stream,
|
stream: room.onUpdate.stream,
|
||||||
builder: (context, snapshot) => FutureBuilder<
|
builder: (context, snapshot) => FutureBuilder<List<DeviceKeys>>(
|
||||||
List<DeviceKeys>>(
|
|
||||||
future: room.getUserDeviceKeys(),
|
future: room.getUserDeviceKeys(),
|
||||||
builder: (BuildContext context, snapshot) {
|
builder: (BuildContext context, snapshot) {
|
||||||
if (snapshot.hasError) {
|
if (snapshot.hasError) {
|
||||||
return Center(
|
return Center(
|
||||||
child: Text(
|
child: Text(
|
||||||
'${L10n.of(context)!.oopsSomethingWentWrong}: ${snapshot.error}'),
|
'${L10n.of(context)!.oopsSomethingWentWrong}: ${snapshot.error}',
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (!snapshot.hasData) {
|
if (!snapshot.hasData) {
|
||||||
return const Center(
|
return const Center(
|
||||||
child: CircularProgressIndicator.adaptive(
|
child: CircularProgressIndicator.adaptive(
|
||||||
strokeWidth: 2));
|
strokeWidth: 2,
|
||||||
|
),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
final deviceKeys = snapshot.data!;
|
final deviceKeys = snapshot.data!;
|
||||||
return ListView.builder(
|
return ListView.builder(
|
||||||
@ -135,11 +137,11 @@ class ChatEncryptionSettingsView extends StatelessWidget {
|
|||||||
child: Material(
|
child: Material(
|
||||||
shape: RoundedRectangleBorder(
|
shape: RoundedRectangleBorder(
|
||||||
borderRadius: BorderRadius.circular(
|
borderRadius: BorderRadius.circular(
|
||||||
AppConfig.borderRadius),
|
AppConfig.borderRadius,
|
||||||
|
),
|
||||||
side: BorderSide(
|
side: BorderSide(
|
||||||
color: Theme.of(context)
|
color:
|
||||||
.colorScheme
|
Theme.of(context).colorScheme.primary,
|
||||||
.primary,
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
color: Theme.of(context)
|
color: Theme.of(context)
|
||||||
@ -152,9 +154,8 @@ class ChatEncryptionSettingsView extends StatelessWidget {
|
|||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: Theme.of(context)
|
color:
|
||||||
.colorScheme
|
Theme.of(context).colorScheme.primary,
|
||||||
.primary,
|
|
||||||
fontSize: 12,
|
fontSize: 12,
|
||||||
fontStyle: FontStyle.italic,
|
fontStyle: FontStyle.italic,
|
||||||
),
|
),
|
||||||
@ -166,17 +167,16 @@ class ChatEncryptionSettingsView extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
subtitle: Text(
|
subtitle: Text(
|
||||||
deviceKeys[i].ed25519Key?.beautified ??
|
deviceKeys[i].ed25519Key?.beautified ??
|
||||||
L10n.of(context)!
|
L10n.of(context)!.unknownEncryptionAlgorithm,
|
||||||
.unknownEncryptionAlgorithm,
|
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontFamily: 'RobotoMono',
|
fontFamily: 'RobotoMono',
|
||||||
color:
|
color: Theme.of(context).colorScheme.secondary,
|
||||||
Theme.of(context).colorScheme.secondary,
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}),
|
},
|
||||||
|
),
|
||||||
),
|
),
|
||||||
] else
|
] else
|
||||||
Padding(
|
Padding(
|
||||||
@ -192,6 +192,7 @@ class ChatEncryptionSettingsView extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
));
|
),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -175,8 +175,10 @@ class ChatListController extends State<ChatList>
|
|||||||
hintText: Matrix.of(context).client.homeserver?.host,
|
hintText: Matrix.of(context).client.homeserver?.host,
|
||||||
initialText: searchServer,
|
initialText: searchServer,
|
||||||
keyboardType: TextInputType.url,
|
keyboardType: TextInputType.url,
|
||||||
autocorrect: false)
|
autocorrect: false,
|
||||||
]);
|
)
|
||||||
|
],
|
||||||
|
);
|
||||||
if (newServer == null) return;
|
if (newServer == null) return;
|
||||||
Store().setItem(_serverStoreNamespace, newServer.single);
|
Store().setItem(_serverStoreNamespace, newServer.single);
|
||||||
setState(() {
|
setState(() {
|
||||||
@ -382,9 +384,11 @@ class ChatListController extends State<ChatList>
|
|||||||
}
|
}
|
||||||
|
|
||||||
void toggleSelection(String roomId) {
|
void toggleSelection(String roomId) {
|
||||||
setState(() => selectedRoomIds.contains(roomId)
|
setState(
|
||||||
|
() => selectedRoomIds.contains(roomId)
|
||||||
? selectedRoomIds.remove(roomId)
|
? selectedRoomIds.remove(roomId)
|
||||||
: selectedRoomIds.add(roomId));
|
: selectedRoomIds.add(roomId),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> toggleUnread() async {
|
Future<void> toggleUnread() async {
|
||||||
@ -465,7 +469,8 @@ class ChatListController extends State<ChatList>
|
|||||||
DialogTextField(
|
DialogTextField(
|
||||||
hintText: L10n.of(context)!.statusExampleMessage,
|
hintText: L10n.of(context)!.statusExampleMessage,
|
||||||
),
|
),
|
||||||
]);
|
],
|
||||||
|
);
|
||||||
if (input == null) return;
|
if (input == null) return;
|
||||||
await showFutureLoadingDialog(
|
await showFutureLoadingDialog(
|
||||||
context: context,
|
context: context,
|
||||||
@ -506,7 +511,8 @@ class ChatListController extends State<ChatList>
|
|||||||
.getLocalizedDisplayname(MatrixLocals(L10n.of(context)!)),
|
.getLocalizedDisplayname(MatrixLocals(L10n.of(context)!)),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
.toList());
|
.toList(),
|
||||||
|
);
|
||||||
if (selectedSpace == null) return;
|
if (selectedSpace == null) return;
|
||||||
final result = await showFutureLoadingDialog(
|
final result = await showFutureLoadingDialog(
|
||||||
context: context,
|
context: context,
|
||||||
@ -532,14 +538,19 @@ class ChatListController extends State<ChatList>
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool get anySelectedRoomNotMarkedUnread => selectedRoomIds.any(
|
bool get anySelectedRoomNotMarkedUnread => selectedRoomIds.any(
|
||||||
(roomId) => !Matrix.of(context).client.getRoomById(roomId)!.markedUnread);
|
(roomId) =>
|
||||||
|
!Matrix.of(context).client.getRoomById(roomId)!.markedUnread,
|
||||||
|
);
|
||||||
|
|
||||||
bool get anySelectedRoomNotFavorite => selectedRoomIds.any(
|
bool get anySelectedRoomNotFavorite => selectedRoomIds.any(
|
||||||
(roomId) => !Matrix.of(context).client.getRoomById(roomId)!.isFavourite);
|
(roomId) => !Matrix.of(context).client.getRoomById(roomId)!.isFavourite,
|
||||||
|
);
|
||||||
|
|
||||||
bool get anySelectedRoomNotMuted => selectedRoomIds.any((roomId) =>
|
bool get anySelectedRoomNotMuted => selectedRoomIds.any(
|
||||||
|
(roomId) =>
|
||||||
Matrix.of(context).client.getRoomById(roomId)!.pushRuleState ==
|
Matrix.of(context).client.getRoomById(roomId)!.pushRuleState ==
|
||||||
PushRuleState.notify);
|
PushRuleState.notify,
|
||||||
|
);
|
||||||
|
|
||||||
bool waitForFirstSync = false;
|
bool waitForFirstSync = false;
|
||||||
|
|
||||||
@ -626,7 +637,8 @@ class ChatListController extends State<ChatList>
|
|||||||
final bundle = await showTextInputDialog(
|
final bundle = await showTextInputDialog(
|
||||||
context: context,
|
context: context,
|
||||||
title: l10n.bundleName,
|
title: l10n.bundleName,
|
||||||
textFields: [DialogTextField(hintText: l10n.bundleName)]);
|
textFields: [DialogTextField(hintText: l10n.bundleName)],
|
||||||
|
);
|
||||||
if (bundle == null || bundle.isEmpty || bundle.single.isEmpty) return;
|
if (bundle == null || bundle.isEmpty || bundle.single.isEmpty) return;
|
||||||
await showFutureLoadingDialog(
|
await showFutureLoadingDialog(
|
||||||
context: context,
|
context: context,
|
||||||
|
@ -46,9 +46,11 @@ class ChatListViewBody extends StatelessWidget {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
child: StreamBuilder(
|
child: StreamBuilder(
|
||||||
key: ValueKey(client.userID.toString() +
|
key: ValueKey(
|
||||||
|
client.userID.toString() +
|
||||||
controller.activeFilter.toString() +
|
controller.activeFilter.toString() +
|
||||||
controller.activeSpaceId.toString()),
|
controller.activeSpaceId.toString(),
|
||||||
|
),
|
||||||
stream: client.onSync.stream
|
stream: client.onSync.stream
|
||||||
.where((s) => s.hasRoomUpdate)
|
.where((s) => s.hasRoomUpdate)
|
||||||
.rateLimit(const Duration(seconds: 1)),
|
.rateLimit(const Duration(seconds: 1)),
|
||||||
@ -98,11 +100,10 @@ class ChatListViewBody extends StatelessWidget {
|
|||||||
itemCount: roomSearchResult.chunk.length,
|
itemCount: roomSearchResult.chunk.length,
|
||||||
itemBuilder: (context, i) => _SearchItem(
|
itemBuilder: (context, i) => _SearchItem(
|
||||||
title: roomSearchResult.chunk[i].name ??
|
title: roomSearchResult.chunk[i].name ??
|
||||||
roomSearchResult.chunk[i]
|
roomSearchResult.chunk[i].canonicalAlias
|
||||||
.canonicalAlias?.localpart ??
|
?.localpart ??
|
||||||
L10n.of(context)!.group,
|
L10n.of(context)!.group,
|
||||||
avatar:
|
avatar: roomSearchResult.chunk[i].avatarUrl,
|
||||||
roomSearchResult.chunk[i].avatarUrl,
|
|
||||||
onPressed: () => showAdaptiveBottomSheet(
|
onPressed: () => showAdaptiveBottomSheet(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (c) => PublicRoomBottomSheet(
|
builder: (c) => PublicRoomBottomSheet(
|
||||||
@ -145,8 +146,8 @@ class ChatListViewBody extends StatelessWidget {
|
|||||||
onPressed: () => showAdaptiveBottomSheet(
|
onPressed: () => showAdaptiveBottomSheet(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (c) => ProfileBottomSheet(
|
builder: (c) => ProfileBottomSheet(
|
||||||
userId: userSearchResult
|
userId:
|
||||||
.results[i].userId,
|
userSearchResult.results[i].userId,
|
||||||
outerContext: context,
|
outerContext: context,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -175,10 +176,8 @@ class ChatListViewBody extends StatelessWidget {
|
|||||||
child: ListTile(
|
child: ListTile(
|
||||||
leading: const Icon(Icons.vpn_key),
|
leading: const Icon(Icons.vpn_key),
|
||||||
title: Text(L10n.of(context)!.dehydrateTor),
|
title: Text(L10n.of(context)!.dehydrateTor),
|
||||||
subtitle:
|
subtitle: Text(L10n.of(context)!.dehydrateTorLong),
|
||||||
Text(L10n.of(context)!.dehydrateTorLong),
|
trailing: const Icon(Icons.chevron_right_outlined),
|
||||||
trailing:
|
|
||||||
const Icon(Icons.chevron_right_outlined),
|
|
||||||
onTap: controller.dehydrate,
|
onTap: controller.dehydrate,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -210,7 +209,8 @@ class ChatListViewBody extends StatelessWidget {
|
|||||||
.getLocalizedDisplayname(MatrixLocals(L10n.of(context)!))
|
.getLocalizedDisplayname(MatrixLocals(L10n.of(context)!))
|
||||||
.toLowerCase()
|
.toLowerCase()
|
||||||
.contains(
|
.contains(
|
||||||
controller.searchController.text.toLowerCase())) {
|
controller.searchController.text.toLowerCase(),
|
||||||
|
)) {
|
||||||
return Container();
|
return Container();
|
||||||
}
|
}
|
||||||
return ChatListItem(
|
return ChatListItem(
|
||||||
@ -286,7 +286,8 @@ class ChatListViewBody extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}),
|
},
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -120,22 +120,28 @@ class ChatListHeader extends StatelessWidget implements PreferredSizeWidget {
|
|||||||
),
|
),
|
||||||
IconButton(
|
IconButton(
|
||||||
tooltip: L10n.of(context)!.toggleUnread,
|
tooltip: L10n.of(context)!.toggleUnread,
|
||||||
icon: Icon(controller.anySelectedRoomNotMarkedUnread
|
icon: Icon(
|
||||||
|
controller.anySelectedRoomNotMarkedUnread
|
||||||
? Icons.mark_chat_read_outlined
|
? Icons.mark_chat_read_outlined
|
||||||
: Icons.mark_chat_unread_outlined),
|
: Icons.mark_chat_unread_outlined,
|
||||||
|
),
|
||||||
onPressed: controller.toggleUnread,
|
onPressed: controller.toggleUnread,
|
||||||
),
|
),
|
||||||
IconButton(
|
IconButton(
|
||||||
tooltip: L10n.of(context)!.toggleFavorite,
|
tooltip: L10n.of(context)!.toggleFavorite,
|
||||||
icon: Icon(controller.anySelectedRoomNotFavorite
|
icon: Icon(
|
||||||
|
controller.anySelectedRoomNotFavorite
|
||||||
? Icons.push_pin_outlined
|
? Icons.push_pin_outlined
|
||||||
: Icons.push_pin),
|
: Icons.push_pin,
|
||||||
|
),
|
||||||
onPressed: controller.toggleFavouriteRoom,
|
onPressed: controller.toggleFavouriteRoom,
|
||||||
),
|
),
|
||||||
IconButton(
|
IconButton(
|
||||||
icon: Icon(controller.anySelectedRoomNotMuted
|
icon: Icon(
|
||||||
|
controller.anySelectedRoomNotMuted
|
||||||
? Icons.notifications_off_outlined
|
? Icons.notifications_off_outlined
|
||||||
: Icons.notifications_outlined),
|
: Icons.notifications_outlined,
|
||||||
|
),
|
||||||
tooltip: L10n.of(context)!.toggleMuted,
|
tooltip: L10n.of(context)!.toggleMuted,
|
||||||
onPressed: controller.toggleMuted,
|
onPressed: controller.toggleMuted,
|
||||||
),
|
),
|
||||||
|
@ -46,7 +46,8 @@ class ChatListItem extends StatelessWidget {
|
|||||||
);
|
);
|
||||||
await room.join();
|
await room.join();
|
||||||
await waitForRoom;
|
await waitForRoom;
|
||||||
});
|
},
|
||||||
|
);
|
||||||
if (joinResult.error != null) return;
|
if (joinResult.error != null) return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -107,7 +108,9 @@ class ChatListItem extends StatelessWidget {
|
|||||||
);
|
);
|
||||||
if (confirmed == OkCancelResult.cancel) return;
|
if (confirmed == OkCancelResult.cancel) return;
|
||||||
await showFutureLoadingDialog(
|
await showFutureLoadingDialog(
|
||||||
context: context, future: () => room.leave());
|
context: context,
|
||||||
|
future: () => room.leave(),
|
||||||
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -183,7 +186,8 @@ class ChatListItem extends StatelessWidget {
|
|||||||
if (room.isFavourite)
|
if (room.isFavourite)
|
||||||
Padding(
|
Padding(
|
||||||
padding: EdgeInsets.only(
|
padding: EdgeInsets.only(
|
||||||
right: room.notificationCount > 0 ? 4.0 : 0.0),
|
right: room.notificationCount > 0 ? 4.0 : 0.0,
|
||||||
|
),
|
||||||
child: Icon(
|
child: Icon(
|
||||||
Icons.push_pin,
|
Icons.push_pin,
|
||||||
size: 16,
|
size: 16,
|
||||||
@ -282,7 +286,8 @@ class ChatListItem extends StatelessWidget {
|
|||||||
: null,
|
: null,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}),
|
},
|
||||||
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(width: 8),
|
const SizedBox(width: 8),
|
||||||
AnimatedContainer(
|
AnimatedContainer(
|
||||||
|
@ -109,8 +109,10 @@ class ChatListView extends StatelessWidget {
|
|||||||
children: [
|
children: [
|
||||||
if (FluffyThemes.isColumnMode(context) &&
|
if (FluffyThemes.isColumnMode(context) &&
|
||||||
FluffyThemes.getDisplayNavigationRail(context)) ...[
|
FluffyThemes.getDisplayNavigationRail(context)) ...[
|
||||||
Builder(builder: (context) {
|
Builder(
|
||||||
final allSpaces = client.rooms.where((room) => room.isSpace);
|
builder: (context) {
|
||||||
|
final allSpaces =
|
||||||
|
client.rooms.where((room) => room.isSpace);
|
||||||
final rootSpaces = allSpaces
|
final rootSpaces = allSpaces
|
||||||
.where(
|
.where(
|
||||||
(space) => !allSpaces.any(
|
(space) => !allSpaces.any(
|
||||||
@ -142,7 +144,8 @@ class ChatListView extends StatelessWidget {
|
|||||||
rootSpaces[i].id == controller.activeSpaceId;
|
rootSpaces[i].id == controller.activeSpaceId;
|
||||||
return NaviRailItem(
|
return NaviRailItem(
|
||||||
toolTip: rootSpaces[i].getLocalizedDisplayname(
|
toolTip: rootSpaces[i].getLocalizedDisplayname(
|
||||||
MatrixLocals(L10n.of(context)!)),
|
MatrixLocals(L10n.of(context)!),
|
||||||
|
),
|
||||||
isSelected: isSelected,
|
isSelected: isSelected,
|
||||||
onTap: () =>
|
onTap: () =>
|
||||||
controller.setActiveSpace(rootSpaces[i].id),
|
controller.setActiveSpace(rootSpaces[i].id),
|
||||||
@ -158,7 +161,8 @@ class ChatListView extends StatelessWidget {
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}),
|
},
|
||||||
|
),
|
||||||
Container(
|
Container(
|
||||||
color: Theme.of(context).dividerColor,
|
color: Theme.of(context).dividerColor,
|
||||||
width: 1,
|
width: 1,
|
||||||
|
@ -20,11 +20,13 @@ class ClientChooserButton extends StatelessWidget {
|
|||||||
List<PopupMenuEntry<Object>> _bundleMenuItems(BuildContext context) {
|
List<PopupMenuEntry<Object>> _bundleMenuItems(BuildContext context) {
|
||||||
final matrix = Matrix.of(context);
|
final matrix = Matrix.of(context);
|
||||||
final bundles = matrix.accountBundles.keys.toList()
|
final bundles = matrix.accountBundles.keys.toList()
|
||||||
..sort((a, b) => a!.isValidMatrixId == b!.isValidMatrixId
|
..sort(
|
||||||
|
(a, b) => a!.isValidMatrixId == b!.isValidMatrixId
|
||||||
? 0
|
? 0
|
||||||
: a.isValidMatrixId && !b.isValidMatrixId
|
: a.isValidMatrixId && !b.isValidMatrixId
|
||||||
? -1
|
? -1
|
||||||
: 1);
|
: 1,
|
||||||
|
);
|
||||||
return <PopupMenuEntry<Object>>[
|
return <PopupMenuEntry<Object>>[
|
||||||
PopupMenuItem(
|
PopupMenuItem(
|
||||||
value: SettingsAction.newStory,
|
value: SettingsAction.newStory,
|
||||||
@ -142,7 +144,9 @@ class ClientChooserButton extends StatelessWidget {
|
|||||||
IconButton(
|
IconButton(
|
||||||
icon: const Icon(Icons.edit_outlined),
|
icon: const Icon(Icons.edit_outlined),
|
||||||
onPressed: () => controller.editBundlesForAccount(
|
onPressed: () => controller.editBundlesForAccount(
|
||||||
client.userID, bundle),
|
client.userID,
|
||||||
|
bundle,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@ -270,9 +274,12 @@ class ClientChooserButton extends StatelessWidget {
|
|||||||
break;
|
break;
|
||||||
case SettingsAction.invite:
|
case SettingsAction.invite:
|
||||||
FluffyShare.share(
|
FluffyShare.share(
|
||||||
L10n.of(context)!.inviteText(Matrix.of(context).client.userID!,
|
L10n.of(context)!.inviteText(
|
||||||
'https://matrix.to/#/${Matrix.of(context).client.userID}?client=im.fluffychat'),
|
Matrix.of(context).client.userID!,
|
||||||
context);
|
'https://matrix.to/#/${Matrix.of(context).client.userID}?client=im.fluffychat',
|
||||||
|
),
|
||||||
|
context,
|
||||||
|
);
|
||||||
break;
|
break;
|
||||||
case SettingsAction.settings:
|
case SettingsAction.settings:
|
||||||
VRouter.of(context).to('/settings');
|
VRouter.of(context).to('/settings');
|
||||||
@ -290,11 +297,13 @@ class ClientChooserButton extends StatelessWidget {
|
|||||||
BuildContext context,
|
BuildContext context,
|
||||||
) {
|
) {
|
||||||
final bundles = matrix.accountBundles.keys.toList()
|
final bundles = matrix.accountBundles.keys.toList()
|
||||||
..sort((a, b) => a!.isValidMatrixId == b!.isValidMatrixId
|
..sort(
|
||||||
|
(a, b) => a!.isValidMatrixId == b!.isValidMatrixId
|
||||||
? 0
|
? 0
|
||||||
: a.isValidMatrixId && !b.isValidMatrixId
|
: a.isValidMatrixId && !b.isValidMatrixId
|
||||||
? -1
|
? -1
|
||||||
: 1);
|
: 1,
|
||||||
|
);
|
||||||
// beginning from end if negative
|
// beginning from end if negative
|
||||||
if (index < 0) {
|
if (index < 0) {
|
||||||
int clientCount = 0;
|
int clientCount = 0;
|
||||||
@ -320,11 +329,13 @@ class ClientChooserButton extends StatelessWidget {
|
|||||||
int index = 0;
|
int index = 0;
|
||||||
|
|
||||||
final bundles = matrix.accountBundles.keys.toList()
|
final bundles = matrix.accountBundles.keys.toList()
|
||||||
..sort((a, b) => a!.isValidMatrixId == b!.isValidMatrixId
|
..sort(
|
||||||
|
(a, b) => a!.isValidMatrixId == b!.isValidMatrixId
|
||||||
? 0
|
? 0
|
||||||
: a.isValidMatrixId && !b.isValidMatrixId
|
: a.isValidMatrixId && !b.isValidMatrixId
|
||||||
? -1
|
? -1
|
||||||
: 1);
|
: 1,
|
||||||
|
);
|
||||||
for (final bundleName in bundles) {
|
for (final bundleName in bundles) {
|
||||||
final bundle = matrix.accountBundles[bundleName];
|
final bundle = matrix.accountBundles[bundleName];
|
||||||
if (bundle == null) return null;
|
if (bundle == null) return null;
|
||||||
|
@ -58,7 +58,8 @@ class NaviRailItem extends StatelessWidget {
|
|||||||
vertical: 8.0,
|
vertical: 8.0,
|
||||||
),
|
),
|
||||||
child: isSelected ? selectedIcon ?? icon : icon,
|
child: isSelected ? selectedIcon ?? icon : icon,
|
||||||
)),
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
@ -45,13 +45,15 @@ class SearchTitle extends StatelessWidget {
|
|||||||
children: [
|
children: [
|
||||||
icon,
|
icon,
|
||||||
const SizedBox(width: 16),
|
const SizedBox(width: 16),
|
||||||
Text(title,
|
Text(
|
||||||
|
title,
|
||||||
textAlign: TextAlign.left,
|
textAlign: TextAlign.left,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: Theme.of(context).colorScheme.onSurface,
|
color: Theme.of(context).colorScheme.onSurface,
|
||||||
fontSize: 12,
|
fontSize: 12,
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
)),
|
),
|
||||||
|
),
|
||||||
if (trailing != null)
|
if (trailing != null)
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Align(
|
child: Align(
|
||||||
|
@ -53,11 +53,14 @@ class _SpaceViewState extends State<SpaceView> {
|
|||||||
final result = await showFutureLoadingDialog(
|
final result = await showFutureLoadingDialog(
|
||||||
context: context,
|
context: context,
|
||||||
future: () async {
|
future: () async {
|
||||||
await client.joinRoom(spaceChild.roomId,
|
await client.joinRoom(
|
||||||
|
spaceChild.roomId,
|
||||||
serverName: space?.spaceChildren
|
serverName: space?.spaceChildren
|
||||||
.firstWhereOrNull(
|
.firstWhereOrNull(
|
||||||
(child) => child.roomId == spaceChild.roomId)
|
(child) => child.roomId == spaceChild.roomId,
|
||||||
?.via);
|
)
|
||||||
|
?.via,
|
||||||
|
);
|
||||||
if (client.getRoomById(spaceChild.roomId) == null) {
|
if (client.getRoomById(spaceChild.roomId) == null) {
|
||||||
// Wait for room actually appears in sync
|
// Wait for room actually appears in sync
|
||||||
await client.waitForRoomInSync(spaceChild.roomId, join: true);
|
await client.waitForRoomInSync(spaceChild.roomId, join: true);
|
||||||
@ -78,8 +81,10 @@ class _SpaceViewState extends State<SpaceView> {
|
|||||||
VRouter.of(context).toSegments(['rooms', spaceChild.roomId]);
|
VRouter.of(context).toSegments(['rooms', spaceChild.roomId]);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _onSpaceChildContextMenu(
|
void _onSpaceChildContextMenu([
|
||||||
[SpaceRoomsChunk? spaceChild, Room? room]) async {
|
SpaceRoomsChunk? spaceChild,
|
||||||
|
Room? room,
|
||||||
|
]) async {
|
||||||
final client = Matrix.of(context).client;
|
final client = Matrix.of(context).client;
|
||||||
final activeSpaceId = widget.controller.activeSpaceId;
|
final activeSpaceId = widget.controller.activeSpaceId;
|
||||||
final activeSpace =
|
final activeSpace =
|
||||||
@ -169,8 +174,10 @@ class _SpaceViewState extends State<SpaceView> {
|
|||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
),
|
),
|
||||||
subtitle: Text(L10n.of(context)!
|
subtitle: Text(
|
||||||
.numChats(rootSpace.spaceChildren.length.toString())),
|
L10n.of(context)!
|
||||||
|
.numChats(rootSpace.spaceChildren.length.toString()),
|
||||||
|
),
|
||||||
onTap: () => widget.controller.setActiveSpace(rootSpace.id),
|
onTap: () => widget.controller.setActiveSpace(rootSpace.id),
|
||||||
onLongPress: () => _onSpaceChildContextMenu(null, rootSpace),
|
onLongPress: () => _onSpaceChildContextMenu(null, rootSpace),
|
||||||
trailing: const Icon(Icons.chevron_right_outlined),
|
trailing: const Icon(Icons.chevron_right_outlined),
|
||||||
@ -203,9 +210,10 @@ class _SpaceViewState extends State<SpaceView> {
|
|||||||
if (response == null) {
|
if (response == null) {
|
||||||
return const Center(child: CircularProgressIndicator.adaptive());
|
return const Center(child: CircularProgressIndicator.adaptive());
|
||||||
}
|
}
|
||||||
final parentSpace = allSpaces.firstWhereOrNull((space) => space
|
final parentSpace = allSpaces.firstWhereOrNull(
|
||||||
.spaceChildren
|
(space) =>
|
||||||
.any((child) => child.roomId == activeSpaceId));
|
space.spaceChildren.any((child) => child.roomId == activeSpaceId),
|
||||||
|
);
|
||||||
final spaceChildren = response.rooms;
|
final spaceChildren = response.rooms;
|
||||||
final canLoadMore = response.nextBatch != null;
|
final canLoadMore = response.nextBatch != null;
|
||||||
return VWidgetGuard(
|
return VWidgetGuard(
|
||||||
@ -226,17 +234,18 @@ class _SpaceViewState extends State<SpaceView> {
|
|||||||
onPressed: () =>
|
onPressed: () =>
|
||||||
widget.controller.setActiveSpace(parentSpace?.id),
|
widget.controller.setActiveSpace(parentSpace?.id),
|
||||||
),
|
),
|
||||||
title: Text(parentSpace == null
|
title: Text(
|
||||||
|
parentSpace == null
|
||||||
? L10n.of(context)!.allSpaces
|
? L10n.of(context)!.allSpaces
|
||||||
: parentSpace.getLocalizedDisplayname(
|
: parentSpace.getLocalizedDisplayname(
|
||||||
MatrixLocals(L10n.of(context)!),
|
MatrixLocals(L10n.of(context)!),
|
||||||
)),
|
),
|
||||||
|
),
|
||||||
trailing: IconButton(
|
trailing: IconButton(
|
||||||
icon: snapshot.connectionState != ConnectionState.done
|
icon: snapshot.connectionState != ConnectionState.done
|
||||||
? const CircularProgressIndicator.adaptive()
|
? const CircularProgressIndicator.adaptive()
|
||||||
: const Icon(Icons.refresh_outlined),
|
: const Icon(Icons.refresh_outlined),
|
||||||
onPressed:
|
onPressed: snapshot.connectionState != ConnectionState.done
|
||||||
snapshot.connectionState != ConnectionState.done
|
|
||||||
? null
|
? null
|
||||||
: _refresh,
|
: _refresh,
|
||||||
),
|
),
|
||||||
@ -258,20 +267,17 @@ class _SpaceViewState extends State<SpaceView> {
|
|||||||
if (room != null && !room.isSpace) {
|
if (room != null && !room.isSpace) {
|
||||||
return ChatListItem(
|
return ChatListItem(
|
||||||
room,
|
room,
|
||||||
onLongPress: () =>
|
onLongPress: () => _onSpaceChildContextMenu(spaceChild, room),
|
||||||
_onSpaceChildContextMenu(spaceChild, room),
|
|
||||||
activeChat: widget.controller.activeChat == room.id,
|
activeChat: widget.controller.activeChat == room.id,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
final isSpace = spaceChild.roomType == 'm.space';
|
final isSpace = spaceChild.roomType == 'm.space';
|
||||||
final topic = spaceChild.topic?.isEmpty ?? true
|
final topic =
|
||||||
? null
|
spaceChild.topic?.isEmpty ?? true ? null : spaceChild.topic;
|
||||||
: spaceChild.topic;
|
|
||||||
if (spaceChild.roomId == activeSpaceId) {
|
if (spaceChild.roomId == activeSpaceId) {
|
||||||
return SearchTitle(
|
return SearchTitle(
|
||||||
title: spaceChild.name ??
|
title:
|
||||||
spaceChild.canonicalAlias ??
|
spaceChild.name ?? spaceChild.canonicalAlias ?? 'Space',
|
||||||
'Space',
|
|
||||||
icon: Padding(
|
icon: Padding(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 10.0),
|
padding: const EdgeInsets.symmetric(horizontal: 10.0),
|
||||||
child: Avatar(
|
child: Avatar(
|
||||||
@ -322,8 +328,7 @@ class _SpaceViewState extends State<SpaceView> {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
onTap: () => _onJoinSpaceChild(spaceChild),
|
onTap: () => _onJoinSpaceChild(spaceChild),
|
||||||
onLongPress: () =>
|
onLongPress: () => _onSpaceChildContextMenu(spaceChild, room),
|
||||||
_onSpaceChildContextMenu(spaceChild, room),
|
|
||||||
subtitle: Text(
|
subtitle: Text(
|
||||||
topic ??
|
topic ??
|
||||||
(isSpace
|
(isSpace
|
||||||
@ -331,15 +336,17 @@ class _SpaceViewState extends State<SpaceView> {
|
|||||||
: L10n.of(context)!.enterRoom),
|
: L10n.of(context)!.enterRoom),
|
||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: Theme.of(context).colorScheme.onBackground),
|
color: Theme.of(context).colorScheme.onBackground,
|
||||||
),
|
),
|
||||||
trailing: isSpace
|
),
|
||||||
? const Icon(Icons.chevron_right_outlined)
|
trailing:
|
||||||
: null,
|
isSpace ? const Icon(Icons.chevron_right_outlined) : null,
|
||||||
);
|
);
|
||||||
}),
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
);
|
);
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,12 +22,17 @@ class ChatPermissionsSettings extends StatefulWidget {
|
|||||||
|
|
||||||
class ChatPermissionsSettingsController extends State<ChatPermissionsSettings> {
|
class ChatPermissionsSettingsController extends State<ChatPermissionsSettings> {
|
||||||
String? get roomId => VRouter.of(context).pathParameters['roomid'];
|
String? get roomId => VRouter.of(context).pathParameters['roomid'];
|
||||||
void editPowerLevel(BuildContext context, String key, int currentLevel,
|
void editPowerLevel(
|
||||||
{String? category}) async {
|
BuildContext context,
|
||||||
|
String key,
|
||||||
|
int currentLevel, {
|
||||||
|
String? category,
|
||||||
|
}) async {
|
||||||
final room = Matrix.of(context).client.getRoomById(roomId!)!;
|
final room = Matrix.of(context).client.getRoomById(roomId!)!;
|
||||||
if (!room.canSendEvent(EventTypes.RoomPowerLevels)) {
|
if (!room.canSendEvent(EventTypes.RoomPowerLevels)) {
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
SnackBar(content: Text(L10n.of(context)!.noPermission)));
|
SnackBar(content: Text(L10n.of(context)!.noPermission)),
|
||||||
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final newLevel = await showPermissionChooser(
|
final newLevel = await showPermissionChooser(
|
||||||
@ -36,7 +41,8 @@ class ChatPermissionsSettingsController extends State<ChatPermissionsSettings> {
|
|||||||
);
|
);
|
||||||
if (newLevel == null) return;
|
if (newLevel == null) return;
|
||||||
final content = Map<String, dynamic>.from(
|
final content = Map<String, dynamic>.from(
|
||||||
room.getState(EventTypes.RoomPowerLevels)!.content);
|
room.getState(EventTypes.RoomPowerLevels)!.content,
|
||||||
|
);
|
||||||
if (category != null) {
|
if (category != null) {
|
||||||
if (!content.containsKey(category)) {
|
if (!content.containsKey(category)) {
|
||||||
content[category] = <String, dynamic>{};
|
content[category] = <String, dynamic>{};
|
||||||
@ -74,10 +80,13 @@ class ChatPermissionsSettingsController extends State<ChatPermissionsSettings> {
|
|||||||
title: L10n.of(context)!.replaceRoomWithNewerVersion,
|
title: L10n.of(context)!.replaceRoomWithNewerVersion,
|
||||||
actions: capabilities.mRoomVersions!.available.entries
|
actions: capabilities.mRoomVersions!.available.entries
|
||||||
.where((r) => r.key != roomVersion)
|
.where((r) => r.key != roomVersion)
|
||||||
.map((version) => AlertDialogAction(
|
.map(
|
||||||
|
(version) => AlertDialogAction(
|
||||||
key: version.key,
|
key: version.key,
|
||||||
label:
|
label:
|
||||||
'${version.key} (${version.value.toString().split('.').last})'))
|
'${version.key} (${version.value.toString().split('.').last})',
|
||||||
|
),
|
||||||
|
)
|
||||||
.toList(),
|
.toList(),
|
||||||
);
|
);
|
||||||
if (newVersion == null ||
|
if (newVersion == null ||
|
||||||
|
@ -41,7 +41,8 @@ class ChatPermissionsSettingsView extends StatelessWidget {
|
|||||||
return Center(child: Text(L10n.of(context)!.noRoomsFound));
|
return Center(child: Text(L10n.of(context)!.noRoomsFound));
|
||||||
}
|
}
|
||||||
final powerLevelsContent = Map<String, dynamic>.from(
|
final powerLevelsContent = Map<String, dynamic>.from(
|
||||||
room.getState(EventTypes.RoomPowerLevels)!.content);
|
room.getState(EventTypes.RoomPowerLevels)!.content,
|
||||||
|
);
|
||||||
final powerLevels = Map<String, dynamic>.from(powerLevelsContent)
|
final powerLevels = Map<String, dynamic>.from(powerLevelsContent)
|
||||||
..removeWhere((k, v) => v is! int);
|
..removeWhere((k, v) => v is! int);
|
||||||
final eventsPowerLevels =
|
final eventsPowerLevels =
|
||||||
@ -57,7 +58,10 @@ class ChatPermissionsSettingsView extends StatelessWidget {
|
|||||||
permissionKey: entry.key,
|
permissionKey: entry.key,
|
||||||
permission: entry.value,
|
permission: entry.value,
|
||||||
onTap: () => controller.editPowerLevel(
|
onTap: () => controller.editPowerLevel(
|
||||||
context, entry.key, entry.value),
|
context,
|
||||||
|
entry.key,
|
||||||
|
entry.value,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
const Divider(thickness: 1),
|
const Divider(thickness: 1),
|
||||||
ListTile(
|
ListTile(
|
||||||
@ -69,7 +73,8 @@ class ChatPermissionsSettingsView extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Builder(builder: (context) {
|
Builder(
|
||||||
|
builder: (context) {
|
||||||
const key = 'rooms';
|
const key = 'rooms';
|
||||||
final int value = powerLevelsContent
|
final int value = powerLevelsContent
|
||||||
.containsKey('notifications')
|
.containsKey('notifications')
|
||||||
@ -80,10 +85,14 @@ class ChatPermissionsSettingsView extends StatelessWidget {
|
|||||||
permission: value,
|
permission: value,
|
||||||
category: 'notifications',
|
category: 'notifications',
|
||||||
onTap: () => controller.editPowerLevel(
|
onTap: () => controller.editPowerLevel(
|
||||||
context, key, value,
|
context,
|
||||||
category: 'notifications'),
|
key,
|
||||||
|
value,
|
||||||
|
category: 'notifications',
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}),
|
},
|
||||||
|
),
|
||||||
const Divider(thickness: 1),
|
const Divider(thickness: 1),
|
||||||
ListTile(
|
ListTile(
|
||||||
title: Text(
|
title: Text(
|
||||||
@ -100,8 +109,11 @@ class ChatPermissionsSettingsView extends StatelessWidget {
|
|||||||
category: 'events',
|
category: 'events',
|
||||||
permission: entry.value,
|
permission: entry.value,
|
||||||
onTap: () => controller.editPowerLevel(
|
onTap: () => controller.editPowerLevel(
|
||||||
context, entry.key, entry.value,
|
context,
|
||||||
category: 'events'),
|
entry.key,
|
||||||
|
entry.value,
|
||||||
|
category: 'events',
|
||||||
|
),
|
||||||
),
|
),
|
||||||
if (room.canSendEvent(EventTypes.RoomTombstone)) ...{
|
if (room.canSendEvent(EventTypes.RoomTombstone)) ...{
|
||||||
const Divider(thickness: 1),
|
const Divider(thickness: 1),
|
||||||
@ -111,7 +123,9 @@ class ChatPermissionsSettingsView extends StatelessWidget {
|
|||||||
if (!snapshot.hasData) {
|
if (!snapshot.hasData) {
|
||||||
return const Center(
|
return const Center(
|
||||||
child: CircularProgressIndicator.adaptive(
|
child: CircularProgressIndicator.adaptive(
|
||||||
strokeWidth: 2));
|
strokeWidth: 2,
|
||||||
|
),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
final String roomVersion = room
|
final String roomVersion = room
|
||||||
.getState(EventTypes.RoomCreate)!
|
.getState(EventTypes.RoomCreate)!
|
||||||
@ -120,7 +134,8 @@ class ChatPermissionsSettingsView extends StatelessWidget {
|
|||||||
|
|
||||||
return ListTile(
|
return ListTile(
|
||||||
title: Text(
|
title: Text(
|
||||||
'${L10n.of(context)!.roomVersion}: $roomVersion'),
|
'${L10n.of(context)!.roomVersion}: $roomVersion',
|
||||||
|
),
|
||||||
onTap: () =>
|
onTap: () =>
|
||||||
controller.updateRoomAction(snapshot.data!),
|
controller.updateRoomAction(snapshot.data!),
|
||||||
);
|
);
|
||||||
|
@ -118,8 +118,9 @@ class ConnectPageController extends State<ConnectPage> {
|
|||||||
List<IdentityProvider>? get identityProviders {
|
List<IdentityProvider>? get identityProviders {
|
||||||
final loginTypes = _rawLoginTypes;
|
final loginTypes = _rawLoginTypes;
|
||||||
if (loginTypes == null) return null;
|
if (loginTypes == null) return null;
|
||||||
final rawProviders = loginTypes.tryGetList('flows')!.singleWhere((flow) =>
|
final rawProviders = loginTypes.tryGetList('flows')!.singleWhere(
|
||||||
flow['type'] == AuthenticationTypes.sso)['identity_providers'];
|
(flow) => flow['type'] == AuthenticationTypes.sso,
|
||||||
|
)['identity_providers'];
|
||||||
final list = (rawProviders as List)
|
final list = (rawProviders as List)
|
||||||
.map((json) => IdentityProvider.fromJson(json))
|
.map((json) => IdentityProvider.fromJson(json))
|
||||||
.toList();
|
.toList();
|
||||||
@ -163,9 +164,11 @@ class ConnectPageController extends State<ConnectPage> {
|
|||||||
RequestType.GET,
|
RequestType.GET,
|
||||||
'/client/r0/login',
|
'/client/r0/login',
|
||||||
)
|
)
|
||||||
.then((loginTypes) => setState(() {
|
.then(
|
||||||
|
(loginTypes) => setState(() {
|
||||||
_rawLoginTypes = loginTypes;
|
_rawLoginTypes = loginTypes;
|
||||||
}));
|
}),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -174,17 +174,20 @@ class ConnectPageView extends StatelessWidget {
|
|||||||
)
|
)
|
||||||
: Image.network(
|
: Image.network(
|
||||||
Uri.parse(identityProviders.single.icon!)
|
Uri.parse(identityProviders.single.icon!)
|
||||||
.getDownloadLink(Matrix.of(context)
|
.getDownloadLink(
|
||||||
.getLoginClient())
|
Matrix.of(context).getLoginClient(),
|
||||||
|
)
|
||||||
.toString(),
|
.toString(),
|
||||||
width: 32,
|
width: 32,
|
||||||
height: 32,
|
height: 32,
|
||||||
),
|
),
|
||||||
onPressed: () => controller
|
onPressed: () => controller
|
||||||
.ssoLoginAction(identityProviders.single.id!),
|
.ssoLoginAction(identityProviders.single.id!),
|
||||||
label: Text(identityProviders.single.name ??
|
label: Text(
|
||||||
|
identityProviders.single.name ??
|
||||||
identityProviders.single.brand ??
|
identityProviders.single.brand ??
|
||||||
L10n.of(context)!.loginWithOneClick),
|
L10n.of(context)!.loginWithOneClick,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
: Wrap(
|
: Wrap(
|
||||||
|
@ -37,7 +37,8 @@ class SsoButton extends StatelessWidget {
|
|||||||
: Image.network(
|
: Image.network(
|
||||||
Uri.parse(identityProvider.icon!)
|
Uri.parse(identityProvider.icon!)
|
||||||
.getDownloadLink(
|
.getDownloadLink(
|
||||||
Matrix.of(context).getLoginClient())
|
Matrix.of(context).getLoginClient(),
|
||||||
|
)
|
||||||
.toString(),
|
.toString(),
|
||||||
width: 32,
|
width: 32,
|
||||||
height: 32,
|
height: 32,
|
||||||
|
@ -35,7 +35,8 @@ class DevicesSettingsView extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
if (!snapshot.hasData || controller.devices == null) {
|
if (!snapshot.hasData || controller.devices == null) {
|
||||||
return const Center(
|
return const Center(
|
||||||
child: CircularProgressIndicator.adaptive(strokeWidth: 2));
|
child: CircularProgressIndicator.adaptive(strokeWidth: 2),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
return ListView.builder(
|
return ListView.builder(
|
||||||
itemCount: controller.notThisDevice.length + 1,
|
itemCount: controller.notThisDevice.length + 1,
|
||||||
@ -63,12 +64,14 @@ class DevicesSettingsView extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
trailing: controller.loadingDeletingDevices
|
trailing: controller.loadingDeletingDevices
|
||||||
? const CircularProgressIndicator.adaptive(
|
? const CircularProgressIndicator.adaptive(
|
||||||
strokeWidth: 2)
|
strokeWidth: 2,
|
||||||
|
)
|
||||||
: const Icon(Icons.delete_outline),
|
: const Icon(Icons.delete_outline),
|
||||||
onTap: controller.loadingDeletingDevices
|
onTap: controller.loadingDeletingDevices
|
||||||
? null
|
? null
|
||||||
: () => controller.removeDevicesAction(
|
: () => controller.removeDevicesAction(
|
||||||
controller.notThisDevice),
|
controller.notThisDevice,
|
||||||
|
),
|
||||||
)
|
)
|
||||||
else
|
else
|
||||||
Center(
|
Center(
|
||||||
|
@ -136,7 +136,8 @@ class UserDeviceListItem extends StatelessWidget {
|
|||||||
subtitle: Text(
|
subtitle: Text(
|
||||||
L10n.of(context)!.lastActiveAgo(
|
L10n.of(context)!.lastActiveAgo(
|
||||||
DateTime.fromMillisecondsSinceEpoch(userDevice.lastSeenTs ?? 0)
|
DateTime.fromMillisecondsSinceEpoch(userDevice.lastSeenTs ?? 0)
|
||||||
.localizedTimeShort(context)),
|
.localizedTimeShort(context),
|
||||||
|
),
|
||||||
style: const TextStyle(fontWeight: FontWeight.w300),
|
style: const TextStyle(fontWeight: FontWeight.w300),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
@ -36,9 +36,12 @@ import 'package:fluffychat/widgets/avatar.dart';
|
|||||||
import 'pip/pip_view.dart';
|
import 'pip/pip_view.dart';
|
||||||
|
|
||||||
class _StreamView extends StatelessWidget {
|
class _StreamView extends StatelessWidget {
|
||||||
const _StreamView(this.wrappedStream,
|
const _StreamView(
|
||||||
{Key? key, this.mainView = false, required this.matrixClient})
|
this.wrappedStream, {
|
||||||
: super(key: key);
|
Key? key,
|
||||||
|
this.mainView = false,
|
||||||
|
required this.matrixClient,
|
||||||
|
}) : super(key: key);
|
||||||
|
|
||||||
final WrappedMediaStream wrappedStream;
|
final WrappedMediaStream wrappedStream;
|
||||||
final Client matrixClient;
|
final Client matrixClient;
|
||||||
@ -94,16 +97,21 @@ class _StreamView extends StatelessWidget {
|
|||||||
client: matrixClient,
|
client: matrixClient,
|
||||||
// textSize: mainView ? 36 : 24,
|
// textSize: mainView ? 36 : 24,
|
||||||
// matrixClient: matrixClient,
|
// matrixClient: matrixClient,
|
||||||
)),
|
),
|
||||||
|
),
|
||||||
if (!isScreenSharing)
|
if (!isScreenSharing)
|
||||||
Positioned(
|
Positioned(
|
||||||
left: 4.0,
|
left: 4.0,
|
||||||
bottom: 4.0,
|
bottom: 4.0,
|
||||||
child: Icon(audioMuted ? Icons.mic_off : Icons.mic,
|
child: Icon(
|
||||||
color: Colors.white, size: 18.0),
|
audioMuted ? Icons.mic_off : Icons.mic,
|
||||||
|
color: Colors.white,
|
||||||
|
size: 18.0,
|
||||||
|
),
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
));
|
),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -114,14 +122,14 @@ class Calling extends StatefulWidget {
|
|||||||
final CallSession call;
|
final CallSession call;
|
||||||
final Client client;
|
final Client client;
|
||||||
|
|
||||||
const Calling(
|
const Calling({
|
||||||
{required this.context,
|
required this.context,
|
||||||
required this.call,
|
required this.call,
|
||||||
required this.client,
|
required this.client,
|
||||||
required this.callId,
|
required this.callId,
|
||||||
this.onClear,
|
this.onClear,
|
||||||
Key? key})
|
Key? key,
|
||||||
: super(key: key);
|
}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
MyCallingPage createState() => MyCallingPage();
|
MyCallingPage createState() => MyCallingPage();
|
||||||
@ -206,7 +214,8 @@ class MyCallingPage extends State<Calling> {
|
|||||||
event == CallEvent.kRemoteHoldUnhold) {
|
event == CallEvent.kRemoteHoldUnhold) {
|
||||||
setState(() {});
|
setState(() {});
|
||||||
Logs().i(
|
Logs().i(
|
||||||
'Call hold event: local ${call.localHold}, remote ${call.remoteOnHold}');
|
'Call hold event: local ${call.localHold}, remote ${call.remoteOnHold}',
|
||||||
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
_state = call.state;
|
_state = call.state;
|
||||||
@ -239,7 +248,9 @@ class MyCallingPage extends State<Calling> {
|
|||||||
|
|
||||||
void _resizeLocalVideo(Orientation orientation) {
|
void _resizeLocalVideo(Orientation orientation) {
|
||||||
final shortSide = min(
|
final shortSide = min(
|
||||||
MediaQuery.of(context).size.width, MediaQuery.of(context).size.height);
|
MediaQuery.of(context).size.width,
|
||||||
|
MediaQuery.of(context).size.height,
|
||||||
|
);
|
||||||
_localVideoMargin = remoteStream != null
|
_localVideoMargin = remoteStream != null
|
||||||
? const EdgeInsets.only(top: 20.0, right: 20.0)
|
? const EdgeInsets.only(top: 20.0, right: 20.0)
|
||||||
: EdgeInsets.zero;
|
: EdgeInsets.zero;
|
||||||
@ -305,7 +316,8 @@ class MyCallingPage extends State<Calling> {
|
|||||||
);
|
);
|
||||||
FlutterForegroundTask.startService(
|
FlutterForegroundTask.startService(
|
||||||
notificationTitle: L10n.of(context)!.screenSharingTitle,
|
notificationTitle: L10n.of(context)!.screenSharingTitle,
|
||||||
notificationText: L10n.of(context)!.screenSharingDetail);
|
notificationText: L10n.of(context)!.screenSharingDetail,
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
FlutterForegroundTask.stopService();
|
FlutterForegroundTask.stopService();
|
||||||
}
|
}
|
||||||
@ -331,7 +343,8 @@ class MyCallingPage extends State<Calling> {
|
|||||||
void _switchCamera() async {
|
void _switchCamera() async {
|
||||||
if (call.localUserMediaStream != null) {
|
if (call.localUserMediaStream != null) {
|
||||||
await Helper.switchCamera(
|
await Helper.switchCamera(
|
||||||
call.localUserMediaStream!.stream!.getVideoTracks()[0]);
|
call.localUserMediaStream!.stream!.getVideoTracks()[0],
|
||||||
|
);
|
||||||
if (PlatformInfos.isMobile) {
|
if (PlatformInfos.isMobile) {
|
||||||
call.facingMode == 'user'
|
call.facingMode == 'user'
|
||||||
? call.facingMode = 'environment'
|
? call.facingMode = 'environment'
|
||||||
@ -473,8 +486,11 @@ class MyCallingPage extends State<Calling> {
|
|||||||
} else if (call.remoteOnHold) {
|
} else if (call.remoteOnHold) {
|
||||||
title = 'You held the call.';
|
title = 'You held the call.';
|
||||||
}
|
}
|
||||||
stackWidgets.add(Center(
|
stackWidgets.add(
|
||||||
child: Column(mainAxisAlignment: MainAxisAlignment.center, children: [
|
Center(
|
||||||
|
child: Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
const Icon(
|
const Icon(
|
||||||
Icons.pause,
|
Icons.pause,
|
||||||
size: 48.0,
|
size: 48.0,
|
||||||
@ -487,8 +503,10 @@ class MyCallingPage extends State<Calling> {
|
|||||||
fontSize: 24.0,
|
fontSize: 24.0,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
]),
|
],
|
||||||
));
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
return stackWidgets;
|
return stackWidgets;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -502,10 +520,15 @@ class MyCallingPage extends State<Calling> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (primaryStream != null) {
|
if (primaryStream != null) {
|
||||||
stackWidgets.add(Center(
|
stackWidgets.add(
|
||||||
child: _StreamView(primaryStream,
|
Center(
|
||||||
mainView: true, matrixClient: widget.client),
|
child: _StreamView(
|
||||||
));
|
primaryStream,
|
||||||
|
mainView: true,
|
||||||
|
matrixClient: widget.client,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isFloating || !connected) {
|
if (isFloating || !connected) {
|
||||||
@ -522,37 +545,47 @@ class MyCallingPage extends State<Calling> {
|
|||||||
|
|
||||||
if (call.remoteScreenSharingStream != null) {
|
if (call.remoteScreenSharingStream != null) {
|
||||||
final remoteUserMediaStream = call.remoteUserMediaStream;
|
final remoteUserMediaStream = call.remoteUserMediaStream;
|
||||||
secondaryStreamViews.add(SizedBox(
|
secondaryStreamViews.add(
|
||||||
|
SizedBox(
|
||||||
width: _localVideoWidth,
|
width: _localVideoWidth,
|
||||||
height: _localVideoHeight,
|
height: _localVideoHeight,
|
||||||
child: _StreamView(remoteUserMediaStream!, matrixClient: widget.client),
|
child:
|
||||||
));
|
_StreamView(remoteUserMediaStream!, matrixClient: widget.client),
|
||||||
|
),
|
||||||
|
);
|
||||||
secondaryStreamViews.add(const SizedBox(height: 10));
|
secondaryStreamViews.add(const SizedBox(height: 10));
|
||||||
}
|
}
|
||||||
|
|
||||||
final localStream =
|
final localStream =
|
||||||
call.localUserMediaStream ?? call.localScreenSharingStream;
|
call.localUserMediaStream ?? call.localScreenSharingStream;
|
||||||
if (localStream != null && !isFloating) {
|
if (localStream != null && !isFloating) {
|
||||||
secondaryStreamViews.add(SizedBox(
|
secondaryStreamViews.add(
|
||||||
|
SizedBox(
|
||||||
width: _localVideoWidth,
|
width: _localVideoWidth,
|
||||||
height: _localVideoHeight,
|
height: _localVideoHeight,
|
||||||
child: _StreamView(localStream, matrixClient: widget.client),
|
child: _StreamView(localStream, matrixClient: widget.client),
|
||||||
));
|
),
|
||||||
|
);
|
||||||
secondaryStreamViews.add(const SizedBox(height: 10));
|
secondaryStreamViews.add(const SizedBox(height: 10));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (call.localScreenSharingStream != null && !isFloating) {
|
if (call.localScreenSharingStream != null && !isFloating) {
|
||||||
secondaryStreamViews.add(SizedBox(
|
secondaryStreamViews.add(
|
||||||
|
SizedBox(
|
||||||
width: _localVideoWidth,
|
width: _localVideoWidth,
|
||||||
height: _localVideoHeight,
|
height: _localVideoHeight,
|
||||||
child: _StreamView(call.remoteUserMediaStream!,
|
child: _StreamView(
|
||||||
matrixClient: widget.client),
|
call.remoteUserMediaStream!,
|
||||||
));
|
matrixClient: widget.client,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
secondaryStreamViews.add(const SizedBox(height: 10));
|
secondaryStreamViews.add(const SizedBox(height: 10));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (secondaryStreamViews.isNotEmpty) {
|
if (secondaryStreamViews.isNotEmpty) {
|
||||||
stackWidgets.add(Container(
|
stackWidgets.add(
|
||||||
|
Container(
|
||||||
padding: const EdgeInsets.fromLTRB(0, 20, 0, 120),
|
padding: const EdgeInsets.fromLTRB(0, 20, 0, 120),
|
||||||
alignment: Alignment.bottomRight,
|
alignment: Alignment.bottomRight,
|
||||||
child: Container(
|
child: Container(
|
||||||
@ -562,7 +595,8 @@ class MyCallingPage extends State<Calling> {
|
|||||||
children: secondaryStreamViews,
|
children: secondaryStreamViews,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
));
|
),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return stackWidgets;
|
return stackWidgets;
|
||||||
@ -570,7 +604,8 @@ class MyCallingPage extends State<Calling> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return PIPView(builder: (context, isFloating) {
|
return PIPView(
|
||||||
|
builder: (context, isFloating) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
resizeToAvoidBottomInset: !isFloating,
|
resizeToAvoidBottomInset: !isFloating,
|
||||||
floatingActionButtonLocation:
|
floatingActionButtonLocation:
|
||||||
@ -580,14 +615,17 @@ class MyCallingPage extends State<Calling> {
|
|||||||
height: 150.0,
|
height: 150.0,
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||||
children: _buildActionButtons(isFloating))),
|
children: _buildActionButtons(isFloating),
|
||||||
|
),
|
||||||
|
),
|
||||||
body: OrientationBuilder(
|
body: OrientationBuilder(
|
||||||
builder: (BuildContext context, Orientation orientation) {
|
builder: (BuildContext context, Orientation orientation) {
|
||||||
return Container(
|
return Container(
|
||||||
decoration: const BoxDecoration(
|
decoration: const BoxDecoration(
|
||||||
color: Colors.black87,
|
color: Colors.black87,
|
||||||
),
|
),
|
||||||
child: Stack(children: [
|
child: Stack(
|
||||||
|
children: [
|
||||||
..._buildContent(orientation, isFloating),
|
..._buildContent(orientation, isFloating),
|
||||||
if (!isFloating)
|
if (!isFloating)
|
||||||
Positioned(
|
Positioned(
|
||||||
@ -599,9 +637,15 @@ class MyCallingPage extends State<Calling> {
|
|||||||
onPressed: () {
|
onPressed: () {
|
||||||
PIPView.of(context)?.setFloating(true);
|
PIPView.of(context)?.setFloating(true);
|
||||||
},
|
},
|
||||||
))
|
),
|
||||||
]));
|
)
|
||||||
}));
|
],
|
||||||
});
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -198,9 +198,11 @@ class PIPViewState extends State<PIPView> with TickerProviderStateMixin {
|
|||||||
: Tween<Offset>(
|
: Tween<Offset>(
|
||||||
begin: _dragOffset,
|
begin: _dragOffset,
|
||||||
end: calculatedOffset,
|
end: calculatedOffset,
|
||||||
).transform(_dragAnimationController.isAnimating
|
).transform(
|
||||||
|
_dragAnimationController.isAnimating
|
||||||
? dragAnimationValue
|
? dragAnimationValue
|
||||||
: toggleFloatingAnimationValue);
|
: toggleFloatingAnimationValue,
|
||||||
|
);
|
||||||
final borderRadius = Tween<double>(
|
final borderRadius = Tween<double>(
|
||||||
begin: 0,
|
begin: 0,
|
||||||
end: 10,
|
end: 10,
|
||||||
|
@ -21,7 +21,8 @@ class HomeserverBottomSheet extends StatelessWidget {
|
|||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
title: Text(homeserver.homeserver.baseUrl.host),
|
title: Text(homeserver.homeserver.baseUrl.host),
|
||||||
),
|
),
|
||||||
body: ListView(children: [
|
body: ListView(
|
||||||
|
children: [
|
||||||
if (description != null && description.isNotEmpty)
|
if (description != null && description.isNotEmpty)
|
||||||
ListTile(
|
ListTile(
|
||||||
leading: const Icon(Icons.info_outlined),
|
leading: const Icon(Icons.info_outlined),
|
||||||
@ -66,7 +67,8 @@ class HomeserverBottomSheet extends StatelessWidget {
|
|||||||
leading: const Icon(Icons.timer_outlined),
|
leading: const Icon(Icons.timer_outlined),
|
||||||
title: Text('${responseTime.inMilliseconds}ms'),
|
title: Text('${responseTime.inMilliseconds}ms'),
|
||||||
),
|
),
|
||||||
]),
|
],
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -54,7 +54,8 @@ class HomeserverPickerController extends State<HomeserverPicker> {
|
|||||||
context: context,
|
context: context,
|
||||||
title: L10n.of(context)!.indexedDbErrorTitle,
|
title: L10n.of(context)!.indexedDbErrorTitle,
|
||||||
message: L10n.of(context)!.indexedDbErrorLong,
|
message: L10n.of(context)!.indexedDbErrorLong,
|
||||||
onWillPop: () async => false);
|
onWillPop: () async => false,
|
||||||
|
);
|
||||||
_checkTorBrowser();
|
_checkTorBrowser();
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
@ -85,9 +86,11 @@ class HomeserverPickerController extends State<HomeserverPicker> {
|
|||||||
});
|
});
|
||||||
|
|
||||||
List<HomeserverBenchmarkResult> get filteredHomeservers => benchmarkResults!
|
List<HomeserverBenchmarkResult> get filteredHomeservers => benchmarkResults!
|
||||||
.where((element) =>
|
.where(
|
||||||
|
(element) =>
|
||||||
element.homeserver.baseUrl.host.contains(searchTerm) ||
|
element.homeserver.baseUrl.host.contains(searchTerm) ||
|
||||||
(element.homeserver.description?.contains(searchTerm) ?? false))
|
(element.homeserver.description?.contains(searchTerm) ?? false),
|
||||||
|
)
|
||||||
.toList();
|
.toList();
|
||||||
|
|
||||||
void _loadHomeserverList() async {
|
void _loadHomeserverList() async {
|
||||||
@ -195,6 +198,7 @@ class HomeserverPickerController extends State<HomeserverPicker> {
|
|||||||
} catch (e, s) {
|
} catch (e, s) {
|
||||||
Logs().e('Future error:', e, s);
|
Logs().e('Future error:', e, s);
|
||||||
}
|
}
|
||||||
});
|
},
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -66,9 +66,10 @@ class HomeserverPickerView extends StatelessWidget {
|
|||||||
? const Center(
|
? const Center(
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: EdgeInsets.all(12.0),
|
padding: EdgeInsets.all(12.0),
|
||||||
child:
|
child: CircularProgressIndicator
|
||||||
CircularProgressIndicator.adaptive(),
|
.adaptive(),
|
||||||
))
|
),
|
||||||
|
)
|
||||||
: Column(
|
: Column(
|
||||||
children: controller.filteredHomeservers
|
children: controller.filteredHomeservers
|
||||||
.map(
|
.map(
|
||||||
@ -82,19 +83,20 @@ class HomeserverPickerView extends StatelessWidget {
|
|||||||
.showServerInfo(server),
|
.showServerInfo(server),
|
||||||
),
|
),
|
||||||
onTap: () => controller.setServer(
|
onTap: () => controller.setServer(
|
||||||
server
|
server.homeserver.baseUrl.host,
|
||||||
.homeserver.baseUrl.host),
|
),
|
||||||
title: Text(
|
title: Text(
|
||||||
server.homeserver.baseUrl.host,
|
server.homeserver.baseUrl.host,
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
color: Colors.black),
|
color: Colors.black,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
subtitle: Text(
|
subtitle: Text(
|
||||||
server.homeserver.description ??
|
server.homeserver.description ??
|
||||||
'',
|
'',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color:
|
color: Colors.grey.shade700,
|
||||||
Colors.grey.shade700),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
@ -47,7 +47,8 @@ class ImageViewerView extends StatelessWidget {
|
|||||||
tooltip: L10n.of(context)!.share,
|
tooltip: L10n.of(context)!.share,
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
icon: Icon(Icons.adaptive.share_outlined),
|
icon: Icon(Icons.adaptive.share_outlined),
|
||||||
))
|
),
|
||||||
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
body: InteractiveViewer(
|
body: InteractiveViewer(
|
||||||
|
@ -71,8 +71,11 @@ class InvitationSelectionController extends State<InvitationSelection> {
|
|||||||
future: () => room.invite(id),
|
future: () => room.invite(id),
|
||||||
);
|
);
|
||||||
if (success.error == null) {
|
if (success.error == null) {
|
||||||
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
content: Text(L10n.of(context)!.contactHasBeenInvitedToTheGroup)));
|
SnackBar(
|
||||||
|
content: Text(L10n.of(context)!.contactHasBeenInvitedToTheGroup),
|
||||||
|
),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -99,7 +102,8 @@ class InvitationSelectionController extends State<InvitationSelection> {
|
|||||||
response = await matrix.client.searchUserDirectory(text, limit: 10);
|
response = await matrix.client.searchUserDirectory(text, limit: 10);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
SnackBar(content: Text((e).toLocalizedString(context))));
|
SnackBar(content: Text((e).toLocalizedString(context))),
|
||||||
|
);
|
||||||
return;
|
return;
|
||||||
} finally {
|
} finally {
|
||||||
setState(() => loading = false);
|
setState(() => loading = false);
|
||||||
@ -108,19 +112,25 @@ class InvitationSelectionController extends State<InvitationSelection> {
|
|||||||
foundProfiles = List<Profile>.from(response.results);
|
foundProfiles = List<Profile>.from(response.results);
|
||||||
if (text.isValidMatrixId &&
|
if (text.isValidMatrixId &&
|
||||||
foundProfiles.indexWhere((profile) => text == profile.userId) == -1) {
|
foundProfiles.indexWhere((profile) => text == profile.userId) == -1) {
|
||||||
setState(() => foundProfiles = [
|
setState(
|
||||||
|
() => foundProfiles = [
|
||||||
Profile.fromJson({'user_id': text}),
|
Profile.fromJson({'user_id': text}),
|
||||||
]);
|
],
|
||||||
|
);
|
||||||
}
|
}
|
||||||
final participants = Matrix.of(context)
|
final participants = Matrix.of(context)
|
||||||
.client
|
.client
|
||||||
.getRoomById(roomId!)!
|
.getRoomById(roomId!)!
|
||||||
.getParticipants()
|
.getParticipants()
|
||||||
.where((user) =>
|
.where(
|
||||||
[Membership.join, Membership.invite].contains(user.membership))
|
(user) =>
|
||||||
|
[Membership.join, Membership.invite].contains(user.membership),
|
||||||
|
)
|
||||||
.toList();
|
.toList();
|
||||||
foundProfiles.removeWhere((profile) =>
|
foundProfiles.removeWhere(
|
||||||
participants.indexWhere((u) => u.id == profile.userId) != -1);
|
(profile) =>
|
||||||
|
participants.indexWhere((u) => u.id == profile.userId) != -1,
|
||||||
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,7 +75,9 @@ class InvitationSelectionView extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
subtitle: Text(controller.foundProfiles[i].userId),
|
subtitle: Text(controller.foundProfiles[i].userId),
|
||||||
onTap: () => controller.inviteAction(
|
onTap: () => controller.inviteAction(
|
||||||
context, controller.foundProfiles[i].userId),
|
context,
|
||||||
|
controller.foundProfiles[i].userId,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
: FutureBuilder<List<User>>(
|
: FutureBuilder<List<User>>(
|
||||||
@ -106,7 +108,8 @@ class InvitationSelectionView extends StatelessWidget {
|
|||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: Theme.of(context).colorScheme.secondary),
|
color: Theme.of(context).colorScheme.secondary,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
onTap: () =>
|
onTap: () =>
|
||||||
controller.inviteAction(context, contacts[i].id),
|
controller.inviteAction(context, contacts[i].id),
|
||||||
|
@ -82,7 +82,8 @@ class KeyVerificationPageState extends State<KeyVerificationDialog> {
|
|||||||
valid = false;
|
valid = false;
|
||||||
}
|
}
|
||||||
return valid;
|
return valid;
|
||||||
});
|
},
|
||||||
|
);
|
||||||
if (valid.error != null) {
|
if (valid.error != null) {
|
||||||
await showOkAlertDialog(
|
await showOkAlertDialog(
|
||||||
useRootNavigator: false,
|
useRootNavigator: false,
|
||||||
@ -117,8 +118,10 @@ class KeyVerificationPageState extends State<KeyVerificationDialog> {
|
|||||||
child: Column(
|
child: Column(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Text(L10n.of(context)!.askSSSSSign,
|
Text(
|
||||||
style: const TextStyle(fontSize: 20)),
|
L10n.of(context)!.askSSSSSign,
|
||||||
|
style: const TextStyle(fontSize: 20),
|
||||||
|
),
|
||||||
Container(height: 10),
|
Container(height: 10),
|
||||||
TextField(
|
TextField(
|
||||||
controller: textEditingController,
|
controller: textEditingController,
|
||||||
@ -141,18 +144,22 @@ class KeyVerificationPageState extends State<KeyVerificationDialog> {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
buttons.add(TextButton(
|
buttons.add(
|
||||||
|
TextButton(
|
||||||
child: Text(
|
child: Text(
|
||||||
L10n.of(context)!.submit,
|
L10n.of(context)!.submit,
|
||||||
),
|
),
|
||||||
onPressed: () => checkInput(textEditingController.text),
|
onPressed: () => checkInput(textEditingController.text),
|
||||||
));
|
),
|
||||||
buttons.add(TextButton(
|
);
|
||||||
|
buttons.add(
|
||||||
|
TextButton(
|
||||||
child: Text(
|
child: Text(
|
||||||
L10n.of(context)!.skip,
|
L10n.of(context)!.skip,
|
||||||
),
|
),
|
||||||
onPressed: () => widget.request.openSSSS(skip: true),
|
onPressed: () => widget.request.openSSSS(skip: true),
|
||||||
));
|
),
|
||||||
|
);
|
||||||
break;
|
break;
|
||||||
case KeyVerificationState.askAccept:
|
case KeyVerificationState.askAccept:
|
||||||
title = Text(L10n.of(context)!.newVerificationRequest);
|
title = Text(L10n.of(context)!.newVerificationRequest);
|
||||||
@ -171,19 +178,23 @@ class KeyVerificationPageState extends State<KeyVerificationDialog> {
|
|||||||
)
|
)
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
buttons.add(TextButton.icon(
|
buttons.add(
|
||||||
|
TextButton.icon(
|
||||||
icon: const Icon(Icons.close),
|
icon: const Icon(Icons.close),
|
||||||
style: TextButton.styleFrom(foregroundColor: Colors.red),
|
style: TextButton.styleFrom(foregroundColor: Colors.red),
|
||||||
label: Text(L10n.of(context)!.reject),
|
label: Text(L10n.of(context)!.reject),
|
||||||
onPressed: () => widget.request
|
onPressed: () => widget.request
|
||||||
.rejectVerification()
|
.rejectVerification()
|
||||||
.then((_) => Navigator.of(context, rootNavigator: false).pop()),
|
.then((_) => Navigator.of(context, rootNavigator: false).pop()),
|
||||||
));
|
),
|
||||||
buttons.add(TextButton.icon(
|
);
|
||||||
|
buttons.add(
|
||||||
|
TextButton.icon(
|
||||||
icon: const Icon(Icons.check),
|
icon: const Icon(Icons.check),
|
||||||
label: Text(L10n.of(context)!.accept),
|
label: Text(L10n.of(context)!.accept),
|
||||||
onPressed: () => widget.request.acceptVerification(),
|
onPressed: () => widget.request.acceptVerification(),
|
||||||
));
|
),
|
||||||
|
);
|
||||||
break;
|
break;
|
||||||
case KeyVerificationState.waitingAccept:
|
case KeyVerificationState.waitingAccept:
|
||||||
body = Center(
|
body = Center(
|
||||||
@ -245,19 +256,23 @@ class KeyVerificationPageState extends State<KeyVerificationDialog> {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
buttons.add(TextButton.icon(
|
buttons.add(
|
||||||
|
TextButton.icon(
|
||||||
icon: const Icon(Icons.close),
|
icon: const Icon(Icons.close),
|
||||||
style: TextButton.styleFrom(
|
style: TextButton.styleFrom(
|
||||||
foregroundColor: Colors.red,
|
foregroundColor: Colors.red,
|
||||||
),
|
),
|
||||||
label: Text(L10n.of(context)!.theyDontMatch),
|
label: Text(L10n.of(context)!.theyDontMatch),
|
||||||
onPressed: () => widget.request.rejectSas(),
|
onPressed: () => widget.request.rejectSas(),
|
||||||
));
|
),
|
||||||
buttons.add(TextButton.icon(
|
);
|
||||||
|
buttons.add(
|
||||||
|
TextButton.icon(
|
||||||
icon: const Icon(Icons.check_outlined),
|
icon: const Icon(Icons.check_outlined),
|
||||||
label: Text(L10n.of(context)!.theyMatch),
|
label: Text(L10n.of(context)!.theyMatch),
|
||||||
onPressed: () => widget.request.acceptSas(),
|
onPressed: () => widget.request.acceptSas(),
|
||||||
));
|
),
|
||||||
|
);
|
||||||
break;
|
break;
|
||||||
case KeyVerificationState.waitingSas:
|
case KeyVerificationState.waitingSas:
|
||||||
final acceptText = widget.request.sasTypes.contains('emoji')
|
final acceptText = widget.request.sasTypes.contains('emoji')
|
||||||
@ -279,8 +294,11 @@ class KeyVerificationPageState extends State<KeyVerificationDialog> {
|
|||||||
body = Column(
|
body = Column(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
const Icon(Icons.check_circle_outlined,
|
const Icon(
|
||||||
color: Colors.green, size: 128.0),
|
Icons.check_circle_outlined,
|
||||||
|
color: Colors.green,
|
||||||
|
size: 128.0,
|
||||||
|
),
|
||||||
const SizedBox(height: 10),
|
const SizedBox(height: 10),
|
||||||
Text(
|
Text(
|
||||||
L10n.of(context)!.verifySuccess,
|
L10n.of(context)!.verifySuccess,
|
||||||
@ -288,12 +306,14 @@ class KeyVerificationPageState extends State<KeyVerificationDialog> {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
buttons.add(TextButton(
|
buttons.add(
|
||||||
|
TextButton(
|
||||||
child: Text(
|
child: Text(
|
||||||
L10n.of(context)!.close,
|
L10n.of(context)!.close,
|
||||||
),
|
),
|
||||||
onPressed: () => Navigator.of(context, rootNavigator: false).pop(),
|
onPressed: () => Navigator.of(context, rootNavigator: false).pop(),
|
||||||
));
|
),
|
||||||
|
);
|
||||||
break;
|
break;
|
||||||
case KeyVerificationState.error:
|
case KeyVerificationState.error:
|
||||||
body = Column(
|
body = Column(
|
||||||
@ -307,12 +327,14 @@ class KeyVerificationPageState extends State<KeyVerificationDialog> {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
buttons.add(TextButton(
|
buttons.add(
|
||||||
|
TextButton(
|
||||||
child: Text(
|
child: Text(
|
||||||
L10n.of(context)!.close,
|
L10n.of(context)!.close,
|
||||||
),
|
),
|
||||||
onPressed: () => Navigator.of(context, rootNavigator: false).pop(),
|
onPressed: () => Navigator.of(context, rootNavigator: false).pop(),
|
||||||
));
|
),
|
||||||
|
);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
@ -350,7 +372,8 @@ class _Emoji extends StatelessWidget {
|
|||||||
return emoji.name;
|
return emoji.name;
|
||||||
}
|
}
|
||||||
final translations = Map<String, String?>.from(
|
final translations = Map<String, String?>.from(
|
||||||
sasEmoji[emoji.number]['translated_descriptions']);
|
sasEmoji[emoji.number]['translated_descriptions'],
|
||||||
|
);
|
||||||
translations['en'] = emoji.name;
|
translations['en'] = emoji.name;
|
||||||
for (final locale in window.locales) {
|
for (final locale in window.locales) {
|
||||||
final wantLocaleParts = locale.toString().split('_');
|
final wantLocaleParts = locale.toString().split('_');
|
||||||
|
@ -67,7 +67,8 @@ class LoginController extends State<Login> {
|
|||||||
} else {
|
} else {
|
||||||
identifier = AuthenticationUserIdentifier(user: username);
|
identifier = AuthenticationUserIdentifier(user: username);
|
||||||
}
|
}
|
||||||
await matrix.getLoginClient().login(LoginType.mLoginPassword,
|
await matrix.getLoginClient().login(
|
||||||
|
LoginType.mLoginPassword,
|
||||||
identifier: identifier,
|
identifier: identifier,
|
||||||
// To stay compatible with older server versions
|
// To stay compatible with older server versions
|
||||||
// ignore: deprecated_member_use
|
// ignore: deprecated_member_use
|
||||||
@ -75,7 +76,8 @@ class LoginController extends State<Login> {
|
|||||||
? username
|
? username
|
||||||
: null,
|
: null,
|
||||||
password: passwordController.text,
|
password: passwordController.text,
|
||||||
initialDeviceDisplayName: PlatformInfos.clientName);
|
initialDeviceDisplayName: PlatformInfos.clientName,
|
||||||
|
);
|
||||||
} on MatrixException catch (exception) {
|
} on MatrixException catch (exception) {
|
||||||
setState(() => passwordError = exception.errorMessage);
|
setState(() => passwordError = exception.errorMessage);
|
||||||
return setState(() => loading = false);
|
return setState(() => loading = false);
|
||||||
@ -121,7 +123,8 @@ class LoginController extends State<Login> {
|
|||||||
Matrix.of(context).getLoginClient().homeserver = oldHomeserver;
|
Matrix.of(context).getLoginClient().homeserver = oldHomeserver;
|
||||||
// okay, the server we checked does not appear to be a matrix server
|
// okay, the server we checked does not appear to be a matrix server
|
||||||
Logs().v(
|
Logs().v(
|
||||||
'$newDomain is not running a homeserver, asking to use $oldHomeserver');
|
'$newDomain is not running a homeserver, asking to use $oldHomeserver',
|
||||||
|
);
|
||||||
final dialogResult = await showOkCancelAlertDialog(
|
final dialogResult = await showOkCancelAlertDialog(
|
||||||
context: context,
|
context: context,
|
||||||
useRootNavigator: false,
|
useRootNavigator: false,
|
||||||
@ -230,7 +233,8 @@ class LoginController extends State<Login> {
|
|||||||
);
|
);
|
||||||
if (success.error == null) {
|
if (success.error == null) {
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
SnackBar(content: Text(L10n.of(context)!.passwordHasBeenChanged)));
|
SnackBar(content: Text(L10n.of(context)!.passwordHasBeenChanged)),
|
||||||
|
);
|
||||||
usernameController.text = input.single;
|
usernameController.text = input.single;
|
||||||
passwordController.text = password.single;
|
passwordController.text = password.single;
|
||||||
login();
|
login();
|
||||||
|
@ -19,14 +19,17 @@ class LoginView extends StatelessWidget {
|
|||||||
automaticallyImplyLeading: !controller.loading,
|
automaticallyImplyLeading: !controller.loading,
|
||||||
centerTitle: true,
|
centerTitle: true,
|
||||||
title: Text(
|
title: Text(
|
||||||
L10n.of(context)!.logInTo(Matrix.of(context)
|
L10n.of(context)!.logInTo(
|
||||||
|
Matrix.of(context)
|
||||||
.getLoginClient()
|
.getLoginClient()
|
||||||
.homeserver
|
.homeserver
|
||||||
.toString()
|
.toString()
|
||||||
.replaceFirst('https://', '')),
|
.replaceFirst('https://', ''),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
body: Builder(builder: (context) {
|
),
|
||||||
|
body: Builder(
|
||||||
|
builder: (context) {
|
||||||
return AutofillGroup(
|
return AutofillGroup(
|
||||||
child: ListView(
|
child: ListView(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
@ -85,7 +88,8 @@ class LoginView extends StatelessWidget {
|
|||||||
child: ElevatedButton.icon(
|
child: ElevatedButton.icon(
|
||||||
style: ElevatedButton.styleFrom(
|
style: ElevatedButton.styleFrom(
|
||||||
backgroundColor: Theme.of(context).colorScheme.primary,
|
backgroundColor: Theme.of(context).colorScheme.primary,
|
||||||
foregroundColor: Theme.of(context).colorScheme.onPrimary,
|
foregroundColor:
|
||||||
|
Theme.of(context).colorScheme.onPrimary,
|
||||||
),
|
),
|
||||||
onPressed: controller.loading ? null : controller.login,
|
onPressed: controller.loading ? null : controller.login,
|
||||||
icon: const Icon(Icons.login_outlined),
|
icon: const Icon(Icons.login_outlined),
|
||||||
@ -124,8 +128,9 @@ class LoginView extends StatelessWidget {
|
|||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.all(12.0),
|
padding: const EdgeInsets.all(12.0),
|
||||||
child: ElevatedButton.icon(
|
child: ElevatedButton.icon(
|
||||||
onPressed:
|
onPressed: controller.loading
|
||||||
controller.loading ? () {} : controller.passwordForgotten,
|
? () {}
|
||||||
|
: controller.passwordForgotten,
|
||||||
style: ElevatedButton.styleFrom(
|
style: ElevatedButton.styleFrom(
|
||||||
foregroundColor: Theme.of(context).colorScheme.error,
|
foregroundColor: Theme.of(context).colorScheme.error,
|
||||||
backgroundColor: Theme.of(context).colorScheme.onError,
|
backgroundColor: Theme.of(context).colorScheme.onError,
|
||||||
@ -137,7 +142,8 @@ class LoginView extends StatelessWidget {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}),
|
},
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,8 @@ class NewGroupView extends StatelessWidget {
|
|||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
labelText: L10n.of(context)!.optionalGroupName,
|
labelText: L10n.of(context)!.optionalGroupName,
|
||||||
prefixIcon: const Icon(Icons.people_outlined),
|
prefixIcon: const Icon(Icons.people_outlined),
|
||||||
hintText: L10n.of(context)!.enterAGroupName),
|
hintText: L10n.of(context)!.enterAGroupName,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
SwitchListTile.adaptive(
|
SwitchListTile.adaptive(
|
||||||
|
@ -31,7 +31,8 @@ class NewSpaceView extends StatelessWidget {
|
|||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
labelText: L10n.of(context)!.spaceName,
|
labelText: L10n.of(context)!.spaceName,
|
||||||
prefixIcon: const Icon(Icons.people_outlined),
|
prefixIcon: const Icon(Icons.people_outlined),
|
||||||
hintText: L10n.of(context)!.enterASpacepName),
|
hintText: L10n.of(context)!.enterASpacepName,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
SwitchListTile.adaptive(
|
SwitchListTile.adaptive(
|
||||||
|
@ -43,8 +43,8 @@ class SettingsView extends StatelessWidget {
|
|||||||
future: controller.profileFuture,
|
future: controller.profileFuture,
|
||||||
builder: (context, snapshot) {
|
builder: (context, snapshot) {
|
||||||
final profile = snapshot.data;
|
final profile = snapshot.data;
|
||||||
final mxid = Matrix.of(context).client.userID ??
|
final mxid =
|
||||||
L10n.of(context)!.user;
|
Matrix.of(context).client.userID ?? L10n.of(context)!.user;
|
||||||
final displayname =
|
final displayname =
|
||||||
profile?.displayName ?? mxid.localpart ?? mxid;
|
profile?.displayName ?? mxid.localpart ?? mxid;
|
||||||
return Row(
|
return Row(
|
||||||
@ -65,7 +65,8 @@ class SettingsView extends StatelessWidget {
|
|||||||
color: Theme.of(context).dividerColor,
|
color: Theme.of(context).dividerColor,
|
||||||
),
|
),
|
||||||
borderRadius: BorderRadius.circular(
|
borderRadius: BorderRadius.circular(
|
||||||
Avatar.defaultSize * 2.5),
|
Avatar.defaultSize * 2.5,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
child: Avatar(
|
child: Avatar(
|
||||||
mxContent: profile?.avatarUrl,
|
mxContent: profile?.avatarUrl,
|
||||||
@ -131,7 +132,8 @@ class SettingsView extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}),
|
},
|
||||||
|
),
|
||||||
const Divider(thickness: 1),
|
const Divider(thickness: 1),
|
||||||
if (showChatBackupBanner == null)
|
if (showChatBackupBanner == null)
|
||||||
ListTile(
|
ListTile(
|
||||||
|
@ -83,7 +83,8 @@ class Settings3PidController extends State<Settings3Pid> {
|
|||||||
future: () => Matrix.of(context).client.delete3pidFromAccount(
|
future: () => Matrix.of(context).client.delete3pidFromAccount(
|
||||||
identifier.address,
|
identifier.address,
|
||||||
identifier.medium,
|
identifier.medium,
|
||||||
));
|
),
|
||||||
|
);
|
||||||
if (success.error != null) return;
|
if (success.error != null) return;
|
||||||
setState(() => request = null);
|
setState(() => request = null);
|
||||||
}
|
}
|
||||||
|
@ -30,8 +30,10 @@ class Settings3PidView extends StatelessWidget {
|
|||||||
body: MaxWidthBody(
|
body: MaxWidthBody(
|
||||||
child: FutureBuilder<List<ThirdPartyIdentifier>?>(
|
child: FutureBuilder<List<ThirdPartyIdentifier>?>(
|
||||||
future: controller.request,
|
future: controller.request,
|
||||||
builder: (BuildContext context,
|
builder: (
|
||||||
AsyncSnapshot<List<ThirdPartyIdentifier>?> snapshot) {
|
BuildContext context,
|
||||||
|
AsyncSnapshot<List<ThirdPartyIdentifier>?> snapshot,
|
||||||
|
) {
|
||||||
if (snapshot.hasError) {
|
if (snapshot.hasError) {
|
||||||
return Center(
|
return Center(
|
||||||
child: Text(
|
child: Text(
|
||||||
@ -42,7 +44,8 @@ class Settings3PidView extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
if (!snapshot.hasData) {
|
if (!snapshot.hasData) {
|
||||||
return const Center(
|
return const Center(
|
||||||
child: CircularProgressIndicator.adaptive(strokeWidth: 2));
|
child: CircularProgressIndicator.adaptive(strokeWidth: 2),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
final identifier = snapshot.data!;
|
final identifier = snapshot.data!;
|
||||||
return Column(
|
return Column(
|
||||||
@ -74,7 +77,8 @@ class Settings3PidView extends StatelessWidget {
|
|||||||
backgroundColor:
|
backgroundColor:
|
||||||
Theme.of(context).scaffoldBackgroundColor,
|
Theme.of(context).scaffoldBackgroundColor,
|
||||||
foregroundColor: Colors.grey,
|
foregroundColor: Colors.grey,
|
||||||
child: Icon(identifier[i].iconData)),
|
child: Icon(identifier[i].iconData),
|
||||||
|
),
|
||||||
title: Text(identifier[i].address),
|
title: Text(identifier[i].address),
|
||||||
trailing: IconButton(
|
trailing: IconButton(
|
||||||
tooltip: L10n.of(context)!.delete,
|
tooltip: L10n.of(context)!.delete,
|
||||||
|
@ -60,13 +60,20 @@ class EmotesSettingsController extends State<EmotesSettings> {
|
|||||||
await showFutureLoadingDialog(
|
await showFutureLoadingDialog(
|
||||||
context: context,
|
context: context,
|
||||||
future: () => client.setRoomStateWithKey(
|
future: () => client.setRoomStateWithKey(
|
||||||
room!.id, 'im.ponies.room_emotes', stateKey ?? '', pack!.toJson()),
|
room!.id,
|
||||||
|
'im.ponies.room_emotes',
|
||||||
|
stateKey ?? '',
|
||||||
|
pack!.toJson(),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
await showFutureLoadingDialog(
|
await showFutureLoadingDialog(
|
||||||
context: context,
|
context: context,
|
||||||
future: () => client.setAccountData(
|
future: () => client.setAccountData(
|
||||||
client.userID!, 'im.ponies.user_emotes', pack!.toJson()),
|
client.userID!,
|
||||||
|
'im.ponies.user_emotes',
|
||||||
|
pack!.toJson(),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -95,7 +102,10 @@ class EmotesSettingsController extends State<EmotesSettings> {
|
|||||||
await showFutureLoadingDialog(
|
await showFutureLoadingDialog(
|
||||||
context: context,
|
context: context,
|
||||||
future: () => client.setAccountData(
|
future: () => client.setAccountData(
|
||||||
client.userID!, 'im.ponies.emote_rooms', content),
|
client.userID!,
|
||||||
|
'im.ponies.emote_rooms',
|
||||||
|
content,
|
||||||
|
),
|
||||||
);
|
);
|
||||||
setState(() {});
|
setState(() {});
|
||||||
}
|
}
|
||||||
@ -197,7 +207,8 @@ class EmotesSettingsController extends State<EmotesSettings> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void imagePickerAction(
|
void imagePickerAction(
|
||||||
ValueNotifier<ImagePackImageContent?> controller) async {
|
ValueNotifier<ImagePackImageContent?> controller,
|
||||||
|
) async {
|
||||||
final result =
|
final result =
|
||||||
await FilePickerCross.importFromStorage(type: FileTypeCross.image);
|
await FilePickerCross.importFromStorage(type: FileTypeCross.image);
|
||||||
if (result.fileName == null) return;
|
if (result.fileName == null) return;
|
||||||
|
@ -140,8 +140,8 @@ class EmotesSettingsView extends StatelessWidget {
|
|||||||
actions: !useShortCuts
|
actions: !useShortCuts
|
||||||
? {}
|
? {}
|
||||||
: {
|
: {
|
||||||
SubmitLineIntent:
|
SubmitLineIntent: CallbackAction(
|
||||||
CallbackAction(onInvoke: (i) {
|
onInvoke: (i) {
|
||||||
controller.submitImageAction(
|
controller.submitImageAction(
|
||||||
imageCode,
|
imageCode,
|
||||||
textEditingController.text,
|
textEditingController.text,
|
||||||
@ -149,7 +149,8 @@ class EmotesSettingsView extends StatelessWidget {
|
|||||||
textEditingController,
|
textEditingController,
|
||||||
);
|
);
|
||||||
return null;
|
return null;
|
||||||
}),
|
},
|
||||||
|
),
|
||||||
},
|
},
|
||||||
child: TextField(
|
child: TextField(
|
||||||
readOnly: controller.readonly,
|
readOnly: controller.readonly,
|
||||||
|
@ -72,7 +72,8 @@ class SettingsIgnoreListView extends StatelessWidget {
|
|||||||
name: s.data?.displayName ?? client.ignoredUsers[i],
|
name: s.data?.displayName ?? client.ignoredUsers[i],
|
||||||
),
|
),
|
||||||
title: Text(
|
title: Text(
|
||||||
s.data?.displayName ?? client.ignoredUsers[i]),
|
s.data?.displayName ?? client.ignoredUsers[i],
|
||||||
|
),
|
||||||
trailing: IconButton(
|
trailing: IconButton(
|
||||||
tooltip: L10n.of(context)!.delete,
|
tooltip: L10n.of(context)!.delete,
|
||||||
icon: const Icon(Icons.delete_forever_outlined),
|
icon: const Icon(Icons.delete_forever_outlined),
|
||||||
@ -85,7 +86,8 @@ class SettingsIgnoreListView extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}),
|
},
|
||||||
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
@ -36,8 +36,7 @@ class MultipleEmotesSettingsView extends StatelessWidget {
|
|||||||
itemCount: keys.length,
|
itemCount: keys.length,
|
||||||
itemBuilder: (BuildContext context, int i) {
|
itemBuilder: (BuildContext context, int i) {
|
||||||
final event = packs[keys[i]];
|
final event = packs[keys[i]];
|
||||||
String? packName =
|
String? packName = keys[i].isNotEmpty ? keys[i] : 'Default Pack';
|
||||||
keys[i].isNotEmpty ? keys[i] : 'Default Pack';
|
|
||||||
if (event != null && event.content['pack'] is Map) {
|
if (event != null && event.content['pack'] is Map) {
|
||||||
if (event.content['pack']['displayname'] is String) {
|
if (event.content['pack']['displayname'] is String) {
|
||||||
packName = event.content['pack']['displayname'];
|
packName = event.content['pack']['displayname'];
|
||||||
@ -49,10 +48,12 @@ class MultipleEmotesSettingsView extends StatelessWidget {
|
|||||||
title: Text(packName!),
|
title: Text(packName!),
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
VRouter.of(context).toSegments(
|
VRouter.of(context).toSegments(
|
||||||
['rooms', room.id, 'details', 'emotes', keys[i]]);
|
['rooms', room.id, 'details', 'emotes', keys[i]],
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
});
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
@ -36,14 +36,14 @@ class SettingsNotificationsView extends StatelessWidget {
|
|||||||
SwitchListTile.adaptive(
|
SwitchListTile.adaptive(
|
||||||
value: !Matrix.of(context).client.allPushNotificationsMuted,
|
value: !Matrix.of(context).client.allPushNotificationsMuted,
|
||||||
title: Text(
|
title: Text(
|
||||||
L10n.of(context)!.notificationsEnabledForThisAccount),
|
L10n.of(context)!.notificationsEnabledForThisAccount,
|
||||||
|
),
|
||||||
onChanged: (_) => showFutureLoadingDialog(
|
onChanged: (_) => showFutureLoadingDialog(
|
||||||
context: context,
|
context: context,
|
||||||
future: () =>
|
future: () => Matrix.of(context)
|
||||||
Matrix.of(context).client.setMuteAllPushNotifications(
|
|
||||||
!Matrix.of(context)
|
|
||||||
.client
|
.client
|
||||||
.allPushNotificationsMuted,
|
.setMuteAllPushNotifications(
|
||||||
|
!Matrix.of(context).client.allPushNotificationsMuted,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -90,7 +90,9 @@ class SettingsNotificationsView extends StatelessWidget {
|
|||||||
if (snapshot.connectionState != ConnectionState.done) {
|
if (snapshot.connectionState != ConnectionState.done) {
|
||||||
const Center(
|
const Center(
|
||||||
child: CircularProgressIndicator.adaptive(
|
child: CircularProgressIndicator.adaptive(
|
||||||
strokeWidth: 2));
|
strokeWidth: 2,
|
||||||
|
),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
final pushers = snapshot.data ?? [];
|
final pushers = snapshot.data ?? [];
|
||||||
return ListView.builder(
|
return ListView.builder(
|
||||||
@ -99,7 +101,8 @@ class SettingsNotificationsView extends StatelessWidget {
|
|||||||
itemCount: pushers.length,
|
itemCount: pushers.length,
|
||||||
itemBuilder: (_, i) => ListTile(
|
itemBuilder: (_, i) => ListTile(
|
||||||
title: Text(
|
title: Text(
|
||||||
'${pushers[i].appDisplayName} - ${pushers[i].appId}'),
|
'${pushers[i].appDisplayName} - ${pushers[i].appId}',
|
||||||
|
),
|
||||||
subtitle: Text(pushers[i].data.url.toString()),
|
subtitle: Text(pushers[i].data.url.toString()),
|
||||||
onTap: () => controller.onPusherTap(pushers[i]),
|
onTap: () => controller.onPusherTap(pushers[i]),
|
||||||
),
|
),
|
||||||
@ -108,7 +111,8 @@ class SettingsNotificationsView extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}),
|
},
|
||||||
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -56,7 +56,8 @@ class SettingsSecurityController extends State<SettingsSecurity> {
|
|||||||
);
|
);
|
||||||
if (success.error == null) {
|
if (success.error == null) {
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
SnackBar(content: Text(L10n.of(context)!.passwordHasBeenChanged)));
|
SnackBar(content: Text(L10n.of(context)!.passwordHasBeenChanged)),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -151,7 +152,8 @@ class SettingsSecurityController extends State<SettingsSecurity> {
|
|||||||
auth: AuthenticationPassword(
|
auth: AuthenticationPassword(
|
||||||
password: input.single,
|
password: input.single,
|
||||||
identifier: AuthenticationUserIdentifier(
|
identifier: AuthenticationUserIdentifier(
|
||||||
user: Matrix.of(context).client.userID!),
|
user: Matrix.of(context).client.userID!,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@ -184,7 +186,8 @@ class SettingsSecurityController extends State<SettingsSecurity> {
|
|||||||
Uint8List.fromList(const Utf8Codec().encode(export!)),
|
Uint8List.fromList(const Utf8Codec().encode(export!)),
|
||||||
path:
|
path:
|
||||||
'/fluffychat-export-${DateFormat(DateFormat.YEAR_MONTH_DAY).format(DateTime.now())}.fluffybackup',
|
'/fluffychat-export-${DateFormat(DateFormat.YEAR_MONTH_DAY).format(DateTime.now())}.fluffybackup',
|
||||||
fileExtension: 'fluffybackup');
|
fileExtension: 'fluffybackup',
|
||||||
|
);
|
||||||
await filePickerCross.exportToStorage(
|
await filePickerCross.exportToStorage(
|
||||||
subject: L10n.of(context)!.dehydrateShare,
|
subject: L10n.of(context)!.dehydrateShare,
|
||||||
);
|
);
|
||||||
|
@ -39,7 +39,8 @@ class SettingsStoriesController extends State<SettingsStories> {
|
|||||||
setState(() {
|
setState(() {
|
||||||
users[user] = false;
|
users[user] = false;
|
||||||
});
|
});
|
||||||
});
|
},
|
||||||
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -54,7 +55,8 @@ class SettingsStoriesController extends State<SettingsStories> {
|
|||||||
setState(() {
|
setState(() {
|
||||||
users[user] = true;
|
users[user] = true;
|
||||||
});
|
});
|
||||||
});
|
},
|
||||||
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,7 +40,8 @@ class SettingsStoriesView extends StatelessWidget {
|
|||||||
return const Center(
|
return const Center(
|
||||||
child: CircularProgressIndicator.adaptive(
|
child: CircularProgressIndicator.adaptive(
|
||||||
strokeWidth: 2,
|
strokeWidth: 2,
|
||||||
));
|
),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
return ListView.builder(
|
return ListView.builder(
|
||||||
itemCount: controller.users.length,
|
itemCount: controller.users.length,
|
||||||
|
@ -67,8 +67,10 @@ class SettingsStyleView extends StatelessWidget {
|
|||||||
Icons.check,
|
Icons.check,
|
||||||
size: 16,
|
size: 16,
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
))
|
),
|
||||||
: null),
|
)
|
||||||
|
: null,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -118,7 +120,8 @@ class SettingsStyleView extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
onTap: controller.deleteWallpaperAction,
|
onTap: controller.deleteWallpaperAction,
|
||||||
),
|
),
|
||||||
Builder(builder: (context) {
|
Builder(
|
||||||
|
builder: (context) {
|
||||||
return ListTile(
|
return ListTile(
|
||||||
title: Text(L10n.of(context)!.changeWallpaper),
|
title: Text(L10n.of(context)!.changeWallpaper),
|
||||||
trailing: Icon(
|
trailing: Icon(
|
||||||
@ -127,7 +130,8 @@ class SettingsStyleView extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
onTap: controller.setWallpaperAction,
|
onTap: controller.setWallpaperAction,
|
||||||
);
|
);
|
||||||
}),
|
},
|
||||||
|
),
|
||||||
const Divider(height: 1),
|
const Divider(height: 1),
|
||||||
ListTile(
|
ListTile(
|
||||||
title: Text(
|
title: Text(
|
||||||
|
@ -46,10 +46,11 @@ class StoryPageController extends State<StoryPage> {
|
|||||||
Timeline? timeline;
|
Timeline? timeline;
|
||||||
|
|
||||||
Event? get currentEvent => index < events.length ? events[index] : null;
|
Event? get currentEvent => index < events.length ? events[index] : null;
|
||||||
StoryThemeData get storyThemeData =>
|
StoryThemeData get storyThemeData => StoryThemeData.fromJson(
|
||||||
StoryThemeData.fromJson(currentEvent?.content
|
currentEvent?.content
|
||||||
.tryGetMap<String, dynamic>(StoryThemeData.contentKey) ??
|
.tryGetMap<String, dynamic>(StoryThemeData.contentKey) ??
|
||||||
{});
|
{},
|
||||||
|
);
|
||||||
|
|
||||||
bool replyLoading = false;
|
bool replyLoading = false;
|
||||||
bool _modalOpened = false;
|
bool _modalOpened = false;
|
||||||
@ -84,7 +85,8 @@ class StoryPageController extends State<StoryPage> {
|
|||||||
final roomId = await client.startDirectChat(currentEvent.senderId);
|
final roomId = await client.startDirectChat(currentEvent.senderId);
|
||||||
var replyText = L10n.of(context)!.storyFrom(
|
var replyText = L10n.of(context)!.storyFrom(
|
||||||
currentEvent.originServerTs.localizedTime(context),
|
currentEvent.originServerTs.localizedTime(context),
|
||||||
currentEvent.content.tryGet<String>('body') ?? '');
|
currentEvent.content.tryGet<String>('body') ?? '',
|
||||||
|
);
|
||||||
replyText = replyText.split('\n').map((line) => '> $line').join('\n');
|
replyText = replyText.split('\n').map((line) => '> $line').join('\n');
|
||||||
message = '$replyText\n\n$message';
|
message = '$replyText\n\n$message';
|
||||||
await client.getRoomById(roomId)!.sendTextEvent(message);
|
await client.getRoomById(roomId)!.sendTextEvent(message);
|
||||||
@ -325,7 +327,8 @@ class StoryPageController extends State<StoryPage> {
|
|||||||
key: 0,
|
key: 0,
|
||||||
label: L10n.of(context)!.inoffensive,
|
label: L10n.of(context)!.inoffensive,
|
||||||
),
|
),
|
||||||
]);
|
],
|
||||||
|
);
|
||||||
if (score == null) return;
|
if (score == null) return;
|
||||||
final reason = await showTextInputDialog(
|
final reason = await showTextInputDialog(
|
||||||
useRootNavigator: false,
|
useRootNavigator: false,
|
||||||
@ -333,7 +336,8 @@ class StoryPageController extends State<StoryPage> {
|
|||||||
title: L10n.of(context)!.whyDoYouWantToReportThis,
|
title: L10n.of(context)!.whyDoYouWantToReportThis,
|
||||||
okLabel: L10n.of(context)!.ok,
|
okLabel: L10n.of(context)!.ok,
|
||||||
cancelLabel: L10n.of(context)!.cancel,
|
cancelLabel: L10n.of(context)!.cancel,
|
||||||
textFields: [DialogTextField(hintText: L10n.of(context)!.reason)]);
|
textFields: [DialogTextField(hintText: L10n.of(context)!.reason)],
|
||||||
|
);
|
||||||
if (reason == null || reason.single.isEmpty) return;
|
if (reason == null || reason.single.isEmpty) return;
|
||||||
final result = await showFutureLoadingDialog(
|
final result = await showFutureLoadingDialog(
|
||||||
context: context,
|
context: context,
|
||||||
@ -352,7 +356,9 @@ class StoryPageController extends State<StoryPage> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<MatrixFile> downloadAndDecryptAttachment(
|
Future<MatrixFile> downloadAndDecryptAttachment(
|
||||||
Event event, bool getThumbnail) async {
|
Event event,
|
||||||
|
bool getThumbnail,
|
||||||
|
) async {
|
||||||
return _fileCache[event.eventId] ??=
|
return _fileCache[event.eventId] ??=
|
||||||
event.downloadAndDecryptAttachment(getThumbnail: getThumbnail);
|
event.downloadAndDecryptAttachment(getThumbnail: getThumbnail);
|
||||||
}
|
}
|
||||||
@ -400,10 +406,12 @@ class StoryPageController extends State<StoryPage> {
|
|||||||
final timeline = this.timeline = await room.getTimeline();
|
final timeline = this.timeline = await room.getTimeline();
|
||||||
timeline.requestKeys();
|
timeline.requestKeys();
|
||||||
var events = timeline.events
|
var events = timeline.events
|
||||||
.where((e) =>
|
.where(
|
||||||
|
(e) =>
|
||||||
e.type == EventTypes.Message &&
|
e.type == EventTypes.Message &&
|
||||||
!e.redacted &&
|
!e.redacted &&
|
||||||
e.status == EventStatus.synced)
|
e.status == EventStatus.synced,
|
||||||
|
)
|
||||||
.toList();
|
.toList();
|
||||||
|
|
||||||
final hasOutdatedEvents = events.removeOutdatedEvents();
|
final hasOutdatedEvents = events.removeOutdatedEvents();
|
||||||
@ -432,12 +440,16 @@ class StoryPageController extends State<StoryPage> {
|
|||||||
|
|
||||||
// Preload images and videos
|
// Preload images and videos
|
||||||
events
|
events
|
||||||
.where((event) => {MessageTypes.Image, MessageTypes.Video}
|
.where(
|
||||||
.contains(event.messageType))
|
(event) => {MessageTypes.Image, MessageTypes.Video}
|
||||||
.forEach((event) => downloadAndDecryptAttachment(
|
.contains(event.messageType),
|
||||||
|
)
|
||||||
|
.forEach(
|
||||||
|
(event) => downloadAndDecryptAttachment(
|
||||||
event,
|
event,
|
||||||
event.messageType == MessageTypes.Video &&
|
event.messageType == MessageTypes.Video && PlatformInfos.isMobile,
|
||||||
PlatformInfos.isMobile));
|
),
|
||||||
|
);
|
||||||
|
|
||||||
// Reverse list
|
// Reverse list
|
||||||
this.events.clear();
|
this.events.clear();
|
||||||
@ -502,9 +514,11 @@ class StoryPageController extends State<StoryPage> {
|
|||||||
|
|
||||||
extension on List<Event> {
|
extension on List<Event> {
|
||||||
bool removeOutdatedEvents() {
|
bool removeOutdatedEvents() {
|
||||||
final outdatedIndex = indexWhere((event) =>
|
final outdatedIndex = indexWhere(
|
||||||
|
(event) =>
|
||||||
DateTime.now().difference(event.originServerTs).inHours >
|
DateTime.now().difference(event.originServerTs).inHours >
|
||||||
ClientStoriesExtension.lifeTimeInHours);
|
ClientStoriesExtension.lifeTimeInHours,
|
||||||
|
);
|
||||||
if (outdatedIndex != -1) {
|
if (outdatedIndex != -1) {
|
||||||
removeRange(outdatedIndex, length);
|
removeRange(outdatedIndex, length);
|
||||||
return true;
|
return true;
|
||||||
|
@ -146,7 +146,8 @@ class StoryView extends StatelessWidget {
|
|||||||
return const Center(
|
return const Center(
|
||||||
child: CircularProgressIndicator.adaptive(
|
child: CircularProgressIndicator.adaptive(
|
||||||
strokeWidth: 2,
|
strokeWidth: 2,
|
||||||
));
|
),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
if (events.isEmpty) {
|
if (events.isEmpty) {
|
||||||
return Center(
|
return Center(
|
||||||
@ -218,7 +219,9 @@ class StoryView extends StatelessWidget {
|
|||||||
!PlatformInfos.isMobile))
|
!PlatformInfos.isMobile))
|
||||||
FutureBuilder<MatrixFile>(
|
FutureBuilder<MatrixFile>(
|
||||||
future: controller.downloadAndDecryptAttachment(
|
future: controller.downloadAndDecryptAttachment(
|
||||||
event, event.messageType == MessageTypes.Video),
|
event,
|
||||||
|
event.messageType == MessageTypes.Video,
|
||||||
|
),
|
||||||
builder: (context, snapshot) {
|
builder: (context, snapshot) {
|
||||||
final matrixFile = snapshot.data;
|
final matrixFile = snapshot.data;
|
||||||
if (matrixFile == null) {
|
if (matrixFile == null) {
|
||||||
@ -364,7 +367,8 @@ class StoryView extends StatelessWidget {
|
|||||||
height: 16,
|
height: 16,
|
||||||
child: Center(
|
child: Center(
|
||||||
child: CircularProgressIndicator.adaptive(
|
child: CircularProgressIndicator.adaptive(
|
||||||
strokeWidth: 2),
|
strokeWidth: 2,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
: IconButton(
|
: IconButton(
|
||||||
|
@ -70,7 +70,8 @@ class UserBottomSheetController extends State<UserBottomSheet> {
|
|||||||
key: 0,
|
key: 0,
|
||||||
label: L10n.of(context)!.inoffensive,
|
label: L10n.of(context)!.inoffensive,
|
||||||
),
|
),
|
||||||
]);
|
],
|
||||||
|
);
|
||||||
if (score == null) return;
|
if (score == null) return;
|
||||||
final reason = await showTextInputDialog(
|
final reason = await showTextInputDialog(
|
||||||
useRootNavigator: false,
|
useRootNavigator: false,
|
||||||
@ -78,7 +79,8 @@ class UserBottomSheetController extends State<UserBottomSheet> {
|
|||||||
title: L10n.of(context)!.whyDoYouWantToReportThis,
|
title: L10n.of(context)!.whyDoYouWantToReportThis,
|
||||||
okLabel: L10n.of(context)!.ok,
|
okLabel: L10n.of(context)!.ok,
|
||||||
cancelLabel: L10n.of(context)!.cancel,
|
cancelLabel: L10n.of(context)!.cancel,
|
||||||
textFields: [DialogTextField(hintText: L10n.of(context)!.reason)]);
|
textFields: [DialogTextField(hintText: L10n.of(context)!.reason)],
|
||||||
|
);
|
||||||
if (reason == null || reason.single.isEmpty) return;
|
if (reason == null || reason.single.isEmpty) return;
|
||||||
final result = await showFutureLoadingDialog(
|
final result = await showFutureLoadingDialog(
|
||||||
context: context,
|
context: context,
|
||||||
@ -91,7 +93,8 @@ class UserBottomSheetController extends State<UserBottomSheet> {
|
|||||||
);
|
);
|
||||||
if (result.error != null) return;
|
if (result.error != null) return;
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
SnackBar(content: Text(L10n.of(context)!.contentHasBeenReported)));
|
SnackBar(content: Text(L10n.of(context)!.contentHasBeenReported)),
|
||||||
|
);
|
||||||
break;
|
break;
|
||||||
case UserBottomSheetAction.mention:
|
case UserBottomSheetAction.mention:
|
||||||
Navigator.of(context, rootNavigator: false).pop();
|
Navigator.of(context, rootNavigator: false).pop();
|
||||||
@ -152,8 +155,8 @@ class UserBottomSheetController extends State<UserBottomSheet> {
|
|||||||
if (await askConfirmation()) {
|
if (await askConfirmation()) {
|
||||||
await showFutureLoadingDialog(
|
await showFutureLoadingDialog(
|
||||||
context: context,
|
context: context,
|
||||||
future: () =>
|
future: () => Matrix.of(context).client.ignoreUser(widget.user.id),
|
||||||
Matrix.of(context).client.ignoreUser(widget.user.id));
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -55,10 +55,12 @@ extension AccountBundlesExtension on Client {
|
|||||||
}
|
}
|
||||||
ret ??= [];
|
ret ??= [];
|
||||||
if (ret.isEmpty) {
|
if (ret.isEmpty) {
|
||||||
ret.add(AccountBundle(
|
ret.add(
|
||||||
|
AccountBundle(
|
||||||
name: userID,
|
name: userID,
|
||||||
priority: 0,
|
priority: 0,
|
||||||
));
|
),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -78,7 +78,8 @@ class BackgroundPush {
|
|||||||
firebase?.setListeners(
|
firebase?.setListeners(
|
||||||
onMessage: (message) => pushHelper(
|
onMessage: (message) => pushHelper(
|
||||||
PushNotification.fromJson(
|
PushNotification.fromJson(
|
||||||
Map<String, dynamic>.from(message['data'] ?? message)),
|
Map<String, dynamic>.from(message['data'] ?? message),
|
||||||
|
),
|
||||||
client: client,
|
client: client,
|
||||||
l10n: l10n,
|
l10n: l10n,
|
||||||
activeRoomId: router?.currentState?.pathParameters['roomid'],
|
activeRoomId: router?.currentState?.pathParameters['roomid'],
|
||||||
@ -331,7 +332,8 @@ class BackgroundPush {
|
|||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
Logs().i(
|
Logs().i(
|
||||||
'[Push] No self-hosted unified push gateway present: $newEndpoint');
|
'[Push] No self-hosted unified push gateway present: $newEndpoint',
|
||||||
|
);
|
||||||
}
|
}
|
||||||
Logs().i('[Push] UnifiedPush using endpoint $endpoint');
|
Logs().i('[Push] UnifiedPush using endpoint $endpoint');
|
||||||
final oldTokens = <String?>{};
|
final oldTokens = <String?>{};
|
||||||
@ -366,7 +368,8 @@ class BackgroundPush {
|
|||||||
Future<void> _onUpMessage(Uint8List message, String i) async {
|
Future<void> _onUpMessage(Uint8List message, String i) async {
|
||||||
upAction = true;
|
upAction = true;
|
||||||
final data = Map<String, dynamic>.from(
|
final data = Map<String, dynamic>.from(
|
||||||
json.decode(utf8.decode(message))['notification']);
|
json.decode(utf8.decode(message))['notification'],
|
||||||
|
);
|
||||||
// UP may strip the devices list
|
// UP may strip the devices list
|
||||||
data['devices'] ??= [];
|
data['devices'] ??= [];
|
||||||
await pushHelper(
|
await pushHelper(
|
||||||
@ -382,8 +385,11 @@ class BackgroundPush {
|
|||||||
/// IDs we map the [roomId] to a number and store this number.
|
/// IDs we map the [roomId] to a number and store this number.
|
||||||
late Map<String, int> idMap;
|
late Map<String, int> idMap;
|
||||||
Future<void> _loadIdMap() async {
|
Future<void> _loadIdMap() async {
|
||||||
idMap = Map<String, int>.from(json.decode(
|
idMap = Map<String, int>.from(
|
||||||
(await store.getItem(SettingKeys.notificationCurrentIds)) ?? '{}'));
|
json.decode(
|
||||||
|
(await store.getItem(SettingKeys.notificationCurrentIds)) ?? '{}',
|
||||||
|
),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<int> mapRoomIdToInt(String roomId) async {
|
Future<int> mapRoomIdToInt(String roomId) async {
|
||||||
@ -441,7 +447,8 @@ class BackgroundPush {
|
|||||||
if (syncErrored) {
|
if (syncErrored) {
|
||||||
try {
|
try {
|
||||||
Logs().v(
|
Logs().v(
|
||||||
'[Push] failed to sync for fallback push, fetching notifications endpoint...');
|
'[Push] failed to sync for fallback push, fetching notifications endpoint...',
|
||||||
|
);
|
||||||
final notifications = await client.getNotifications(limit: 20);
|
final notifications = await client.getNotifications(limit: 20);
|
||||||
final notificationRooms =
|
final notificationRooms =
|
||||||
notifications.notifications.map((n) => n.roomId).toSet();
|
notifications.notifications.map((n) => n.roomId).toSet();
|
||||||
@ -451,7 +458,8 @@ class BackgroundPush {
|
|||||||
} catch (e) {
|
} catch (e) {
|
||||||
Logs().v(
|
Logs().v(
|
||||||
'[Push] failed to fetch pending notifications for clearing push, falling back...',
|
'[Push] failed to fetch pending notifications for clearing push, falling back...',
|
||||||
e);
|
e,
|
||||||
|
);
|
||||||
emptyRooms = client.rooms
|
emptyRooms = client.rooms
|
||||||
.where((r) => r.notificationCount == 0)
|
.where((r) => r.notificationCount == 0)
|
||||||
.map((r) => r.id);
|
.map((r) => r.id);
|
||||||
@ -474,7 +482,9 @@ class BackgroundPush {
|
|||||||
}
|
}
|
||||||
if (changed) {
|
if (changed) {
|
||||||
await store.setItem(
|
await store.setItem(
|
||||||
SettingKeys.notificationCurrentIds, json.encode(idMap));
|
SettingKeys.notificationCurrentIds,
|
||||||
|
json.encode(idMap),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
_clearingPushLock = false;
|
_clearingPushLock = false;
|
||||||
|
@ -39,19 +39,25 @@ abstract class ClientManager {
|
|||||||
}
|
}
|
||||||
final clients = clientNames.map(createClient).toList();
|
final clients = clientNames.map(createClient).toList();
|
||||||
if (initialize) {
|
if (initialize) {
|
||||||
await Future.wait(clients.map((client) => client
|
await Future.wait(
|
||||||
|
clients.map(
|
||||||
|
(client) => client
|
||||||
.init(
|
.init(
|
||||||
waitForFirstSync: false,
|
waitForFirstSync: false,
|
||||||
waitUntilLoadCompletedLoaded: false,
|
waitUntilLoadCompletedLoaded: false,
|
||||||
)
|
)
|
||||||
.catchError(
|
.catchError(
|
||||||
(e, s) => Logs().e('Unable to initialize client', e, s))));
|
(e, s) => Logs().e('Unable to initialize client', e, s),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
if (clients.length > 1 && clients.any((c) => !c.isLogged())) {
|
if (clients.length > 1 && clients.any((c) => !c.isLogged())) {
|
||||||
final loggedOutClients = clients.where((c) => !c.isLogged()).toList();
|
final loggedOutClients = clients.where((c) => !c.isLogged()).toList();
|
||||||
for (final client in loggedOutClients) {
|
for (final client in loggedOutClients) {
|
||||||
Logs().w(
|
Logs().w(
|
||||||
'Multi account is enabled but client ${client.userID} is not logged in. Removing...');
|
'Multi account is enabled but client ${client.userID} is not logged in. Removing...',
|
||||||
|
);
|
||||||
clientNames.remove(client.clientName);
|
clientNames.remove(client.clientName);
|
||||||
clients.remove(client);
|
clients.remove(client);
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,8 @@ import 'package:matrix/matrix.dart';
|
|||||||
import 'package:native_imaging/native_imaging.dart' as native;
|
import 'package:native_imaging/native_imaging.dart' as native;
|
||||||
|
|
||||||
Future<MatrixImageFileResizedResponse?> customImageResizer(
|
Future<MatrixImageFileResizedResponse?> customImageResizer(
|
||||||
MatrixImageFileResizeArguments arguments) async {
|
MatrixImageFileResizeArguments arguments,
|
||||||
|
) async {
|
||||||
await native.init();
|
await native.init();
|
||||||
late native.Image nativeImg;
|
late native.Image nativeImg;
|
||||||
|
|
||||||
@ -21,7 +22,10 @@ Future<MatrixImageFileResizedResponse?> customImageResizer(
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
final rgba = Uint8List.view(
|
final rgba = Uint8List.view(
|
||||||
rgbaData.buffer, rgbaData.offsetInBytes, rgbaData.lengthInBytes);
|
rgbaData.buffer,
|
||||||
|
rgbaData.offsetInBytes,
|
||||||
|
rgbaData.lengthInBytes,
|
||||||
|
);
|
||||||
|
|
||||||
final width = dartFrame.image.width;
|
final width = dartFrame.image.width;
|
||||||
final height = dartFrame.image.height;
|
final height = dartFrame.image.height;
|
||||||
|
@ -77,10 +77,15 @@ extension DateTimeExtension on DateTime {
|
|||||||
}
|
}
|
||||||
} else if (sameYear) {
|
} else if (sameYear) {
|
||||||
return L10n.of(context)!.dateWithoutYear(
|
return L10n.of(context)!.dateWithoutYear(
|
||||||
month.toString().padLeft(2, '0'), day.toString().padLeft(2, '0'));
|
month.toString().padLeft(2, '0'),
|
||||||
|
day.toString().padLeft(2, '0'),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
return L10n.of(context)!.dateWithYear(year.toString(),
|
return L10n.of(context)!.dateWithYear(
|
||||||
month.toString().padLeft(2, '0'), day.toString().padLeft(2, '0'));
|
year.toString(),
|
||||||
|
month.toString().padLeft(2, '0'),
|
||||||
|
day.toString().padLeft(2, '0'),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// If the DateTime is today, this returns [localizedTimeOfDay()], if not it also
|
/// If the DateTime is today, this returns [localizedTimeOfDay()], if not it also
|
||||||
@ -95,7 +100,9 @@ extension DateTimeExtension on DateTime {
|
|||||||
|
|
||||||
if (sameDay) return localizedTimeOfDay(context);
|
if (sameDay) return localizedTimeOfDay(context);
|
||||||
return L10n.of(context)!.dateAndTimeOfDay(
|
return L10n.of(context)!.dateAndTimeOfDay(
|
||||||
localizedTimeShort(context), localizedTimeOfDay(context));
|
localizedTimeShort(context),
|
||||||
|
localizedTimeOfDay(context),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
static String _z(int i) => i < 10 ? '0${i.toString()}' : i.toString();
|
static String _z(int i) => i < 10 ? '0${i.toString()}' : i.toString();
|
||||||
|
@ -19,7 +19,8 @@ abstract class FluffyShare {
|
|||||||
ClipboardData(text: text),
|
ClipboardData(text: text),
|
||||||
);
|
);
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
SnackBar(content: Text(L10n.of(context)!.copiedToClipboard)));
|
SnackBar(content: Text(L10n.of(context)!.copiedToClipboard)),
|
||||||
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,8 +15,10 @@ extension ClientStoriesExtension on Client {
|
|||||||
|
|
||||||
List<User> get contacts => rooms
|
List<User> get contacts => rooms
|
||||||
.where((room) => room.isDirectChat)
|
.where((room) => room.isDirectChat)
|
||||||
.map((room) =>
|
.map(
|
||||||
room.unsafeGetUserFromMemoryOrFallback(room.directChatMatrixID!))
|
(room) =>
|
||||||
|
room.unsafeGetUserFromMemoryOrFallback(room.directChatMatrixID!),
|
||||||
|
)
|
||||||
.toList();
|
.toList();
|
||||||
|
|
||||||
List<Room> get storiesRooms =>
|
List<Room> get storiesRooms =>
|
||||||
@ -78,10 +80,15 @@ extension ClientStoriesExtension on Client {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<Room?> getStoriesRoom(BuildContext context) async {
|
Future<Room?> getStoriesRoom(BuildContext context) async {
|
||||||
final candidates = rooms.where((room) =>
|
final candidates = rooms.where(
|
||||||
room.getState(EventTypes.RoomCreate)?.content.tryGet<String>('type') ==
|
(room) =>
|
||||||
|
room
|
||||||
|
.getState(EventTypes.RoomCreate)
|
||||||
|
?.content
|
||||||
|
.tryGet<String>('type') ==
|
||||||
storiesRoomType &&
|
storiesRoomType &&
|
||||||
room.ownPowerLevel >= 100);
|
room.ownPowerLevel >= 100,
|
||||||
|
);
|
||||||
if (candidates.isEmpty) return null;
|
if (candidates.isEmpty) return null;
|
||||||
if (candidates.length == 1) return candidates.single;
|
if (candidates.length == 1) return candidates.single;
|
||||||
return await showModalActionSheet<Room>(
|
return await showModalActionSheet<Room>(
|
||||||
@ -92,9 +99,11 @@ extension ClientStoriesExtension on Client {
|
|||||||
label: room.getLocalizedDisplayname(
|
label: room.getLocalizedDisplayname(
|
||||||
MatrixLocals(L10n.of(context)!),
|
MatrixLocals(L10n.of(context)!),
|
||||||
),
|
),
|
||||||
key: room),
|
key: room,
|
||||||
|
),
|
||||||
)
|
)
|
||||||
.toList());
|
.toList(),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,7 +23,8 @@ class FlutterHiveCollectionsDatabase extends HiveCollectionsDatabase {
|
|||||||
static const String _cipherStorageKey = 'hive_encryption_key';
|
static const String _cipherStorageKey = 'hive_encryption_key';
|
||||||
|
|
||||||
static Future<FlutterHiveCollectionsDatabase> databaseBuilder(
|
static Future<FlutterHiveCollectionsDatabase> databaseBuilder(
|
||||||
Client client) async {
|
Client client,
|
||||||
|
) async {
|
||||||
Logs().d('Open Hive...');
|
Logs().d('Open Hive...');
|
||||||
HiveAesCipher? hiverCipher;
|
HiveAesCipher? hiverCipher;
|
||||||
try {
|
try {
|
||||||
@ -96,9 +97,9 @@ class FlutterHiveCollectionsDatabase extends HiveCollectionsDatabase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// do not destroy your stable FluffyChat in debug mode
|
// do not destroy your stable FluffyChat in debug mode
|
||||||
directory = Directory(directory.uri
|
directory = Directory(
|
||||||
.resolve(kDebugMode ? 'hive_debug' : 'hive')
|
directory.uri.resolve(kDebugMode ? 'hive_debug' : 'hive').toFilePath(),
|
||||||
.toFilePath());
|
);
|
||||||
directory.create(recursive: true);
|
directory.create(recursive: true);
|
||||||
path = directory.path;
|
path = directory.path;
|
||||||
}
|
}
|
||||||
|
@ -8,8 +8,9 @@ extension IosBadgeClientExtension on Client {
|
|||||||
void updateIosBadge() {
|
void updateIosBadge() {
|
||||||
if (PlatformInfos.isIOS) {
|
if (PlatformInfos.isIOS) {
|
||||||
// Workaround for iOS not clearing notifications with fcm_shared_isolate
|
// Workaround for iOS not clearing notifications with fcm_shared_isolate
|
||||||
if (!rooms.any((r) =>
|
if (!rooms.any(
|
||||||
r.membership == Membership.invite || (r.notificationCount > 0))) {
|
(r) => r.membership == Membership.invite || (r.notificationCount > 0),
|
||||||
|
)) {
|
||||||
// ignore: unawaited_futures
|
// ignore: unawaited_futures
|
||||||
FlutterLocalNotificationsPlugin().cancelAll();
|
FlutterLocalNotificationsPlugin().cancelAll();
|
||||||
FlutterAppBadger.removeBadge();
|
FlutterAppBadger.removeBadge();
|
||||||
|
@ -62,7 +62,9 @@ class MatrixLocals extends MatrixLocalizations {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
String changedTheGuestAccessRulesTo(
|
String changedTheGuestAccessRulesTo(
|
||||||
String senderName, String localizedString) {
|
String senderName,
|
||||||
|
String localizedString,
|
||||||
|
) {
|
||||||
return l10n.changedTheGuestAccessRulesTo(senderName, localizedString);
|
return l10n.changedTheGuestAccessRulesTo(senderName, localizedString);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -73,7 +75,9 @@ class MatrixLocals extends MatrixLocalizations {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
String changedTheHistoryVisibilityTo(
|
String changedTheHistoryVisibilityTo(
|
||||||
String senderName, String localizedString) {
|
String senderName,
|
||||||
|
String localizedString,
|
||||||
|
) {
|
||||||
return l10n.changedTheHistoryVisibilityTo(senderName, localizedString);
|
return l10n.changedTheHistoryVisibilityTo(senderName, localizedString);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -111,7 +111,9 @@ Future<void> _tryPushHelper(
|
|||||||
await flutterLocalNotificationsPlugin.cancelAll();
|
await flutterLocalNotificationsPlugin.cancelAll();
|
||||||
final store = await SharedPreferences.getInstance();
|
final store = await SharedPreferences.getInstance();
|
||||||
await store.setString(
|
await store.setString(
|
||||||
SettingKeys.notificationCurrentIds, json.encode({}));
|
SettingKeys.notificationCurrentIds,
|
||||||
|
json.encode({}),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
@ -237,7 +239,8 @@ Future<void> _tryPushHelper(
|
|||||||
Future<int> mapRoomIdToInt(String roomId) async {
|
Future<int> mapRoomIdToInt(String roomId) async {
|
||||||
final store = await SharedPreferences.getInstance();
|
final store = await SharedPreferences.getInstance();
|
||||||
final idMap = Map<String, int>.from(
|
final idMap = Map<String, int>.from(
|
||||||
jsonDecode(store.getString(SettingKeys.notificationCurrentIds) ?? '{}'));
|
jsonDecode(store.getString(SettingKeys.notificationCurrentIds) ?? '{}'),
|
||||||
|
);
|
||||||
int? currentInt;
|
int? currentInt;
|
||||||
try {
|
try {
|
||||||
currentInt = idMap[roomId];
|
currentInt = idMap[roomId];
|
||||||
|
@ -55,11 +55,13 @@ extension RoomStatusExtension on Room {
|
|||||||
} else if (typingUsers.length == 2) {
|
} else if (typingUsers.length == 2) {
|
||||||
typingText = L10n.of(context)!.userAndUserAreTyping(
|
typingText = L10n.of(context)!.userAndUserAreTyping(
|
||||||
typingUsers.first.calcDisplayname(),
|
typingUsers.first.calcDisplayname(),
|
||||||
typingUsers[1].calcDisplayname());
|
typingUsers[1].calcDisplayname(),
|
||||||
|
);
|
||||||
} else if (typingUsers.length > 2) {
|
} else if (typingUsers.length > 2) {
|
||||||
typingText = L10n.of(context)!.userAndOthersAreTyping(
|
typingText = L10n.of(context)!.userAndOthersAreTyping(
|
||||||
typingUsers.first.calcDisplayname(),
|
typingUsers.first.calcDisplayname(),
|
||||||
(typingUsers.length - 1).toString());
|
(typingUsers.length - 1).toString(),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
return typingText;
|
return typingText;
|
||||||
}
|
}
|
||||||
@ -76,8 +78,10 @@ extension RoomStatusExtension on Room {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
lastReceipts.removeWhere((user) =>
|
lastReceipts.removeWhere(
|
||||||
user.id == client.userID || user.id == timeline.events.first.senderId);
|
(user) =>
|
||||||
|
user.id == client.userID || user.id == timeline.events.first.senderId,
|
||||||
|
);
|
||||||
return lastReceipts.toList();
|
return lastReceipts.toList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -33,9 +33,11 @@ extension StreamExtension on Stream {
|
|||||||
gotMessage = true;
|
gotMessage = true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
final subscription = listen((_) => onMessage?.call(),
|
final subscription = listen(
|
||||||
|
(_) => onMessage?.call(),
|
||||||
onDone: () => controller.close(),
|
onDone: () => controller.close(),
|
||||||
onError: (e, s) => controller.addError(e, s));
|
onError: (e, s) => controller.addError(e, s),
|
||||||
|
);
|
||||||
// add proper cleanup to the subscription and the controller, to not memory leak
|
// add proper cleanup to the subscription and the controller, to not memory leak
|
||||||
controller.onCancel = () {
|
controller.onCancel = () {
|
||||||
subscription.cancel();
|
subscription.cancel();
|
||||||
|
@ -82,7 +82,8 @@ extension UiaRequestManager on MatrixState {
|
|||||||
);
|
);
|
||||||
default:
|
default:
|
||||||
final url = Uri.parse(
|
final url = Uri.parse(
|
||||||
'${client.homeserver}/_matrix/client/r0/auth/$stage/fallback/web?session=${uiaRequest.session}');
|
'${client.homeserver}/_matrix/client/r0/auth/$stage/fallback/web?session=${uiaRequest.session}',
|
||||||
|
);
|
||||||
launchUrlString(url.toString());
|
launchUrlString(url.toString());
|
||||||
if (OkCancelResult.ok ==
|
if (OkCancelResult.ok ==
|
||||||
await showOkCancelAlertDialog(
|
await showOkCancelAlertDialog(
|
||||||
|
@ -20,7 +20,8 @@ class UpdateCheckerNoStore {
|
|||||||
static const gitLabHost = 'gitlab.com';
|
static const gitLabHost = 'gitlab.com';
|
||||||
|
|
||||||
static Uri get tagsUri => Uri.parse(
|
static Uri get tagsUri => Uri.parse(
|
||||||
'https://$gitLabHost/projects/$gitLabProjectId/repository/tags');
|
'https://$gitLabHost/projects/$gitLabProjectId/repository/tags',
|
||||||
|
);
|
||||||
|
|
||||||
final BuildContext context;
|
final BuildContext context;
|
||||||
|
|
||||||
|
@ -33,7 +33,8 @@ class UrlLauncher {
|
|||||||
if (uri == null) {
|
if (uri == null) {
|
||||||
// we can't open this thing
|
// we can't open this thing
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
SnackBar(content: Text(L10n.of(context)!.cantOpenUri(url!))));
|
SnackBar(content: Text(L10n.of(context)!.cantOpenUri(url!))),
|
||||||
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!{'https', 'http'}.contains(uri.scheme)) {
|
if (!{'https', 'http'}.contains(uri.scheme)) {
|
||||||
@ -61,7 +62,8 @@ class UrlLauncher {
|
|||||||
// transmute geo URIs on desktop to openstreetmap links, as those usually can't handle
|
// transmute geo URIs on desktop to openstreetmap links, as those usually can't handle
|
||||||
// geo URIs
|
// geo URIs
|
||||||
launchUrlString(
|
launchUrlString(
|
||||||
'https://www.openstreetmap.org/?mlat=${latlong.first}&mlon=${latlong.last}#map=16/${latlong.first}/${latlong.last}');
|
'https://www.openstreetmap.org/?mlat=${latlong.first}&mlon=${latlong.last}#map=16/${latlong.first}/${latlong.last}',
|
||||||
|
);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -71,7 +73,8 @@ class UrlLauncher {
|
|||||||
}
|
}
|
||||||
if (uri.host.isEmpty) {
|
if (uri.host.isEmpty) {
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
SnackBar(content: Text(L10n.of(context)!.cantOpenUri(url!))));
|
SnackBar(content: Text(L10n.of(context)!.cantOpenUri(url!))),
|
||||||
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// okay, we have either an http or an https URI.
|
// okay, we have either an http or an https URI.
|
||||||
@ -86,8 +89,10 @@ class UrlLauncher {
|
|||||||
}).join('.');
|
}).join('.');
|
||||||
// Force LaunchMode.externalApplication, otherwise url_launcher will default
|
// Force LaunchMode.externalApplication, otherwise url_launcher will default
|
||||||
// to opening links in a webview on mobile platforms.
|
// to opening links in a webview on mobile platforms.
|
||||||
launchUrlString(uri.replace(host: newHost).toString(),
|
launchUrlString(
|
||||||
mode: LaunchMode.externalApplication);
|
uri.replace(host: newHost).toString(),
|
||||||
|
mode: LaunchMode.externalApplication,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void openMatrixToUrl() async {
|
void openMatrixToUrl() async {
|
||||||
@ -142,8 +147,10 @@ class UrlLauncher {
|
|||||||
}
|
}
|
||||||
// we have the room, so....just open it
|
// we have the room, so....just open it
|
||||||
if (event != null) {
|
if (event != null) {
|
||||||
VRouter.of(context).toSegments(['rooms', room.id],
|
VRouter.of(context).toSegments(
|
||||||
queryParameters: {'event': event});
|
['rooms', room.id],
|
||||||
|
queryParameters: {'event': event},
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
VRouter.of(context).toSegments(['rooms', room.id]);
|
VRouter.of(context).toSegments(['rooms', room.id]);
|
||||||
}
|
}
|
||||||
@ -176,10 +183,13 @@ class UrlLauncher {
|
|||||||
// wait for two seconds so that it probably came down /sync
|
// wait for two seconds so that it probably came down /sync
|
||||||
await showFutureLoadingDialog(
|
await showFutureLoadingDialog(
|
||||||
context: context,
|
context: context,
|
||||||
future: () => Future.delayed(const Duration(seconds: 2)));
|
future: () => Future.delayed(const Duration(seconds: 2)),
|
||||||
|
);
|
||||||
if (event != null) {
|
if (event != null) {
|
||||||
VRouter.of(context).toSegments(['rooms', response.result!],
|
VRouter.of(context).toSegments(
|
||||||
queryParameters: {'event': event});
|
['rooms', response.result!],
|
||||||
|
queryParameters: {'event': event},
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
VRouter.of(context).toSegments(['rooms', response.result!]);
|
VRouter.of(context).toSegments(['rooms', response.result!]);
|
||||||
}
|
}
|
||||||
|
@ -118,7 +118,8 @@ class CallKeepManager {
|
|||||||
},
|
},
|
||||||
'android': alertOptions,
|
'android': alertOptions,
|
||||||
},
|
},
|
||||||
backgroundMode: true);
|
backgroundMode: true,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
setupDone = true;
|
setupDone = true;
|
||||||
await displayIncomingCall(call);
|
await displayIncomingCall(call);
|
||||||
@ -131,7 +132,8 @@ class CallKeepManager {
|
|||||||
(event) {
|
(event) {
|
||||||
if (event == CallEvent.kLocalHoldUnhold) {
|
if (event == CallEvent.kLocalHoldUnhold) {
|
||||||
Logs().i(
|
Logs().i(
|
||||||
'Call hold event: local ${call.localHold}, remote ${call.remoteOnHold}');
|
'Call hold event: local ${call.localHold}, remote ${call.remoteOnHold}',
|
||||||
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
@ -169,10 +171,14 @@ class CallKeepManager {
|
|||||||
_callKeep.on(CallKeepPerformAnswerCallAction(), answerCall);
|
_callKeep.on(CallKeepPerformAnswerCallAction(), answerCall);
|
||||||
_callKeep.on(CallKeepDidPerformDTMFAction(), didPerformDTMFAction);
|
_callKeep.on(CallKeepDidPerformDTMFAction(), didPerformDTMFAction);
|
||||||
_callKeep.on(
|
_callKeep.on(
|
||||||
CallKeepDidReceiveStartCallAction(), didReceiveStartCallAction);
|
CallKeepDidReceiveStartCallAction(),
|
||||||
|
didReceiveStartCallAction,
|
||||||
|
);
|
||||||
_callKeep.on(CallKeepDidToggleHoldAction(), didToggleHoldCallAction);
|
_callKeep.on(CallKeepDidToggleHoldAction(), didToggleHoldCallAction);
|
||||||
_callKeep.on(
|
_callKeep.on(
|
||||||
CallKeepDidPerformSetMutedCallAction(), didPerformSetMutedCallAction);
|
CallKeepDidPerformSetMutedCallAction(),
|
||||||
|
didPerformSetMutedCallAction,
|
||||||
|
);
|
||||||
_callKeep.on(CallKeepPerformEndCallAction(), endCall);
|
_callKeep.on(CallKeepPerformEndCallAction(), endCall);
|
||||||
_callKeep.on(CallKeepPushKitToken(), onPushKitToken);
|
_callKeep.on(CallKeepPushKitToken(), onPushKitToken);
|
||||||
_callKeep.on(CallKeepDidDisplayIncomingCall(), didDisplayIncomingCall);
|
_callKeep.on(CallKeepDidDisplayIncomingCall(), didDisplayIncomingCall);
|
||||||
@ -209,11 +215,17 @@ class CallKeepManager {
|
|||||||
Future<void> updateDisplay(String callUUID) async {
|
Future<void> updateDisplay(String callUUID) async {
|
||||||
// Workaround because Android doesn't display well displayName, se we have to switch ...
|
// Workaround because Android doesn't display well displayName, se we have to switch ...
|
||||||
if (isIOS) {
|
if (isIOS) {
|
||||||
await _callKeep.updateDisplay(callUUID,
|
await _callKeep.updateDisplay(
|
||||||
displayName: 'New Name', handle: callUUID);
|
callUUID,
|
||||||
|
displayName: 'New Name',
|
||||||
|
handle: callUUID,
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
await _callKeep.updateDisplay(callUUID,
|
await _callKeep.updateDisplay(
|
||||||
displayName: callUUID, handle: 'New Name');
|
callUUID,
|
||||||
|
displayName: callUUID,
|
||||||
|
handle: 'New Name',
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -250,7 +262,8 @@ class CallKeepManager {
|
|||||||
const Divider(),
|
const Divider(),
|
||||||
ListTile(
|
ListTile(
|
||||||
onTap: () => FlutterForegroundTask.openSystemAlertWindowSettings(
|
onTap: () => FlutterForegroundTask.openSystemAlertWindowSettings(
|
||||||
forceOpen: true),
|
forceOpen: true,
|
||||||
|
),
|
||||||
title: Text(L10n.of(context)!.appearOnTop),
|
title: Text(L10n.of(context)!.appearOnTop),
|
||||||
subtitle: Text(L10n.of(context)!.appearOnTopDetails),
|
subtitle: Text(L10n.of(context)!.appearOnTopDetails),
|
||||||
trailing: const Icon(Icons.file_upload_rounded),
|
trailing: const Icon(Icons.file_upload_rounded),
|
||||||
@ -310,7 +323,8 @@ class CallKeepManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<void> didReceiveStartCallAction(
|
Future<void> didReceiveStartCallAction(
|
||||||
CallKeepDidReceiveStartCallAction event) async {
|
CallKeepDidReceiveStartCallAction event,
|
||||||
|
) async {
|
||||||
if (event.handle == null) {
|
if (event.handle == null) {
|
||||||
// @TODO: sometime we receive `didReceiveStartCallAction` with handle` undefined`
|
// @TODO: sometime we receive `didReceiveStartCallAction` with handle` undefined`
|
||||||
return;
|
return;
|
||||||
@ -328,7 +342,8 @@ class CallKeepManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<void> didPerformSetMutedCallAction(
|
Future<void> didPerformSetMutedCallAction(
|
||||||
CallKeepDidPerformSetMutedCallAction event) async {
|
CallKeepDidPerformSetMutedCallAction event,
|
||||||
|
) async {
|
||||||
final keeper = calls[event.callUUID];
|
final keeper = calls[event.callUUID];
|
||||||
if (event.muted!) {
|
if (event.muted!) {
|
||||||
keeper!.call.setMicrophoneMuted(true);
|
keeper!.call.setMicrophoneMuted(true);
|
||||||
@ -339,7 +354,8 @@ class CallKeepManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<void> didToggleHoldCallAction(
|
Future<void> didToggleHoldCallAction(
|
||||||
CallKeepDidToggleHoldAction event) async {
|
CallKeepDidToggleHoldAction event,
|
||||||
|
) async {
|
||||||
final keeper = calls[event.callUUID];
|
final keeper = calls[event.callUUID];
|
||||||
if (event.hold!) {
|
if (event.hold!) {
|
||||||
keeper!.call.setRemoteOnHold(true);
|
keeper!.call.setRemoteOnHold(true);
|
||||||
|
@ -89,7 +89,8 @@ class VoipPlugin with WidgetsBindingObserver implements WebRTCDelegate {
|
|||||||
onClear: () {
|
onClear: () {
|
||||||
overlayEntry?.remove();
|
overlayEntry?.remove();
|
||||||
overlayEntry = null;
|
overlayEntry = null;
|
||||||
}),
|
},
|
||||||
|
),
|
||||||
);
|
);
|
||||||
Overlay.of(context).insert(overlayEntry!);
|
Overlay.of(context).insert(overlayEntry!);
|
||||||
}
|
}
|
||||||
@ -103,8 +104,9 @@ class VoipPlugin with WidgetsBindingObserver implements WebRTCDelegate {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Future<RTCPeerConnection> createPeerConnection(
|
Future<RTCPeerConnection> createPeerConnection(
|
||||||
Map<String, dynamic> configuration,
|
Map<String, dynamic> configuration, [
|
||||||
[Map<String, dynamic> constraints = const {}]) =>
|
Map<String, dynamic> constraints = const {},
|
||||||
|
]) =>
|
||||||
webrtc_impl.createPeerConnection(configuration, constraints);
|
webrtc_impl.createPeerConnection(configuration, constraints);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -150,7 +152,9 @@ class VoipPlugin with WidgetsBindingObserver implements WebRTCDelegate {
|
|||||||
try {
|
try {
|
||||||
final wasForeground = await FlutterForegroundTask.isAppOnForeground;
|
final wasForeground = await FlutterForegroundTask.isAppOnForeground;
|
||||||
await Store().setItem(
|
await Store().setItem(
|
||||||
'wasForeground', wasForeground == true ? 'true' : 'false');
|
'wasForeground',
|
||||||
|
wasForeground == true ? 'true' : 'false',
|
||||||
|
);
|
||||||
FlutterForegroundTask.setOnLockScreenVisibility(true);
|
FlutterForegroundTask.setOnLockScreenVisibility(true);
|
||||||
FlutterForegroundTask.wakeUpScreen();
|
FlutterForegroundTask.wakeUpScreen();
|
||||||
FlutterForegroundTask.launchApp();
|
FlutterForegroundTask.launchApp();
|
||||||
@ -162,10 +166,13 @@ class VoipPlugin with WidgetsBindingObserver implements WebRTCDelegate {
|
|||||||
try {
|
try {
|
||||||
if (!hasCallingAccount) {
|
if (!hasCallingAccount) {
|
||||||
ScaffoldMessenger.of(FluffyChatApp.routerKey.currentContext!)
|
ScaffoldMessenger.of(FluffyChatApp.routerKey.currentContext!)
|
||||||
.showSnackBar(const SnackBar(
|
.showSnackBar(
|
||||||
|
const SnackBar(
|
||||||
content: Text(
|
content: Text(
|
||||||
'No calling accounts found (used for native calls UI)',
|
'No calling accounts found (used for native calls UI)',
|
||||||
)));
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
Logs().e('failed to show snackbar');
|
Logs().e('failed to show snackbar');
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user