-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: extract ComposeUtils to share with plugins (#202)
* fix: moved compose logic to ComposeUtils
- Loading branch information
1 parent
1a5a392
commit c239bba
Showing
2 changed files
with
25 additions
and
16 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
22 changes: 22 additions & 0 deletions
22
android/src/main/java/com/amplitude/android/utilities/ComposeUtils.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,22 @@ | ||
package com.amplitude.android.utilities | ||
|
||
import com.amplitude.common.Logger | ||
|
||
class ComposeUtils { | ||
companion object { | ||
private val loadClass = LoadClass() | ||
private const val COMPOSE_CLASS_NAME = "androidx.compose.ui.node.Owner" | ||
private const val SCROLLING_VIEW_CLASS_NAME = "androidx.core.view.ScrollingView" | ||
private const val COMPOSE_GESTURE_LOCATOR_CLASS_NAME = | ||
"com.amplitude.android.internal.locators.ComposeViewTargetLocator" | ||
|
||
fun isComposeAvailable(logger: Logger? = null): Boolean { | ||
return loadClass.isClassAvailable(COMPOSE_CLASS_NAME, logger) && | ||
loadClass.isClassAvailable(COMPOSE_GESTURE_LOCATOR_CLASS_NAME, logger) | ||
} | ||
|
||
fun isAndroidXScrollViewAvailable(logger: Logger? = null): Boolean { | ||
return loadClass.isClassAvailable(SCROLLING_VIEW_CLASS_NAME, logger) | ||
} | ||
} | ||
} |