弹出电话页面

This commit is contained in:
GYJ
2024-11-27 18:18:08 +08:00
parent 938a5df35f
commit 1da1683adc
14 changed files with 252 additions and 16 deletions

View File

@@ -1,15 +1,17 @@
import 'dart:convert';
import 'package:cashier_reserve/common/channel/model/call_status_change_model.dart';
import 'package:cashier_reserve/common/print/print.dart';
import 'package:flutter/services.dart';
import '../manager/event_manager.dart';
import 'call_log_model.dart';
import 'model/call_log_model.dart';
import 'names.dart';
class MyEventChannel {
static void startListener() {
onGetCallLogResult();
onCallStatusChange();
}
static void onGetCallLogResult() {
@@ -35,4 +37,18 @@ class MyEventChannel {
yjPrint("onGetCallLogResult error");
});
}
static void onCallStatusChange() {
EventChannel channel = EventChannel(getChannelName(kCallStatusChange));
channel.receiveBroadcastStream().listen((Object? o) {
yjPrint("onCallStatusChange: $o");
if (o is String) {
Map<String, dynamic> m = json.decode(o);
CallStatusChangeModel model = CallStatusChangeModel.fromJson(m);
EventManager.postEvent(CallStatusChangeEvent(model: model));
}
}, onError: (Object error) {
yjPrint("onCallStatusChange error");
});
}
}