Skip to content

Add TimeProvider interface to abstract away the clock #4905

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 19, 2023

Conversation

mrober
Copy link
Contributor

@mrober mrober commented Apr 17, 2023

Add TimeProvider interface to abstract away the "wall time" clock. This is to avoid passing around a Long of the time in microseconds, which is a bad practice. Also made a nicer FakeTimeProvider.

We can't use java.time.Instant because our min SDK level is too low.

@google-oss-bot
Copy link
Contributor

google-oss-bot commented Apr 17, 2023

Coverage Report 1

Affected Products

  • firebase-sessions

    Overall coverage changed from ? (1abd88d) to 64.98% (31c4cad) by ?.

    14 individual files with coverage change

    FilenameBase (1abd88d)Merge (31c4cad)Diff
    ApplicationInfo.kt?100.00%?
    EventGDTLogger.kt?75.00%?
    FirebaseSessions.kt?0.00%?
    FirebaseSessionsEarly.kt?0.00%?
    FirebaseSessionsRegistrar.kt?0.00%?
    LocalOverrideSettings.kt?90.00%?
    SessionCoordinator.kt?76.47%?
    SessionEvent.kt?100.00%?
    SessionEvents.kt?100.00%?
    SessionGenerator.kt?22.73%?
    SessionInitiator.kt?66.67%?
    SessionsSettings.kt?84.62%?
    SettingsProvider.kt?0.00%?
    Time.kt?0.00%?

Test Logs

  1. https://storage.googleapis.com/firebase-sdk-metric-reports/qa1WOMUiNn.html

@google-oss-bot
Copy link
Contributor

google-oss-bot commented Apr 17, 2023

Size Report 1

Affected Products

  • base

    TypeBase (1abd88d)Merge (31c4cad)Diff
    apk (aggressive)?8.39 kB? (?)
    apk (release)?8.65 kB? (?)
  • firebase-datatransport

    TypeBase (1abd88d)Merge (31c4cad)Diff
    aar?4.94 kB? (?)
    apk (aggressive)?161 kB? (?)
    apk (release)?1.35 MB? (?)
  • firebase-sessions

    TypeBase (1abd88d)Merge (31c4cad)Diff
    aar?48.2 kB? (?)
    apk (aggressive)?251 kB? (?)
    apk (release)?1.77 MB? (?)

Test Logs

  1. https://storage.googleapis.com/firebase-sdk-metric-reports/acLcf9F3va.html

@github-actions
Copy link
Contributor

github-actions bot commented Apr 17, 2023

Unit Test Results

18 files  18 suites   22s ⏱️
23 tests 23 ✔️ 0 💤 0
46 runs  46 ✔️ 0 💤 0

Results for commit d02f440.

♻️ This comment has been updated with latest results.

Copy link
Contributor

@visumickey visumickey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice and a sleek refactor. Thanks for doing this Matt.

@mrober mrober merged commit 5f592d2 into firebase-sessions Apr 19, 2023
@mrober mrober deleted the sessions-time branch April 19, 2023 14:54
@firebase firebase locked and limited conversation to collaborators Jun 1, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants