Skip to content

[Fix] InstallationId storage and User login #375

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

Merged
merged 1 commit into from
May 18, 2020
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
2 changes: 2 additions & 0 deletions lib/src/objects/parse_installation.dart
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,8 @@ class ParseInstallation extends ParseObject {
final ParseInstallation installation = ParseInstallation();
installation._installationId = _currentInstallationId;
await installation._updateInstallation();
await ParseCoreData().getStore().setString(keyParseStoreInstallation,
json.encode(installation.toJson(full: true)));
return installation;
}

Expand Down
10 changes: 5 additions & 5 deletions lib/src/objects/parse_user.dart
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,10 @@ class ParseUser extends ParseObject implements ParseCloneable {
try {
final Uri url = getSanitisedUri(_client, '$keyEndPointUserName');
final Response response = await _client.get(url, headers: headers);
return await _handleResponse(this, response,
ParseApiRQ.currentUser, _debug, parseClassName);
return await _handleResponse(
this, response, ParseApiRQ.currentUser, _debug, parseClassName);
} on Exception catch (e) {
return handleException(
e, ParseApiRQ.currentUser, _debug, parseClassName);
return handleException(e, ParseApiRQ.currentUser, _debug, parseClassName);
}
}

Expand Down Expand Up @@ -178,13 +177,14 @@ class ParseUser extends ParseObject implements ParseCloneable {
keyVarUsername: username,
keyVarPassword: password
};

final String installationId = await _getInstallationId();
final Uri url = getSanitisedUri(_client, '$keyEndPointLogin',
queryParams: queryParams);
_saveChanges();
final Response response =
await _client.get(url, headers: <String, String>{
keyHeaderRevocableSession: '1',
if (installationId != null) keyHeaderInstallationId: installationId,
});

return await _handleResponse(
Expand Down