@capacitor-community/fcm 7.1.2 → 7.2.0
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/Package.swift +46 -0
- package/README.md +11 -0
- package/ios/Plugin/Plugin.swift +3 -2
- package/package.json +3 -2
package/Package.swift
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
// swift-tools-version: 5.9
|
|
2
|
+
import PackageDescription
|
|
3
|
+
|
|
4
|
+
let package = Package(
|
|
5
|
+
name: "CapacitorCommunityFcm",
|
|
6
|
+
platforms: [.iOS(.v15)],
|
|
7
|
+
products: [
|
|
8
|
+
.library(
|
|
9
|
+
name: "CapacitorCommunityFcm",
|
|
10
|
+
targets: ["CapacitorCommunityFcmC", "CapacitorCommunityFcmSwift"])
|
|
11
|
+
],
|
|
12
|
+
dependencies: [
|
|
13
|
+
.package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", from: "7.0.0"),
|
|
14
|
+
.package(url: "https://github.com/firebase/firebase-ios-sdk.git", from: "12.6.0"),
|
|
15
|
+
],
|
|
16
|
+
targets: [
|
|
17
|
+
.target(
|
|
18
|
+
name: "CapacitorCommunityFcmC",
|
|
19
|
+
dependencies: [
|
|
20
|
+
.product(name: "Capacitor", package: "capacitor-swift-pm")
|
|
21
|
+
],
|
|
22
|
+
path: "ios/Plugin",
|
|
23
|
+
sources: [
|
|
24
|
+
"Plugin.h",
|
|
25
|
+
"Plugin.m"
|
|
26
|
+
],
|
|
27
|
+
publicHeadersPath: "."
|
|
28
|
+
),
|
|
29
|
+
.target(
|
|
30
|
+
name: "CapacitorCommunityFcmSwift",
|
|
31
|
+
dependencies: [
|
|
32
|
+
.product(name: "Capacitor", package: "capacitor-swift-pm"),
|
|
33
|
+
.product(name: "FirebaseMessaging", package: "firebase-ios-sdk")
|
|
34
|
+
],
|
|
35
|
+
path: "ios/Plugin",
|
|
36
|
+
sources: [
|
|
37
|
+
"Plugin.swift"
|
|
38
|
+
]
|
|
39
|
+
),
|
|
40
|
+
.testTarget(
|
|
41
|
+
name: "CapacitorCommunityFcmTests",
|
|
42
|
+
dependencies: ["CapacitorCommunityFcmSwift"],
|
|
43
|
+
path: "ios/PluginTests"
|
|
44
|
+
)
|
|
45
|
+
]
|
|
46
|
+
)
|
package/README.md
CHANGED
|
@@ -160,6 +160,17 @@ Download the `google-services.json` file and copy it to `android/app/` directory
|
|
|
160
160
|
|
|
161
161
|
If you need to implement opt-in behavior, you can disable the auto initialization of the library by following the [Firebase docs](https://firebase.google.com/docs/cloud-messaging/ios/client#prevent_auto_initialization).
|
|
162
162
|
|
|
163
|
+
### SPM setup (iOS 15.0+)
|
|
164
|
+
|
|
165
|
+
__First ensure all your dependencies are compatible with SPM. Otherwise, stick to the Cocoapods installation steps.__
|
|
166
|
+
|
|
167
|
+
You can also install the plugin using Swift Package Manager (SPM) instead of CocoaPods.
|
|
168
|
+
To do so, you don't need to install CocoaPods (steps 1 & 2), but you'll need to configure capacitor to use SPM:
|
|
169
|
+
* to add iOS target: `npx cap add ios --packagemanager SPM`
|
|
170
|
+
* to migrate an existing target: `npx cap spm-migration-assistant` (with capacitor 7.4.0+).
|
|
171
|
+
|
|
172
|
+
You can find more info in the official [capacitor docs](https://capacitorjs.com/docs/ios/spm).
|
|
173
|
+
|
|
163
174
|
## Android setup
|
|
164
175
|
|
|
165
176
|
- `ionic start my-cap-app --capacitor`
|
package/ios/Plugin/Plugin.swift
CHANGED
|
@@ -17,8 +17,9 @@ public class FCMPlugin: CAPPlugin, MessagingDelegate {
|
|
|
17
17
|
var fcmToken: String?
|
|
18
18
|
|
|
19
19
|
override public func load() {
|
|
20
|
-
FirebaseApp.
|
|
21
|
-
|
|
20
|
+
if FirebaseApp.app() == nil {
|
|
21
|
+
FirebaseApp.configure()
|
|
22
|
+
}
|
|
22
23
|
Messaging.messaging().delegate = self
|
|
23
24
|
NotificationCenter.default.addObserver(self, selector: #selector(self.didRegisterWithToken(notification:)), name: .capacitorDidRegisterForRemoteNotifications, object: nil)
|
|
24
25
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capacitor-community/fcm",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.2.0",
|
|
4
4
|
"description": "Enable Firebase Cloud Messaging features for Capacitor apps",
|
|
5
5
|
"main": "dist/esm/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -11,7 +11,8 @@
|
|
|
11
11
|
"android/build.gradle",
|
|
12
12
|
"dist/",
|
|
13
13
|
"ios/Plugin",
|
|
14
|
-
"CapacitorCommunityFcm.podspec"
|
|
14
|
+
"CapacitorCommunityFcm.podspec",
|
|
15
|
+
"Package.swift"
|
|
15
16
|
],
|
|
16
17
|
"author": "Stewan Silva",
|
|
17
18
|
"license": "MIT",
|