diff --git a/android/demo/BUILD b/android/demo/BUILD index 7ad4173b3..7307058c1 100644 --- a/android/demo/BUILD +++ b/android/demo/BUILD @@ -1,8 +1,8 @@ load("@rules_android//android:rules.bzl", "android_binary", "android_library") -load("@rules_kotlin//kotlin:jvm.bzl", "kt_jvm_import") load("@rules_kotlin//kotlin:android.bzl", "kt_android_library") -load(":defs.bzl", "main_deps", "test_deps") +load("@rules_kotlin//kotlin:jvm.bzl", "kt_jvm_import") load("@rules_player//kotlin:defs.bzl", "lint") +load(":defs.bzl", "main_deps", "test_deps") kt_android_library( name = "demo_lib", @@ -15,20 +15,28 @@ kt_android_library( android_binary( name = "demo", - custom_package = "com.intuit.playerui.android.reference.demo", assets = glob(["src/main/assets/mocks/**"]), assets_dir = "src/main/assets", + custom_package = "com.intuit.playerui.android.reference.demo", dex_shards = 3, enable_data_binding = True, manifest = ":src/main/AndroidManifest.xml", multidex = "native", deps = [ ":demo_lib", - "//jvm/j2v8:j2v8-android", - "@maven//:com_eclipsesource_j2v8_j2v8", + # "//jvm/j2v8:j2v8-android", "@maven//:androidx_databinding_databinding_common", "@maven//:androidx_databinding_databinding_runtime", - "@maven//:org_jetbrains_kotlin_kotlin_reflect", + # "@maven//:com_eclipsesource_j2v8_j2v8", + # "@maven//:com_facebook_react_hermes_android", + # "//jvm/hermes/libs:hermes-android", + # "//jvm/hermes/libs:jsi-android", + # "@maven//:org_jetbrains_kotlin_kotlin_reflect", + # "//jvm/hermes/libs:arm64-v8a-jsi", + # "//jvm/hermes/src/main/jni:hermes_jni", + # "//jvm/hermes/libs:armeabi-v7a-jsi", + # "//jvm/hermes/libs:x86_64_jsi", + # "//jvm/hermes/libs:x86_jsi", ], ) diff --git a/android/demo/defs.bzl b/android/demo/defs.bzl index e542d2e45..52abaa0b3 100644 --- a/android/demo/defs.bzl +++ b/android/demo/defs.bzl @@ -2,17 +2,23 @@ maven_main = [ "@maven//:androidx_navigation_navigation_runtime", "@maven//:androidx_navigation_navigation_ui_ktx", "@maven//:androidx_navigation_navigation_fragment_ktx", - "@maven//:com_afollestad_material_dialogs_core", "@maven//:com_google_android_material_material", #"@maven//:com_squareup_leakcanary_leakcanary_android", + + # TODO: Pull these from j2v8-android-debug "@maven//:com_github_AlexTrotsenko_j2v8_debugger", - "@maven//:com_facebook_stetho_stetho" + "@maven//:com_facebook_stetho_stetho", + + # TODO: Pull these from hermes-android + # "@maven//:com_facebook_fbjni_fbjni", + # "@maven//:com_facebook_react_hermes_android", + "@maven//:com_facebook_fbjni_fbjni", ] maven_test = [ "@maven//:androidx_test_espresso_espresso_intents", - "@maven//:androidx_test_ext_junit_ktx" + "@maven//:androidx_test_ext_junit_ktx", ] maven = maven_main + maven_test @@ -26,5 +32,5 @@ main_deps = maven_main + [ ] test_deps = maven_test + [ - "//jvm/utils" + "//jvm/utils", ] diff --git a/android/demo/src/main/java/com/intuit/playerui/android/reference/demo/ui/base/BasePlayerFragment.kt b/android/demo/src/main/java/com/intuit/playerui/android/reference/demo/ui/base/BasePlayerFragment.kt index 013c987c7..d62952e4e 100644 --- a/android/demo/src/main/java/com/intuit/playerui/android/reference/demo/ui/base/BasePlayerFragment.kt +++ b/android/demo/src/main/java/com/intuit/playerui/android/reference/demo/ui/base/BasePlayerFragment.kt @@ -31,7 +31,7 @@ abstract class BasePlayerFragment : PlayerFragment() { private val currentPlayerCanvas get() = binding.playerCanvas.getChildAt(0) override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View { - StethoHelper.initializeDebugger(requireContext(), playerViewModel.player) +// StethoHelper.initializeDebugger(requireContext(), playerViewModel.player) return super.onCreateView(inflater, container, savedInstanceState) } diff --git a/android/demo/src/main/java/com/intuit/playerui/android/reference/demo/ui/main/MainActivity.kt b/android/demo/src/main/java/com/intuit/playerui/android/reference/demo/ui/main/MainActivity.kt index abb30ce86..9c62ee855 100644 --- a/android/demo/src/main/java/com/intuit/playerui/android/reference/demo/ui/main/MainActivity.kt +++ b/android/demo/src/main/java/com/intuit/playerui/android/reference/demo/ui/main/MainActivity.kt @@ -19,6 +19,7 @@ import androidx.navigation.ui.navigateUp import androidx.navigation.ui.onNavDestinationSelected import androidx.navigation.ui.setupActionBarWithNavController import androidx.navigation.ui.setupWithNavController +import com.facebook.soloader.SoLoader import com.google.android.material.navigation.NavigationView import com.intuit.playerui.android.reference.demo.R import com.intuit.playerui.android.reference.demo.model.AssetMock @@ -58,6 +59,8 @@ class MainActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) + SoLoader.init(this, false) + setContentView(R.layout.activity_main) val storybookNav = findViewById(R.id.storybook_nav) diff --git a/android/player/defs.bzl b/android/player/defs.bzl index baf305530..00c84b40b 100644 --- a/android/player/defs.bzl +++ b/android/player/defs.bzl @@ -1,5 +1,7 @@ main_exports = [ - "//jvm/j2v8:j2v8-android", + # TODO: These should absolutely not be exported via android player + # "//jvm/j2v8:j2v8-android", + "//jvm/hermes:hermes-android", ] main_deps = main_exports + [ @@ -25,4 +27,4 @@ test_deps = [ "//jvm/testutils", "@maven//:org_robolectric_robolectric", "@maven//:org_jetbrains_kotlinx_kotlinx_coroutines_test", -] \ No newline at end of file +] diff --git a/android/player/src/main/java/com/intuit/playerui/android/AndroidPlayer.kt b/android/player/src/main/java/com/intuit/playerui/android/AndroidPlayer.kt index 42cd4e894..510b84761 100644 --- a/android/player/src/main/java/com/intuit/playerui/android/AndroidPlayer.kt +++ b/android/player/src/main/java/com/intuit/playerui/android/AndroidPlayer.kt @@ -2,14 +2,14 @@ package com.intuit.playerui.android import android.content.Context import android.view.View -import com.alexii.j2v8debugger.ScriptSourceProvider +//import com.alexii.j2v8debugger.ScriptSourceProvider import com.intuit.hooks.BailResult import com.intuit.hooks.HookContext import com.intuit.hooks.SyncBailHook import com.intuit.hooks.SyncHook import com.intuit.hooks.SyncWaterfallHook import com.intuit.playerui.android.asset.RenderableAsset -import com.intuit.playerui.android.debug.UnsupportedScriptProvider +//import com.intuit.playerui.android.debug.UnsupportedScriptProvider import com.intuit.playerui.android.extensions.Styles import com.intuit.playerui.android.extensions.overlayStyles import com.intuit.playerui.android.extensions.removeSelf @@ -47,7 +47,7 @@ public typealias AndroidPlayerConfig = AndroidPlayer.Config public class AndroidPlayer private constructor( private val player: HeadlessPlayer, override val plugins: List = player.plugins, -) : Player(), ScriptSourceProvider by player.runtime as? ScriptSourceProvider ?: UnsupportedScriptProvider(player.runtime) { +) : Player() { /** Convenience constructor to provide vararg style [plugins] parameter */ public constructor( diff --git a/android/player/src/main/java/com/intuit/playerui/android/debug/UnsupportedScriptProvider.kt b/android/player/src/main/java/com/intuit/playerui/android/debug/UnsupportedScriptProvider.kt index 8eb58b69a..c5befe017 100644 --- a/android/player/src/main/java/com/intuit/playerui/android/debug/UnsupportedScriptProvider.kt +++ b/android/player/src/main/java/com/intuit/playerui/android/debug/UnsupportedScriptProvider.kt @@ -1,14 +1,14 @@ -package com.intuit.playerui.android.debug - -import com.alexii.j2v8debugger.ScriptSourceProvider -import com.intuit.playerui.core.bridge.runtime.Runtime -import com.intuit.playerui.core.player.PlayerException - -internal class UnsupportedScriptProvider(private val runtime: Runtime<*>) : ScriptSourceProvider { - override val allScriptIds: Collection - get() = throw PlayerException("Unsupported exception, $runtime runtime does not support JS debugging") - - override fun getSource(scriptId: String): String { - throw PlayerException("Unsupported exception, $runtime runtime does not support JS debugging") - } -} +//package com.intuit.playerui.android.debug +// +//import com.alexii.j2v8debugger.ScriptSourceProvider +//import com.intuit.playerui.core.bridge.runtime.Runtime +//import com.intuit.playerui.core.player.PlayerException +// +//internal class UnsupportedScriptProvider(private val runtime: Runtime<*>) : ScriptSourceProvider { +// override val allScriptIds: Collection +// get() = throw PlayerException("Unsupported exception, $runtime runtime does not support JS debugging") +// +// override fun getSource(scriptId: String): String { +// throw PlayerException("Unsupported exception, $runtime runtime does not support JS debugging") +// } +//}