mahnuh / capacitor-plugin-app-tracking-transparency

Capacitor plugin to request user authorization to access app-related data for tracking the user or the device.
MIT License
33 stars 10 forks source link

Ionic no alert #5

Closed thomashrabe closed 3 years ago

thomashrabe commented 3 years ago

Plugin version: [x] 1.x [] 2.x

Capacitor version: [x] 2.x [] 3.x

Current behavior:

Not sure if this is a bug. I run

const transparencyResult = await AppTrackingTransparency.requestPermission();
        console.log("");
        console.log("");
        console.log("");
        console.log("");
        console.log("");
        console.log(transparencyResult);
        console.log("");
        console.log("");
        console.log("");
        console.log("");

in my Ionic app and it prints

[log] - {"status":"authorized"}

when running on a device. Should I not see a confirmation message at the first run of the app when I add this plugin?

$ ionic --version
6.12.4
$ node -v
v10.16.3
$ npm -v
6.9.0

Or, how can I reset the status to factory so I know I am testing from scratch?

mahnuh commented 3 years ago

Hey @thomashrabe, can you please provide a sample repo to reproduce this issue?

mahnuh commented 3 years ago

And what iOS version is your app running on @thomashrabe?

thomashrabe commented 3 years ago

Company repo, not public. I think I would like to know what the default behavior should be and what to expect on the happy path...

iOS 14.4.1

mahnuh commented 3 years ago

Device or simulator?

The expected behavior should be the native confirm dialog asking for permission. Can you reproduce this issue in a fresh ionic/capacitor app and share the repo?

thomashrabe commented 3 years ago

Device - but same on Simulator. Sure. I can try and share.

thomashrabe commented 3 years ago

Hi Michael, here is the link to a project I just reproduced the issue I mentioned above https://github.com/thomashrabe/Transparency

check https://github.com/thomashrabe/Transparency/blob/df8862f49af5a8f7531d7f77a73aa48150487b89/src/app/app.component.ts#L16

When I run this in the simulator I see no UI asking for permission, but the app prints

[log] - {"status":"authorized"}
mahnuh commented 3 years ago

Hi @thomashrabe, you are using the plugin the Capacitor 3 way while your app is built with Capacitor 2. I added a link to the v1 docs to the README for clarification. This should solve your issue.

thomashrabe commented 3 years ago

Thanks @mahnuh, I'll check it

Pendrokar commented 2 years ago

Hi @thomashrabe, you are using the plugin the Capacitor 3 way while your app is built with Capacitor 2. I added a link to the v1 docs to the README for clarification. This should solve your issue.

What is the difference? As the only difference that I see is the use of AppTrackingTransparencyPlugin.

But it seems even with the change that @thomashrabe did on his sample project a day later, it was not enough. The Transparency sample project even crashes when I try it on a simulator (iOS 15)

mahnuh commented 2 years ago

@Pendrokar did you add NSUserTrackingUsageDescription to your Info.plist as described in the docs? In @thomashrabe's example repo it is missing.

This causes the app to crash with the following error:

[access] This app has crashed because it attempted to access privacy-sensitive data without a usage description.  The app's Info.plist must contain an NSUserTrackingUsageDescription key with a string value explaining to the user how the app uses this data.
thomashrabe commented 2 years ago

@Pendrokar @mahnuh I got it to run back then with the v2 changes, sorry I can not share our app code.