cordova-plugin-firebasex
Advanced tools
Comparing version
@@ -0,1 +1,13 @@ | ||
# Version 18.0.1 | ||
* feat(ios): prepare for cordova-ios 8 support - corrected app name | ||
* Merged from PR [#896](https://github.com/dpa99c/cordova-plugin-firebasex/pull/896) | ||
* (ios) Explicitly allow 8.0.0-beta.1 in cordova-ios version requirements as >=5 does not allow it | ||
* (ios) Gracefully handle missing Podfile when running hook scripts | ||
* (ios) Ensure plist files exist before attempting to access their contents. Gracefully fail if they are missing. | ||
* (ios) Gracefully fail if Google App ID is not found in Google plist | ||
* (ios) fix: ensure IOS_FIREBASE_SDK_VERSION is applied to pre-built Firestore pod version if IOS_USE_PRECOMPILED_FIRESTORE_POD=true | ||
* (ios) Update pinned Firebase SDK versions to [v11.4.0](https://firebase.google.com/support/release-notes/ios#version_1140_-_october_21_2024) | ||
* (android) Update pinned Firebase SDK component versions to [BoM v33.6.1 (23 October 2024)](https://firebase.google.com/support/release-notes/android#2024-10-23) | ||
# Version 18.0.0 | ||
@@ -2,0 +14,0 @@ * (iOS & Android) BREAKING change: Notification payloads received while the app is in the background or inactive are now queued by default, instead of delivered immediately to the application. |
{ | ||
"name": "cordova-plugin-firebasex", | ||
"version": "18.0.0", | ||
"version": "18.0.1", | ||
"description": "Cordova plugin for Google Firebase", | ||
@@ -5,0 +5,0 @@ "types": "./types/index.d.ts", |
@@ -19,2 +19,3 @@ var fs = require("fs"); | ||
googleTagManagerPodRegEx = /pod 'GoogleTagManager', '(\d+\.\d+\.\d+[^'"]*)'/, | ||
prebuiltFirestorePodRegEx = /pod 'FirebaseFirestore', :tag => '(\d+\.\d+\.\d+[^'"]*)', :git => 'https:\/\/github.com\/invertase\/firestore-ios-sdk-frameworks.git'/, | ||
prebuiltFirestorePodTemplate = "pod 'FirebaseFirestore', :tag => '{version}', :git => 'https://github.com/invertase/firestore-ios-sdk-frameworks.git'", | ||
@@ -52,3 +53,3 @@ iosDeploymentTargetPodRegEx = /platform :ios, '(\d+\.\d+\.?\d*)'/; | ||
appPlistModified = true; | ||
utilities.log('cordova-plugin-firebasex: Added URL scheme "'+urlScheme+'"'); | ||
utilities.log('Added URL scheme "'+urlScheme+'"'); | ||
} | ||
@@ -236,4 +237,11 @@ | ||
var podFileModified = false, | ||
podFilePath = iosPlatform.podFile, | ||
podFile = fs.readFileSync(path.resolve(podFilePath)).toString(), | ||
podFilePath = path.resolve(iosPlatform.podFile); | ||
// check if file exists | ||
if(!fs.existsSync(podFilePath)){ | ||
utilities.warn(`Podfile not found at ${podFilePath}`); | ||
return false; | ||
} | ||
var podFile = fs.readFileSync(podFilePath).toString(), | ||
DEBUG_INFORMATION_FORMAT = pluginVariables['IOS_STRIP_DEBUG'] && pluginVariables['IOS_STRIP_DEBUG'] === 'true' ? 'dwarf' : 'dwarf-with-dsym', | ||
@@ -258,3 +266,3 @@ iosDeploymentTargetMatch = podFile.match(iosDeploymentTargetPodRegEx), | ||
fs.writeFileSync(path.resolve(podFilePath), podFile); | ||
utilities.log('cordova-plugin-firebasex: Applied post install block to Podfile'); | ||
utilities.log('Applied post install block to Podfile'); | ||
podFileModified = true; | ||
@@ -265,6 +273,30 @@ } | ||
applyPluginVarsToPlists: function(pluginVariables, iosPlatform){ | ||
var googlePlist = plist.parse(fs.readFileSync(path.resolve(iosPlatform.dest), 'utf8')), | ||
appPlist = plist.parse(fs.readFileSync(path.resolve(iosPlatform.appPlist), 'utf8')), | ||
entitlementsDebugPlist = plist.parse(fs.readFileSync(path.resolve(iosPlatform.entitlementsDebugPlist), 'utf8')), | ||
entitlementsReleasePlist = plist.parse(fs.readFileSync(path.resolve(iosPlatform.entitlementsReleasePlist), 'utf8')), | ||
var googlePlistPath = path.resolve(iosPlatform.dest); | ||
if(!fs.existsSync(googlePlistPath)){ | ||
utilities.warn(`Google plist not found at ${googlePlistPath}`); | ||
return; | ||
} | ||
var appPlistPath = path.resolve(iosPlatform.appPlist); | ||
if(!fs.existsSync(appPlistPath)){ | ||
utilities.warn(`App plist not found at ${appPlistPath}`); | ||
return; | ||
} | ||
var entitlementsDebugPlistPath = path.resolve(iosPlatform.entitlementsDebugPlist); | ||
if(!fs.existsSync(entitlementsDebugPlistPath)){ | ||
utilities.warn(`Entitlements debug plist not found at ${entitlementsDebugPlistPath}`); | ||
return; | ||
} | ||
var entitlementsReleasePlistPath = path.resolve(iosPlatform.entitlementsReleasePlist); | ||
if(!fs.existsSync(entitlementsReleasePlistPath)){ | ||
utilities.warn(`Entitlements release plist not found at ${entitlementsReleasePlistPath}`); | ||
return; | ||
} | ||
var googlePlist = plist.parse(fs.readFileSync(googlePlistPath, 'utf8')), | ||
appPlist = plist.parse(fs.readFileSync(appPlistPath, 'utf8')), | ||
entitlementsDebugPlist = plist.parse(fs.readFileSync(entitlementsDebugPlistPath, 'utf8')), | ||
entitlementsReleasePlist = plist.parse(fs.readFileSync(entitlementsReleasePlistPath, 'utf8')), | ||
googlePlistModified = false, | ||
@@ -353,3 +385,11 @@ appPlistModified = false, | ||
applyPluginVarsToPodfile: function(pluginVariables, iosPlatform){ | ||
var podFileContents = fs.readFileSync(path.resolve(iosPlatform.podFile), 'utf8'), | ||
var podFilePath = path.resolve(iosPlatform.podFile); | ||
// check if file exists | ||
if(!fs.existsSync(podFilePath)){ | ||
utilities.warn(`Podfile not found at ${podFilePath}`); | ||
return false; | ||
} | ||
var podFileContents = fs.readFileSync(podFilePath, 'utf8'), | ||
podFileModified = false, | ||
@@ -392,4 +432,14 @@ specifiedInAppMessagingVersion = false; | ||
}); | ||
if(podFileModified) utilities.log("Firebase iOS SDK version set to v"+pluginVariables['IOS_FIREBASE_SDK_VERSION']+" in Podfile"); | ||
} | ||
var prebuiltFirestoreMatches = podFileContents.match(prebuiltFirestorePodRegEx); | ||
if(prebuiltFirestoreMatches){ | ||
prebuiltFirestoreMatches.forEach((match) => { | ||
var currentVersion = match.match(versionRegex)[0]; | ||
if(!match.match(pluginVariables['IOS_FIREBASE_SDK_VERSION'])){ | ||
podFileContents = podFileContents.replace(match, match.replace(currentVersion, pluginVariables['IOS_FIREBASE_SDK_VERSION'])); | ||
podFileModified = true; | ||
} | ||
}); | ||
} | ||
if(podFileModified) utilities.log("Firebase iOS SDK version set to v"+pluginVariables['IOS_FIREBASE_SDK_VERSION']+" in Podfile"); | ||
}else{ | ||
@@ -455,7 +505,25 @@ throw new Error("The value \""+pluginVariables['IOS_FIREBASE_SDK_VERSION']+"\" for IOS_FIREBASE_SDK_VERSION is not a valid semantic version format") | ||
ensureEncodedAppIdInUrlSchemes: function (iosPlatform){ | ||
var googlePlist = plist.parse(fs.readFileSync(path.resolve(iosPlatform.dest), 'utf8')), | ||
appPlist = plist.parse(fs.readFileSync(path.resolve(iosPlatform.appPlist), 'utf8')), | ||
googleAppId = googlePlist["GOOGLE_APP_ID"], | ||
encodedAppId = 'app-'+googleAppId.replace(/:/g,'-'); | ||
var googlePlistPath = path.resolve(iosPlatform.dest); | ||
if(!fs.existsSync(googlePlistPath)){ | ||
utilities.warn(`Google plist not found at ${googlePlistPath}`); | ||
return; | ||
} | ||
var appPlistPath = path.resolve(iosPlatform.appPlist); | ||
if(!fs.existsSync(appPlistPath)){ | ||
utilities.warn(`App plist not found at ${appPlistPath}`); | ||
return; | ||
} | ||
var googlePlist = plist.parse(fs.readFileSync(googlePlistPath, 'utf8')), | ||
appPlist = plist.parse(fs.readFileSync(appPlistPath, 'utf8')), | ||
googleAppId = googlePlist["GOOGLE_APP_ID"]; | ||
if(!googleAppId){ | ||
utilities.warn("Google App ID not found in Google plist"); | ||
return; | ||
} | ||
var encodedAppId = 'app-'+googleAppId.replace(/:/g,'-'); | ||
var result = ensureUrlSchemeInPlist(encodedAppId, appPlist); | ||
@@ -462,0 +530,0 @@ if(result.modified){ |
@@ -64,6 +64,12 @@ /** | ||
/** | ||
* Used to get the name of the application as defined in the config.xml. | ||
* Used to get the name of the application from the xcodeCordovaProj directory path. | ||
* The xcodeCordovaProj directory path is defined in the locations property of the Cordova-iOS platform's API. | ||
*/ | ||
Utilities.getAppName = function(){ | ||
return Utilities.parseConfigXml().widget.name._text.toString().trim(); | ||
const projectRoot = _context.opts.projectRoot; | ||
const platformPath = path.join(projectRoot, 'platforms', 'ios'); | ||
const cordova_ios = require('cordova-ios'); | ||
const iosProject = new cordova_ios('ios', platformPath); | ||
return path.basename(iosProject.locations.xcodeCordovaProj); | ||
}; | ||
@@ -173,2 +179,10 @@ | ||
Utilities.warn = function(msg){ | ||
console.warn(Utilities.getPluginId()+': '+msg); | ||
}; | ||
Utilities.error = function(msg){ | ||
console.error(Utilities.getPluginId()+': '+msg); | ||
}; | ||
module.exports = Utilities; |
Sorry, the diff of this file is not supported yet
833802
0.49%6483
1.04%