@capawesome/capacitor-app-tracking-transparency 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CapawesomeCapacitorAppTrackingTransparency.podspec +17 -0
- package/LICENSE +21 -0
- package/Package.swift +28 -0
- package/README.md +229 -0
- package/android/build.gradle +58 -0
- package/android/src/main/AndroidManifest.xml +2 -0
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/apptrackingtransparency/AppTrackingTransparencyPlugin.java +30 -0
- package/android/src/main/res/.gitkeep +0 -0
- package/dist/docs.json +177 -0
- package/dist/esm/definitions.d.ts +87 -0
- package/dist/esm/definitions.js +2 -0
- package/dist/esm/definitions.js.map +1 -0
- package/dist/esm/index.d.ts +4 -0
- package/dist/esm/index.js +7 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/web.d.ts +7 -0
- package/dist/esm/web.js +13 -0
- package/dist/esm/web.js.map +1 -0
- package/dist/plugin.cjs.js +27 -0
- package/dist/plugin.cjs.js.map +1 -0
- package/dist/plugin.js +30 -0
- package/dist/plugin.js.map +1 -0
- package/ios/Plugin/AppTrackingTransparency.swift +54 -0
- package/ios/Plugin/AppTrackingTransparencyPlugin.swift +64 -0
- package/ios/Plugin/Classes/Results/GetAdvertisingIdentifierResult.swift +16 -0
- package/ios/Plugin/Classes/Results/GetStatusResult.swift +16 -0
- package/ios/Plugin/Classes/Results/RequestPermissionResult.swift +16 -0
- package/ios/Plugin/Enums/CustomError.swift +14 -0
- package/ios/Plugin/Info.plist +24 -0
- package/ios/Plugin/Protocols/Result.swift +5 -0
- package/package.json +91 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
require 'json'
|
|
2
|
+
|
|
3
|
+
package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
|
|
4
|
+
|
|
5
|
+
Pod::Spec.new do |s|
|
|
6
|
+
s.name = 'CapawesomeCapacitorAppTrackingTransparency'
|
|
7
|
+
s.version = package['version']
|
|
8
|
+
s.summary = package['description']
|
|
9
|
+
s.license = package['license']
|
|
10
|
+
s.homepage = package['repository']['url']
|
|
11
|
+
s.author = package['author']
|
|
12
|
+
s.source = { :git => package['repository']['url'], :tag => s.version.to_s }
|
|
13
|
+
s.source_files = 'ios/Plugin/**/*.{swift,h,m,c,cc,mm,cpp}'
|
|
14
|
+
s.ios.deployment_target = '15.0'
|
|
15
|
+
s.dependency 'Capacitor'
|
|
16
|
+
s.swift_version = '5.1'
|
|
17
|
+
end
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Robin Genz
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/Package.swift
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// swift-tools-version: 5.9
|
|
2
|
+
import PackageDescription
|
|
3
|
+
|
|
4
|
+
let package = Package(
|
|
5
|
+
name: "CapawesomeCapacitorAppTrackingTransparency",
|
|
6
|
+
platforms: [.iOS(.v15)],
|
|
7
|
+
products: [
|
|
8
|
+
.library(
|
|
9
|
+
name: "CapawesomeCapacitorAppTrackingTransparency",
|
|
10
|
+
targets: ["AppTrackingTransparencyPlugin"])
|
|
11
|
+
],
|
|
12
|
+
dependencies: [
|
|
13
|
+
.package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", from: "8.0.0")
|
|
14
|
+
],
|
|
15
|
+
targets: [
|
|
16
|
+
.target(
|
|
17
|
+
name: "AppTrackingTransparencyPlugin",
|
|
18
|
+
dependencies: [
|
|
19
|
+
.product(name: "Capacitor", package: "capacitor-swift-pm"),
|
|
20
|
+
.product(name: "Cordova", package: "capacitor-swift-pm")
|
|
21
|
+
],
|
|
22
|
+
path: "ios/Plugin"),
|
|
23
|
+
.testTarget(
|
|
24
|
+
name: "AppTrackingTransparencyPluginTests",
|
|
25
|
+
dependencies: ["AppTrackingTransparencyPlugin"],
|
|
26
|
+
path: "ios/PluginTests")
|
|
27
|
+
]
|
|
28
|
+
)
|
package/README.md
ADDED
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
# @capawesome/capacitor-app-tracking-transparency
|
|
2
|
+
|
|
3
|
+
Capacitor plugin for the [App Tracking Transparency](https://developer.apple.com/documentation/apptrackingtransparency) framework.
|
|
4
|
+
|
|
5
|
+
<div class="capawesome-z29o10a">
|
|
6
|
+
<a href="https://cloud.capawesome.io/" target="_blank">
|
|
7
|
+
<img alt="Deliver Live Updates to your Capacitor app with Capawesome Cloud" src="https://cloud.capawesome.io/assets/banners/cloud-build-and-deploy-capacitor-apps.png?t=1" />
|
|
8
|
+
</a>
|
|
9
|
+
</div>
|
|
10
|
+
|
|
11
|
+
## Features
|
|
12
|
+
|
|
13
|
+
We are proud to offer one of the most complete and feature-rich Capacitor plugins for App Tracking Transparency. Here are some of the key features:
|
|
14
|
+
|
|
15
|
+
- 🔒 **Authorization status**: Read the current tracking authorization status.
|
|
16
|
+
- 🙋 **Permission request**: Present the system tracking authorization prompt.
|
|
17
|
+
- 🆔 **Advertising identifier**: Read the advertising identifier (IDFA) when authorized.
|
|
18
|
+
- 📦 **CocoaPods & SPM**: Supports CocoaPods and Swift Package Manager for iOS.
|
|
19
|
+
- 🔁 **Up-to-date**: Always supports the latest Capacitor version.
|
|
20
|
+
|
|
21
|
+
Missing a feature? Just [open an issue](https://github.com/capawesome-team/capacitor-plugins/issues) and we'll take a look!
|
|
22
|
+
|
|
23
|
+
## Newsletter
|
|
24
|
+
|
|
25
|
+
Stay up to date with the latest news and updates about the Capawesome, Capacitor, and Ionic ecosystem by subscribing to our [Capawesome Newsletter](https://cloud.capawesome.io/newsletter/).
|
|
26
|
+
|
|
27
|
+
## Compatibility
|
|
28
|
+
|
|
29
|
+
| Plugin Version | Capacitor Version | Status |
|
|
30
|
+
| -------------- | ----------------- | -------------- |
|
|
31
|
+
| 0.x.x | >=8.x.x | Active support |
|
|
32
|
+
|
|
33
|
+
## Installation
|
|
34
|
+
|
|
35
|
+
You can use our **AI-Assisted Setup** to install the plugin.
|
|
36
|
+
Add the [Capawesome Skills](https://github.com/capawesome-team/skills) to your AI tool using the following command:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
npx skills add capawesome-team/skills --skill capacitor-plugins
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Then use the following prompt:
|
|
43
|
+
|
|
44
|
+
```
|
|
45
|
+
Use the `capacitor-plugins` skill from `capawesome-team/skills` to install the `@capawesome/capacitor-app-tracking-transparency` plugin in my project.
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
If you prefer **Manual Setup**, install the plugin by running the following commands and follow the platform-specific instructions below:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
npm install @capawesome/capacitor-app-tracking-transparency
|
|
52
|
+
npx cap sync
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
This plugin is only available on **iOS**. On Android and Web, all methods reject as unimplemented.
|
|
56
|
+
|
|
57
|
+
### iOS
|
|
58
|
+
|
|
59
|
+
#### Privacy Descriptions
|
|
60
|
+
|
|
61
|
+
The `NSUserTrackingUsageDescription` key must be added to the `Info.plist` file of your app. Otherwise, the `requestPermission(...)` method will reject with an error.
|
|
62
|
+
|
|
63
|
+
```xml
|
|
64
|
+
<key>NSUserTrackingUsageDescription</key>
|
|
65
|
+
<string>Your data will be used to deliver personalized ads to you.</string>
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
The purpose string must clearly explain why your app is requesting permission to track the user. See the [Apple documentation](https://developer.apple.com/documentation/bundleresources/information-property-list/nsusertrackingusagedescription) for more information.
|
|
69
|
+
|
|
70
|
+
## Configuration
|
|
71
|
+
|
|
72
|
+
No configuration required for this plugin.
|
|
73
|
+
|
|
74
|
+
## Usage
|
|
75
|
+
|
|
76
|
+
```typescript
|
|
77
|
+
import { AppTrackingTransparency } from '@capawesome/capacitor-app-tracking-transparency';
|
|
78
|
+
|
|
79
|
+
const getStatus = async () => {
|
|
80
|
+
const { status } = await AppTrackingTransparency.getStatus();
|
|
81
|
+
return status;
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
const requestPermission = async () => {
|
|
85
|
+
const { status } = await AppTrackingTransparency.requestPermission();
|
|
86
|
+
return status;
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
const getAdvertisingIdentifier = async () => {
|
|
90
|
+
const { advertisingIdentifier } =
|
|
91
|
+
await AppTrackingTransparency.getAdvertisingIdentifier();
|
|
92
|
+
return advertisingIdentifier;
|
|
93
|
+
};
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## API
|
|
97
|
+
|
|
98
|
+
<docgen-index>
|
|
99
|
+
|
|
100
|
+
* [`getAdvertisingIdentifier()`](#getadvertisingidentifier)
|
|
101
|
+
* [`getStatus()`](#getstatus)
|
|
102
|
+
* [`requestPermission()`](#requestpermission)
|
|
103
|
+
* [Interfaces](#interfaces)
|
|
104
|
+
* [Type Aliases](#type-aliases)
|
|
105
|
+
|
|
106
|
+
</docgen-index>
|
|
107
|
+
|
|
108
|
+
<docgen-api>
|
|
109
|
+
<!--Update the source file JSDoc comments and rerun docgen to update the docs below-->
|
|
110
|
+
|
|
111
|
+
### getAdvertisingIdentifier()
|
|
112
|
+
|
|
113
|
+
```typescript
|
|
114
|
+
getAdvertisingIdentifier() => Promise<GetAdvertisingIdentifierResult>
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
Get the advertising identifier (IDFA) of the device.
|
|
118
|
+
|
|
119
|
+
The advertising identifier is only available if the tracking authorization
|
|
120
|
+
status is `authorized`. Otherwise, `null` is returned.
|
|
121
|
+
|
|
122
|
+
**Note**: The iOS Simulator always returns `null`, even if the tracking
|
|
123
|
+
authorization status is `authorized`. Use a real device to test this method.
|
|
124
|
+
|
|
125
|
+
Only available on iOS.
|
|
126
|
+
|
|
127
|
+
**Returns:** <code>Promise<<a href="#getadvertisingidentifierresult">GetAdvertisingIdentifierResult</a>></code>
|
|
128
|
+
|
|
129
|
+
**Since:** 0.1.0
|
|
130
|
+
|
|
131
|
+
--------------------
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
### getStatus()
|
|
135
|
+
|
|
136
|
+
```typescript
|
|
137
|
+
getStatus() => Promise<GetStatusResult>
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
Get the current tracking authorization status.
|
|
141
|
+
|
|
142
|
+
Only available on iOS.
|
|
143
|
+
|
|
144
|
+
**Returns:** <code>Promise<<a href="#getstatusresult">GetStatusResult</a>></code>
|
|
145
|
+
|
|
146
|
+
**Since:** 0.1.0
|
|
147
|
+
|
|
148
|
+
--------------------
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
### requestPermission()
|
|
152
|
+
|
|
153
|
+
```typescript
|
|
154
|
+
requestPermission() => Promise<RequestPermissionResult>
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
Request permission to track the user.
|
|
158
|
+
|
|
159
|
+
This will present the system tracking authorization prompt if the status
|
|
160
|
+
has not been determined yet. The prompt is only shown once per install.
|
|
161
|
+
|
|
162
|
+
The `NSUserTrackingUsageDescription` key must be added to the `Info.plist`
|
|
163
|
+
file of your app.
|
|
164
|
+
|
|
165
|
+
Only available on iOS.
|
|
166
|
+
|
|
167
|
+
**Returns:** <code>Promise<<a href="#requestpermissionresult">RequestPermissionResult</a>></code>
|
|
168
|
+
|
|
169
|
+
**Since:** 0.1.0
|
|
170
|
+
|
|
171
|
+
--------------------
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
### Interfaces
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
#### GetAdvertisingIdentifierResult
|
|
178
|
+
|
|
179
|
+
| Prop | Type | Description | Since |
|
|
180
|
+
| --------------------------- | --------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----- |
|
|
181
|
+
| **`advertisingIdentifier`** | <code>string \| null</code> | The advertising identifier (IDFA) of the device. Returns `null` if the tracking authorization status is not `authorized` or if no advertising identifier is available, which is always the case on the iOS Simulator. | 0.1.0 |
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
#### GetStatusResult
|
|
185
|
+
|
|
186
|
+
| Prop | Type | Description | Since |
|
|
187
|
+
| ------------ | --------------------------------------------------------- | ------------------------------------------ | ----- |
|
|
188
|
+
| **`status`** | <code><a href="#trackingstatus">TrackingStatus</a></code> | The current tracking authorization status. | 0.1.0 |
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
#### RequestPermissionResult
|
|
192
|
+
|
|
193
|
+
| Prop | Type | Description | Since |
|
|
194
|
+
| ------------ | --------------------------------------------------------- | ---------------------------------------------------- | ----- |
|
|
195
|
+
| **`status`** | <code><a href="#trackingstatus">TrackingStatus</a></code> | The tracking authorization status after the request. | 0.1.0 |
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
### Type Aliases
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
#### TrackingStatus
|
|
202
|
+
|
|
203
|
+
The tracking authorization status.
|
|
204
|
+
|
|
205
|
+
- `authorized`: The user authorized access to app-related data for tracking.
|
|
206
|
+
- `denied`: The user denied access to app-related data for tracking.
|
|
207
|
+
- `notDetermined`: The user has not yet received a tracking authorization request.
|
|
208
|
+
- `restricted`: Tracking authorization is restricted and cannot be changed by the user.
|
|
209
|
+
|
|
210
|
+
<code>'authorized' | 'denied' | 'notDetermined' | 'restricted'</code>
|
|
211
|
+
|
|
212
|
+
</docgen-api>
|
|
213
|
+
|
|
214
|
+
## App Review Guidance
|
|
215
|
+
|
|
216
|
+
Apple requires that any app that tracks users requests permission via the App Tracking Transparency framework. Keep the following guidelines in mind to avoid App Review rejections:
|
|
217
|
+
|
|
218
|
+
- **Prompt timing**: Call `requestPermission(...)` only when the user is in a context where tracking makes sense. The system prompt is only shown once per install while the status is `notDetermined`. Calling the method again afterwards resolves with the existing status without showing the prompt.
|
|
219
|
+
- **Purpose string**: The `NSUserTrackingUsageDescription` purpose string must accurately describe how the collected data is used. Vague or misleading descriptions are a common reason for rejection.
|
|
220
|
+
- **Advertising identifier**: The advertising identifier (IDFA) is only available while the status is `authorized`. In all other cases, `getAdvertisingIdentifier(...)` returns `null`.
|
|
221
|
+
- **Simulator**: The iOS Simulator never provides an advertising identifier, so `getAdvertisingIdentifier(...)` always returns `null` there, even if the status is `authorized`. Use a real device to test the advertising identifier.
|
|
222
|
+
|
|
223
|
+
## Changelog
|
|
224
|
+
|
|
225
|
+
See [CHANGELOG.md](https://github.com/capawesome-team/capacitor-plugins/blob/main/packages/app-tracking-transparency/CHANGELOG.md).
|
|
226
|
+
|
|
227
|
+
## License
|
|
228
|
+
|
|
229
|
+
See [LICENSE](https://github.com/capawesome-team/capacitor-plugins/blob/main/packages/app-tracking-transparency/LICENSE).
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
ext {
|
|
2
|
+
junitVersion = project.hasProperty('junitVersion') ? rootProject.ext.junitVersion : '4.13.2'
|
|
3
|
+
androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.7.1'
|
|
4
|
+
androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.3.0'
|
|
5
|
+
androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.7.0'
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
buildscript {
|
|
9
|
+
repositories {
|
|
10
|
+
google()
|
|
11
|
+
mavenCentral()
|
|
12
|
+
}
|
|
13
|
+
dependencies {
|
|
14
|
+
classpath 'com.android.tools.build:gradle:8.13.0'
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
apply plugin: 'com.android.library'
|
|
19
|
+
|
|
20
|
+
android {
|
|
21
|
+
namespace = "io.capawesome.capacitorjs.plugins.apptrackingtransparency"
|
|
22
|
+
compileSdk = project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 36
|
|
23
|
+
defaultConfig {
|
|
24
|
+
minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 24
|
|
25
|
+
targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 36
|
|
26
|
+
versionCode 1
|
|
27
|
+
versionName "1.0"
|
|
28
|
+
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
|
29
|
+
}
|
|
30
|
+
buildTypes {
|
|
31
|
+
release {
|
|
32
|
+
minifyEnabled false
|
|
33
|
+
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
lintOptions {
|
|
37
|
+
abortOnError = false
|
|
38
|
+
}
|
|
39
|
+
compileOptions {
|
|
40
|
+
sourceCompatibility JavaVersion.VERSION_21
|
|
41
|
+
targetCompatibility JavaVersion.VERSION_21
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
repositories {
|
|
46
|
+
google()
|
|
47
|
+
mavenCentral()
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
dependencies {
|
|
52
|
+
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
|
53
|
+
implementation project(':capacitor-android')
|
|
54
|
+
implementation "androidx.appcompat:appcompat:$androidxAppCompatVersion"
|
|
55
|
+
testImplementation "junit:junit:$junitVersion"
|
|
56
|
+
androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion"
|
|
57
|
+
androidTestImplementation "androidx.test.espresso:espresso-core:$androidxEspressoCoreVersion"
|
|
58
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
package io.capawesome.capacitorjs.plugins.apptrackingtransparency;
|
|
2
|
+
|
|
3
|
+
import androidx.annotation.NonNull;
|
|
4
|
+
import com.getcapacitor.Plugin;
|
|
5
|
+
import com.getcapacitor.PluginCall;
|
|
6
|
+
import com.getcapacitor.PluginMethod;
|
|
7
|
+
import com.getcapacitor.annotation.CapacitorPlugin;
|
|
8
|
+
|
|
9
|
+
@CapacitorPlugin(name = "AppTrackingTransparency")
|
|
10
|
+
public class AppTrackingTransparencyPlugin extends Plugin {
|
|
11
|
+
|
|
12
|
+
@PluginMethod
|
|
13
|
+
public void getAdvertisingIdentifier(PluginCall call) {
|
|
14
|
+
rejectCallAsUnimplemented(call);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
@PluginMethod
|
|
18
|
+
public void getStatus(PluginCall call) {
|
|
19
|
+
rejectCallAsUnimplemented(call);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
@PluginMethod
|
|
23
|
+
public void requestPermission(PluginCall call) {
|
|
24
|
+
rejectCallAsUnimplemented(call);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
private void rejectCallAsUnimplemented(@NonNull PluginCall call) {
|
|
28
|
+
call.unimplemented("This method is not available on this platform.");
|
|
29
|
+
}
|
|
30
|
+
}
|
|
File without changes
|
package/dist/docs.json
ADDED
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
{
|
|
2
|
+
"api": {
|
|
3
|
+
"name": "AppTrackingTransparencyPlugin",
|
|
4
|
+
"slug": "apptrackingtransparencyplugin",
|
|
5
|
+
"docs": "",
|
|
6
|
+
"tags": [],
|
|
7
|
+
"methods": [
|
|
8
|
+
{
|
|
9
|
+
"name": "getAdvertisingIdentifier",
|
|
10
|
+
"signature": "() => Promise<GetAdvertisingIdentifierResult>",
|
|
11
|
+
"parameters": [],
|
|
12
|
+
"returns": "Promise<GetAdvertisingIdentifierResult>",
|
|
13
|
+
"tags": [
|
|
14
|
+
{
|
|
15
|
+
"name": "since",
|
|
16
|
+
"text": "0.1.0"
|
|
17
|
+
}
|
|
18
|
+
],
|
|
19
|
+
"docs": "Get the advertising identifier (IDFA) of the device.\n\nThe advertising identifier is only available if the tracking authorization\nstatus is `authorized`. Otherwise, `null` is returned.\n\n**Note**: The iOS Simulator always returns `null`, even if the tracking\nauthorization status is `authorized`. Use a real device to test this method.\n\nOnly available on iOS.",
|
|
20
|
+
"complexTypes": [
|
|
21
|
+
"GetAdvertisingIdentifierResult"
|
|
22
|
+
],
|
|
23
|
+
"slug": "getadvertisingidentifier"
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"name": "getStatus",
|
|
27
|
+
"signature": "() => Promise<GetStatusResult>",
|
|
28
|
+
"parameters": [],
|
|
29
|
+
"returns": "Promise<GetStatusResult>",
|
|
30
|
+
"tags": [
|
|
31
|
+
{
|
|
32
|
+
"name": "since",
|
|
33
|
+
"text": "0.1.0"
|
|
34
|
+
}
|
|
35
|
+
],
|
|
36
|
+
"docs": "Get the current tracking authorization status.\n\nOnly available on iOS.",
|
|
37
|
+
"complexTypes": [
|
|
38
|
+
"GetStatusResult"
|
|
39
|
+
],
|
|
40
|
+
"slug": "getstatus"
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"name": "requestPermission",
|
|
44
|
+
"signature": "() => Promise<RequestPermissionResult>",
|
|
45
|
+
"parameters": [],
|
|
46
|
+
"returns": "Promise<RequestPermissionResult>",
|
|
47
|
+
"tags": [
|
|
48
|
+
{
|
|
49
|
+
"name": "since",
|
|
50
|
+
"text": "0.1.0"
|
|
51
|
+
}
|
|
52
|
+
],
|
|
53
|
+
"docs": "Request permission to track the user.\n\nThis will present the system tracking authorization prompt if the status\nhas not been determined yet. The prompt is only shown once per install.\n\nThe `NSUserTrackingUsageDescription` key must be added to the `Info.plist`\nfile of your app.\n\nOnly available on iOS.",
|
|
54
|
+
"complexTypes": [
|
|
55
|
+
"RequestPermissionResult"
|
|
56
|
+
],
|
|
57
|
+
"slug": "requestpermission"
|
|
58
|
+
}
|
|
59
|
+
],
|
|
60
|
+
"properties": []
|
|
61
|
+
},
|
|
62
|
+
"interfaces": [
|
|
63
|
+
{
|
|
64
|
+
"name": "GetAdvertisingIdentifierResult",
|
|
65
|
+
"slug": "getadvertisingidentifierresult",
|
|
66
|
+
"docs": "",
|
|
67
|
+
"tags": [
|
|
68
|
+
{
|
|
69
|
+
"text": "0.1.0",
|
|
70
|
+
"name": "since"
|
|
71
|
+
}
|
|
72
|
+
],
|
|
73
|
+
"methods": [],
|
|
74
|
+
"properties": [
|
|
75
|
+
{
|
|
76
|
+
"name": "advertisingIdentifier",
|
|
77
|
+
"tags": [
|
|
78
|
+
{
|
|
79
|
+
"text": "'6D92078A-8246-4BA4-AE5B-76104861E7DC'",
|
|
80
|
+
"name": "example"
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
"text": "0.1.0",
|
|
84
|
+
"name": "since"
|
|
85
|
+
}
|
|
86
|
+
],
|
|
87
|
+
"docs": "The advertising identifier (IDFA) of the device.\n\nReturns `null` if the tracking authorization status is not `authorized`\nor if no advertising identifier is available, which is always the case\non the iOS Simulator.",
|
|
88
|
+
"complexTypes": [],
|
|
89
|
+
"type": "string | null"
|
|
90
|
+
}
|
|
91
|
+
]
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
"name": "GetStatusResult",
|
|
95
|
+
"slug": "getstatusresult",
|
|
96
|
+
"docs": "",
|
|
97
|
+
"tags": [
|
|
98
|
+
{
|
|
99
|
+
"text": "0.1.0",
|
|
100
|
+
"name": "since"
|
|
101
|
+
}
|
|
102
|
+
],
|
|
103
|
+
"methods": [],
|
|
104
|
+
"properties": [
|
|
105
|
+
{
|
|
106
|
+
"name": "status",
|
|
107
|
+
"tags": [
|
|
108
|
+
{
|
|
109
|
+
"text": "0.1.0",
|
|
110
|
+
"name": "since"
|
|
111
|
+
}
|
|
112
|
+
],
|
|
113
|
+
"docs": "The current tracking authorization status.",
|
|
114
|
+
"complexTypes": [
|
|
115
|
+
"TrackingStatus"
|
|
116
|
+
],
|
|
117
|
+
"type": "TrackingStatus"
|
|
118
|
+
}
|
|
119
|
+
]
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
"name": "RequestPermissionResult",
|
|
123
|
+
"slug": "requestpermissionresult",
|
|
124
|
+
"docs": "",
|
|
125
|
+
"tags": [
|
|
126
|
+
{
|
|
127
|
+
"text": "0.1.0",
|
|
128
|
+
"name": "since"
|
|
129
|
+
}
|
|
130
|
+
],
|
|
131
|
+
"methods": [],
|
|
132
|
+
"properties": [
|
|
133
|
+
{
|
|
134
|
+
"name": "status",
|
|
135
|
+
"tags": [
|
|
136
|
+
{
|
|
137
|
+
"text": "0.1.0",
|
|
138
|
+
"name": "since"
|
|
139
|
+
}
|
|
140
|
+
],
|
|
141
|
+
"docs": "The tracking authorization status after the request.",
|
|
142
|
+
"complexTypes": [
|
|
143
|
+
"TrackingStatus"
|
|
144
|
+
],
|
|
145
|
+
"type": "TrackingStatus"
|
|
146
|
+
}
|
|
147
|
+
]
|
|
148
|
+
}
|
|
149
|
+
],
|
|
150
|
+
"enums": [],
|
|
151
|
+
"typeAliases": [
|
|
152
|
+
{
|
|
153
|
+
"name": "TrackingStatus",
|
|
154
|
+
"slug": "trackingstatus",
|
|
155
|
+
"docs": "The tracking authorization status.\n\n- `authorized`: The user authorized access to app-related data for tracking.\n- `denied`: The user denied access to app-related data for tracking.\n- `notDetermined`: The user has not yet received a tracking authorization request.\n- `restricted`: Tracking authorization is restricted and cannot be changed by the user.",
|
|
156
|
+
"types": [
|
|
157
|
+
{
|
|
158
|
+
"text": "'authorized'",
|
|
159
|
+
"complexTypes": []
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
"text": "'denied'",
|
|
163
|
+
"complexTypes": []
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
"text": "'notDetermined'",
|
|
167
|
+
"complexTypes": []
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
"text": "'restricted'",
|
|
171
|
+
"complexTypes": []
|
|
172
|
+
}
|
|
173
|
+
]
|
|
174
|
+
}
|
|
175
|
+
],
|
|
176
|
+
"pluginConfigs": []
|
|
177
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
export interface AppTrackingTransparencyPlugin {
|
|
2
|
+
/**
|
|
3
|
+
* Get the advertising identifier (IDFA) of the device.
|
|
4
|
+
*
|
|
5
|
+
* The advertising identifier is only available if the tracking authorization
|
|
6
|
+
* status is `authorized`. Otherwise, `null` is returned.
|
|
7
|
+
*
|
|
8
|
+
* **Note**: The iOS Simulator always returns `null`, even if the tracking
|
|
9
|
+
* authorization status is `authorized`. Use a real device to test this method.
|
|
10
|
+
*
|
|
11
|
+
* Only available on iOS.
|
|
12
|
+
*
|
|
13
|
+
* @since 0.1.0
|
|
14
|
+
*/
|
|
15
|
+
getAdvertisingIdentifier(): Promise<GetAdvertisingIdentifierResult>;
|
|
16
|
+
/**
|
|
17
|
+
* Get the current tracking authorization status.
|
|
18
|
+
*
|
|
19
|
+
* Only available on iOS.
|
|
20
|
+
*
|
|
21
|
+
* @since 0.1.0
|
|
22
|
+
*/
|
|
23
|
+
getStatus(): Promise<GetStatusResult>;
|
|
24
|
+
/**
|
|
25
|
+
* Request permission to track the user.
|
|
26
|
+
*
|
|
27
|
+
* This will present the system tracking authorization prompt if the status
|
|
28
|
+
* has not been determined yet. The prompt is only shown once per install.
|
|
29
|
+
*
|
|
30
|
+
* The `NSUserTrackingUsageDescription` key must be added to the `Info.plist`
|
|
31
|
+
* file of your app.
|
|
32
|
+
*
|
|
33
|
+
* Only available on iOS.
|
|
34
|
+
*
|
|
35
|
+
* @since 0.1.0
|
|
36
|
+
*/
|
|
37
|
+
requestPermission(): Promise<RequestPermissionResult>;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* @since 0.1.0
|
|
41
|
+
*/
|
|
42
|
+
export interface GetStatusResult {
|
|
43
|
+
/**
|
|
44
|
+
* The current tracking authorization status.
|
|
45
|
+
*
|
|
46
|
+
* @since 0.1.0
|
|
47
|
+
*/
|
|
48
|
+
status: TrackingStatus;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* @since 0.1.0
|
|
52
|
+
*/
|
|
53
|
+
export interface RequestPermissionResult {
|
|
54
|
+
/**
|
|
55
|
+
* The tracking authorization status after the request.
|
|
56
|
+
*
|
|
57
|
+
* @since 0.1.0
|
|
58
|
+
*/
|
|
59
|
+
status: TrackingStatus;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* @since 0.1.0
|
|
63
|
+
*/
|
|
64
|
+
export interface GetAdvertisingIdentifierResult {
|
|
65
|
+
/**
|
|
66
|
+
* The advertising identifier (IDFA) of the device.
|
|
67
|
+
*
|
|
68
|
+
* Returns `null` if the tracking authorization status is not `authorized`
|
|
69
|
+
* or if no advertising identifier is available, which is always the case
|
|
70
|
+
* on the iOS Simulator.
|
|
71
|
+
*
|
|
72
|
+
* @example '6D92078A-8246-4BA4-AE5B-76104861E7DC'
|
|
73
|
+
* @since 0.1.0
|
|
74
|
+
*/
|
|
75
|
+
advertisingIdentifier: string | null;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* The tracking authorization status.
|
|
79
|
+
*
|
|
80
|
+
* - `authorized`: The user authorized access to app-related data for tracking.
|
|
81
|
+
* - `denied`: The user denied access to app-related data for tracking.
|
|
82
|
+
* - `notDetermined`: The user has not yet received a tracking authorization request.
|
|
83
|
+
* - `restricted`: Tracking authorization is restricted and cannot be changed by the user.
|
|
84
|
+
*
|
|
85
|
+
* @since 0.1.0
|
|
86
|
+
*/
|
|
87
|
+
export type TrackingStatus = 'authorized' | 'denied' | 'notDetermined' | 'restricted';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["export interface AppTrackingTransparencyPlugin {\n /**\n * Get the advertising identifier (IDFA) of the device.\n *\n * The advertising identifier is only available if the tracking authorization\n * status is `authorized`. Otherwise, `null` is returned.\n *\n * **Note**: The iOS Simulator always returns `null`, even if the tracking\n * authorization status is `authorized`. Use a real device to test this method.\n *\n * Only available on iOS.\n *\n * @since 0.1.0\n */\n getAdvertisingIdentifier(): Promise<GetAdvertisingIdentifierResult>;\n /**\n * Get the current tracking authorization status.\n *\n * Only available on iOS.\n *\n * @since 0.1.0\n */\n getStatus(): Promise<GetStatusResult>;\n /**\n * Request permission to track the user.\n *\n * This will present the system tracking authorization prompt if the status\n * has not been determined yet. The prompt is only shown once per install.\n *\n * The `NSUserTrackingUsageDescription` key must be added to the `Info.plist`\n * file of your app.\n *\n * Only available on iOS.\n *\n * @since 0.1.0\n */\n requestPermission(): Promise<RequestPermissionResult>;\n}\n\n/**\n * @since 0.1.0\n */\nexport interface GetStatusResult {\n /**\n * The current tracking authorization status.\n *\n * @since 0.1.0\n */\n status: TrackingStatus;\n}\n\n/**\n * @since 0.1.0\n */\nexport interface RequestPermissionResult {\n /**\n * The tracking authorization status after the request.\n *\n * @since 0.1.0\n */\n status: TrackingStatus;\n}\n\n/**\n * @since 0.1.0\n */\nexport interface GetAdvertisingIdentifierResult {\n /**\n * The advertising identifier (IDFA) of the device.\n *\n * Returns `null` if the tracking authorization status is not `authorized`\n * or if no advertising identifier is available, which is always the case\n * on the iOS Simulator.\n *\n * @example '6D92078A-8246-4BA4-AE5B-76104861E7DC'\n * @since 0.1.0\n */\n advertisingIdentifier: string | null;\n}\n\n/**\n * The tracking authorization status.\n *\n * - `authorized`: The user authorized access to app-related data for tracking.\n * - `denied`: The user denied access to app-related data for tracking.\n * - `notDetermined`: The user has not yet received a tracking authorization request.\n * - `restricted`: Tracking authorization is restricted and cannot be changed by the user.\n *\n * @since 0.1.0\n */\nexport type TrackingStatus =\n | 'authorized'\n | 'denied'\n | 'notDetermined'\n | 'restricted';\n"]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { registerPlugin } from '@capacitor/core';
|
|
2
|
+
const AppTrackingTransparency = registerPlugin('AppTrackingTransparency', {
|
|
3
|
+
web: () => import('./web').then(m => new m.AppTrackingTransparencyWeb()),
|
|
4
|
+
});
|
|
5
|
+
export * from './definitions';
|
|
6
|
+
export { AppTrackingTransparency };
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAIjD,MAAM,uBAAuB,GAAG,cAAc,CAC5C,yBAAyB,EACzB;IACE,GAAG,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,0BAA0B,EAAE,CAAC;CACzE,CACF,CAAC;AAEF,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,uBAAuB,EAAE,CAAC","sourcesContent":["import { registerPlugin } from '@capacitor/core';\n\nimport type { AppTrackingTransparencyPlugin } from './definitions';\n\nconst AppTrackingTransparency = registerPlugin<AppTrackingTransparencyPlugin>(\n 'AppTrackingTransparency',\n {\n web: () => import('./web').then(m => new m.AppTrackingTransparencyWeb()),\n },\n);\n\nexport * from './definitions';\nexport { AppTrackingTransparency };\n"]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { WebPlugin } from '@capacitor/core';
|
|
2
|
+
import type { AppTrackingTransparencyPlugin, GetAdvertisingIdentifierResult, GetStatusResult, RequestPermissionResult } from './definitions';
|
|
3
|
+
export declare class AppTrackingTransparencyWeb extends WebPlugin implements AppTrackingTransparencyPlugin {
|
|
4
|
+
getAdvertisingIdentifier(): Promise<GetAdvertisingIdentifierResult>;
|
|
5
|
+
getStatus(): Promise<GetStatusResult>;
|
|
6
|
+
requestPermission(): Promise<RequestPermissionResult>;
|
|
7
|
+
}
|
package/dist/esm/web.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { WebPlugin } from '@capacitor/core';
|
|
2
|
+
export class AppTrackingTransparencyWeb extends WebPlugin {
|
|
3
|
+
async getAdvertisingIdentifier() {
|
|
4
|
+
throw this.unimplemented('Not implemented on web.');
|
|
5
|
+
}
|
|
6
|
+
async getStatus() {
|
|
7
|
+
throw this.unimplemented('Not implemented on web.');
|
|
8
|
+
}
|
|
9
|
+
async requestPermission() {
|
|
10
|
+
throw this.unimplemented('Not implemented on web.');
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=web.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAS5C,MAAM,OAAO,0BACX,SAAQ,SAAS;IAGjB,KAAK,CAAC,wBAAwB;QAC5B,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;IACtD,CAAC;IAED,KAAK,CAAC,SAAS;QACb,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;IACtD,CAAC;IAED,KAAK,CAAC,iBAAiB;QACrB,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;IACtD,CAAC;CACF","sourcesContent":["import { WebPlugin } from '@capacitor/core';\n\nimport type {\n AppTrackingTransparencyPlugin,\n GetAdvertisingIdentifierResult,\n GetStatusResult,\n RequestPermissionResult,\n} from './definitions';\n\nexport class AppTrackingTransparencyWeb\n extends WebPlugin\n implements AppTrackingTransparencyPlugin\n{\n async getAdvertisingIdentifier(): Promise<GetAdvertisingIdentifierResult> {\n throw this.unimplemented('Not implemented on web.');\n }\n\n async getStatus(): Promise<GetStatusResult> {\n throw this.unimplemented('Not implemented on web.');\n }\n\n async requestPermission(): Promise<RequestPermissionResult> {\n throw this.unimplemented('Not implemented on web.');\n }\n}\n"]}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var core = require('@capacitor/core');
|
|
4
|
+
|
|
5
|
+
const AppTrackingTransparency = core.registerPlugin('AppTrackingTransparency', {
|
|
6
|
+
web: () => Promise.resolve().then(function () { return web; }).then(m => new m.AppTrackingTransparencyWeb()),
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
class AppTrackingTransparencyWeb extends core.WebPlugin {
|
|
10
|
+
async getAdvertisingIdentifier() {
|
|
11
|
+
throw this.unimplemented('Not implemented on web.');
|
|
12
|
+
}
|
|
13
|
+
async getStatus() {
|
|
14
|
+
throw this.unimplemented('Not implemented on web.');
|
|
15
|
+
}
|
|
16
|
+
async requestPermission() {
|
|
17
|
+
throw this.unimplemented('Not implemented on web.');
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
var web = /*#__PURE__*/Object.freeze({
|
|
22
|
+
__proto__: null,
|
|
23
|
+
AppTrackingTransparencyWeb: AppTrackingTransparencyWeb
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
exports.AppTrackingTransparency = AppTrackingTransparency;
|
|
27
|
+
//# sourceMappingURL=plugin.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst AppTrackingTransparency = registerPlugin('AppTrackingTransparency', {\n web: () => import('./web').then(m => new m.AppTrackingTransparencyWeb()),\n});\nexport * from './definitions';\nexport { AppTrackingTransparency };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class AppTrackingTransparencyWeb extends WebPlugin {\n async getAdvertisingIdentifier() {\n throw this.unimplemented('Not implemented on web.');\n }\n async getStatus() {\n throw this.unimplemented('Not implemented on web.');\n }\n async requestPermission() {\n throw this.unimplemented('Not implemented on web.');\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;;AACK,MAAC,uBAAuB,GAAGA,mBAAc,CAAC,yBAAyB,EAAE;AAC1E,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,0BAA0B,EAAE,CAAC;AAC5E,CAAC;;ACFM,MAAM,0BAA0B,SAASC,cAAS,CAAC;AAC1D,IAAI,MAAM,wBAAwB,GAAG;AACrC,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC;AAC3D,IAAI;AACJ,IAAI,MAAM,SAAS,GAAG;AACtB,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC;AAC3D,IAAI;AACJ,IAAI,MAAM,iBAAiB,GAAG;AAC9B,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC;AAC3D,IAAI;AACJ;;;;;;;;;"}
|
package/dist/plugin.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
var capacitorAppTrackingTransparency = (function (exports, core) {
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
const AppTrackingTransparency = core.registerPlugin('AppTrackingTransparency', {
|
|
5
|
+
web: () => Promise.resolve().then(function () { return web; }).then(m => new m.AppTrackingTransparencyWeb()),
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
class AppTrackingTransparencyWeb extends core.WebPlugin {
|
|
9
|
+
async getAdvertisingIdentifier() {
|
|
10
|
+
throw this.unimplemented('Not implemented on web.');
|
|
11
|
+
}
|
|
12
|
+
async getStatus() {
|
|
13
|
+
throw this.unimplemented('Not implemented on web.');
|
|
14
|
+
}
|
|
15
|
+
async requestPermission() {
|
|
16
|
+
throw this.unimplemented('Not implemented on web.');
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
var web = /*#__PURE__*/Object.freeze({
|
|
21
|
+
__proto__: null,
|
|
22
|
+
AppTrackingTransparencyWeb: AppTrackingTransparencyWeb
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
exports.AppTrackingTransparency = AppTrackingTransparency;
|
|
26
|
+
|
|
27
|
+
return exports;
|
|
28
|
+
|
|
29
|
+
})({}, capacitorExports);
|
|
30
|
+
//# sourceMappingURL=plugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst AppTrackingTransparency = registerPlugin('AppTrackingTransparency', {\n web: () => import('./web').then(m => new m.AppTrackingTransparencyWeb()),\n});\nexport * from './definitions';\nexport { AppTrackingTransparency };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class AppTrackingTransparencyWeb extends WebPlugin {\n async getAdvertisingIdentifier() {\n throw this.unimplemented('Not implemented on web.');\n }\n async getStatus() {\n throw this.unimplemented('Not implemented on web.');\n }\n async requestPermission() {\n throw this.unimplemented('Not implemented on web.');\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;AACK,UAAC,uBAAuB,GAAGA,mBAAc,CAAC,yBAAyB,EAAE;IAC1E,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,0BAA0B,EAAE,CAAC;IAC5E,CAAC;;ICFM,MAAM,0BAA0B,SAASC,cAAS,CAAC;IAC1D,IAAI,MAAM,wBAAwB,GAAG;IACrC,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC;IAC3D,IAAI;IACJ,IAAI,MAAM,SAAS,GAAG;IACtB,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC;IAC3D,IAAI;IACJ,IAAI,MAAM,iBAAiB,GAAG;IAC9B,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC;IAC3D,IAAI;IACJ;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import Foundation
|
|
2
|
+
import AdSupport
|
|
3
|
+
import AppTrackingTransparency
|
|
4
|
+
|
|
5
|
+
@objc public class AppTrackingTransparency: NSObject {
|
|
6
|
+
let plugin: AppTrackingTransparencyPlugin
|
|
7
|
+
|
|
8
|
+
init(plugin: AppTrackingTransparencyPlugin) {
|
|
9
|
+
self.plugin = plugin
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
@objc public func getAdvertisingIdentifier(completion: @escaping (GetAdvertisingIdentifierResult?, Error?) -> Void) {
|
|
13
|
+
let identifier = ASIdentifierManager.shared().advertisingIdentifier.uuidString
|
|
14
|
+
let advertisingIdentifier = identifier == Self.zeroIdentifier ? nil : identifier
|
|
15
|
+
let result = GetAdvertisingIdentifierResult(advertisingIdentifier: advertisingIdentifier)
|
|
16
|
+
completion(result, nil)
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
@objc public func getStatus(completion: @escaping (GetStatusResult?, Error?) -> Void) {
|
|
20
|
+
let status = Self.mapAuthorizationStatus(ATTrackingManager.trackingAuthorizationStatus)
|
|
21
|
+
let result = GetStatusResult(status: status)
|
|
22
|
+
completion(result, nil)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
@objc public func requestPermission(completion: @escaping (RequestPermissionResult?, Error?) -> Void) {
|
|
26
|
+
guard Bundle.main.object(forInfoDictionaryKey: "NSUserTrackingUsageDescription") is String else {
|
|
27
|
+
completion(nil, CustomError.usageDescriptionMissing)
|
|
28
|
+
return
|
|
29
|
+
}
|
|
30
|
+
DispatchQueue.main.async {
|
|
31
|
+
ATTrackingManager.requestTrackingAuthorization { status in
|
|
32
|
+
let result = RequestPermissionResult(status: Self.mapAuthorizationStatus(status))
|
|
33
|
+
completion(result, nil)
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
private static let zeroIdentifier = "00000000-0000-0000-0000-000000000000"
|
|
39
|
+
|
|
40
|
+
private static func mapAuthorizationStatus(_ status: ATTrackingManager.AuthorizationStatus) -> String {
|
|
41
|
+
switch status {
|
|
42
|
+
case .authorized:
|
|
43
|
+
return "authorized"
|
|
44
|
+
case .denied:
|
|
45
|
+
return "denied"
|
|
46
|
+
case .restricted:
|
|
47
|
+
return "restricted"
|
|
48
|
+
case .notDetermined:
|
|
49
|
+
return "notDetermined"
|
|
50
|
+
@unknown default:
|
|
51
|
+
return "notDetermined"
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import Foundation
|
|
2
|
+
import Capacitor
|
|
3
|
+
|
|
4
|
+
@objc(AppTrackingTransparencyPlugin)
|
|
5
|
+
public class AppTrackingTransparencyPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
6
|
+
public let identifier = "AppTrackingTransparencyPlugin"
|
|
7
|
+
public let jsName = "AppTrackingTransparency"
|
|
8
|
+
public let pluginMethods: [CAPPluginMethod] = [
|
|
9
|
+
CAPPluginMethod(name: "getAdvertisingIdentifier", returnType: CAPPluginReturnPromise),
|
|
10
|
+
CAPPluginMethod(name: "getStatus", returnType: CAPPluginReturnPromise),
|
|
11
|
+
CAPPluginMethod(name: "requestPermission", returnType: CAPPluginReturnPromise)
|
|
12
|
+
]
|
|
13
|
+
|
|
14
|
+
public static let tag = "AppTrackingTransparencyPlugin"
|
|
15
|
+
|
|
16
|
+
private var implementation: AppTrackingTransparency?
|
|
17
|
+
|
|
18
|
+
override public func load() {
|
|
19
|
+
self.implementation = AppTrackingTransparency(plugin: self)
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
@objc func getAdvertisingIdentifier(_ call: CAPPluginCall) {
|
|
23
|
+
implementation?.getAdvertisingIdentifier { result, error in
|
|
24
|
+
if let error = error {
|
|
25
|
+
self.rejectCall(call, error)
|
|
26
|
+
return
|
|
27
|
+
}
|
|
28
|
+
self.resolveCall(call, result)
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
@objc func getStatus(_ call: CAPPluginCall) {
|
|
33
|
+
implementation?.getStatus { result, error in
|
|
34
|
+
if let error = error {
|
|
35
|
+
self.rejectCall(call, error)
|
|
36
|
+
return
|
|
37
|
+
}
|
|
38
|
+
self.resolveCall(call, result)
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
@objc func requestPermission(_ call: CAPPluginCall) {
|
|
43
|
+
implementation?.requestPermission { result, error in
|
|
44
|
+
if let error = error {
|
|
45
|
+
self.rejectCall(call, error)
|
|
46
|
+
return
|
|
47
|
+
}
|
|
48
|
+
self.resolveCall(call, result)
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
private func rejectCall(_ call: CAPPluginCall, _ error: Error) {
|
|
53
|
+
CAPLog.print("[", AppTrackingTransparencyPlugin.tag, "] ", error)
|
|
54
|
+
call.reject(error.localizedDescription)
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
private func resolveCall(_ call: CAPPluginCall, _ result: Result?) {
|
|
58
|
+
if let result = result?.toJSObject() as? JSObject {
|
|
59
|
+
call.resolve(result)
|
|
60
|
+
} else {
|
|
61
|
+
call.resolve()
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import Foundation
|
|
2
|
+
import Capacitor
|
|
3
|
+
|
|
4
|
+
@objc public class GetAdvertisingIdentifierResult: NSObject, Result {
|
|
5
|
+
let advertisingIdentifier: String?
|
|
6
|
+
|
|
7
|
+
init(advertisingIdentifier: String?) {
|
|
8
|
+
self.advertisingIdentifier = advertisingIdentifier
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
@objc public func toJSObject() -> AnyObject {
|
|
12
|
+
var result = JSObject()
|
|
13
|
+
result["advertisingIdentifier"] = advertisingIdentifier == nil ? NSNull() : advertisingIdentifier
|
|
14
|
+
return result as AnyObject
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import Foundation
|
|
2
|
+
import Capacitor
|
|
3
|
+
|
|
4
|
+
@objc public class GetStatusResult: NSObject, Result {
|
|
5
|
+
let status: String
|
|
6
|
+
|
|
7
|
+
init(status: String) {
|
|
8
|
+
self.status = status
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
@objc public func toJSObject() -> AnyObject {
|
|
12
|
+
var result = JSObject()
|
|
13
|
+
result["status"] = status
|
|
14
|
+
return result as AnyObject
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import Foundation
|
|
2
|
+
import Capacitor
|
|
3
|
+
|
|
4
|
+
@objc public class RequestPermissionResult: NSObject, Result {
|
|
5
|
+
let status: String
|
|
6
|
+
|
|
7
|
+
init(status: String) {
|
|
8
|
+
self.status = status
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
@objc public func toJSObject() -> AnyObject {
|
|
12
|
+
var result = JSObject()
|
|
13
|
+
result["status"] = status
|
|
14
|
+
return result as AnyObject
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import Foundation
|
|
2
|
+
|
|
3
|
+
public enum CustomError: Error {
|
|
4
|
+
case usageDescriptionMissing
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
extension CustomError: LocalizedError {
|
|
8
|
+
public var errorDescription: String? {
|
|
9
|
+
switch self {
|
|
10
|
+
case .usageDescriptionMissing:
|
|
11
|
+
return NSLocalizedString("NSUserTrackingUsageDescription key is missing in the Info.plist file.", comment: "usageDescriptionMissing")
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
3
|
+
<plist version="1.0">
|
|
4
|
+
<dict>
|
|
5
|
+
<key>CFBundleDevelopmentRegion</key>
|
|
6
|
+
<string>$(DEVELOPMENT_LANGUAGE)</string>
|
|
7
|
+
<key>CFBundleExecutable</key>
|
|
8
|
+
<string>$(EXECUTABLE_NAME)</string>
|
|
9
|
+
<key>CFBundleIdentifier</key>
|
|
10
|
+
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
|
11
|
+
<key>CFBundleInfoDictionaryVersion</key>
|
|
12
|
+
<string>6.0</string>
|
|
13
|
+
<key>CFBundleName</key>
|
|
14
|
+
<string>$(PRODUCT_NAME)</string>
|
|
15
|
+
<key>CFBundlePackageType</key>
|
|
16
|
+
<string>FMWK</string>
|
|
17
|
+
<key>CFBundleShortVersionString</key>
|
|
18
|
+
<string>1.0</string>
|
|
19
|
+
<key>CFBundleVersion</key>
|
|
20
|
+
<string>$(CURRENT_PROJECT_VERSION)</string>
|
|
21
|
+
<key>NSPrincipalClass</key>
|
|
22
|
+
<string></string>
|
|
23
|
+
</dict>
|
|
24
|
+
</plist>
|
package/package.json
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@capawesome/capacitor-app-tracking-transparency",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "Capacitor plugin for the App Tracking Transparency framework.",
|
|
5
|
+
"main": "dist/plugin.cjs.js",
|
|
6
|
+
"module": "dist/esm/index.js",
|
|
7
|
+
"types": "dist/esm/index.d.ts",
|
|
8
|
+
"unpkg": "dist/plugin.js",
|
|
9
|
+
"files": [
|
|
10
|
+
"android/src/main/",
|
|
11
|
+
"android/build.gradle",
|
|
12
|
+
"dist/",
|
|
13
|
+
"ios/Plugin/",
|
|
14
|
+
"CapawesomeCapacitorAppTrackingTransparency.podspec",
|
|
15
|
+
"Package.swift"
|
|
16
|
+
],
|
|
17
|
+
"author": "Robin Genz <mail@robingenz.dev>",
|
|
18
|
+
"license": "MIT",
|
|
19
|
+
"repository": {
|
|
20
|
+
"type": "git",
|
|
21
|
+
"url": "git+https://github.com/capawesome-team/capacitor-plugins.git"
|
|
22
|
+
},
|
|
23
|
+
"bugs": {
|
|
24
|
+
"url": "https://github.com/capawesome-team/capacitor-plugins/issues"
|
|
25
|
+
},
|
|
26
|
+
"funding": [
|
|
27
|
+
{
|
|
28
|
+
"type": "github",
|
|
29
|
+
"url": "https://github.com/sponsors/capawesome-team/"
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"type": "opencollective",
|
|
33
|
+
"url": "https://opencollective.com/capawesome"
|
|
34
|
+
}
|
|
35
|
+
],
|
|
36
|
+
"homepage": "https://capawesome.io/docs/plugins/app-tracking-transparency/",
|
|
37
|
+
"keywords": [
|
|
38
|
+
"capacitor",
|
|
39
|
+
"plugin",
|
|
40
|
+
"native"
|
|
41
|
+
],
|
|
42
|
+
"scripts": {
|
|
43
|
+
"verify": "npm run verify:ios && npm run verify:android && npm run verify:web",
|
|
44
|
+
"verify:ios": "cd ios && pod install && xcodebuild -workspace Plugin.xcworkspace -scheme Plugin -destination generic/platform=iOS && cd ..",
|
|
45
|
+
"verify:android": "cd android && ./gradlew clean build test && cd ..",
|
|
46
|
+
"verify:web": "npm run build",
|
|
47
|
+
"lint": "npm run eslint && npm run prettier -- --check && npm run swiftlint -- lint",
|
|
48
|
+
"fmt": "npm run eslint -- --fix && npm run prettier -- --write && npm run swiftlint -- --fix --format",
|
|
49
|
+
"eslint": "eslint . --ext ts",
|
|
50
|
+
"prettier": "prettier \"**/*.{css,html,ts,js,java}\"",
|
|
51
|
+
"swiftlint": "node-swiftlint",
|
|
52
|
+
"docgen": "docgen --api AppTrackingTransparencyPlugin --output-readme README.md --output-json dist/docs.json",
|
|
53
|
+
"build": "npm run clean && npm run docgen && tsc && rollup -c rollup.config.mjs",
|
|
54
|
+
"clean": "rimraf ./dist",
|
|
55
|
+
"watch": "tsc --watch",
|
|
56
|
+
"ios:pod:install": "cd ios && pod install --repo-update && cd ..",
|
|
57
|
+
"ios:spm:install": "cd ios && swift package resolve && cd ..",
|
|
58
|
+
"prepublishOnly": "npm run build"
|
|
59
|
+
},
|
|
60
|
+
"devDependencies": {
|
|
61
|
+
"@capacitor/android": "8.0.0",
|
|
62
|
+
"@capacitor/cli": "8.0.0",
|
|
63
|
+
"@capacitor/core": "8.0.0",
|
|
64
|
+
"@capacitor/docgen": "0.3.1",
|
|
65
|
+
"@capacitor/ios": "8.0.0",
|
|
66
|
+
"@ionic/eslint-config": "0.4.0",
|
|
67
|
+
"eslint": "8.57.0",
|
|
68
|
+
"prettier-plugin-java": "2.6.7",
|
|
69
|
+
"rimraf": "6.1.2",
|
|
70
|
+
"rollup": "4.53.3",
|
|
71
|
+
"swiftlint": "2.0.0",
|
|
72
|
+
"typescript": "5.9.3"
|
|
73
|
+
},
|
|
74
|
+
"peerDependencies": {
|
|
75
|
+
"@capacitor/core": ">=8.0.0"
|
|
76
|
+
},
|
|
77
|
+
"eslintConfig": {
|
|
78
|
+
"extends": "@ionic/eslint-config/recommended"
|
|
79
|
+
},
|
|
80
|
+
"capacitor": {
|
|
81
|
+
"ios": {
|
|
82
|
+
"src": "ios"
|
|
83
|
+
},
|
|
84
|
+
"android": {
|
|
85
|
+
"src": "android"
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
"publishConfig": {
|
|
89
|
+
"access": "public"
|
|
90
|
+
}
|
|
91
|
+
}
|