package com.project.ilsaenterprise;

import android.content.Context;
import android.content.SharedPreferences;

public class SharedPref {
    public static final String sharedPref = "sharedPref";

    public static final String name = "name";
    public static final String email = "email";
    public static final String logined = "login";

    SharedPreferences sp;
    SharedPreferences.Editor spEditor;

    public SharedPref(Context context){
        sp = context.getSharedPreferences(sharedPref, Context.MODE_PRIVATE);
        spEditor = sp.edit();
    }

    public void saveString(String keySP, String value){
        spEditor.putString(keySP, value);
        spEditor.commit();
    }

    public void saveInt(String keySP, int value){
        spEditor.putInt(keySP, value);
        spEditor.commit();
    }

    public void saveBoolean(String keySP, boolean value){
        spEditor.putBoolean(keySP, value);
        spEditor.commit();
    }

    public String getName(){
        return sp.getString(name, "");
    }

    public String getEmail(){
        return sp.getString(email, "");
    }

    public Boolean getLogined(){
        return sp.getBoolean(logined, false);
    }
}
