use of run.wallet.common.json.JSONObject in project run-wallet-android by runplay.
the class Store method loadTransfers.
private static void loadTransfers(Context context) {
if (store.currentSeed != null) {
SharedPreferences sp = context.getSharedPreferences(store.currentSeed.id, Context.MODE_PRIVATE);
String jarrayString = SpManager.getEncryptedPreference(sp, PREF_TRANSFERS, "[]");
// String jarrayString = sp.getString(PREF_SEEDS,"[]");
store.transfers.clear();
try {
JSONArray jar = new JSONArray(jarrayString);
// Log.e("LOAD-TRANSFERS","json: "+jar.toString());
for (int i = 0; i < jar.length(); i++) {
JSONObject job = jar.getJSONObject(i);
Transfer add = new Transfer(job);
store.transfers.add(add);
}
} catch (Exception e) {
}
}
}
use of run.wallet.common.json.JSONObject in project run-wallet-android by runplay.
the class Store method getAddresses.
public static List<Address> getAddresses(Context context, Seeds.Seed seed) {
List<Address> addresses = new ArrayList<>();
if (Validator.isValidCaller()) {
SharedPreferences sp = context.getSharedPreferences(seed.id, Context.MODE_PRIVATE);
String jarrayString = SpManager.getEncryptedPreference(sp, PREF_ADDRESSES, "[]");
// Log.e("TMP-LOAD-ADDRESS",jarrayString);
try {
JSONArray jar = new JSONArray(jarrayString);
for (int i = 0; i < jar.length(); i++) {
JSONObject job = jar.getJSONObject(i);
Address add = new Address(job);
addresses.add(add);
}
} catch (Exception e) {
}
}
return addresses;
}
use of run.wallet.common.json.JSONObject in project run-wallet-android by runplay.
the class Store method loadNudgeTransfers.
public static void loadNudgeTransfers(Context context) {
SharedPreferences sp = context.getSharedPreferences(NT_STORE, Context.MODE_PRIVATE);
String jarrayString = SpManager.getEncryptedPreference(sp, PREF_NUDGE_TRANSFERS, "[]");
try {
JSONArray jar = new JSONArray(jarrayString);
store.nudgeTransfers.clear();
// Log.e("LOAD-NUDGE-TRANSFERS","json: "+jar.toString());
for (int i = 0; i < jar.length(); i++) {
JSONObject job = jar.getJSONObject(i);
NudgeTransfer add = new NudgeTransfer(job);
store.nudgeTransfers.add(add);
}
} catch (Exception e) {
Log.e("ERR-S-01", "ex: " + e.getMessage());
}
}
use of run.wallet.common.json.JSONObject in project run-wallet-android by runplay.
the class Store method getTickerHist.
public static TickerHist getTickerHist(Context context, String ticker, int step) {
TickerHist hist = store.tickerHist.get(ticker + step);
if (hist == null) {
SharedPreferences sp = context.getSharedPreferences(SP_STORE, Context.MODE_PRIVATE);
String strJson = sp.getString(PREF_TICKHIST, null);
if (strJson != null) {
JSONObject tickerHistories = new JSONObject(strJson);
JSONObject gottickerhist = tickerHistories.optJSONObject(ticker + step);
// Log.e("GTL",""+gottickerhist);
if (gottickerhist != null) {
String cp = gottickerhist.optString("cp");
if (!cp.isEmpty()) {
long last = gottickerhist.optLong("last");
// Log.e("STORE-THIST", "get: " + cp);
List<Tick> history = new ArrayList<>();
JSONArray jar = gottickerhist.optJSONArray("data");
for (int i = 0; i < jar.length(); i++) {
Tick aticker = new Tick(jar.optJSONObject(i));
// Log.e("TCIK",ticker.getLast()+"--"+jar.optJSONObject(i).toString());
history.add(aticker);
}
TickerHist thist = new TickerHist();
thist.setTicker(cp);
thist.setStep(gottickerhist.optInt("step"));
thist.setTicks(history);
thist.setLastUpdate(last);
// Log.e("STORE-THIST",cp);
store.tickerHist.put(cp + step, thist);
}
}
}
}
return store.tickerHist.get(ticker + step);
}
use of run.wallet.common.json.JSONObject in project run-wallet-android by runplay.
the class SystemMessage method toJson.
public JSONObject toJson() {
JSONObject job = new JSONObject();
job.put("date", date);
job.put("dis", disable);
job.put("msg", message);
job.put("read", isread);
return job;
}
Aggregations