@capawesome/capacitor-app-icon 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.
Files changed (38) hide show
  1. package/CapawesomeCapacitorAppIcon.podspec +17 -0
  2. package/LICENSE +21 -0
  3. package/Package.swift +28 -0
  4. package/README.md +280 -0
  5. package/android/build.gradle +58 -0
  6. package/android/src/main/AndroidManifest.xml +2 -0
  7. package/android/src/main/java/io/capawesome/capacitorjs/plugins/appicon/AppIcon.java +118 -0
  8. package/android/src/main/java/io/capawesome/capacitorjs/plugins/appicon/AppIconPlugin.java +94 -0
  9. package/android/src/main/java/io/capawesome/capacitorjs/plugins/appicon/classes/CustomException.java +20 -0
  10. package/android/src/main/java/io/capawesome/capacitorjs/plugins/appicon/classes/CustomExceptions.java +11 -0
  11. package/android/src/main/java/io/capawesome/capacitorjs/plugins/appicon/classes/options/SetIconOptions.java +29 -0
  12. package/android/src/main/java/io/capawesome/capacitorjs/plugins/appicon/classes/results/GetCurrentIconResult.java +25 -0
  13. package/android/src/main/java/io/capawesome/capacitorjs/plugins/appicon/classes/results/IsAvailableResult.java +22 -0
  14. package/android/src/main/java/io/capawesome/capacitorjs/plugins/appicon/interfaces/Result.java +7 -0
  15. package/android/src/main/res/.gitkeep +0 -0
  16. package/dist/docs.json +174 -0
  17. package/dist/esm/definitions.d.ts +100 -0
  18. package/dist/esm/definitions.js +19 -0
  19. package/dist/esm/definitions.js.map +1 -0
  20. package/dist/esm/index.d.ts +4 -0
  21. package/dist/esm/index.js +7 -0
  22. package/dist/esm/index.js.map +1 -0
  23. package/dist/esm/web.d.ts +8 -0
  24. package/dist/esm/web.js +16 -0
  25. package/dist/esm/web.js.map +1 -0
  26. package/dist/plugin.cjs.js +49 -0
  27. package/dist/plugin.cjs.js.map +1 -0
  28. package/dist/plugin.js +52 -0
  29. package/dist/plugin.js.map +1 -0
  30. package/ios/Plugin/AppIcon.swift +40 -0
  31. package/ios/Plugin/AppIconPlugin.swift +77 -0
  32. package/ios/Plugin/Classes/Options/SetIconOptions.swift +17 -0
  33. package/ios/Plugin/Classes/Results/GetCurrentIconResult.swift +16 -0
  34. package/ios/Plugin/Classes/Results/IsAvailableResult.swift +16 -0
  35. package/ios/Plugin/Enums/CustomError.swift +31 -0
  36. package/ios/Plugin/Info.plist +24 -0
  37. package/ios/Plugin/Protocols/Result.swift +5 -0
  38. package/package.json +91 -0
@@ -0,0 +1,16 @@
1
+ import Foundation
2
+ import Capacitor
3
+
4
+ @objc public class GetCurrentIconResult: NSObject, Result {
5
+ let icon: String?
6
+
7
+ init(icon: String?) {
8
+ self.icon = icon
9
+ }
10
+
11
+ @objc public func toJSObject() -> AnyObject {
12
+ var result = JSObject()
13
+ result["icon"] = icon == nil ? NSNull() : icon
14
+ return result as AnyObject
15
+ }
16
+ }
@@ -0,0 +1,16 @@
1
+ import Foundation
2
+ import Capacitor
3
+
4
+ @objc public class IsAvailableResult: NSObject, Result {
5
+ let available: Bool
6
+
7
+ init(available: Bool) {
8
+ self.available = available
9
+ }
10
+
11
+ @objc public func toJSObject() -> AnyObject {
12
+ var result = JSObject()
13
+ result["available"] = available
14
+ return result as AnyObject
15
+ }
16
+ }
@@ -0,0 +1,31 @@
1
+ import Foundation
2
+
3
+ public enum CustomError: Error {
4
+ case changeFailed
5
+ case iconMissing
6
+ case iconNotFound
7
+
8
+ var code: String? {
9
+ switch self {
10
+ case .changeFailed:
11
+ return "CHANGE_FAILED"
12
+ case .iconMissing:
13
+ return nil
14
+ case .iconNotFound:
15
+ return "ICON_NOT_FOUND"
16
+ }
17
+ }
18
+ }
19
+
20
+ extension CustomError: LocalizedError {
21
+ public var errorDescription: String? {
22
+ switch self {
23
+ case .changeFailed:
24
+ return NSLocalizedString("The app icon could not be changed.", comment: "changeFailed")
25
+ case .iconMissing:
26
+ return NSLocalizedString("icon must be provided.", comment: "iconMissing")
27
+ case .iconNotFound:
28
+ return NSLocalizedString("The alternate icon with the given name could not be found.", comment: "iconNotFound")
29
+ }
30
+ }
31
+ }
@@ -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>
@@ -0,0 +1,5 @@
1
+ import Capacitor
2
+
3
+ @objc public protocol Result {
4
+ @objc func toJSObject() -> AnyObject
5
+ }
package/package.json ADDED
@@ -0,0 +1,91 @@
1
+ {
2
+ "name": "@capawesome/capacitor-app-icon",
3
+ "version": "0.0.1",
4
+ "description": "Capacitor plugin to change the app icon at runtime.",
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
+ "CapawesomeCapacitorAppIcon.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-icon/",
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 AppIconPlugin --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
+ }