Skip to content

Commit 6234311

Browse files
committed
Merge branch 'master' of github.com:fullstackreact/react-native-firestack
* 'master' of github.com:fullstackreact/react-native-firestack: Parity of response format Parity of response format getToken(true) will try to fetch token from server and fail if offline. Analytics parameter variable type fix for quantity, price and value. fix missing downloadUrl property on ios fix missing downloadUrl property on ios
2 parents 29140b6 + e8c5db0 commit 6234311

File tree

5 files changed

+20
-13
lines changed

5 files changed

+20
-13
lines changed

android/src/main/java/io/fullstack/firestack/FirestackAnalytics.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -102,16 +102,16 @@ private Bundle makeEventBundle(final String name, final Map<String, Object> map)
102102
bundle.putString(FirebaseAnalytics.Param.ITEM_NAME, val);
103103
}
104104
if (map.containsKey("quantity")) {
105-
long val = (long) map.get("quantity");
106-
bundle.putLong(FirebaseAnalytics.Param.QUANTITY, val);
105+
double val = (double) map.get("quantity");
106+
bundle.putDouble(FirebaseAnalytics.Param.QUANTITY, val);
107107
}
108108
if (map.containsKey("price")) {
109-
long val = (long) map.get("price");
110-
bundle.putLong(FirebaseAnalytics.Param.PRICE, val);
109+
double val = (double) map.get("price");
110+
bundle.putDouble(FirebaseAnalytics.Param.PRICE, val);
111111
}
112112
if (map.containsKey("value")) {
113-
long val = (long) map.get("value");
114-
bundle.putLong(FirebaseAnalytics.Param.VALUE, val);
113+
double val = (double) map.get("value");
114+
bundle.putDouble(FirebaseAnalytics.Param.VALUE, val);
115115
}
116116
if (map.containsKey("currency")) {
117117
String val = (String) map.get("currency");
@@ -171,7 +171,7 @@ private Bundle makeEventBundle(final String name, final Map<String, Object> map)
171171
}
172172
if (map.containsKey("shipping")) {
173173
double val = (double) map.get("shipping");
174-
bundle.putDouble(FirebaseAnalytics.Param.NUMBER_OF_PASSENGERS, val);
174+
bundle.putDouble(FirebaseAnalytics.Param.SHIPPING, val);
175175
}
176176
if (map.containsKey("group_id")) {
177177
String val = (String) map.get("group_id");

android/src/main/java/io/fullstack/firestack/FirestackAuth.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -518,7 +518,7 @@ public void userCallback(FirebaseUser passedUser, final Callback callback) {
518518
this.user = passedUser;
519519
}
520520

521-
this.user.getToken(true).addOnCompleteListener(new OnCompleteListener<GetTokenResult>() {
521+
this.user.getToken(false).addOnCompleteListener(new OnCompleteListener<GetTokenResult>() {
522522
@Override
523523
public void onComplete(@NonNull Task<GetTokenResult> task) {
524524
WritableMap msgMap = Arguments.createMap();

ios/Firestack.xcodeproj/project.pbxproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,7 @@
203203
MTL_ENABLE_DEBUG_INFO = YES;
204204
ONLY_ACTIVE_ARCH = YES;
205205
SDKROOT = iphoneos;
206+
USER_HEADER_SEARCH_PATHS = "";
206207
};
207208
name = Debug;
208209
};
@@ -237,6 +238,7 @@
237238
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
238239
MTL_ENABLE_DEBUG_INFO = NO;
239240
SDKROOT = iphoneos;
241+
USER_HEADER_SEARCH_PATHS = "";
240242
VALIDATE_PRODUCT = YES;
241243
};
242244
name = Release;

ios/Firestack/FirestackAuth.m

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ @implementation FirestackAuth
2929
};
3030

3131

32-
[self sendJSEvent:AUTH_CHANGED_EVENT
32+
[self sendJSEvent:AUTH_CHANGED_EVENT
3333
props: evt];
3434

3535
callBack(@[evt]);
@@ -43,7 +43,7 @@ @implementation FirestackAuth
4343
@"eventName": AUTH_ANONYMOUS_ERROR_EVENT,
4444
@"errorMessage": ex.reason
4545
};
46-
46+
4747
[self sendJSEvent:AUTH_ERROR_EVENT
4848
props:eventError];
4949
NSLog(@"An exception occurred: %@", ex);
@@ -186,12 +186,16 @@ @implementation FirestackAuth
186186
FIRUser *user = [FIRAuth auth].currentUser;
187187

188188
if (user != nil) {
189-
NSMutableDictionary *userProps = [self userPropsFromFIRUser:user];
190-
[userProps setValue: @((BOOL)true) forKey: @"authenticated"];
191-
callback(@[[NSNull null], userProps]);
189+
NSDictionary *userProps = [self userPropsFromFIRUser:user];
190+
NSDictionary *responseProps = @{
191+
@"authenticated": @((BOOL) true),
192+
@"user": userProps
193+
};
194+
callback(@[[NSNull null], responseProps]);
192195
} else {
193196
// No user is signed in.
194197
NSDictionary *err = @{
198+
@"authenticated": @((BOOL) false),
195199
@"user": @"No user logged in"
196200
};
197201
callback(@[err]);

ios/Firestack/FirestackStorage.m

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ - (void) addUploadObservers:(FIRStorageUploadTask *) uploadTask
135135
@"fullPath": ref.fullPath,
136136
@"bucket": ref.bucket,
137137
@"name": ref.name,
138+
@"downloadUrl": snapshot.metadata.downloadURLs[0].absoluteString,
138139
@"metadata": [snapshot.metadata dictionaryRepresentation]
139140
};
140141

0 commit comments

Comments
 (0)