Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ios/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
7 changes: 7 additions & 0 deletions ios/Runner/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,27 @@ import Flutter
// Add these two import lines
import TIMPush
import tencent_cloud_chat_push
import TUIVoIPExtension

@main
@objc class AppDelegate: FlutterAppDelegate, TIMPushDelegate {
override func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
TUIVoIPExtension.setCertificateID(000)
GeneratedPluginRegistrant.register(with: self)
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}
override func application(_ application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: Error) {
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();
Expand Down
4 changes: 2 additions & 2 deletions ios/Runner/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@
<key>UIBackgroundModes</key>
<array>
<string>audio</string>
<string>voip</string>
<string>remote-notification</string>
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
<key>flutter_apns.disable_firebase_core</key>
<false/>
<key>io.flutter.embedded_views_preview</key>
<string>YES</string>
<key>UIApplicationSupportsIndirectInputEvents</key>
<true/>
</dict>
</plist>
12 changes: 10 additions & 2 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -76,7 +77,14 @@ void main(List<String> 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 {
Expand Down