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

feat: alternative foreground/background events #108

Open
TiBz0u opened this issue Sep 24, 2024 · 6 comments
Open

feat: alternative foreground/background events #108

TiBz0u opened this issue Sep 24, 2024 · 6 comments
Labels
feature Feature platform: ios iOS platform

Comments

@TiBz0u
Copy link

TiBz0u commented Sep 24, 2024

Is your feature request related to a problem? Please describe:

Hi,

We are using your plugin since few months and we discover a difference between the behavior from Cordova to Capacitor implementation.

In our new Capacitor application, when we try to open a phone number or start biometric, the privacy screen starts (grey screen or splash image). That's very confusing for the users.

We discover it's linked to the event used into the plugin.

For Cordova, we were using a fork of the cordova-plugin-privacyscreen in which the events were replaced :

  • UIApplicationDidBecomeActiveNotification => UIApplicationWillEnterForegroundNotification
  • UIApplicationWillResignActiveNotification => UIApplicationDidEnterBackgroundNotification

jayj/cordova-plugin-privacyscreen@6a29d66

With this implementation, the event is triggered at the right moment. However, at the moment, the viewController doesn't seem to be shown correctly (I'm currently trying to fix it, but not expert in swift).

Describe the solution you'd like:

A parameter that permit to switch between activeNotificationEvent and foregroundBackgroundNotificationEvent.

Describe alternatives you've considered:

Create a fork of the plugin....

Additional context:

@robingenz
Copy link
Member

Can you record two screen videos with the behavior before and after? I'd like to take a look at it. Basically, I have nothing against this change.

@TiBz0u
Copy link
Author

TiBz0u commented Sep 24, 2024

hi @robingenz ,
Thanks for your fast reply. I'll try to generate a video soon. I need to anonymise the application first.

Meanwhile, you can easily reproduce by having a link/button that makes a call

<a href="tel:+xx xxx xxx">call</a>

On iOS, you'll have a small pop-up at the bottom on the application and the application will be hidden by the grey screen (privacy). With the other events, app is still visible.
example :
image

Kr.

@robingenz
Copy link
Member

Thanks, i need to test this myself. I will get back to you.

However, at the moment, the viewController doesn't seem to be shown correctly (I'm currently trying to fix it, but not expert in swift).

Does this problem also occur in the current implementation?

@TiBz0u
Copy link
Author

TiBz0u commented Sep 25, 2024

Hi @robingenz ,
If I only change the event type on the current implementation (version 5.2.1), it doesn't work anymore.
Kr.

@robingenz
Copy link
Member

Okay, we need to fix that before we can merge it. I would then suggest that we add a configuration option so that you can choose the behavior.

@TiBz0u
Copy link
Author

TiBz0u commented Nov 7, 2024

Hi @robingenz,

FYI, I have succeeded to have a working result.

However, I had to rewrite the system for showing the "Privacy Controller" by using a new UIWindow. It's more readable that the current implementation with Scene/ViewController.
Will be certainly one of the main subject of discussion.

I took inspiration from the following example.

I still need to make some tests.

After my testing, I'll make a PR like this we can discuss on it.

Kr.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Feature platform: ios iOS platform
Projects
None yet
Development

No branches or pull requests

2 participants