refactor: Remove deprecated jitsi call generator

This commit is contained in:
Christian Pauly 2022-02-16 12:02:01 +01:00
parent ff89fcfc84
commit e023d52bef
13 changed files with 1 additions and 132 deletions

View File

@ -21,7 +21,6 @@ FluffyChat is an open source, nonprofit and cute matrix messenger app. The app i
- Custom themes
- Hides complexity of Matrix IDs behind simple QR codes
- Custom emotes and stickers
- Video calls via sharing links to Jitsi
- Spaces
- Compatible with Element, Nheko, NeoChat and all other Matrix apps
- End to end encryption

View File

@ -2,7 +2,6 @@
"application_name": "FluffyChat",
"application_welcome_message": null,
"default_homeserver": "matrix.org",
"jitsi_instance": "https://meet.jit.si/",
"web_base_url": "https://fluffychat.im/web",
"privacy_url": "https://fluffychat.im/en/privacy.html",
"render_html": false,

View File

@ -9,7 +9,6 @@ abstract class AppConfig {
static String? get applicationWelcomeMessage => _applicationWelcomeMessage;
static String _defaultHomeserver = 'matrix.org';
static String get defaultHomeserver => _defaultHomeserver;
static String jitsiInstance = 'https://meet.jit.si/';
static double bubbleSizeFactor = 1;
static double fontSizeFactor = 1;
static Color chatColor = primaryColor;
@ -77,9 +76,6 @@ abstract class AppConfig {
if (json['default_homeserver'] is String) {
_defaultHomeserver = json['default_homeserver'];
}
if (json['jitsi_instance'] is String) {
jitsiInstance = json['jitsi_instance'];
}
if (json['privacy_url'] is String) {
_webBaseUrl = json['privacy_url'];
}

View File

@ -1,5 +1,4 @@
abstract class SettingKeys {
static const String jitsiInstance = 'chat.fluffy.jitsi_instance';
static const String wallpaper = 'chat.fluffy.wallpaper';
static const String renderHtml = 'chat.fluffy.renderHtml';
static const String hideRedactedEvents = 'chat.fluffy.hideRedactedEvents';

View File

@ -16,10 +16,8 @@ import 'package:image_picker/image_picker.dart';
import 'package:matrix/matrix.dart';
import 'package:record/record.dart';
import 'package:scroll_to_index/scroll_to_index.dart';
import 'package:url_launcher/url_launcher.dart';
import 'package:vrouter/vrouter.dart';
import 'package:fluffychat/config/app_config.dart';
import 'package:fluffychat/pages/chat/chat_view.dart';
import 'package:fluffychat/pages/chat/cupertino_widgets_bottom_sheet.dart';
import 'package:fluffychat/pages/chat/event_info_dialog.dart';
@ -128,20 +126,6 @@ class ChatController extends State<Chat> {
EmojiPickerType emojiPickerType = EmojiPickerType.keyboard;
void startCallAction() async {
final url =
'${AppConfig.jitsiInstance}${Uri.encodeComponent(Matrix.of(context).client.generateUniqueTransactionId())}';
final success = await showFutureLoadingDialog(
context: context,
future: () => room!.sendEvent({
'msgtype': Matrix.callNamespace,
'body': url,
}));
if (success.error != null) return;
await launch(url);
}
void requestHistory() async {
if (canLoadMore) {
try {
@ -878,9 +862,6 @@ class ChatController extends State<Chat> {
if (choice == 'location') {
sendLocationAction();
}
if (choice == 'videocall') {
startCallAction();
}
}
unpinEvent(String eventId) async {

View File

@ -84,18 +84,6 @@ class ChatInputRow extends StatelessWidget {
onSelected: controller.onAddPopupMenuButtonSelected,
itemBuilder: (BuildContext context) =>
<PopupMenuEntry<String>>[
PopupMenuItem<String>(
value: 'videocall',
child: ListTile(
leading: const CircleAvatar(
backgroundColor: Colors.blueGrey,
foregroundColor: Colors.white,
child: Icon(Icons.video_call_outlined),
),
title: Text(L10n.of(context)!.videoCall),
contentPadding: const EdgeInsets.all(0),
),
),
PopupMenuItem<String>(
value: 'file',
child: ListTile(

View File

@ -4,7 +4,6 @@ import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:future_loading_dialog/future_loading_dialog.dart';
import 'package:matrix/matrix.dart';
import 'package:matrix_link_text/link_text.dart';
import 'package:url_launcher/url_launcher.dart';
import 'package:fluffychat/pages/chat/events/video_player.dart';
import 'package:fluffychat/utils/matrix_sdk_extensions.dart/matrix_locals.dart';
@ -172,14 +171,6 @@ class MessageContent extends StatelessWidget {
case MessageTypes.None:
textmessage:
default:
if (event.content['msgtype'] == Matrix.callNamespace) {
return _ButtonContent(
onPressed: () => launch(event.body),
icon: const Icon(Icons.phone_outlined, color: Colors.green),
label: L10n.of(context)!.videoCall,
textColor: buttonTextColor,
);
}
if (event.redacted) {
return _ButtonContent(
label: L10n.of(context)!

View File

@ -11,7 +11,6 @@ import 'package:universal_html/html.dart' as html;
import 'package:vrouter/vrouter.dart';
import 'package:fluffychat/config/app_config.dart';
import 'package:fluffychat/config/setting_keys.dart';
import 'package:fluffychat/pages/homeserver_picker/homeserver_picker_view.dart';
import 'package:fluffychat/utils/famedlysdk_store.dart';
import 'package:fluffychat/utils/platform_infos.dart';
@ -98,22 +97,7 @@ class HomeserverPickerController extends State<HomeserverPicker> {
});
try {
final summary =
await Matrix.of(context).getLoginClient().checkHomeserver(homeserver);
var jitsi = summary.discoveryInformation?.additionalProperties
.tryGet<Map<String, dynamic>>('im.vector.riot.jitsi')
?.tryGet<String>('preferredDomain');
if (jitsi != null) {
if (!jitsi.endsWith('/')) {
jitsi += '/';
}
Logs().v('Found custom jitsi instance $jitsi');
await Matrix.of(context)
.store
.setItem(SettingKeys.jitsiInstance, jitsi);
AppConfig.jitsiInstance = jitsi;
}
await Matrix.of(context).getLoginClient().checkHomeserver(homeserver);
_rawLoginTypes = await Matrix.of(context).getLoginClient().request(
RequestType.GET,

View File

@ -9,8 +9,6 @@ import 'package:future_loading_dialog/future_loading_dialog.dart';
import 'package:matrix/matrix.dart';
import 'package:fluffychat/widgets/matrix.dart';
import '../../config/app_config.dart';
import '../../config/setting_keys.dart';
import '../../utils/platform_infos.dart';
import 'login_view.dart';
@ -141,19 +139,6 @@ class LoginController extends State<Login> {
return;
}
}
var jitsi = wellKnownInformation?.additionalProperties
.tryGet<Map<String, dynamic>>('im.vector.riot.jitsi')
?.tryGet<String>('preferredDomain');
if (jitsi != null) {
if (!jitsi.endsWith('/')) {
jitsi += '/';
}
Logs().v('Found custom jitsi instance $jitsi');
await Matrix.of(context)
.store
.setItem(SettingKeys.jitsiInstance, jitsi);
AppConfig.jitsiInstance = jitsi;
}
setState(() => usernameError = null);
} else {
setState(() =>

View File

@ -1,11 +1,5 @@
import 'package:flutter/material.dart';
import 'package:adaptive_dialog/adaptive_dialog.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:fluffychat/config/app_config.dart';
import 'package:fluffychat/config/setting_keys.dart';
import 'package:fluffychat/widgets/matrix.dart';
import 'settings_chat_view.dart';
class SettingsChat extends StatefulWidget {
@ -16,31 +10,6 @@ class SettingsChat extends StatefulWidget {
}
class SettingsChatController extends State<SettingsChat> {
void setJitsiInstanceAction() async {
const prefix = 'https://';
final input = await showTextInputDialog(
useRootNavigator: false,
context: context,
title: L10n.of(context)!.editJitsiInstance,
okLabel: L10n.of(context)!.ok,
cancelLabel: L10n.of(context)!.cancel,
textFields: [
DialogTextField(
initialText: AppConfig.jitsiInstance.replaceFirst(prefix, ''),
prefixText: prefix,
),
],
);
if (input == null) return;
var jitsi = prefix + input.single;
if (!jitsi.endsWith('/')) {
jitsi += '/';
}
final matrix = Matrix.of(context);
await matrix.store.setItem(SettingKeys.jitsiInstance, jitsi);
AppConfig.jitsiInstance = jitsi;
}
@override
Widget build(BuildContext context) => SettingsChatView(this);
}

View File

@ -64,15 +64,6 @@ class SettingsChatView extends StatelessWidget {
child: Icon(Icons.insert_emoticon_outlined),
),
),
ListTile(
trailing: const Padding(
padding: EdgeInsets.all(16.0),
child: Icon(Icons.phone_outlined),
),
title: Text(L10n.of(context)!.editJitsiInstance),
subtitle: Text(AppConfig.jitsiInstance),
onTap: controller.setJitsiInstanceAction,
),
],
),
),

View File

@ -37,8 +37,6 @@ import 'local_notifications_extension.dart';
// import 'package:flutter_secure_storage/flutter_secure_storage.dart';
class Matrix extends StatefulWidget {
static const String callNamespace = 'chat.fluffy.jitsi_call';
final Widget? child;
final GlobalKey<VRouterState>? router;
@ -203,7 +201,6 @@ class MatrixState extends State<Matrix> with WidgetsBindingObserver {
final onRoomKeyRequestSub = <String, StreamSubscription>{};
final onKeyVerificationRequestSub = <String, StreamSubscription>{};
final onJitsiCallSub = <String, StreamSubscription>{};
final onNotification = <String, StreamSubscription>{};
final onLoginStateChanged = <String, StreamSubscription<LoginState>>{};
final onUiaRequest = <String, StreamSubscription<UiaRequest>>{};
@ -436,8 +433,6 @@ class MatrixState extends State<Matrix> with WidgetsBindingObserver {
}
void initSettings() {
store.getItem(SettingKeys.jitsiInstance).then((final instance) =>
AppConfig.jitsiInstance = instance ?? AppConfig.jitsiInstance);
store.getItem(SettingKeys.wallpaper).then((final path) async {
if (path == null) return;
final file = File(path);

View File

@ -9,9 +9,6 @@ list(APPEND FLUTTER_PLUGIN_LIST
url_launcher_windows
)
list(APPEND FLUTTER_FFI_PLUGIN_LIST
)
set(PLUGIN_BUNDLED_LIBRARIES)
foreach(plugin ${FLUTTER_PLUGIN_LIST})
@ -20,8 +17,3 @@ foreach(plugin ${FLUTTER_PLUGIN_LIST})
list(APPEND PLUGIN_BUNDLED_LIBRARIES $<TARGET_FILE:${plugin}_plugin>)
list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries})
endforeach(plugin)
foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST})
add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin})
list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries})
endforeach(ffi_plugin)