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
import org.gradle.api.JavaVersion | |
import org.gradle.api.Plugin | |
import org.gradle.api.Project | |
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile | |
class MyModulePlugin : Plugin<Project> { | |
override fun apply(project: Project) { | |
... | |
// Configure common android build parameters. | |
val androidExtension = project.extensions.getByName("android") |
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
@Test | |
fun testFlexibleUpdate_DownloadFails() { | |
// Setup Flexible update. | |
fakeAppUpdateManager.partiallyAllowedUpdateType = AppUpdateType.FLEXIBLE | |
fakeAppUpdateManager.setUpdateAvailable(2) | |
ActivityScenario.launch(MainActivity::class.java) | |
// Validate that flexible update is prompted to the user. | |
assertTrue(fakeAppUpdateManager.isConfirmationDialogVisible) |
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
@Test | |
fun testImmediateUpdate_Completes() { | |
// Setup immediate update. | |
fakeAppUpdateManager.partiallyAllowedUpdateType = AppUpdateType.IMMEDIATE | |
fakeAppUpdateManager.setUpdateAvailable(2) | |
ActivityScenario.launch(MainActivity::class.java) | |
// Validate that immediate update is prompted to the user. | |
assertTrue(fakeAppUpdateManager.isImmediateFlowVisible) |
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
@Test | |
fun testFlexibleUpdate_Completes() { | |
// Setup flexible update. | |
fakeAppUpdateManager.partiallyAllowedUpdateType = AppUpdateType.FLEXIBLE | |
fakeAppUpdateManager.setUpdateAvailable(2) | |
ActivityScenario.launch(MainActivity::class.java) | |
// Validate that flexible update is prompted to the user. | |
assertTrue(fakeAppUpdateManager.isConfirmationDialogVisible) |
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
[ | |
{ | |
"eventType": "VIEW_CLICKED", | |
"timestamp": 1561810695346, | |
"replacementText": "", | |
"actionCode": -1, | |
"delayTime": 0, | |
"canScrollTo": false, | |
"elementDescriptors": [ | |
{ |
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
fun <T> Flow<T>.mergeWith(other: Flow<T>): Flow<T> = flow { | |
coroutineScope { | |
launch { | |
collect { emit(it) } | |
} | |
launch { | |
other.collect { emit(it) } | |
} | |
} | |
} |
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
... | |
apply plugin: 'kotlin-kapt' | |
android { | |
... | |
} | |
dependencies { | |
implementation project(':tracker') |
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
@AutoService(Processor::class) | |
class AnalyticsEventProcessor : KotlinAbstractProcessor(), KotlinMetadataUtils { | |
companion object { | |
private val ANNOTATION = AnalyticsEvent::class.java | |
private const val EVENT_PARAMETER_NAME = "event" | |
private const val EVENT_NAME_PARAMETER_NAME = "name" | |
private const val EVENT_PARAM_PARAMETER_NAME = "params" | |
private const val LOG_EVENT_FUNCTION_NAME = "logEvent" |
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
@AutoService(Processor::class) | |
class AnalyticsEventProcessor : KotlinAbstractProcessor(), KotlinMetadataUtils { | |
companion object { | |
private val ANNOTATION = AnalyticsEvent::class.java | |
} | |
... | |
override fun process( | |
annotations: Set<TypeElement>, |
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
@AutoService(Processor::class) | |
class AnalyticsEventProcessor : KotlinAbstractProcessor(), KotlinMetadataUtils { | |
companion object { | |
private val ANNOTATION = AnalyticsEvent::class.java | |
} | |
override fun getSupportedAnnotationTypes() = setOf(ANNOTATION.canonicalName) | |
override fun getSupportedSourceVersion(): SourceVersion = SourceVersion.latestSupported() |
NewerOlder