Skip to content

Commit

Permalink
Merge pull request #119 from adobe/dev-v3.x
Browse files Browse the repository at this point in the history
Merge `dev-v3.x` into `staging` for Assurance v3.0.1
  • Loading branch information
prudrabhat authored Jun 4, 2024
2 parents b035dbf + 7906561 commit 1f2ad04
Show file tree
Hide file tree
Showing 10 changed files with 31 additions and 17 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/update-testapp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@ jobs:
runs-on: macos-latest

steps:

- name: Set up Java
uses: actions/setup-java@v1
uses: actions/setup-java@v3
with:
java-version: 11
distribution: 'zulu'
java-version: 17

- name: Checkout
uses: actions/[email protected]
Expand Down
Binary file modified artifacts/assurance-testapp-debug.apk
Binary file not shown.
12 changes: 3 additions & 9 deletions code/assurance-testapp/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,9 @@ android {
implementation("com.adobe.marketing.mobile:lifecycle:3.0.0")
// Messaging, Edge, and EdgeIdentity will be available after Core, Assurance release.
// Use Snapshot version for initial Assurance release.
implementation("com.adobe.marketing.mobile:messaging:3.0.0-beta.1-SNAPSHOT") {
isTransitive = false
}
implementation("com.adobe.marketing.mobile:edge:3.0.0-beta.1-SNAPSHOT") {
isTransitive = false
}
implementation("com.adobe.marketing.mobile:edgeidentity:3.0.0-beta.1-SNAPSHOT") {
isTransitive = false
}
implementation("com.adobe.marketing.mobile:messaging:3.0.0")
implementation("com.adobe.marketing.mobile:edge:3.0.0")
implementation("com.adobe.marketing.mobile:edgeidentity:3.0.0")

testImplementation("junit:junit:4.13.2")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public class Assurance {

public static final Class<? extends Extension> EXTENSION = AssuranceExtension.class;
public static final String LOG_TAG = "Assurance";
public static final String EXTENSION_VERSION = "3.0.0";
public static final String EXTENSION_VERSION = "3.0.1";
public static final String EXTENSION_NAME = "com.adobe.assurance";
public static final String EXTENSION_FRIENDLY_NAME = "Assurance";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,17 @@ internal class AssuranceSessionPresentationManager {
/** Shows the UI elements that are required when a session connection has been disconnected. */
@JvmName("onSessionDisconnected")
internal fun onSessionDisconnected(closeCode: Int) {
// Remove the button from the UI on any disconnection. This is OK since
// 1. The button will be re-added when the session is connected via (onSessionConnected) or
// re-connected (onSessionReconnecting) again after an error.
// 2. The button is not shown anyway when the Assurance Authorization UI is active.
button.remove()

val error = SocketCloseCode.toAssuranceConnectionError(closeCode)
if (error == null) {
AssuranceComponentRegistry.appState.onSessionPhaseChange(
AssuranceAppState.SessionPhase.Disconnected()
)
button.remove()
logLocalUI(
UILogColorVisibility.LOW,
"Assurance disconnected."
Expand All @@ -96,7 +101,11 @@ internal class AssuranceSessionPresentationManager {
*/
@JvmName("onSessionReconnecting")
internal fun onSessionReconnecting() {
button.updateGraphic(false)
button.apply {
show()
updateGraphic(connected = false)
}

logLocalUI(
UILogColorVisibility.HIGH,
"Assurance disconnected, attempting to reconnect ..."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import android.webkit.WebChromeClient;
import android.webkit.WebResourceError;
import android.webkit.WebResourceRequest;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import com.adobe.marketing.mobile.Assurance;
Expand Down Expand Up @@ -228,7 +229,10 @@ public void run() {
webView == null
? new WebView(MobileCore.getApplication())
: webView;
currentSocket.webView.getSettings().setJavaScriptEnabled(true);
final WebSettings webSettings = currentSocket.webView.getSettings();
webSettings.setJavaScriptEnabled(true);
webSettings.setAllowContentAccess(false);
webSettings.setAllowFileAccess(false);
currentSocket.webView.setWebViewClient(new WebViewSocketClient());
currentSocket.webView.setWebChromeClient(
new WebChromeClient() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ internal class QuickConnectViewModel : ViewModel {
when (quickConnectScreenAction) {
is QuickConnectScreenAction.Cancel -> {
_state.value = ConnectionState.Disconnected(null)
quickConnectManager.cancel()
AssuranceComponentRegistry.sessionUIOperationHandler?.onCancel()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,14 +124,16 @@ class AssuranceSessionPresentationManagerTest {

// Verify

// Floating button should be removed on disconnection
verify(mockAssuranceFloatingButton).remove()

// Session phase should remain in Authorizing phase because the UI is active
assertEquals(
AssuranceAppState.SessionPhase.Authorizing(credentials),
AssuranceComponentRegistry.appState.sessionPhase.value
)

// no changes in ui elements
verify(mockAssuranceFloatingButton, never()).remove()
verify(mockActivity, never()).startActivity(any())
}

Expand Down Expand Up @@ -210,6 +212,7 @@ class AssuranceSessionPresentationManagerTest {
assuranceSessionPresentationManager.onSessionReconnecting()

// Verify
verify(mockAssuranceFloatingButton).show()
verify(mockAssuranceFloatingButton).updateGraphic(false)
val currentPhase = AssuranceComponentRegistry.appState.sessionPhase.value
assertTrue { currentPhase is AssuranceAppState.SessionPhase.Disconnected }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ class QuickConnectViewModelTest {
ConnectionState.Disconnected(null),
quickConnectViewModel.state.value
)
verify(mockQuickConnectManager).cancel()
verify(mockSessionUIOperationHandler).onCancel()
}

Expand Down
2 changes: 1 addition & 1 deletion code/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ android.injected.testOnly = false
org.gradle.configureondemand=false

moduleName=assurance
moduleVersion=3.0.0
moduleVersion=3.0.1
mavenRepoName=AdobeMobileAssurance
mavenRepoDescription=Android Assurance Extension for Adobe Mobile Marketing
mavenCoreVersion=3.0.0
Expand Down

0 comments on commit 1f2ad04

Please sign in to comment.