use of run.wallet.common.json.JSONObject in project run-wallet-android by runplay.
the class MsgStore method loadSeed.
private static void loadSeed(Context context) {
SharedPreferences sp = context.getSharedPreferences(SP_STORE, Context.MODE_PRIVATE);
String jString = SpManager.getEncryptedPreference(sp, PREF_MSG_SEED, "");
if (!jString.isEmpty()) {
JSONObject job = new JSONObject(jString);
Seeds.Seed seed = new Seeds.Seed();
seed.value = job.optString(Seeds.J_VALUE).toCharArray();
seed.name = job.optString(Seeds.J_NAME);
seed.isdefault = job.optBoolean(Seeds.J_DEFAULT);
seed.id = job.optString(Seeds.J_ID);
msgStore.currentSeed = seed;
}
}
use of run.wallet.common.json.JSONObject in project run-wallet-android by runplay.
the class MsgStore method loadAddresses.
private static void loadAddresses(Context context) {
if (msgStore.currentSeed != null) {
SharedPreferences sp = context.getSharedPreferences(msgStore.currentSeed.id, Context.MODE_PRIVATE);
String jarrayString = SpManager.getEncryptedPreference(sp, PREF_ADDRESSES, "[]");
// Log.e("MSG-LOAD-ADDRESS",jarrayString);
msgStore.addresses.clear();
try {
JSONArray jar = new JSONArray(jarrayString);
for (int i = 0; i < jar.length(); i++) {
JSONObject job = jar.getJSONObject(i);
Address add = new Address(job.optString("address"), job.optBoolean("used"));
msgStore.addresses.add(add);
}
} catch (Exception e) {
}
}
}
use of run.wallet.common.json.JSONObject in project run-wallet-android by runplay.
the class MsgStore method loadWallet.
private static void loadWallet(Context context) {
if (msgStore.currentSeed != null) {
SharedPreferences sp = context.getSharedPreferences(msgStore.currentSeed.id, Context.MODE_PRIVATE);
String jobString = SpManager.getEncryptedPreference(sp, PREF_WALLET, "[]");
msgStore.currentWallet = null;
try {
JSONObject job = new JSONObject(jobString);
if (job != null) {
msgStore.currentWallet = new Wallet(job);
}
} catch (Exception e) {
}
}
}
use of run.wallet.common.json.JSONObject in project run-wallet-android by runplay.
the class MsgStore method setSeed.
private static void setSeed(Context context, Seeds.Seed seed) {
SharedPreferences sp = context.getSharedPreferences(SP_STORE, Context.MODE_PRIVATE);
JSONObject job = new JSONObject();
msgStore.currentSeed = seed;
job.put(Seeds.J_ID, seed.id);
job.put(Seeds.J_VALUE, String.valueOf(seed.value));
job.put(Seeds.J_NAME, seed.name);
job.put(Seeds.J_DEFAULT, seed.isdefault);
sp.edit().putString(PREF_MSG_SEED, job.toString()).commit();
}
use of run.wallet.common.json.JSONObject in project run-wallet-android by runplay.
the class MsgStore method loadTransfers.
private static void loadTransfers(Context context) {
if (msgStore.currentSeed != null) {
SharedPreferences sp = context.getSharedPreferences(msgStore.currentSeed.id, Context.MODE_PRIVATE);
String jarrayString = SpManager.getEncryptedPreference(sp, PREF_TRANSFERS, "[]");
// String jarrayString = sp.getString(PREF_SEEDS,"[]");
msgStore.transfers.clear();
try {
JSONArray jar = new JSONArray(jarrayString);
for (int i = 0; i < jar.length(); i++) {
JSONObject job = jar.getJSONObject(i);
Transfer add = new Transfer(job);
msgStore.transfers.add(add);
}
} catch (Exception e) {
}
}
}
Aggregations