cordova-plugin-firebasex-firestore 1.0.2 → 2.0.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/CHANGELOG.md +7 -0
- package/Package.swift +32 -0
- package/package.json +1 -1
- package/plugin.xml +7 -7
- package/scripts/ios/after_plugin_install.js +48 -2
- package/scripts/post_install.js +8 -6
- package/src/ios/FirebasexFirestorePlugin.m +7 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
# Version 2.0.0
|
|
2
|
+
- (ios) feat - BREAKING: Use Swift Package Manager (SPM) for Firebase SDK and other dependencies with `cordova-ios@8+`; continue to use Cocoapods for `cordova-ios@7`.
|
|
3
|
+
- (android) Update pinned Firebase SDK versions to BoM v34.14.0 (May 28, 2026)
|
|
4
|
+
- https://firebase.google.com/support/release-notes/android#2026-05-28
|
|
5
|
+
- (ios) Update pinned Firebase SDK version to v12.14.0 (May 26, 2026)
|
|
6
|
+
- https://firebase.google.com/support/release-notes/ios#version_12140_-_may_26_2026
|
|
7
|
+
|
|
1
8
|
# Version 1.0.1
|
|
2
9
|
- Fix plugin metadata
|
|
3
10
|
|
package/Package.swift
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// swift-tools-version:5.9
|
|
2
|
+
import PackageDescription
|
|
3
|
+
|
|
4
|
+
let firebaseSDKVersion: Version = "12.14.0"
|
|
5
|
+
|
|
6
|
+
let package = Package(
|
|
7
|
+
name: "cordova-plugin-firebasex-firestore",
|
|
8
|
+
platforms: [.iOS(.v15)],
|
|
9
|
+
products: [
|
|
10
|
+
.library(
|
|
11
|
+
name: "cordova-plugin-firebasex-firestore",
|
|
12
|
+
targets: ["FirebasexFirestorePlugin"]
|
|
13
|
+
)
|
|
14
|
+
],
|
|
15
|
+
dependencies: [
|
|
16
|
+
.package(path: "../cordova-plugin-firebasex-core"),
|
|
17
|
+
.package(url: "https://github.com/apache/cordova-ios.git", branch: "master"),
|
|
18
|
+
.package(url: "https://github.com/firebase/firebase-ios-sdk.git", exact: firebaseSDKVersion),
|
|
19
|
+
],
|
|
20
|
+
targets: [
|
|
21
|
+
.target(
|
|
22
|
+
name: "FirebasexFirestorePlugin",
|
|
23
|
+
dependencies: [
|
|
24
|
+
.product(name: "cordova-plugin-firebasex-core", package: "cordova-plugin-firebasex-core"),
|
|
25
|
+
.product(name: "Cordova", package: "cordova-ios"),
|
|
26
|
+
.product(name: "FirebaseFirestore", package: "firebase-ios-sdk"),
|
|
27
|
+
],
|
|
28
|
+
path: "src/ios",
|
|
29
|
+
publicHeadersPath: "."
|
|
30
|
+
)
|
|
31
|
+
]
|
|
32
|
+
)
|
package/package.json
CHANGED
package/plugin.xml
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<?xml version='1.0' encoding='utf-8'?>
|
|
2
2
|
<plugin id="cordova-plugin-firebasex-firestore"
|
|
3
|
-
version="
|
|
3
|
+
version="2.0.0"
|
|
4
4
|
xmlns="http://apache.org/cordova/ns/plugins/1.0"
|
|
5
5
|
xmlns:android="http://schemas.android.com/apk/res/android">
|
|
6
6
|
|
|
@@ -34,9 +34,9 @@
|
|
|
34
34
|
</feature>
|
|
35
35
|
</config-file>
|
|
36
36
|
|
|
37
|
-
<preference name="ANDROID_FIREBASE_FIRESTORE_VERSION" default="26.
|
|
38
|
-
<preference name="ANDROID_GRPC_OKHTTP" default="1.
|
|
39
|
-
<preference name="ANDROID_GSON_VERSION" default="2.
|
|
37
|
+
<preference name="ANDROID_FIREBASE_FIRESTORE_VERSION" default="26.3.0" />
|
|
38
|
+
<preference name="ANDROID_GRPC_OKHTTP" default="1.81.0" />
|
|
39
|
+
<preference name="ANDROID_GSON_VERSION" default="2.14.0" />
|
|
40
40
|
|
|
41
41
|
<source-file src="src/android/FirebasexFirestorePlugin.java" target-dir="src/org/apache/cordova/firebasex" />
|
|
42
42
|
<framework src="com.google.firebase:firebase-firestore:$ANDROID_FIREBASE_FIRESTORE_VERSION" />
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
</platform>
|
|
46
46
|
|
|
47
47
|
<!-- iOS -->
|
|
48
|
-
<platform name="ios">
|
|
48
|
+
<platform name="ios" package="swift">
|
|
49
49
|
<config-file target="config.xml" parent="/*">
|
|
50
50
|
<feature name="FirebasexFirestorePlugin">
|
|
51
51
|
<param name="ios-package" value="FirebasexFirestorePlugin" />
|
|
@@ -56,14 +56,14 @@
|
|
|
56
56
|
<header-file src="src/ios/FirebasexFirestorePlugin.h" />
|
|
57
57
|
<source-file src="src/ios/FirebasexFirestorePlugin.m" />
|
|
58
58
|
|
|
59
|
-
<preference name="IOS_FIREBASE_SDK_VERSION" default="12.
|
|
59
|
+
<preference name="IOS_FIREBASE_SDK_VERSION" default="12.14.0" />
|
|
60
60
|
|
|
61
61
|
<podspec>
|
|
62
62
|
<config>
|
|
63
63
|
<source url="https://cdn.cocoapods.org/"/>
|
|
64
64
|
</config>
|
|
65
65
|
<pods use-frameworks="true">
|
|
66
|
-
<pod name="FirebaseFirestore"
|
|
66
|
+
<pod name="FirebaseFirestore" spec="12.14.0" nospm="true" />
|
|
67
67
|
</pods>
|
|
68
68
|
</podspec>
|
|
69
69
|
|
|
@@ -22,6 +22,12 @@ var PLUGIN_ID = "cordova-plugin-firebasex-firestore";
|
|
|
22
22
|
/** @constant {string} The wrapper meta-plugin identifier used as a fallback source for plugin variables. */
|
|
23
23
|
var WRAPPER_PLUGIN_ID = "cordova-plugin-firebasex";
|
|
24
24
|
|
|
25
|
+
function isSwiftPackageManagerEnabled(projectRoot) {
|
|
26
|
+
var iosPlatformPath = path.join(projectRoot, "platforms", "ios");
|
|
27
|
+
var appSubDirPath = path.join(iosPlatformPath, "App");
|
|
28
|
+
return fs.existsSync(appSubDirPath) && fs.statSync(appSubDirPath).isDirectory();
|
|
29
|
+
}
|
|
30
|
+
|
|
25
31
|
/**
|
|
26
32
|
* Resolves plugin variables using the 4-layer override strategy.
|
|
27
33
|
*
|
|
@@ -96,6 +102,34 @@ function resolvePluginVariables(context) {
|
|
|
96
102
|
return pluginVariables;
|
|
97
103
|
}
|
|
98
104
|
|
|
105
|
+
function getPackageSwiftPaths(context) {
|
|
106
|
+
var paths = [
|
|
107
|
+
path.resolve(__dirname, "..", "..", "Package.swift"),
|
|
108
|
+
path.join(context.opts.projectRoot, "plugins", PLUGIN_ID, "Package.swift")
|
|
109
|
+
];
|
|
110
|
+
|
|
111
|
+
return paths.filter(function(packageSwiftPath, index) {
|
|
112
|
+
return fs.existsSync(packageSwiftPath) && paths.indexOf(packageSwiftPath) === index;
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
function rewritePackageSwiftValue(packageSwiftContents, key, value) {
|
|
117
|
+
if (!value) {
|
|
118
|
+
return { contents: packageSwiftContents, modified: false };
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
var packageValueRegex = new RegExp("let " + key + "(?:\\s*:\\s*Version)? = \\\"[^\\\"]+\\\"");
|
|
122
|
+
if (!packageValueRegex.test(packageSwiftContents)) {
|
|
123
|
+
return { contents: packageSwiftContents, modified: false };
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
var updatedContents = packageSwiftContents.replace(packageValueRegex, function(match) {
|
|
127
|
+
return match.replace(/\"[^\"]+\"/, '"' + value + '"');
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
return { contents: updatedContents, modified: updatedContents !== packageSwiftContents };
|
|
131
|
+
}
|
|
132
|
+
|
|
99
133
|
/**
|
|
100
134
|
* Cordova hook entry point.
|
|
101
135
|
* Updates the FirebaseFirestore git pod tag in the Podfile.
|
|
@@ -104,8 +138,20 @@ function resolvePluginVariables(context) {
|
|
|
104
138
|
*/
|
|
105
139
|
module.exports = function(context) {
|
|
106
140
|
var pluginVariables = resolvePluginVariables(context);
|
|
107
|
-
|
|
108
|
-
|
|
141
|
+
var useSwiftPackageManager = isSwiftPackageManagerEnabled(context.opts.projectRoot);
|
|
142
|
+
if (!pluginVariables["IOS_FIREBASE_SDK_VERSION"]) {
|
|
143
|
+
console.warn("[FirebasexFirestore] IOS_FIREBASE_SDK_VERSION variable not set. Skipping iOS dependency version update.");
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
if (useSwiftPackageManager) {
|
|
148
|
+
getPackageSwiftPaths(context).forEach(function(packageSwiftPath) {
|
|
149
|
+
var packageSwiftContents = fs.readFileSync(packageSwiftPath, "utf-8");
|
|
150
|
+
var result = rewritePackageSwiftValue(packageSwiftContents, "firebaseSDKVersion", pluginVariables["IOS_FIREBASE_SDK_VERSION"]);
|
|
151
|
+
if (result.modified) {
|
|
152
|
+
fs.writeFileSync(packageSwiftPath, result.contents);
|
|
153
|
+
}
|
|
154
|
+
});
|
|
109
155
|
return;
|
|
110
156
|
}
|
|
111
157
|
|
package/scripts/post_install.js
CHANGED
|
@@ -5,9 +5,10 @@
|
|
|
5
5
|
* Modifies the plugin's `plugin.xml` to switch between the standard and precompiled
|
|
6
6
|
* FirebaseFirestore iOS pods based on the `IOS_USE_PRECOMPILED_FIRESTORE_POD` plugin variable.
|
|
7
7
|
*
|
|
8
|
-
* When enabled, the standard `FirebaseFirestore`
|
|
8
|
+
* When enabled, the standard `FirebaseFirestore` CocoaPods fallback dependency is replaced
|
|
9
9
|
* with the precompiled version from the `invertase/firestore-ios-sdk-frameworks` GitHub
|
|
10
|
-
* repository
|
|
10
|
+
* repository. Swift Package Manager builds ignore this setting and always use the upstream
|
|
11
|
+
* Firebase package.
|
|
11
12
|
*
|
|
12
13
|
* When disabled (or not set), restores the standard CocoaPods-based pod if the precompiled
|
|
13
14
|
* version was previously applied.
|
|
@@ -124,14 +125,15 @@ module.exports = function (context) {
|
|
|
124
125
|
|
|
125
126
|
// Handle IOS_USE_PRECOMPILED_FIRESTORE_POD
|
|
126
127
|
/** @constant {RegExp} Matches the standard CocoaPods-based FirebaseFirestore pod entry. */
|
|
127
|
-
var standardPodRegExp = /<pod\s+name="FirebaseFirestore"\s+spec="([^"]+)"\s*\/>/;
|
|
128
|
+
var standardPodRegExp = /<pod\s+name="FirebaseFirestore"\s+spec="([^"]+)"\s+nospm="true"\s*\/>/;
|
|
128
129
|
/** @constant {RegExp} Matches the precompiled FirebaseFirestore pod entry (from invertase git repo). */
|
|
129
|
-
var precompiledPodRegExp = /<pod\s+name="FirebaseFirestore"\s+tag="([^"]+)"\s+git="[^"]+"\s
|
|
130
|
+
var precompiledPodRegExp = /<pod\s+name="FirebaseFirestore"\s+tag="([^"]+)"\s+git="[^"]+"\s+nospm="true"\s*\/>/;
|
|
130
131
|
|
|
131
132
|
if (pluginVariables["IOS_USE_PRECOMPILED_FIRESTORE_POD"] === "true") {
|
|
133
|
+
console.warn("IOS_USE_PRECOMPILED_FIRESTORE_POD only affects CocoaPods fallback installs; Swift Package Manager builds ignore it.");
|
|
132
134
|
var match = pluginXmlText.match(standardPodRegExp);
|
|
133
135
|
if (match) {
|
|
134
|
-
var replacement = '<pod name="FirebaseFirestore" tag="' + match[1] + '" git="https://github.com/invertase/firestore-ios-sdk-frameworks.git" />';
|
|
136
|
+
var replacement = '<pod name="FirebaseFirestore" tag="' + match[1] + '" git="https://github.com/invertase/firestore-ios-sdk-frameworks.git" nospm="true" />';
|
|
135
137
|
pluginXmlText = pluginXmlText.replace(standardPodRegExp, replacement);
|
|
136
138
|
pluginXmlModified = true;
|
|
137
139
|
console.log("Replaced FirebaseFirestore pod with precompiled version (tag " + match[1] + ") in " + PLUGIN_ID + "/plugin.xml");
|
|
@@ -144,7 +146,7 @@ module.exports = function (context) {
|
|
|
144
146
|
// Restore standard pod if precompiled was previously applied
|
|
145
147
|
var preMatch = pluginXmlText.match(precompiledPodRegExp);
|
|
146
148
|
if (preMatch) {
|
|
147
|
-
var restored = '<pod name="FirebaseFirestore" spec="' + preMatch[1] + '"/>';
|
|
149
|
+
var restored = '<pod name="FirebaseFirestore" spec="' + preMatch[1] + '" nospm="true" />';
|
|
148
150
|
pluginXmlText = pluginXmlText.replace(precompiledPodRegExp, restored);
|
|
149
151
|
pluginXmlModified = true;
|
|
150
152
|
console.log("Restored standard FirebaseFirestore pod (spec " + preMatch[1] + ") in " + PLUGIN_ID + "/plugin.xml");
|
|
@@ -3,7 +3,13 @@
|
|
|
3
3
|
* @brief iOS implementation of the FirebaseX Cloud Firestore Cordova plugin.
|
|
4
4
|
*/
|
|
5
5
|
#import "FirebasexFirestorePlugin.h"
|
|
6
|
-
#
|
|
6
|
+
#if __has_include("FirebasexCorePlugin.h")
|
|
7
|
+
// Cordova-ios 7 / CocoaPods: Files are compiled in a flat target structure
|
|
8
|
+
#import "FirebasexCorePlugin.h"
|
|
9
|
+
#else
|
|
10
|
+
// Cordova-ios 8+ / SPM: Plugins are isolated Swift Package modules
|
|
11
|
+
@import cordova_plugin_firebasex_core;
|
|
12
|
+
#endif
|
|
7
13
|
|
|
8
14
|
@interface FirebasexFirestorePlugin ()
|
|
9
15
|
/** Cloud Firestore instance. */
|