From 3faac938c111a9b3392e3a340b6e57bf673e3099 Mon Sep 17 00:00:00 2001 From: Rafa Hernandez Date: Fri, 6 Jul 2018 10:07:13 -0400 Subject: [PATCH] fix(enroll): fill profile and session token directly Signed-off-by: Rafa Hernandez --- .../mdm/agent/core/enrollment/EnrollmentHelper.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/org/flyve/mdm/agent/core/enrollment/EnrollmentHelper.java b/app/src/main/java/org/flyve/mdm/agent/core/enrollment/EnrollmentHelper.java index f8db4e9c02..90d84ff0dc 100644 --- a/app/src/main/java/org/flyve/mdm/agent/core/enrollment/EnrollmentHelper.java +++ b/app/src/main/java/org/flyve/mdm/agent/core/enrollment/EnrollmentHelper.java @@ -136,11 +136,12 @@ public void run() { } JSONObject jsonSession = new JSONObject(data); - cache.setSessionToken(jsonSession.getString("session_token")); + final String sessionToken = jsonSession.getString("session_token"); + cache.setSessionToken(sessionToken); // STEP 2 get full session information HashMap header = new HashMap(); - header.put(SESSION_TOKEN, cache.getSessionToken()); + header.put(SESSION_TOKEN, sessionToken); header.put(ACCEPT,APPLICATION_JSON); header.put(CONTENT_TYPE,APPLICATION_JSON + ";" + CHARSET); header.put(USER_AGENT,FLYVE_MDM); @@ -164,7 +165,7 @@ public void run() { cache.setProfileId(profileId); // STEP 3 Activated the profile - final String dataActiveProfile = getSyncWebData(routes.changeActiveProfile(cache.getProfileId()), "POST", header); + final String dataActiveProfile = getSyncWebData(routes.changeActiveProfile(profileId), "POST", header); final String errorActiveProfile = manageError(dataActiveProfile); if(!errorActiveProfile.equals("")) { EnrollmentHelper.runOnUI(new Runnable() { @@ -176,7 +177,7 @@ public void run() { // Success EnrollmentHelper.runOnUI(new Runnable() { public void run() { - callback.onSuccess(cache.getSessionToken()); + callback.onSuccess(sessionToken); } }); }