|
|
|
|
@ -13,9 +13,6 @@ import net.pokeranalytics.android.model.LiveOnline |
|
|
|
|
import net.pokeranalytics.android.model.realm.* |
|
|
|
|
import net.pokeranalytics.android.ui.view.rows.StaticReport |
|
|
|
|
import net.pokeranalytics.android.util.extensions.formattedHourlyDuration |
|
|
|
|
import timber.log.Timber |
|
|
|
|
import kotlin.coroutines.CoroutineContext |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
interface NewPerformanceListener { |
|
|
|
|
fun newBestPerformanceHandler() |
|
|
|
|
@ -62,7 +59,7 @@ class ReportWhistleBlower(var context: Context) { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
fun requestReportLaunch() { |
|
|
|
|
Timber.d(">>> Launch report") |
|
|
|
|
// Timber.d(">>> Launch report") |
|
|
|
|
|
|
|
|
|
if (paused) { |
|
|
|
|
return |
|
|
|
|
@ -169,7 +166,7 @@ class ReportTask(private var whistleBlower: ReportWhistleBlower, var context: Co |
|
|
|
|
|
|
|
|
|
private fun launchReport(realm: Realm, report: StaticReport) { |
|
|
|
|
|
|
|
|
|
Timber.d(">>> launch report = $report") |
|
|
|
|
// Timber.d(">>> launch report = $report") |
|
|
|
|
|
|
|
|
|
when (report) { |
|
|
|
|
StaticReport.OptimalDuration -> launchOptimalDuration(realm, report) |
|
|
|
|
@ -259,10 +256,10 @@ class ReportTask(private var whistleBlower: ReportWhistleBlower, var context: Co |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} ?: run { // if there is no max but a now irrelevant Performance, we delete it |
|
|
|
|
Timber.d("NO best computed value, current perf = $currentPerf ") |
|
|
|
|
// Timber.d("NO best computed value, current perf = $currentPerf ") |
|
|
|
|
currentPerf?.let { perf -> |
|
|
|
|
realm.executeTransaction { |
|
|
|
|
Timber.d("Delete perf: stat = ${perf.stat}, report = ${perf.reportId}") |
|
|
|
|
// Timber.d("Delete perf: stat = ${perf.stat}, report = ${perf.reportId}") |
|
|
|
|
perf.deleteFromRealm() |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|