Add GeckoResult import; explicit lambda params
Browse files
app/src/main/java/dev/nova/browser/BrowserActivity.kt
CHANGED
|
@@ -13,6 +13,7 @@ import androidx.compose.runtime.*
|
|
| 13 |
import androidx.compose.ui.Modifier
|
| 14 |
import androidx.compose.ui.unit.dp
|
| 15 |
import androidx.compose.ui.viewinterop.AndroidView
|
|
|
|
| 16 |
import org.mozilla.geckoview.GeckoRuntime
|
| 17 |
import org.mozilla.geckoview.GeckoView
|
| 18 |
import org.mozilla.geckoview.WebExtension
|
|
@@ -62,13 +63,12 @@ class BrowserActivity : ComponentActivity() {
|
|
| 62 |
.accept(
|
| 63 |
{ ext ->
|
| 64 |
Log.i("Nova", "Dev-console extension installed: ${ext?.id}")
|
| 65 |
-
ext?.let {
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
tabManager.wireExtension(it)
|
| 69 |
}
|
| 70 |
},
|
| 71 |
-
{
|
| 72 |
)
|
| 73 |
}
|
| 74 |
|
|
@@ -95,9 +95,9 @@ class BrowserActivity : ComponentActivity() {
|
|
| 95 |
|
| 96 |
// Switch the engine view whenever the active tab changes.
|
| 97 |
LaunchedEffect(activeId) {
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
}
|
| 102 |
|
| 103 |
Column(Modifier.fillMaxSize()) {
|
|
@@ -145,7 +145,7 @@ class BrowserActivity : ComponentActivity() {
|
|
| 145 |
.heightIn(max = 72.dp),
|
| 146 |
) {
|
| 147 |
Column(Modifier.padding(6.dp)) {
|
| 148 |
-
lines.forEach { Text(
|
| 149 |
}
|
| 150 |
}
|
| 151 |
}
|
|
|
|
| 13 |
import androidx.compose.ui.Modifier
|
| 14 |
import androidx.compose.ui.unit.dp
|
| 15 |
import androidx.compose.ui.viewinterop.AndroidView
|
| 16 |
+
import org.mozilla.geckoview.GeckoResult
|
| 17 |
import org.mozilla.geckoview.GeckoRuntime
|
| 18 |
import org.mozilla.geckoview.GeckoView
|
| 19 |
import org.mozilla.geckoview.WebExtension
|
|
|
|
| 63 |
.accept(
|
| 64 |
{ ext ->
|
| 65 |
Log.i("Nova", "Dev-console extension installed: ${ext?.id}")
|
| 66 |
+
ext?.let { installed ->
|
| 67 |
+
installed.setMessageDelegate(NovaBackgroundMessageDelegate(), "browser")
|
| 68 |
+
tabManager.wireExtension(installed)
|
|
|
|
| 69 |
}
|
| 70 |
},
|
| 71 |
+
{ error -> Log.e("Nova", "Failed to install dev-console extension", error) }
|
| 72 |
)
|
| 73 |
}
|
| 74 |
|
|
|
|
| 95 |
|
| 96 |
// Switch the engine view whenever the active tab changes.
|
| 97 |
LaunchedEffect(activeId) {
|
| 98 |
+
val id = activeId ?: return@LaunchedEffect
|
| 99 |
+
val tab = tabManager.tabs.firstOrNull { t -> t.id == id } ?: return@LaunchedEffect
|
| 100 |
+
geckoView.setSession(tab.session)
|
| 101 |
}
|
| 102 |
|
| 103 |
Column(Modifier.fillMaxSize()) {
|
|
|
|
| 145 |
.heightIn(max = 72.dp),
|
| 146 |
) {
|
| 147 |
Column(Modifier.padding(6.dp)) {
|
| 148 |
+
lines.forEach { line -> Text(line, style = MaterialTheme.typography.labelSmall, maxLines = 1) }
|
| 149 |
}
|
| 150 |
}
|
| 151 |
}
|