aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/src/main/java/moe/yuuta/workmode/access/AccessorStarter.kt13
1 files changed, 5 insertions, 8 deletions
diff --git a/app/src/main/java/moe/yuuta/workmode/access/AccessorStarter.kt b/app/src/main/java/moe/yuuta/workmode/access/AccessorStarter.kt
index 5845ff2..98c8053 100644
--- a/app/src/main/java/moe/yuuta/workmode/access/AccessorStarter.kt
+++ b/app/src/main/java/moe/yuuta/workmode/access/AccessorStarter.kt
@@ -165,10 +165,11 @@ open class AccessorStarter(private val mContext: Context, private val mLogPath:
2.toByte() -> {
// The ID is used to prevent from multiple reporting.
val id = result.readString()
- // 0: not written
- // 1: already reported
- val writtenValue = SuspendedStorage(mContext).getStorage().getInt("c_$id", 0)
- if (writtenValue == 0) {
+ val reportTimes = SuspendedStorage(mContext).getStorage().getInt("c_$id", 0)
+ SuspendedStorage(mContext).getStorage().edit()
+ .putInt("c_$id", reportTimes + 1)
+ .apply()
+ if (reportTimes <= 0) {
val reason = result.readString()
Runnable {
Runnable {
@@ -178,12 +179,8 @@ open class AccessorStarter(private val mContext: Context, private val mLogPath:
.putCustomAttribute("rn", reason))
Crashlytics.log("Sf. $reason")
}.run()
- SuspendedStorage(mContext).getStorage().edit()
- .putInt("c_$id", 1)
- .apply()
}.run()
}.run()
- } else {
}
}
}