Option to turn off acknowledgements

This commit is contained in:
2017-08-11 17:24:36 +02:00
parent e2aa0e8b1d
commit 3a98cc115a
4 changed files with 22 additions and 0 deletions

View File

@ -27,6 +27,7 @@ public class Constants {
public static final String PREFERENCE_SYNC_TIMEOUT = "sync_timeout";
public static final String PREFERENCE_SERVER_POW = "server_pow";
public static final String PREFERENCE_FULL_NODE = "full_node";
public static final String PREFERENCE_REQUEST_ACK = "request_acknowledgments";
public static final String PREFERENCE_POW_AVERAGE = "average_pow_time_ms";
public static final String PREFERENCE_POW_COUNT = "pow_count";

View File

@ -122,6 +122,18 @@ object Preferences {
return File(ctx.filesDir, "exports")
}
@JvmStatic
fun requestAcknowledgements(ctx: Context): Boolean {
val preferences = PreferenceManager.getDefaultSharedPreferences(ctx)
return preferences.getBoolean(PREFERENCE_REQUEST_ACK, true)
}
@JvmStatic
fun setRequestAcknowledgements(ctx: Context, status: Boolean) {
val preferences = PreferenceManager.getDefaultSharedPreferences(ctx)
preferences.edit().putBoolean(PREFERENCE_REQUEST_ACK, status).apply()
}
@JvmStatic
fun cleanupExportDirectory(ctx: Context) {
val exportDirectory = getExportDirectory(ctx)