Skip to content

Commit f71a370

Browse files
committed
Another big fixup, verifying compatibility between Android and iOS on function names, avoidance of conflicts with FIR* builtins.
1 parent 0d6cead commit f71a370

File tree

11 files changed

+44
-35
lines changed

11 files changed

+44
-35
lines changed

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,6 @@
1212
hs_err_pid*
1313

1414
.DS_Store
15+
16+
build
17+
*.iml

Analytics.js

+11-3
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,21 @@
44
'use strict';
55

66
var { NativeModules } = require('react-native');
7-
var FBAnalytics = NativeModules.FBAnalytics;
7+
var Analytics = NativeModules.RNFIRAnalytics;
88

99
function setUserProperties(properties) {
1010
Object.keys(properties).forEach((key) => {
11-
FBAnalytics.setUserProperty(key, properties[key]);
11+
Analytics.setUserProperty(key, properties[key]);
1212
});
1313
}
1414

15-
module.exports = {...FBAnalytics, setUserProperties};
15+
function logEvent(eventName, params) {
16+
Analytics.logEvent(eventName, params);
17+
}
18+
19+
module.exports = {
20+
...Analytics,
21+
setUserProperties,
22+
logEvent,
23+
};
1624

RemoteConfig.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44
'use strict';
55

66
var { NativeModules } = require('react-native');
7-
var FBRemoteConfig = NativeModules.FBRemoteConfig;
7+
var RemoteConfig = NativeModules.RNFIRRemoteConfig;
88

9-
module.exports = FBRemoteConfig;
9+
module.exports = RemoteConfig;

