From 905038082dcd2e206386cd38f1ef8196a3741f18 Mon Sep 17 00:00:00 2001 From: Magical Yang Date: Wed, 11 Oct 2023 09:11:23 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8DRuntimeInfo=E5=88=9D=E5=A7=8B?= =?UTF-8?q?=E5=8C=96=E5=A4=B1=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/build.gradle | 4 ++-- .../xposed/quickenergy/data/RuntimeInfo.java | 12 +++++++++++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 7729057a6..1b99776a6 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -8,8 +8,8 @@ android { minSdk 21 //noinspection ExpiredTargetSdkVersion targetSdk 29 - versionCode 69 - versionName "1.2.2" + versionCode 70 + versionName "1.2.2-fix1" } buildTypes { release { diff --git a/app/src/main/java/pansong291/xposed/quickenergy/data/RuntimeInfo.java b/app/src/main/java/pansong291/xposed/quickenergy/data/RuntimeInfo.java index 84ec4572e..965142f9c 100644 --- a/app/src/main/java/pansong291/xposed/quickenergy/data/RuntimeInfo.java +++ b/app/src/main/java/pansong291/xposed/quickenergy/data/RuntimeInfo.java @@ -40,11 +40,20 @@ private RuntimeInfo() { String content = FileUtils.readFromFile(FileUtils.runtimeInfoFile()); try { joAll = new JSONObject(content); + } catch (Exception ignored) { + joAll = new JSONObject(); + } + try { if (!joAll.has(userId)) { joAll.put(userId, new JSONObject()); } + } catch (Exception ignored) { + } + try { joCurrent = joAll.getJSONObject(userId); - } catch (Exception ignored) { } + } catch (Exception ignored) { + joCurrent = new JSONObject(); + } } public void save() { @@ -66,6 +75,7 @@ public Long getLong(RuntimeInfoKey key) { public void put(RuntimeInfoKey key, Object value) { try { joCurrent.put(key.name(), value); + joAll.put(userId, joCurrent); } catch (JSONException e) { Log.i(TAG, "put err:"); Log.printStackTrace(TAG, e);