|
@ -1,7 +1,6 @@ |
|
|
package gr.thmmy.mthmmy.session; |
|
|
package gr.thmmy.mthmmy.session; |
|
|
|
|
|
|
|
|
import android.content.SharedPreferences; |
|
|
import android.content.SharedPreferences; |
|
|
import android.graphics.Bitmap; |
|
|
|
|
|
import android.os.Environment; |
|
|
import android.os.Environment; |
|
|
|
|
|
|
|
|
import com.franmontiel.persistentcookiejar.PersistentCookieJar; |
|
|
import com.franmontiel.persistentcookiejar.PersistentCookieJar; |
|
@ -13,14 +12,13 @@ import org.jsoup.nodes.Element; |
|
|
import org.jsoup.select.Elements; |
|
|
import org.jsoup.select.Elements; |
|
|
|
|
|
|
|
|
import java.io.File; |
|
|
import java.io.File; |
|
|
import java.io.FileNotFoundException; |
|
|
|
|
|
import java.io.FileOutputStream; |
|
|
|
|
|
import java.io.IOException; |
|
|
import java.io.IOException; |
|
|
import java.io.InterruptedIOException; |
|
|
import java.io.InterruptedIOException; |
|
|
import java.util.List; |
|
|
import java.util.List; |
|
|
import java.util.regex.Matcher; |
|
|
import java.util.regex.Matcher; |
|
|
import java.util.regex.Pattern; |
|
|
import java.util.regex.Pattern; |
|
|
|
|
|
|
|
|
|
|
|
import mthmmy.utils.Report; |
|
|
import okhttp3.Cookie; |
|
|
import okhttp3.Cookie; |
|
|
import okhttp3.FormBody; |
|
|
import okhttp3.FormBody; |
|
|
import okhttp3.HttpUrl; |
|
|
import okhttp3.HttpUrl; |
|
@ -155,15 +153,15 @@ public class SessionManager |
|
|
//Handle exception
|
|
|
//Handle exception
|
|
|
} |
|
|
} |
|
|
catch (InterruptedIOException e){ |
|
|
catch (InterruptedIOException e){ |
|
|
Report.i(TAG, "Login InterruptedIOException: "+ e.getMessage(), e); //users cancels LoginTask
|
|
|
Report.i(TAG, "Login InterruptedIOException", e); //users cancels LoginTask
|
|
|
return CANCELLED; |
|
|
return CANCELLED; |
|
|
} |
|
|
} |
|
|
catch (IOException e) { |
|
|
catch (IOException e) { |
|
|
Report.w(TAG, "Login IOException: "+ e.getMessage(), e); |
|
|
Report.w(TAG, "Login IOException", e); |
|
|
return CONNECTION_ERROR; |
|
|
return CONNECTION_ERROR; |
|
|
} |
|
|
} |
|
|
catch (Exception e) { |
|
|
catch (Exception e) { |
|
|
Report.w(TAG, "Login Exception (other): "+ e.getMessage(), e); |
|
|
Report.w(TAG, "Login Exception (other)", e); |
|
|
return EXCEPTION; |
|
|
return EXCEPTION; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
@ -232,10 +230,10 @@ public class SessionManager |
|
|
return FAILURE; |
|
|
return FAILURE; |
|
|
} |
|
|
} |
|
|
} catch (IOException e) { |
|
|
} catch (IOException e) { |
|
|
Report.w(TAG, "Logout IOException: "+ e.getMessage(), e); |
|
|
Report.w(TAG, "Logout IOException", e); |
|
|
return CONNECTION_ERROR; |
|
|
return CONNECTION_ERROR; |
|
|
} catch (Exception e) { |
|
|
} catch (Exception e) { |
|
|
Report.w(TAG, "Logout Exception: "+ e.getMessage(), e); |
|
|
Report.w(TAG, "Logout Exception", e); |
|
|
return EXCEPTION; |
|
|
return EXCEPTION; |
|
|
} finally { |
|
|
} finally { |
|
|
//All data should always be cleared from device regardless the result of logout
|
|
|
//All data should always be cleared from device regardless the result of logout
|
|
@ -316,7 +314,7 @@ public class SessionManager |
|
|
|
|
|
|
|
|
if (pictureFile == null) { |
|
|
if (pictureFile == null) { |
|
|
Report.d(TAG, |
|
|
Report.d(TAG, |
|
|
"Error creating media file, check storage permissions: ");// e.getMessage());
|
|
|
"Error creating media file, check storage permissions: "); |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
try { |
|
|
try { |
|
@ -326,9 +324,9 @@ public class SessionManager |
|
|
bitmap.compress(Bitmap.CompressFormat.PNG, 90, fos); |
|
|
bitmap.compress(Bitmap.CompressFormat.PNG, 90, fos); |
|
|
fos.close(); |
|
|
fos.close(); |
|
|
} catch (FileNotFoundException e) { |
|
|
} catch (FileNotFoundException e) { |
|
|
Report.d(TAG, "File not found: " + e.getMessage()); |
|
|
Report.d(TAG, "File not found"); |
|
|
} catch (IOException e) { |
|
|
} catch (IOException e) { |
|
|
Report.d(TAG, "Error accessing file: " + e.getMessage()); |
|
|
Report.d(TAG, "Error accessing file")); |
|
|
} |
|
|
} |
|
|
returnImage[0] = pictureFile; |
|
|
returnImage[0] = pictureFile; |
|
|
} |
|
|
} |
|
|