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

Getting iOS localizable string keys in mic permission request dialog box when trying place a call in iOS ? #257

Open
RageshAntonyHM opened this issue Jan 16, 2025 · 7 comments

Comments

@RageshAntonyHM
Copy link

Issue Summary

When I try to place a call without microphone permission enabled, I am getting a dialog box like this

Image

It shows "localisation string keys" instead of it's value. Why? These keys come from twilio_voice plugin's iOS folder's Localizable.strings file.

Steps to Reproduce

This is the code:

        ref.read(twilioVoiceProvider).call.place(
              from: from,
              to: '+1$phoneNumber',
              extraOptions: extra,
            );
        ref.read(navNotifierProvider.notifier).onAnswerCall();
        ref.read(twilioNotifierProvider.notifier).setCallToName(prettyNumber);
        ref.read(callTimerProvider.notifier).startCallTimer();

please help me.

@Erchil66
Copy link

Have you already allowed mic on permission when first install?
And also added in the info plist file the request for audio and such? included the xcode allow audio as well.

@RageshAntonyHM
Copy link
Author

RageshAntonyHM commented Jan 17, 2025

@Erchil66

No. I didn't allowed mic on permission when first install. This is intentional flow due to a bug ticket that is "IF mic permission not allowed by any means and a call is initiated, this kind of dialog appears".

And, info.plsit already added.

	<key>NSMicrophoneUsageDescription</key>
	<string>Microphone is used for in-app calls</string>

<key>UIBackgroundModes</key>
	<array>
		<string>audio</string>

@Erchil66
Copy link

How about a flow that when trying to call, Request the mic audio again before start calling.
IOS is quite strict on permission so it might trouble on the callkit side maybe.

@RageshAntonyHM
Copy link
Author

@Erchil66

Sorry. I didn't get you. I am actually an Android dev who working in a Flutter project. Can you please explain in detail ?

@Erchil66
Copy link

@RageshAntonyHM

Flow for start calling without accepting mic permission,

my question are you using permission_handler?

flow:

- Not accepting mic permission
- UI on start calling
- Before calling   ref.read(twilioVoiceProvider).call.place(
              from: from,
              to: '+1$phoneNumber',
              extraOptions: extra,
            );
- Try to create a blocker first if you are using permission_handler
  e.g.

   if(!(await.Permission.microphone.isGranted)}{
    // Call request for mic/audio
   await Permission.microphone.request();
   }else{
        ref.read(twilioVoiceProvider).call.place(
              from: from,
              to: '+1$phoneNumber',
              extraOptions: extra,
            );
        ref.read(navNotifierProvider.notifier).onAnswerCall();
        ref.read(twilioNotifierProvider.notifier).setCallToName(prettyNumber);
        ref.read(callTimerProvider.notifier).startCallTimer();
   }

Thus this helps?

@RageshAntonyHM
Copy link
Author

@Erchil66

The error arises in this block

in the file ios/Classes/SwiftTwilioVoicePlugin.swift, in the func makecall(..)

            self.checkRecordPermission { (permissionGranted) in
                if (!permissionGranted) {
                    let alertController: UIAlertController = UIAlertController(title: String(format:  NSLocalizedString("mic_permission_title", comment: "") , SwiftTwilioVoicePlugin.appName),
                                                                               message: NSLocalizedString( "mic_permission_subtitle", comment: ""),
                                                                               preferredStyle: .alert)
                    
                    let continueWithMic: UIAlertAction = UIAlertAction(title: NSLocalizedString("btn_continue_no_mic", comment: ""),
                                                                       style: .default,
                                                                       handler: { (action) in
                                                                        self.performStartCallAction(uuid: uuid, handle: to)
                                                                       })
                    alertController.addAction(continueWithMic)
                    
                    let goToSettings: UIAlertAction = UIAlertAction(title:NSLocalizedString("btn_settings", comment: ""),
                                                                    style: .default,
                                                                    handler: { (action) in
                                                                        UIApplication.shared.open(URL(string: UIApplication.openSettingsURLString)!,
                                                                                                  options: [UIApplication.OpenExternalURLOptionsKey.universalLinksOnly: false],
                                                                                                  completionHandler: nil)
                                                                    })
                    alertController.addAction(goToSettings)
                    
                    let cancel: UIAlertAction = UIAlertAction(title: NSLocalizedString("btn_cancel", comment: ""),
                                                              style: .cancel,
                                                              handler: { (action) in
                                                                //self.toggleUIState(isEnabled: true, showCallControl: false)
                                                                //self.stopSpin()
                                                              })
                    alertController.addAction(cancel)
                    guard let currentViewController = UIApplication.shared.keyWindow?.topMostViewController() else {
                        return
                    }
                    currentViewController.present(alertController, animated: true, completion: nil)
                    
                } else {
                    self.performStartCallAction(uuid: uuid, handle: to)
                }
            }

The keys are returned instead of values

@RageshAntonyHM
Copy link
Author

RageshAntonyHM commented Jan 19, 2025

@Erchil66

I fixed the issue. Can I create a PR and is the project is alive (no release for 14 months) so it will be merged and published to pub.dev?

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