From 934cdd85cd8722dfab9e34f67d9a7a74e00e9876 Mon Sep 17 00:00:00 2001 From: Eugene Crosser Date: Fri, 3 Feb 2012 14:18:13 +0400 Subject: [PATCH] rename token access methods --- src/org/average/whereami/Authorize.java | 7 +++---- src/org/average/whereami/Oracle.java | 2 +- src/org/average/whereami/PersistentStore.java | 6 +++--- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/org/average/whereami/Authorize.java b/src/org/average/whereami/Authorize.java index 1137ea5..804486f 100644 --- a/src/org/average/whereami/Authorize.java +++ b/src/org/average/whereami/Authorize.java @@ -68,12 +68,11 @@ public class Authorize extends Activity { ClientCredentials.CLIENT_SECRET, code, ClientCredentials.REDIRECT_URI).execute(); - PersistentStore credentialStore = - new PersistentStore(prefs); - credentialStore.write(accessTokenResponse); + PersistentStore store = new PersistentStore(prefs); + store.writeTokens(accessTokenResponse); finish(); } else if (url.indexOf("error=")!=-1) { - new PersistentStore(prefs).clear(); + new PersistentStore(prefs).clearTokens(); finish(); } } catch (IOException e) { diff --git a/src/org/average/whereami/Oracle.java b/src/org/average/whereami/Oracle.java index 28effd9..ed3f93f 100644 --- a/src/org/average/whereami/Oracle.java +++ b/src/org/average/whereami/Oracle.java @@ -30,7 +30,7 @@ public class Oracle { httpTransport = AndroidHttp.newCompatibleTransport(); jsonFactory = new JacksonFactory(); - AccessTokenResponse token = store.read(); + AccessTokenResponse token = store.readTokens(); Log.v(TAG, "tokens - access: \"" + token.accessToken + "\", refresh: \"" + token.refreshToken + "\", client_id: \"" + ClientCredentials.CLIENT_ID + diff --git a/src/org/average/whereami/PersistentStore.java b/src/org/average/whereami/PersistentStore.java index 595fbf7..c39f822 100644 --- a/src/org/average/whereami/PersistentStore.java +++ b/src/org/average/whereami/PersistentStore.java @@ -19,7 +19,7 @@ public class PersistentStore { this.prefs = prefs; } - public AccessTokenResponse read() { + public AccessTokenResponse readTokens() { AccessTokenResponse accessTokenResponse = new AccessTokenResponse(); accessTokenResponse.accessToken = prefs.getString(ACCESS_TOKEN, ""); accessTokenResponse.expiresIn = prefs.getLong(EXPIRES_IN, 0); @@ -28,7 +28,7 @@ public class PersistentStore { return accessTokenResponse; } - public void write(AccessTokenResponse accessTokenResponse) { + public void writeTokens(AccessTokenResponse accessTokenResponse) { Editor editor = prefs.edit(); editor.putString(ACCESS_TOKEN,accessTokenResponse.accessToken); editor.putLong(EXPIRES_IN,accessTokenResponse.expiresIn); @@ -37,7 +37,7 @@ public class PersistentStore { editor.commit(); } - public void clear() { + public void clearTokens() { Editor editor = prefs.edit(); editor.remove(ACCESS_TOKEN); editor.remove(EXPIRES_IN); -- 2.43.0