// Path: src/com/nitindhar/kampr/models/Session.java
// public class Session {
// 
//     private final String username;
//     private final String password;
//     private final String token;
//     private final Integer userId;
// 
//     public Session(String username, String password, String token,
//             Integer userId) {
//         Preconditions.checkArgument(!StringUtils.isBlank(username));
//         Preconditions.checkArgument(!StringUtils.isBlank(password));
//         Preconditions.checkArgument(!StringUtils.isBlank(token));
// 
//         this.username = username;
//         this.password = password;
//         this.token = token;
//         this.userId = userId;
//     }
// 
//     public String getUsername() {
//         return username;
//     }
// 
//     public String getPassword() {
//         return password;
//     }
// 
//     public String getToken() {
//         return token;
//     }
// 
//     public Integer getUserId() {
//         return userId;
//     }
// 
// }


import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import android.content.SharedPreferences;
import com.nitindhar.kampr.models.Session;
package com.nitindhar.kampr.data;




public class SessionSharedPreferencesDao implements SessionDao {

    private static final SessionDao INSTANCE = new SessionSharedPreferencesDao();
    private static final String SESSION_KEY_USERNAME = "login_username";
    private static final String SESSION_KEY_PASSWORD = "login_password";
    private static final String SESSION_KEY_TOKEN = "login_token";
    private static final String SESSION_KEY_USER_ID = "login_user_id";
    private static final String SESSION_KEY_EULA_ACCEPTED = "agreed_to_eula";
    private static final String SESSION_KEY_POST_TYPE = "post_type";
    private static final String SESSION_PASSWORD_HASH_ALGO = "MD5";

    private static SharedPreferences preferences;

    public static SessionDao instance() {
        return INSTANCE;
    }

    public static void setSharedPreferences(SharedPreferences preferences) {
        SessionSharedPreferencesDao.preferences = preferences;
    }

    @Override
    public boolean sessionExists() {
        if (preferences.getString(SESSION_KEY_TOKEN, null) != null) {
            return true;
        } else {
            return false;
        }
    }

    @Override
// Path: src/com/nitindhar/kampr/models/Session.java
// public class Session {
// 
//     private final String username;
//     private final String password;
//     private final String token;
//     private final Integer userId;
// 
//     public Session(String username, String password, String token,
//             Integer userId) {
//         Preconditions.checkArgument(!StringUtils.isBlank(username));
//         Preconditions.checkArgument(!StringUtils.isBlank(password));
//         Preconditions.checkArgument(!StringUtils.isBlank(token));
// 
//         this.username = username;
//         this.password = password;
//         this.token = token;
//         this.userId = userId;
//     }
// 
//     public String getUsername() {
//         return username;
//     }
// 
//     public String getPassword() {
//         return password;
//     }
// 
//     public String getToken() {
//         return token;
//     }
// 
//     public Integer getUserId() {
//         return userId;
//     }
// 
// }


// Path: src/com/nitindhar/kampr/data/SessionSharedPreferencesDao.java
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import android.content.SharedPreferences;
import com.nitindhar.kampr.models.Session;

package com.nitindhar.kampr.data;




public class SessionSharedPreferencesDao implements SessionDao {

    private static final SessionDao INSTANCE = new SessionSharedPreferencesDao();
    private static final String SESSION_KEY_USERNAME = "login_username";
    private static final String SESSION_KEY_PASSWORD = "login_password";
    private static final String SESSION_KEY_TOKEN = "login_token";
    private static final String SESSION_KEY_USER_ID = "login_user_id";
    private static final String SESSION_KEY_EULA_ACCEPTED = "agreed_to_eula";
    private static final String SESSION_KEY_POST_TYPE = "post_type";
    private static final String SESSION_PASSWORD_HASH_ALGO = "MD5";

    private static SharedPreferences preferences;

    public static SessionDao instance() {
        return INSTANCE;
    }

    public static void setSharedPreferences(SharedPreferences preferences) {
        SessionSharedPreferencesDao.preferences = preferences;
    }

    @Override
    public boolean sessionExists() {
        if (preferences.getString(SESSION_KEY_TOKEN, null) != null) {
            return true;
        } else {
            return false;
        }
    }

    @Override
    public boolean storeSession(Session session)