-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package com.tinder.scarlet.internal.utils; | ||
|
||
import androidx.annotation.NonNull; | ||
|
||
class RuntimePlatformInternals { | ||
Check warning on line 5 in gto-support-scarlet/src/main/java/com/tinder/scarlet/internal/utils/RuntimePlatformInternals.java Codecov / codecov/patchgto-support-scarlet/src/main/java/com/tinder/scarlet/internal/utils/RuntimePlatformInternals.java#L5
|
||
/** @noinspection KotlinInternalInJava*/ | ||
@NonNull | ||
@SuppressWarnings("MethodName") | ||
static RuntimePlatform Default() { | ||
return new RuntimePlatform.Default(); | ||
Check warning on line 10 in gto-support-scarlet/src/main/java/com/tinder/scarlet/internal/utils/RuntimePlatformInternals.java Codecov / codecov/patchgto-support-scarlet/src/main/java/com/tinder/scarlet/internal/utils/RuntimePlatformInternals.java#L10
|
||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package com.tinder.scarlet | ||
|
||
import org.ccci.gto.android.common.util.getDeclaredFieldOrNull | ||
import org.ccci.gto.android.common.util.getOrNull | ||
|
||
private val platformField = getDeclaredFieldOrNull<Scarlet.Builder>("platform") | ||
|
||
internal var Scarlet.Builder.platform: Any? | ||
get() = platformField?.getOrNull(this) | ||
set(value) { | ||
platformField?.set(this, requireNotNull(value)) | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
package com.tinder.scarlet.internal.utils | ||
|
||
internal fun defaultPlatform() = RuntimePlatformInternals.Default() | ||
Check warning on line 3 in gto-support-scarlet/src/main/kotlin/com/tinder/scarlet/internal/utils/RuntimePlatformInternals.kt Codecov / codecov/patchgto-support-scarlet/src/main/kotlin/com/tinder/scarlet/internal/utils/RuntimePlatformInternals.kt#L3
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package org.ccci.gto.android.common.scarlet | ||
|
||
import com.tinder.scarlet.Scarlet | ||
import com.tinder.scarlet.internal.utils.defaultPlatform | ||
import com.tinder.scarlet.platform | ||
|
||
/** | ||
* Scarlet improperly detects desugared Android apps as the Java 8 runtime. | ||
* This method will force the default platform for Scarlet to be used. | ||
* | ||
* See: | ||
* https://github.com/Tinder/Scarlet/issues/235 | ||
* https://issuetracker.google.com/issues/342419066 | ||
*/ | ||
fun Scarlet.Builder.forceDefaultPlatform() = apply { platform = defaultPlatform() } | ||
Check warning on line 15 in gto-support-scarlet/src/main/kotlin/org/ccci/gto/android/common/scarlet/ScarletBuilder.kt Codecov / codecov/patchgto-support-scarlet/src/main/kotlin/org/ccci/gto/android/common/scarlet/ScarletBuilder.kt#L15
|