android/src/main/java/org/jall/reactnative/firebase/FirebasePackage.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ public class FirebasePackage implements ReactPackage {
1717
public List<NativeModule> createNativeModules(
1818
ReactApplicationContext reactContext) {
1919
List<NativeModule> modules = new ArrayList<>();
20-
modules.add(new FIRRemoteConfig(reactContext));
21-
modules.add(new FIRAnalytics(reactContext));
20+
modules.add(new RNFIRRemoteConfig(reactContext));
21+
modules.add(new RNFIRAnalytics(reactContext));
2222
return modules;
2323
}
2424

android/src/main/java/org/jall/reactnative/firebase/FIRAnalytics.java android/src/main/java/org/jall/reactnative/firebase/RNFIRAnalytics.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@
1111

1212
import javax.annotation.Nullable;
1313

14-
public class FIRAnalytics extends ReactContextBaseJavaModule {
15-
public FIRAnalytics(ReactApplicationContext reactContext) {
14+
public class RNFIRAnalytics extends ReactContextBaseJavaModule {
15+
public RNFIRAnalytics(ReactApplicationContext reactContext) {
1616
super(reactContext);
1717
}
1818

1919
@Override
2020
public String getName() {
21-
return "FIRAnalytics";
21+
return "RNFIRAnalytics";
2222
}
2323

2424
@ReactMethod

android/src/main/java/org/jall/reactnative/firebase/FIRRemoteConfig.java android/src/main/java/org/jall/reactnative/firebase/RNFIRRemoteConfig.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@
1616
import java.util.ArrayList;
1717
import java.util.HashMap;
1818

19-
public class FIRRemoteConfig extends ReactContextBaseJavaModule {
20-
public FIRRemoteConfig(ReactApplicationContext reactContext) {
19+
public class RNFIRRemoteConfig extends ReactContextBaseJavaModule {
20+
public RNFIRRemoteConfig(ReactApplicationContext reactContext) {
2121
super(reactContext);
2222
}
2323

2424
@Override
2525
public String getName() {
26-
return "FIRRemoteConfig";
26+
return "RNFIRRemoteConfig";
2727
}
2828

2929
@ReactMethod

ios/Firebase.xcodeproj/project.pbxproj

+12-12
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
objects = {
88

99
/* Begin PBXBuildFile section */
10-
D87A76C31C86A251004ABB23 /* FIRAnalytics.m in Sources */ = {isa = PBXBuildFile; fileRef = D87A76C01C86A251004ABB23 /* FIRAnalytics.m */; };
11-
D87A76C41C86A251004ABB23 /* FIRRemoteConfig.m in Sources */ = {isa = PBXBuildFile; fileRef = D87A76C21C86A251004ABB23 /* FIRRemoteConfig.m */; };
10+
D87A76C31C86A251004ABB23 /* RNFIRAnalytics.m in Sources */ = {isa = PBXBuildFile; fileRef = D87A76C01C86A251004ABB23 /* RNFIRAnalytics.m */; };
11+
D87A76C41C86A251004ABB23 /* RNFIRRemoteConfig.m in Sources */ = {isa = PBXBuildFile; fileRef = D87A76C21C86A251004ABB23 /* RNFIRRemoteConfig.m */; };
1212
/* End PBXBuildFile section */
1313

1414
/* Begin PBXCopyFilesBuildPhase section */
@@ -24,10 +24,10 @@
2424
/* End PBXCopyFilesBuildPhase section */
2525

2626
/* Begin PBXFileReference section */
27-
D87A76BF1C86A251004ABB23 /* FIRAnalytics.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FIRAnalytics.h; path = Firebase/FIRAnalytics.h; sourceTree = "<group>"; };
28-
D87A76C01C86A251004ABB23 /* FIRAnalytics.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = FIRAnalytics.m; path = Firebase/FIRAnalytics.m; sourceTree = "<group>"; };
29-
D87A76C11C86A251004ABB23 /* FIRRemoteConfig.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FIRRemoteConfig.h; path = Firebase/FIRRemoteConfig.h; sourceTree = "<group>"; };
30-
D87A76C21C86A251004ABB23 /* FIRRemoteConfig.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = FIRRemoteConfig.m; path = Firebase/FIRRemoteConfig.m; sourceTree = "<group>"; };
27+
D87A76BF1C86A251004ABB23 /* RNFIRAnalytics.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RNFIRAnalytics.h; path = Firebase/RNFIRAnalytics.h; sourceTree = "<group>"; };
28+
D87A76C01C86A251004ABB23 /* RNFIRAnalytics.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = RNFIRAnalytics.m; path = Firebase/RNFIRAnalytics.m; sourceTree = "<group>"; };
29+
D87A76C11C86A251004ABB23 /* RNFIRRemoteConfig.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RNFIRRemoteConfig.h; path = Firebase/RNFIRRemoteConfig.h; sourceTree = "<group>"; };
30+
D87A76C21C86A251004ABB23 /* RNFIRRemoteConfig.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = RNFIRRemoteConfig.m; path = Firebase/RNFIRRemoteConfig.m; sourceTree = "<group>"; };
3131
D8D9DB831C6D03DB009FBC0E /* libFirebase.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libFirebase.a; sourceTree = BUILT_PRODUCTS_DIR; };
3232
/* End PBXFileReference section */
3333

@@ -45,10 +45,10 @@
4545
D8D9DB5B1C6D01F4009FBC0E = {
4646
isa = PBXGroup;
4747
children = (
48-
D87A76BF1C86A251004ABB23 /* FIRAnalytics.h */,
49-
D87A76C01C86A251004ABB23 /* FIRAnalytics.m */,
50-
D87A76C11C86A251004ABB23 /* FIRRemoteConfig.h */,
51-
D87A76C21C86A251004ABB23 /* FIRRemoteConfig.m */,
48+
D87A76BF1C86A251004ABB23 /* RNFIRAnalytics.h */,
49+
D87A76C01C86A251004ABB23 /* RNFIRAnalytics.m */,
50+
D87A76C11C86A251004ABB23 /* RNFIRRemoteConfig.h */,
51+
D87A76C21C86A251004ABB23 /* RNFIRRemoteConfig.m */,
5252
D8D9DB661C6D01F4009FBC0E /* Products */,
5353
);
5454
sourceTree = "<group>";
@@ -117,8 +117,8 @@
117117
isa = PBXSourcesBuildPhase;
118118
buildActionMask = 2147483647;
119119
files = (
120-
D87A76C41C86A251004ABB23 /* FIRRemoteConfig.m in Sources */,
121-
D87A76C31C86A251004ABB23 /* FIRAnalytics.m in Sources */,
120+
D87A76C41C86A251004ABB23 /* RNFIRRemoteConfig.m in Sources */,
121+
D87A76C31C86A251004ABB23 /* RNFIRAnalytics.m in Sources */,
122122
);
123123
runOnlyForDeploymentPostprocessing = 0;
124124
};
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#import <Foundation/Foundation.h>
22
#import "RCTBridgeModule.h"
33

4-
@interface FIRAnalytics : NSObject <RCTBridgeModule>
4+
@interface RNFIRAnalytics : NSObject <RCTBridgeModule>
55

66
@end
77

ios/Firebase/FIRAnalytics.m ios/Firebase/RNFIRAnalytics.m

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
#import "FIRAnalytics.h"
1+
#import "RNFIRAnalytics.h"
22
@import Firebase;
33

4-
@implementation FIRAnalytics
5-
@synthesize bridge = _bridge;
4+
@implementation RNFIRAnalytics
65

76
RCT_EXPORT_MODULE();
87

@@ -23,7 +22,7 @@ - (dispatch_queue_t)methodQueue
2322
[FIRAnalytics setUserPropertyString:value forName:name];
2423
}
2524

26-
RCT_EXPORT_METHOD(setUserID: (NSString *)userID)
25+
RCT_EXPORT_METHOD(setUserId: (NSString *)userID)
2726
{
2827
[FIRAnalytics setUserID:userID];
2928
}
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#import <Foundation/Foundation.h>
22
#import "RCTBridgeModule.h"
33

4-
@interface FIRRemoteConfig : NSObject <RCTBridgeModule>
4+
@interface RNFIRRemoteConfig : NSObject <RCTBridgeModule>
55

66
@end

ios/Firebase/FIRRemoteConfig.m ios/Firebase/RNFIRRemoteConfig.m

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
#import "FIRRemoteConfig.h"
1+
#import "RNFIRRemoteConfig.h"
22
@import Firebase;
33

4-
@implementation FIRRemoteConfig
5-
@synthesize bridge = _bridge;
4+
@implementation RNFIRRemoteConfig
65

76
RCT_EXPORT_MODULE();
87

@@ -110,7 +109,7 @@ - (dispatch_queue_t)methodQueue
110109
}
111110

112111

113-
RCT_EXPORT_METHOD(getNamedspacedString: (NSString *)key
112+
RCT_EXPORT_METHOD(getNamespacedString: (NSString *)key
114113
withNamespace:(NSString *)namespace
115114
resolver:(RCTPromiseResolveBlock)resolve
116115
rejecter:(RCTPromiseRejectBlock)reject)

0 commit comments

Comments
 (0)