Skip to content

Commit 3b11ac9

Browse files
hyperrecursivephillwiggins
authored andcommitted
Refactored ParseUser.logout - resetting session id and deleting local data are now separate functions (#270)
1 parent 31d874b commit 3b11ac9

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

lib/src/objects/parse_user.dart

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -236,12 +236,10 @@ class ParseUser extends ParseObject implements ParseCloneable {
236236
Future<ParseResponse> logout({bool deleteLocalUserData = true}) async {
237237
final String sessionId = _client.data.sessionId;
238238

239-
_client.data.sessionId = null;
240-
ParseCoreData().setSessionId(null);
239+
forgetLocalSession();
241240

242241
if (deleteLocalUserData == true) {
243-
unpin(key: keyParseStoreUser);
244-
_setObjectData(null);
242+
await this.deleteLocalUserData();
245243
}
246244

247245
try {
@@ -256,6 +254,17 @@ class ParseUser extends ParseObject implements ParseCloneable {
256254
}
257255
}
258256

257+
void forgetLocalSession() async {
258+
_client.data.sessionId = null;
259+
ParseCoreData().setSessionId(null);
260+
}
261+
262+
/// Delete the local user data.
263+
Future<void> deleteLocalUserData() async {
264+
await unpin(key: keyParseStoreUser);
265+
_setObjectData(null);
266+
}
267+
259268
/// Sends a verification email to the users email address
260269
Future<ParseResponse> verificationEmailRequest() async {
261270
try {

0 commit comments

Comments
 (0)