diff --git a/ios/Podfile b/ios/Podfile index d294c1c..0b5eb72 100644 --- a/ios/Podfile +++ b/ios/Podfile @@ -31,6 +31,7 @@ target 'Runner' do use_frameworks! use_modular_headers! + pod 'TUIVoIPExtension' flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__)) end diff --git a/ios/Runner/AppDelegate.swift b/ios/Runner/AppDelegate.swift index 8ba2f1c..bc3d430 100644 --- a/ios/Runner/AppDelegate.swift +++ b/ios/Runner/AppDelegate.swift @@ -4,6 +4,7 @@ import Flutter // Add these two import lines import TIMPush import tencent_cloud_chat_push +import TUIVoIPExtension @main @objc class AppDelegate: FlutterAppDelegate, TIMPushDelegate { @@ -11,6 +12,7 @@ import tencent_cloud_chat_push _ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? ) -> Bool { + TUIVoIPExtension.setCertificateID(000) GeneratedPluginRegistrant.register(with: self) return super.application(application, didFinishLaunchingWithOptions: launchOptions) } @@ -18,6 +20,11 @@ import tencent_cloud_chat_push print(error) } + override func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([any UIUserActivityRestoring]?) -> Void) -> Bool { + TUIVoIPExtension.call(userActivity) + return true + } + // Add this function func businessID() -> Int32 { return TencentCloudChatPushFlutterModal.shared.businessID(); diff --git a/ios/Runner/Info.plist b/ios/Runner/Info.plist index 48bf740..9ae1d32 100644 --- a/ios/Runner/Info.plist +++ b/ios/Runner/Info.plist @@ -38,6 +38,8 @@ UIBackgroundModes audio + voip + remote-notification UIViewControllerBasedStatusBarAppearance @@ -45,7 +47,5 @@ io.flutter.embedded_views_preview YES - UIApplicationSupportsIndirectInputEvents - diff --git a/lib/main.dart b/lib/main.dart index 1bc87c9..1157624 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -9,7 +9,8 @@ import 'package:flutter/services.dart'; import 'package:flutter_easyloading/flutter_easyloading.dart'; import 'package:flutter_localizations/flutter_localizations.dart'; import 'package:provider/provider.dart'; -import 'package:tencent_calls_uikit/tuicall_kit.dart'; +import 'package:tencent_calls_uikit/tencent_calls_uikit.dart'; +import 'package:tencent_calls_uikit/debug/generate_test_user_sig.dart'; import 'package:tencent_cloud_chat_demo/custom_animation.dart'; import 'package:tencent_cloud_chat_demo/config.dart'; import 'package:tencent_cloud_chat_demo/src/pages/app.dart'; @@ -76,7 +77,14 @@ void main(List args) { }); } - // ); + /// 使用 TUIVoIP Extension 插件,收到 VoIP 推送, APP 被激活, 这个时候需要完成自动登陆操作。 + /// 自动登陆 操作需要在 UI 绘制之前完成(APP 切到前台时, 才会执行UI 绘制的代码)。 + /// 请根据您的业务代码, 在程序激活后完成登陆!!! + /// + /// Use TUIVoIP Extension plug-in, receive VoIP push, APP is activated, at this time you need to complete the automatic login operation. + /// The automatic login operation needs to be completed before the UI is drawn (the UI drawing code will be executed only when the APP is switched to the foreground). + /// Please complete the login after the program is activated according to your business code! ! ! + TUICallKit.instance.login(IMDemoConfig.sdkAppID, '****', GenerateTestUserSig.genTestSig("****", IMDemoConfig.sdkAppID, IMDemoConfig.key)); } class TUIKitDemoApp extends StatelessWidget {