Skip to content
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

GT-2455 provide a Scarlet.Builder extension method to force the default platform #2173

Merged
merged 1 commit into from
Sep 25, 2024

Conversation

frett
Copy link
Contributor

@frett frett commented Sep 25, 2024

No description provided.

Copy link

codecov bot commented Sep 25, 2024

Codecov Report

Attention: Patch coverage is 0% with 7 lines in your changes missing coverage. Please review.

Project coverage is 40.23%. Comparing base (dd15a60) to head (03de060).
Report is 5 commits behind head on master.

Files with missing lines Patch % Lines
...tlin/com/tinder/scarlet/ScarletBuilderInternals.kt 0.00% 3 Missing ⚠️
...arlet/internal/utils/RuntimePlatformInternals.java 0.00% 2 Missing ⚠️
...scarlet/internal/utils/RuntimePlatformInternals.kt 0.00% 1 Missing ⚠️
.../ccci/gto/android/common/scarlet/ScarletBuilder.kt 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2173      +/-   ##
==========================================
- Coverage   40.28%   40.23%   -0.05%     
==========================================
  Files         384      388       +4     
  Lines        5702     5709       +7     
  Branches     1401     1403       +2     
==========================================
  Hits         2297     2297              
- Misses       3082     3089       +7     
  Partials      323      323              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@NonNull
@SuppressWarnings("MethodName")
static RuntimePlatform Default() {
return new RuntimePlatform.Default();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

RuntimePlatform is a Kotlin internal class in another library, we can still access it from Java to create the instance we need.


import androidx.annotation.NonNull;

class RuntimePlatformInternals {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is a package private Java class to hide it from the public API for library consumers

@@ -0,0 +1,3 @@
package com.tinder.scarlet.internal.utils

internal fun defaultPlatform() = RuntimePlatformInternals.Default()
Copy link
Contributor Author

Choose a reason for hiding this comment

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

we wrap the package-private java RuntimePlatformInternals.Default() in an internal Kotlin function, this allows us to access it from other packages in this module without exposing it on the public API

* https://github.com/Tinder/Scarlet/issues/235
* https://issuetracker.google.com/issues/342419066
*/
fun Scarlet.Builder.forceDefaultPlatform() = apply { platform = defaultPlatform() }
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the only new thing exposed on the public API of this module

@frett frett merged commit c12879d into master Sep 25, 2024
12 of 13 checks passed
@frett frett deleted the scarletJava8Detection branch September 25, 2024 20:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants