-
-
Notifications
You must be signed in to change notification settings - Fork 443
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Monitor barcode scanning performance (#4651)
Monitor how long the barcode scanner took #4622
- Loading branch information
Showing
5 changed files
with
53 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
app/src/main/java/openfoodfacts/github/scrachx/openfood/analytics/AnalyticsTrackingEvent.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package openfoodfacts.github.scrachx.openfood.analytics | ||
|
||
import android.app.Activity | ||
import java.util.concurrent.TimeUnit | ||
import kotlin.time.Duration.Companion.milliseconds | ||
|
||
fun Activity.startTrackEvent(event: AnalyticsEvent): AnalyticsTrackingEvent { | ||
return AnalyticsTrackingEvent(event = event) | ||
} | ||
|
||
data class AnalyticsTrackingEvent( | ||
val startDate: Long = System.currentTimeMillis(), | ||
val event: AnalyticsEvent | ||
) { | ||
|
||
fun computeDurationInSeconds(): Float = | ||
(System.currentTimeMillis() - startDate).milliseconds.inWholeSeconds.toFloat() | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters