✨ iOS quick reply (finished)
This commit is contained in:
@@ -57,23 +57,6 @@ void appBackgroundDispatcher() {
|
||||
});
|
||||
}
|
||||
|
||||
@pragma("vm:entry-point")
|
||||
FutureOr<void> appInteractiveBackgroundDispatcher(Uri? data) async {
|
||||
print('Interactive background dispatcher called with $data');
|
||||
switch (data?.path) {
|
||||
case "/chat/reply":
|
||||
final channelId = data?.queryParameters['channel_id'];
|
||||
final eventId = data?.queryParameters['event_id'];
|
||||
final message = data?.queryParameters['text'];
|
||||
if (channelId != null && eventId != null && (message?.isNotEmpty ?? false)) {
|
||||
await chatReplyMessage(channelId, eventId, message!);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void main() async {
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
await EasyLocalization.ensureInitialized();
|
||||
|
@@ -140,19 +140,3 @@ class ChatChannelProvider extends ChangeNotifier {
|
||||
super.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> chatReplyMessage(channelId, eventId, String message) async {
|
||||
print('Chat reply message called with $channelId $eventId $message');
|
||||
try {
|
||||
final snc = await SnNetworkProvider.createOffContextClient();
|
||||
await snc.post('/cgi/im/quick/$channelId/reply/$eventId', data: {
|
||||
'type': 'messages.new',
|
||||
'body': {
|
||||
'text': message,
|
||||
'algorithm': 'plain',
|
||||
},
|
||||
});
|
||||
} catch (err) {
|
||||
print('Failed to send chat reply message: $err');
|
||||
}
|
||||
}
|
||||
|
@@ -5,7 +5,6 @@ import 'dart:io';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:home_widget/home_widget.dart';
|
||||
import 'package:surface/main.dart';
|
||||
import 'package:surface/providers/sn_network.dart';
|
||||
import 'package:surface/types/post.dart';
|
||||
|
||||
@@ -17,8 +16,6 @@ class HomeWidgetProvider {
|
||||
if (!kIsWeb && Platform.isIOS) {
|
||||
await HomeWidget.setAppGroupId("group.solsynth.solian");
|
||||
}
|
||||
|
||||
await HomeWidget.registerInteractivityCallback(appInteractiveBackgroundDispatcher);
|
||||
}
|
||||
|
||||
Future<void> saveWidgetData(String id, dynamic data, {bool update = true}) async {
|
||||
|
Reference in New Issue
Block a user