Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

app got freezed when I call #55

Open
heshesh2010 opened this issue Aug 13, 2024 · 2 comments
Open

app got freezed when I call #55

heshesh2010 opened this issue Aug 13, 2024 · 2 comments

Comments

@heshesh2010
Copy link

Hi ,

when I call ZegoUIKitPrebuiltCallInvitationService().init for ZegoUIKitSignalingPlugin
I see the app got freezed for 5 seconds or more ,

I call this method every time user logged in in my app

@yoer
Copy link
Collaborator

yoer commented Aug 16, 2024

This is an asynchronous operation, please do not await

@heshesh2010
Copy link
Author

heshesh2010 commented Aug 17, 2024

This is an asynchronous operation, please do not await

Hello ,

i'm not using await , but still my app got freezed on startup

here is main.dart code

`Future<void> main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await Firebase.initializeApp(
    options: DefaultFirebaseOptions.currentPlatform,
  );
  await setupServiceLocator();
  await Get.putAsync(() => AuthService().init());

  Get.find<AuthService>().initLoginZegoUser();

  await SystemChrome.setPreferredOrientations([
    DeviceOrientation.portraitUp,
  ]);

  /// 1/5: define a navigator key
  final navigatorKey = GlobalKey<NavigatorState>();

  /// 2/5: set navigator key to ZegoUIKitPrebuiltCallInvitationService
  ZegoUIKitPrebuiltCallInvitationService().setNavigatorKey(navigatorKey);

  ZegoUIKit().initLog().then((value) {
    ZegoUIKitPrebuiltCallInvitationService().useSystemCallingUI(
      [ZegoUIKitSignalingPlugin()],
    );

    runApp(RootApp(navigatorKey: navigatorKey));
  });
}`

init login zego user


  void initLoginZegoUser() {
    if (_user.value.id == null) {
      return;
    } else {
      /// 4/5. initialized ZegoUIKitPrebuiltCallInvitationService when account is logged in or re-logged in
      ZegoUIKitPrebuiltCallInvitationService().init(
        appID: xxxx /*input your AppID*/,
        appSign:
            "xxxx" /*input your AppSign*/,
        userID: _user.value.id.toString(),
        userName: _user.value.name ?? "loklok user",
        plugins: [
          ZegoUIKitSignalingPlugin(),
        ],
        notificationConfig: ZegoCallInvitationNotificationConfig(
          androidNotificationConfig: ZegoCallAndroidNotificationConfig(
            showFullScreen: true,
            fullScreenBackground: 'assets/image/call.png',
            channelID: "ZegoUIKit",
            channelName: "Call Notifications",
            sound: "call",
            icon: "call",
            certificateIndex:
                ZegoSignalingPluginMultiCertificate.firstCertificate,
          ),
          iOSNotificationConfig: ZegoCallIOSNotificationConfig(
            systemCallingIconName: 'CallKitIcon',
          ),
        ),
        requireConfig: (ZegoCallInvitationData data) {
          final config = (data.invitees.length > 1)
              ? ZegoCallInvitationType.videoCall == data.type
                  ? ZegoUIKitPrebuiltCallConfig.groupVideoCall()
                  : ZegoUIKitPrebuiltCallConfig.groupVoiceCall()
              : ZegoCallInvitationType.videoCall == data.type
                  ? ZegoUIKitPrebuiltCallConfig.oneOnOneVideoCall()
                  : ZegoUIKitPrebuiltCallConfig.oneOnOneVoiceCall();

          config.avatarBuilder = customAvatarBuilder;

          /// support minimizing, show minimizing button
          config.topMenuBar.isVisible = false;
          // config.topMenuBar.buttons
          //     .insert(0, ZegoCallMenuBarButtonName.minimizingButton);

          return config;
        },
      );
    }
  }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants