fluffychat merge
This commit is contained in:
commit
3efe713aeb
8 changed files with 59 additions and 15 deletions
|
|
@ -84,6 +84,9 @@ abstract class AppConfig {
|
|||
path: '/en/privacy',
|
||||
);
|
||||
|
||||
static const String mainIsolatePortName = 'main_isolate';
|
||||
static const String pushIsolatePortName = 'push_isolate';
|
||||
|
||||
// #Pangea
|
||||
static String assetsBaseURL =
|
||||
"https://pangea-chat-client-assets.s3.us-east-1.amazonaws.com";
|
||||
|
|
|
|||
|
|
@ -12,12 +12,14 @@ import 'package:matrix/matrix.dart';
|
|||
import 'package:provider/provider.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
||||
import 'package:fluffychat/config/app_config.dart';
|
||||
import 'package:fluffychat/pangea/common/config/environment.dart';
|
||||
import 'package:fluffychat/pangea/common/utils/error_handler.dart';
|
||||
import 'package:fluffychat/pangea/common/utils/firebase_analytics.dart';
|
||||
import 'package:fluffychat/pangea/languages/locale_provider.dart';
|
||||
import 'package:fluffychat/pangea/languages/p_language_store.dart';
|
||||
import 'package:fluffychat/utils/client_manager.dart';
|
||||
import 'package:fluffychat/utils/notification_background_handler.dart';
|
||||
import 'package:fluffychat/utils/platform_infos.dart';
|
||||
import 'config/setting_keys.dart';
|
||||
import 'utils/background_push.dart';
|
||||
|
|
@ -54,10 +56,12 @@ void main() async {
|
|||
|
||||
if (PlatformInfos.isAndroid) {
|
||||
final port = mainIsolateReceivePort = ReceivePort();
|
||||
IsolateNameServer.removePortNameMapping(AppConfig.mainIsolatePortName);
|
||||
IsolateNameServer.registerPortWithName(
|
||||
port.sendPort,
|
||||
'main_isolate',
|
||||
AppConfig.mainIsolatePortName,
|
||||
);
|
||||
await waitForPushIsolateDone();
|
||||
}
|
||||
|
||||
// Our background push shared isolate accesses flutter-internal things very early in the startup proccess
|
||||
|
|
|
|||
|
|
@ -703,10 +703,12 @@ class Message extends StatelessWidget {
|
|||
CrossAxisAlignment
|
||||
.start,
|
||||
children: <Widget>[
|
||||
if (RelationshipTypes
|
||||
.reply ==
|
||||
event
|
||||
.relationshipType)
|
||||
if (event
|
||||
.inReplyToEventId(
|
||||
includingFallback:
|
||||
false,
|
||||
) !=
|
||||
null)
|
||||
FutureBuilder<
|
||||
Event?>(
|
||||
future: event
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ class HomeserverPickerController extends State<HomeserverPicker> {
|
|||
homeserver = Uri.https(homeserverInput, '');
|
||||
}
|
||||
final client = await Matrix.of(context).getLoginClient();
|
||||
final (_, _, loginFlows) = await client.checkHomeserver(homeserver);
|
||||
final (_, _, loginFlows, _) = await client.checkHomeserver(homeserver);
|
||||
this.loginFlows = loginFlows;
|
||||
if (supportsSso && !legacyPasswordLogin) {
|
||||
if (!PlatformInfos.isMobile) {
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ import 'package:unifiedpush/unifiedpush.dart';
|
|||
import 'package:unifiedpush_ui/unifiedpush_ui.dart';
|
||||
|
||||
import 'package:fluffychat/l10n/l10n.dart';
|
||||
import 'package:fluffychat/main.dart';
|
||||
import 'package:fluffychat/pangea/common/utils/error_handler.dart';
|
||||
import 'package:fluffychat/pangea/languages/language_constants.dart';
|
||||
import 'package:fluffychat/utils/notification_background_handler.dart';
|
||||
|
|
@ -85,6 +86,20 @@ class BackgroundPush {
|
|||
FirebaseMessaging.instance.getInitialMessage().then(_onOpenNotification);
|
||||
FirebaseMessaging.onMessageOpenedApp.listen(_onOpenNotification);
|
||||
// Pangea#
|
||||
mainIsolateReceivePort?.listen(
|
||||
(message) async {
|
||||
try {
|
||||
await notificationTap(
|
||||
NotificationResponseJson.fromJsonString(message),
|
||||
client: client,
|
||||
router: FluffyChatApp.router,
|
||||
l10n: l10n,
|
||||
);
|
||||
} catch (e, s) {
|
||||
Logs().wtf('Main Notification Tap crashed', e, s);
|
||||
}
|
||||
},
|
||||
);
|
||||
if (PlatformInfos.isAndroid) {
|
||||
final port = ReceivePort();
|
||||
IsolateNameServer.removePortNameMapping('background_tab_port');
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import 'dart:convert';
|
||||
import 'dart:isolate';
|
||||
import 'dart:ui';
|
||||
|
||||
import 'package:collection/collection.dart';
|
||||
|
|
@ -42,17 +43,34 @@ extension NotificationResponseJson on NotificationResponse {
|
|||
}
|
||||
}
|
||||
|
||||
Future<void> waitForPushIsolateDone() async {
|
||||
if (IsolateNameServer.lookupPortByName(AppConfig.pushIsolatePortName) !=
|
||||
null) {
|
||||
Logs().i('Wait for Push Isolate to be done...');
|
||||
await Future.delayed(const Duration(milliseconds: 300));
|
||||
}
|
||||
}
|
||||
|
||||
@pragma('vm:entry-point')
|
||||
void notificationTapBackground(
|
||||
NotificationResponse notificationResponse,
|
||||
) async {
|
||||
Logs().i('Notification tap in background');
|
||||
|
||||
final sendPort = IsolateNameServer.lookupPortByName('main_isolate');
|
||||
final sendPort =
|
||||
IsolateNameServer.lookupPortByName(AppConfig.mainIsolatePortName);
|
||||
if (sendPort != null) {
|
||||
sendPort.send(notificationResponse.toJsonString());
|
||||
Logs().i('Notification tap sent to main isolate!');
|
||||
return;
|
||||
}
|
||||
Logs().i(
|
||||
'Main isolate no up - Create temporary client for notification tap intend!',
|
||||
);
|
||||
|
||||
final pushIsolateReceivePort = ReceivePort();
|
||||
IsolateNameServer.registerPortWithName(
|
||||
pushIsolateReceivePort.sendPort,
|
||||
AppConfig.pushIsolatePortName,
|
||||
);
|
||||
|
||||
if (!_vodInitialized) {
|
||||
await vod.init();
|
||||
|
|
@ -77,6 +95,8 @@ void notificationTapBackground(
|
|||
await notificationTap(notificationResponse, client: client);
|
||||
} finally {
|
||||
await client.dispose(closeDatabase: false);
|
||||
pushIsolateReceivePort.sendPort.send('DONE');
|
||||
IsolateNameServer.removePortNameMapping(AppConfig.pushIsolatePortName);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1204,10 +1204,10 @@ packages:
|
|||
dependency: "direct main"
|
||||
description:
|
||||
name: image_picker
|
||||
sha256: "736eb56a911cf24d1859315ad09ddec0b66104bc41a7f8c5b96b4e2620cf5041"
|
||||
sha256: "784210112be18ea55f69d7076e2c656a4e24949fa9e76429fe53af0c0f4fa320"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.2.0"
|
||||
version: "1.2.1"
|
||||
image_picker_android:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
@ -2693,10 +2693,10 @@ packages:
|
|||
dependency: "direct main"
|
||||
description:
|
||||
name: video_player
|
||||
sha256: "0d55b1f1a31e5ad4c4967bfaa8ade0240b07d20ee4af1dfef5f531056512961a"
|
||||
sha256: "096bc28ce10d131be80dfb00c223024eb0fba301315a406728ab43dd99c45bdf"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.10.0"
|
||||
version: "2.10.1"
|
||||
video_player_android:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ dependencies:
|
|||
html: ^0.15.4
|
||||
http: ^1.6.0
|
||||
image: ^4.1.7
|
||||
image_picker: ^1.2.0
|
||||
image_picker: ^1.2.1
|
||||
intl: any
|
||||
just_audio: ^0.10.5
|
||||
latlong2: ^0.9.1
|
||||
|
|
@ -95,7 +95,7 @@ dependencies:
|
|||
universal_html: ^2.2.4
|
||||
url_launcher: ^6.3.2
|
||||
video_compress: ^3.1.4
|
||||
video_player: ^2.9.5
|
||||
video_player: ^2.10.1
|
||||
wakelock_plus: ^1.3.3
|
||||
webrtc_interface: ^1.3.0
|
||||
# #Pangea
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue