Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parity of response format between ios and android #119

Merged
merged 5 commits into from
Nov 9, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions android/.idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,6 @@ public void onComplete(@NonNull Task<GetTokenResult> task) {
WritableMap userMap = getUserMap();
if (FirestackAuthModule.this.user != null) {
final String token = task.getResult().getToken();

userMap.putString("token", token);
userMap.putBoolean("anonymous", false);
}
Expand Down Expand Up @@ -509,9 +508,10 @@ private WritableMap getUserMap() {
userMap.putString("email", email);
userMap.putString("uid", uid);
userMap.putString("providerId", provider);
userMap.putBoolean("emailVerified", user.isEmailVerified());

if (name != null) {
userMap.putString("name", name);
userMap.putString("displayName", name);
}

if (photoUrl != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -304,8 +304,12 @@ public String getName() {
public void enablePersistence(
final Boolean enable,
final Callback callback) {
FirebaseDatabase.getInstance()
try {
FirebaseDatabase.getInstance()
.setPersistenceEnabled(enable);
} catch (Throwable t) {
Log.e(TAG, "FirebaseDatabase setPersistenceEnabled exception", t);
}

WritableMap res = Arguments.createMap();
res.putString("status", "success");
Expand Down
14 changes: 8 additions & 6 deletions ios/Firestack/FirestackAuth.m
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ @implementation FirestackAuth
if (!user) {
NSDictionary *evt = @{
@"eventName": AUTH_ANONYMOUS_ERROR_EVENT,
@"msg": [error localizedDescription]
@"errorMessage": [error localizedDescription]
};


Expand All @@ -41,7 +41,7 @@ @implementation FirestackAuth
} @catch(NSException *ex) {
NSDictionary *eventError = @{
@"eventName": AUTH_ANONYMOUS_ERROR_EVENT,
@"msg": ex.reason
@"errorMessage": ex.reason
};

[self sendJSEvent:AUTH_ERROR_EVENT
Expand Down Expand Up @@ -144,14 +144,15 @@ @implementation FirestackAuth
sendJSEvent:AUTH_CHANGED_EVENT
props: @{
@"eventName": @"userTokenError",
@"msg": [error localizedFailureReason]
@"authenticated": @((BOOL)true),
@"errorMessage": [error localizedFailureReason]
}];
} else {
[self
sendJSEvent:AUTH_CHANGED_EVENT
props: @{
@"eventName": @"user",
@"authenticated": @(true),
@"authenticated": @((BOOL)true),
@"user": userProps
}];
}
Expand All @@ -164,7 +165,7 @@ @implementation FirestackAuth
[self sendJSEvent:AUTH_CHANGED_EVENT
props:@{
@"eventName": @"no_user",
@"authenticated": @(false),
@"authenticated": @((BOOL)false),
@"error": err
}];
}
Expand All @@ -185,7 +186,8 @@ @implementation FirestackAuth
FIRUser *user = [FIRAuth auth].currentUser;

if (user != nil) {
NSDictionary *userProps = [self userPropsFromFIRUser:user];
NSMutableDictionary *userProps = [self userPropsFromFIRUser:user];
[userProps setValue: @((BOOL)true) forKey: @"authenticated"];
callback(@[[NSNull null], userProps]);
} else {
// No user is signed in.
Expand Down
2 changes: 1 addition & 1 deletion lib/modules/database.js
Original file line number Diff line number Diff line change
Expand Up @@ -514,4 +514,4 @@ export class Database extends Base {
}
}

export default Database
export default Database