From f29456770bf842c180668f18428ac5d93769c256 Mon Sep 17 00:00:00 2001 From: Jay Ohms Date: Thu, 6 Apr 2023 11:29:23 -0400 Subject: [PATCH] Update the public delegate APIs to match the turbo-android callbacks, so it's trivial to understand/setup in an app --- .../src/main/kotlin/dev/hotwire/strada/BridgeDelegate.kt | 6 +++--- .../test/kotlin/dev/hotwire/strada/BridgeDelegateTest.kt | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/strada/src/main/kotlin/dev/hotwire/strada/BridgeDelegate.kt b/strada/src/main/kotlin/dev/hotwire/strada/BridgeDelegate.kt index 24449db..b275b49 100644 --- a/strada/src/main/kotlin/dev/hotwire/strada/BridgeDelegate.kt +++ b/strada/src/main/kotlin/dev/hotwire/strada/BridgeDelegate.kt @@ -23,11 +23,11 @@ class BridgeDelegate( observeLifeCycle() } - fun loadBridgeInWebView() { + fun onColdBootPageCompleted() { bridge?.load() } - fun resetBridge() { + fun onColdBootPageStarted() { bridge?.reset() } @@ -38,7 +38,7 @@ class BridgeDelegate( if (bridge != null) { if (shouldReloadBridge()) { - loadBridgeInWebView() + bridge?.load() } } else { logEvent("bridgeNotInitializedForWebView", destination.bridgeDestinationLocation()) diff --git a/strada/src/test/kotlin/dev/hotwire/strada/BridgeDelegateTest.kt b/strada/src/test/kotlin/dev/hotwire/strada/BridgeDelegateTest.kt index 5a405ab..8204c8e 100644 --- a/strada/src/test/kotlin/dev/hotwire/strada/BridgeDelegateTest.kt +++ b/strada/src/test/kotlin/dev/hotwire/strada/BridgeDelegateTest.kt @@ -35,14 +35,14 @@ class BridgeDelegateTest { } @Test - fun loadBridgeInWebView() { - delegate.loadBridgeInWebView() + fun onColdBootPageCompleted() { + delegate.onColdBootPageCompleted() verify(bridge).load() } @Test - fun resetBridge() { - delegate.resetBridge() + fun onColdBootPageStarted() { + delegate.onColdBootPageStarted() verify(bridge).reset() }