diff --git a/.gitignore b/.gitignore index 58722c7f..276bdcf3 100644 --- a/.gitignore +++ b/.gitignore @@ -551,3 +551,6 @@ tests/ios/Firebase google-services.json GoogleService-Info.plist + +# generated file +RNFBVersion.m diff --git a/packages/app/.npmignore b/packages/app/.npmignore index 29e5aa19..6e9fa627 100644 --- a/packages/app/.npmignore +++ b/packages/app/.npmignore @@ -64,3 +64,4 @@ android/.settings .circleci .eslintignore type-test.ts +scripts diff --git a/packages/app/ios/RNFBApp.xcodeproj/project.pbxproj b/packages/app/ios/RNFBApp.xcodeproj/project.pbxproj index 3fbd7b15..3c65628c 100644 --- a/packages/app/ios/RNFBApp.xcodeproj/project.pbxproj +++ b/packages/app/ios/RNFBApp.xcodeproj/project.pbxproj @@ -15,6 +15,7 @@ 2748D8172236429D00FC8DC8 /* RNFBSharedUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = 2748D8102236417700FC8DC8 /* RNFBSharedUtils.m */; }; 2748D81C223674CD00FC8DC8 /* RNFBPreferences.m in Sources */ = {isa = PBXBuildFile; fileRef = 2748D81B223674CD00FC8DC8 /* RNFBPreferences.m */; }; 2748D8202237018600FC8DC8 /* RNFBMeta.m in Sources */ = {isa = PBXBuildFile; fileRef = 2748D81F2237018600FC8DC8 /* RNFBMeta.m */; }; + DAA1F28522FCF6AD00F4DEC1 /* RNFBVersion.m in Sources */ = {isa = PBXBuildFile; fileRef = DAA1F28422FCF6AD00F4DEC1 /* RNFBVersion.m */; }; /* End PBXBuildFile section */ /* Begin PBXCopyFilesBuildPhase section */ @@ -47,6 +48,8 @@ 2748D81B223674CD00FC8DC8 /* RNFBPreferences.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RNFBPreferences.m; sourceTree = ""; }; 2748D81E2237012B00FC8DC8 /* RNFBMeta.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RNFBMeta.h; sourceTree = ""; }; 2748D81F2237018600FC8DC8 /* RNFBMeta.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RNFBMeta.m; sourceTree = ""; }; + DAA1F28422FCF6AD00F4DEC1 /* RNFBVersion.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RNFBVersion.m; sourceTree = ""; }; + DAA1F28622FCF6C200F4DEC1 /* RNFBVersion.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RNFBVersion.h; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -87,6 +90,8 @@ 2748D8142236426300FC8DC8 /* RNFBJSON.m */, 2748D81A223674B600FC8DC8 /* RNFBPreferences.h */, 2748D81B223674CD00FC8DC8 /* RNFBPreferences.m */, + DAA1F28422FCF6AD00F4DEC1 /* RNFBVersion.m */, + DAA1F28622FCF6C200F4DEC1 /* RNFBVersion.h */, ); path = RNFBApp; sourceTree = ""; @@ -162,6 +167,7 @@ 2744B9A721F57C2F004F8E3F /* RCTConvert+FIRApp.m in Sources */, 2748D8172236429D00FC8DC8 /* RNFBSharedUtils.m in Sources */, 2748D81C223674CD00FC8DC8 /* RNFBPreferences.m in Sources */, + DAA1F28522FCF6AD00F4DEC1 /* RNFBVersion.m in Sources */, 2748D8202237018600FC8DC8 /* RNFBMeta.m in Sources */, 2744B99121F46140004F8E3F /* RNFBRCTEventEmitter.m in Sources */, 2744B9A421F48A4F004F8E3F /* RCTConvert+FIROptions.m in Sources */, diff --git a/packages/app/ios/RNFBApp/RNFBAppModule.m b/packages/app/ios/RNFBApp/RNFBAppModule.m index a8d080fc..10db157d 100644 --- a/packages/app/ios/RNFBApp/RNFBAppModule.m +++ b/packages/app/ios/RNFBApp/RNFBAppModule.m @@ -24,6 +24,7 @@ #import "RNFBPreferences.h" #import "RNFBJSON.h" #import "RNFBMeta.h" +#import "RNFBVersion.h" #if __has_include() #import @@ -54,7 +55,7 @@ RCT_EXPORT_MODULE(); #ifdef REGISTER_LIB static dispatch_once_t once; dispatch_once(&once, ^{ - [FIRApp registerLibrary:@"react-native-firebase" withVersion:@"0.1.5"]; + [FIRApp registerLibrary:@"react-native-firebase" withVersion:RNFBVersionString]; }); #endif } diff --git a/packages/app/ios/RNFBApp/RNFBVersion.h b/packages/app/ios/RNFBApp/RNFBVersion.h new file mode 100644 index 00000000..d3aa357d --- /dev/null +++ b/packages/app/ios/RNFBApp/RNFBVersion.h @@ -0,0 +1,20 @@ +/** + * Copyright (c) 2016-present Invertase Limited & Contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this library except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#import + +extern const NSString * RNFBVersionString; diff --git a/packages/app/package.json b/packages/app/package.json index 6ea6f015..b73e47b7 100644 --- a/packages/app/package.json +++ b/packages/app/package.json @@ -6,7 +6,7 @@ "main": "lib/index.js", "types": "lib/index.d.ts", "scripts": { - "build": "genversion --semi lib/version.js", + "build": "genversion --semi lib/version.js && node ./scripts/genversion-ios", "build:clean": "rimraf android/build && rimraf ios/build", "prepare": "npm run build" }, diff --git a/packages/app/scripts/genversion-ios.js b/packages/app/scripts/genversion-ios.js new file mode 100644 index 00000000..cee73520 --- /dev/null +++ b/packages/app/scripts/genversion-ios.js @@ -0,0 +1,30 @@ +const fs = require('fs'); +const path = require('path'); + +const version = require('../lib/version'); +const outputPath = path.resolve(__dirname, '..', 'ios', 'RNFBApp', 'RNFBVersion.m'); +const template = `/** + * Copyright (c) 2016-present Invertase Limited & Contributors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this library except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#import "RCTVersion.h" + +// generated file - do not modify or commit +NSString* const RNFBVersionString = @"VERSION"; + +`; + +fs.writeFileSync(outputPath, template.replace('@"VERSION"', `@"${version}"`), 'utf8');