@capgo/capacitor-permissions 0.0.0-stage → 8.2.2
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/CapgoCapacitorPermissions.podspec +17 -0
- package/LICENSE +373 -0
- package/Package.swift +40 -0
- package/README.md +456 -2
- package/android/build.gradle +68 -0
- package/android/src/main/AndroidManifest.xml +2 -0
- package/android/src/main/kotlin/app/capgo/permissions/Permissions.kt +263 -0
- package/android/src/main/kotlin/app/capgo/permissions/PermissionsPlugin.kt +273 -0
- package/android/src/main/res/.gitkeep +0 -0
- package/dist/docs.json +587 -0
- package/dist/esm/definitions.d.ts +219 -0
- package/dist/esm/definitions.js +2 -0
- package/dist/esm/definitions.js.map +1 -0
- package/dist/esm/index.d.ts +5 -0
- package/dist/esm/index.js +7 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/web.d.ts +27 -0
- package/dist/esm/web.js +113 -0
- package/dist/esm/web.js.map +1 -0
- package/dist/plugin.cjs.js +127 -0
- package/dist/plugin.cjs.js.map +1 -0
- package/dist/plugin.js +130 -0
- package/dist/plugin.js.map +1 -0
- package/ios/Sources/PermissionsPlugin/PermissionStatusMapper.swift +139 -0
- package/ios/Sources/PermissionsPlugin/Permissions.swift +222 -0
- package/ios/Sources/PermissionsPlugin/PermissionsPlugin.swift +123 -0
- package/ios/Tests/PermissionsPluginTests/PermissionsTests.swift +73 -0
- package/package.json +93 -4
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import XCTest
|
|
2
|
+
@testable import PermissionsPlugin
|
|
3
|
+
import Photos
|
|
4
|
+
import AVFoundation
|
|
5
|
+
import Contacts
|
|
6
|
+
import Speech
|
|
7
|
+
import AppTrackingTransparency
|
|
8
|
+
import CoreBluetooth
|
|
9
|
+
import CoreLocation
|
|
10
|
+
|
|
11
|
+
class PermissionsTests: XCTestCase {
|
|
12
|
+
func testPhotoStatusMapping() {
|
|
13
|
+
XCTAssertEqual(PermissionStatusMapper.fromPhoto(.authorized), .granted)
|
|
14
|
+
XCTAssertEqual(PermissionStatusMapper.fromPhoto(.limited), .limited)
|
|
15
|
+
XCTAssertEqual(PermissionStatusMapper.fromPhoto(.denied), .denied)
|
|
16
|
+
XCTAssertEqual(PermissionStatusMapper.fromPhoto(.restricted), .blocked)
|
|
17
|
+
XCTAssertEqual(PermissionStatusMapper.fromPhoto(.notDetermined), .denied)
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
func testAVStatusMapping() {
|
|
21
|
+
XCTAssertEqual(PermissionStatusMapper.fromAV(.authorized), .granted)
|
|
22
|
+
XCTAssertEqual(PermissionStatusMapper.fromAV(.denied), .denied)
|
|
23
|
+
XCTAssertEqual(PermissionStatusMapper.fromAV(.restricted), .blocked)
|
|
24
|
+
XCTAssertEqual(PermissionStatusMapper.fromAV(.notDetermined), .denied)
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
func testContactsStatusMapping() {
|
|
28
|
+
XCTAssertEqual(PermissionStatusMapper.fromContacts(.authorized), .granted)
|
|
29
|
+
XCTAssertEqual(PermissionStatusMapper.fromContacts(.denied), .denied)
|
|
30
|
+
XCTAssertEqual(PermissionStatusMapper.fromContacts(.restricted), .blocked)
|
|
31
|
+
XCTAssertEqual(PermissionStatusMapper.fromContacts(.notDetermined), .denied)
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
func testSpeechStatusMapping() {
|
|
35
|
+
XCTAssertEqual(PermissionStatusMapper.fromSpeech(.authorized), .granted)
|
|
36
|
+
XCTAssertEqual(PermissionStatusMapper.fromSpeech(.denied), .denied)
|
|
37
|
+
XCTAssertEqual(PermissionStatusMapper.fromSpeech(.restricted), .blocked)
|
|
38
|
+
XCTAssertEqual(PermissionStatusMapper.fromSpeech(.notDetermined), .denied)
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
func testTrackingStatusMapping() {
|
|
42
|
+
XCTAssertEqual(PermissionStatusMapper.fromTracking(.authorized), .granted)
|
|
43
|
+
XCTAssertEqual(PermissionStatusMapper.fromTracking(.denied), .denied)
|
|
44
|
+
XCTAssertEqual(PermissionStatusMapper.fromTracking(.restricted), .blocked)
|
|
45
|
+
XCTAssertEqual(PermissionStatusMapper.fromTracking(.notDetermined), .denied)
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
func testBluetoothStatusMapping() {
|
|
49
|
+
XCTAssertEqual(PermissionStatusMapper.fromBluetooth(.allowedAlways), .granted)
|
|
50
|
+
XCTAssertEqual(PermissionStatusMapper.fromBluetooth(.denied), .denied)
|
|
51
|
+
XCTAssertEqual(PermissionStatusMapper.fromBluetooth(.restricted), .blocked)
|
|
52
|
+
XCTAssertEqual(PermissionStatusMapper.fromBluetooth(.notDetermined), .denied)
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
func testLocationStatusMapping() {
|
|
56
|
+
XCTAssertEqual(
|
|
57
|
+
PermissionStatusMapper.fromLocation(.authorizedWhenInUse, accuracy: .fullAccuracy),
|
|
58
|
+
.granted
|
|
59
|
+
)
|
|
60
|
+
XCTAssertEqual(
|
|
61
|
+
PermissionStatusMapper.fromLocation(.authorizedWhenInUse, accuracy: .reducedAccuracy),
|
|
62
|
+
.limited
|
|
63
|
+
)
|
|
64
|
+
XCTAssertEqual(PermissionStatusMapper.fromLocation(.denied, accuracy: nil), .denied)
|
|
65
|
+
XCTAssertEqual(PermissionStatusMapper.fromLocation(.restricted, accuracy: nil), .blocked)
|
|
66
|
+
XCTAssertEqual(PermissionStatusMapper.fromLocation(.notDetermined, accuracy: nil), .denied)
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
func testGetPluginVersion() {
|
|
70
|
+
let implementation = Permissions()
|
|
71
|
+
XCTAssertEqual("native", implementation.getPluginVersion())
|
|
72
|
+
}
|
|
73
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,95 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capgo/capacitor-permissions",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "8.2.2",
|
|
4
|
+
"description": "Capacitor plugin for checking and requesting app permissions.",
|
|
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/Sources",
|
|
14
|
+
"ios/Tests",
|
|
15
|
+
"Package.swift",
|
|
16
|
+
"CapgoCapacitorPermissions.podspec"
|
|
17
|
+
],
|
|
18
|
+
"author": "Martin Donadieu <martin@capgo.app>",
|
|
19
|
+
"license": "MPL-2.0",
|
|
20
|
+
"repository": {
|
|
21
|
+
"type": "git",
|
|
22
|
+
"url": "git+https://github.com/Cap-go/capacitor-permissions.git"
|
|
23
|
+
},
|
|
24
|
+
"bugs": {
|
|
25
|
+
"url": "https://github.com/Cap-go/capacitor-permissions/issues"
|
|
26
|
+
},
|
|
27
|
+
"homepage": "https://capgo.app/docs/plugins/permissions/",
|
|
28
|
+
"keywords": [
|
|
29
|
+
"capacitor",
|
|
30
|
+
"permissions",
|
|
31
|
+
"privacy",
|
|
32
|
+
"runtime-permissions",
|
|
33
|
+
"settings",
|
|
34
|
+
"plugin",
|
|
35
|
+
"native"
|
|
36
|
+
],
|
|
37
|
+
"scripts": {
|
|
38
|
+
"verify": "bun run verify:ios && bun run verify:android && bun run verify:web",
|
|
39
|
+
"verify:ios": "xcodebuild -scheme CapgoCapacitorPermissions -destination generic/platform=iOS",
|
|
40
|
+
"verify:android": "cd android && ./gradlew clean build test && cd ..",
|
|
41
|
+
"verify:web": "bun run build && bun run test:web",
|
|
42
|
+
"test:web": "bun test",
|
|
43
|
+
"lint": "bun run eslint && bun run prettier -- --check && bun run swiftlint -- lint",
|
|
44
|
+
"fmt": "bun run eslint -- --fix && bun run prettier -- --write && bun run swiftlint -- --fix --format",
|
|
45
|
+
"eslint": "eslint \"**/*.ts\"",
|
|
46
|
+
"prettier": "prettier-pretty-check \"**/*.{css,html,ts,js,java}\" --plugin=prettier-plugin-java",
|
|
47
|
+
"swiftlint": "node-swiftlint",
|
|
48
|
+
"docgen": "docgen --api PermissionsPlugin --output-readme README.md --output-json dist/docs.json",
|
|
49
|
+
"build": "bun run clean && bun run docgen && tsc && rollup -c rollup.config.mjs",
|
|
50
|
+
"clean": "rimraf ./dist",
|
|
51
|
+
"watch": "tsc --watch",
|
|
52
|
+
"prepublishOnly": "bun run build",
|
|
53
|
+
"check:wiring": "node scripts/check-capacitor-plugin-wiring.mjs",
|
|
54
|
+
"check:cap9-deprecated": "node scripts/check-cap9-deprecated.mjs",
|
|
55
|
+
"example:install": "cd example-app && bun install --frozen-lockfile",
|
|
56
|
+
"example:build": "bun run build && cd example-app && bun install --frozen-lockfile && bun run build",
|
|
57
|
+
"changelog:ai": "node scripts/generate-ai-changelog.mjs"
|
|
58
|
+
},
|
|
59
|
+
"devDependencies": {
|
|
60
|
+
"@capacitor/android": "^8.3.4",
|
|
61
|
+
"@capacitor/cli": "^8.3.4",
|
|
62
|
+
"@capacitor/core": "^8.3.4",
|
|
63
|
+
"@capacitor/docgen": "^0.3.1",
|
|
64
|
+
"@capacitor/ios": "^8.3.4",
|
|
65
|
+
"@eslint/js": "^10.0.1",
|
|
66
|
+
"@ionic/prettier-config": "^4.0.0",
|
|
67
|
+
"@ionic/swiftlint-config": "^2.0.0",
|
|
68
|
+
"@types/node": "^25.9.1",
|
|
69
|
+
"eslint": "^10.4.0",
|
|
70
|
+
"eslint-config-prettier": "^10.1.8",
|
|
71
|
+
"eslint-plugin-import": "^2.32.0",
|
|
72
|
+
"husky": "^9.1.7",
|
|
73
|
+
"prettier": "^3.8.3",
|
|
74
|
+
"prettier-plugin-java": "^2.9.2",
|
|
75
|
+
"prettier-pretty-check": "^0.2.0",
|
|
76
|
+
"rimraf": "^6.1.3",
|
|
77
|
+
"rollup": "^4.60.4",
|
|
78
|
+
"swiftlint": "^2.0.0",
|
|
79
|
+
"typescript": "^6.0.3",
|
|
80
|
+
"typescript-eslint": "^8.59.4"
|
|
81
|
+
},
|
|
82
|
+
"peerDependencies": {
|
|
83
|
+
"@capacitor/core": ">=8.0.0"
|
|
84
|
+
},
|
|
85
|
+
"prettier": "@ionic/prettier-config",
|
|
86
|
+
"swiftlint": "@ionic/swiftlint-config",
|
|
87
|
+
"capacitor": {
|
|
88
|
+
"ios": {
|
|
89
|
+
"src": "ios"
|
|
90
|
+
},
|
|
91
|
+
"android": {
|
|
92
|
+
"src": "android"
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|