Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions .github/workflows/run-mobileboost-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Run MobileBoost Tests on PR

on:
pull_request:
types: [opened, reopened]
workflow_dispatch:

jobs:
build-and-test:
runs-on: macos-latest

steps:
- name: Check out repository code
uses: actions/checkout@v2

- name: Navigate to TestBed Directory
run: cd Branch-SDK-TestBed

- name: Setup java for gradle
uses: actions/setup-java@v3
with:
distribution: ${{ env.JAVA_DISTRIBUTION }}
java-version: ${{ env.JAVA_VERSION }}

- name: Build Android App
run: ./gradlew Branch-SDK-TestBed:assembleDebug

- name: Build Android App
run: ./gradlew Liking-Testbeds/DelayedInitTest:assembleDebug

- name: Upload APK to Mobile Boost and Run Tests
run: |
curl -s https://app.mobileboost.io/cli.sh | tr -d '\r' | /bin/bash -s -- "$PWD/Branch-SDK-TestBed/build/outputs/apk/debug/Branch-SDK-TestBed-debug.apk" android

curl -s https://app.mobileboost.io/cli.sh | tr -d '\r' | /bin/bash -s -- "$PWD/Liking-Testbeds/DelayedInitTest/build/outputs/apk/debug/DelayedInitTest-debug.apk" android
env:
API_ORG_KEY: ${{ secrets.MOBILEBOOST_API_ORG_KEY }}
API_KEY: ${{ secrets.MOBILEBOOST_API_ORG_KEY }}
TEST_TAGS: Android
shell: bash
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,5 @@ Branch-SDK-TestBed/gradlew.bat

Branch-SDK-TestBed/gradle/wrapper/gradle-wrapper.properties

.direnv
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.gitignore

.direnv
.secrets
2 changes: 1 addition & 1 deletion Branch-SDK-Automation-TestBed/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ android {
}
defaultConfig {
applicationId "io.branch.branchandroiddemo"
minSdk 21
minSdk 23
targetSdk 33
versionCode 1
versionName "1.0"
Expand Down
Binary file added Branch-SDK-TestBed/branchandroidtestbed.apk
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,13 @@ public void onClick(View v) {
}
});

findViewById(R.id.force_quit_btn).setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
System.exit(0);
}
});

((ToggleButton) findViewById(R.id.tracking_cntrl_btn)).setOnCheckedChangeListener((buttonView, isChecked) -> {
Branch.getInstance().disableTracking(isChecked, (trackingDisabled, referringParams, error) -> {
if (trackingDisabled) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="24dp" android:tint="#FFFFFF" android:viewportHeight="24" android:viewportWidth="24" android:width="24dp">

<path android:fillColor="@android:color/white" android:pathData="M13,3h-2v10h2L13,3zM17.83,5.17l-1.42,1.42C17.99,7.86 19,9.81 19,12c0,3.87 -3.13,7 -7,7s-7,-3.13 -7,-7c0,-2.19 1.01,-4.14 2.58,-5.42L6.17,5.17C4.23,6.82 3,9.26 3,12c0,4.97 4.03,9 9,9s9,-4.03 9,-9c0,-2.74 -1.23,-5.18 -3.17,-6.83z"/>

</vector>
8 changes: 8 additions & 0 deletions Branch-SDK-TestBed/src/main/res/layout/main_activity.xml
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,14 @@
android:drawableStart="@drawable/ic_baseline_settings_24"
android:layout_marginBottom="20dp"
android:text="Settings" />

<Button
android:id="@+id/force_quit_btn"
style="@style/testbed_button_style"
android:drawableStart="@drawable/baseline_power_settings_new_24"
android:layout_marginBottom="20dp"
android:text="Force Quit App" />

</LinearLayout>

</ScrollView>
Expand Down
15 changes: 15 additions & 0 deletions Linking-Testbeds/DelayedInitTest/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
*.iml
.gradle
/local.properties
/.idea/caches
/.idea/libraries
/.idea/modules.xml
/.idea/workspace.xml
/.idea/navEditor.xml
/.idea/assetWizardSettings.xml
.DS_Store
/build
/captures
.externalNativeBuild
.cxx
local.properties
1 change: 1 addition & 0 deletions Linking-Testbeds/DelayedInitTest/app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
72 changes: 72 additions & 0 deletions Linking-Testbeds/DelayedInitTest/app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
plugins {
alias(libs.plugins.androidApplication)
alias(libs.plugins.jetbrainsKotlinAndroid)
}

android {
namespace = "io.branch.delayedinittest"
compileSdk = 35

defaultConfig {
applicationId = "io.branch.delayedinittest"
minSdk = 26
targetSdk = 35
versionCode = 1
versionName = "1.0"

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables {
useSupportLibrary = true
}
}

buildTypes {
release {
isMinifyEnabled = false
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = "1.8"
}
buildFeatures {
compose = true
}
composeOptions {
kotlinCompilerExtensionVersion = "1.5.1"
}
packaging {
resources {
excludes += "/META-INF/{AL2.0,LGPL2.1}"
}
}
}

dependencies {

implementation(libs.androidx.core.ktx)
implementation(libs.androidx.lifecycle.runtime.ktx)
implementation(libs.androidx.activity.compose)
implementation(platform(libs.androidx.compose.bom))
implementation(libs.androidx.ui)
implementation(libs.androidx.ui.graphics)
implementation(libs.androidx.ui.tooling.preview)
implementation(libs.androidx.material3)
testImplementation(libs.junit)
androidTestImplementation(libs.androidx.junit)
androidTestImplementation(libs.androidx.espresso.core)
androidTestImplementation(platform(libs.androidx.compose.bom))
androidTestImplementation(libs.androidx.ui.test.junit4)
debugImplementation(libs.androidx.ui.tooling)
debugImplementation(libs.androidx.ui.test.manifest)

implementation("io.branch.sdk.android:library:5.15.0")
implementation("com.google.android.gms:play-services-ads-identifier:18.0.1")
}
21 changes: 21 additions & 0 deletions Linking-Testbeds/DelayedInitTest/app/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package io.branch.delayedinittest

import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.ext.junit.runners.AndroidJUnit4

import org.junit.Test
import org.junit.runner.RunWith

import org.junit.Assert.*

/**
* Instrumented test, which will execute on an Android device.
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
@RunWith(AndroidJUnit4::class)
class ExampleInstrumentedTest {
@Test
fun useAppContext() {
// Context of the app under test.
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
assertEquals("io.branch.delayedinittest", appContext.packageName)
}
}
131 changes: 131 additions & 0 deletions Linking-Testbeds/DelayedInitTest/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="com.google.android.gms.permission.AD_ID"/>

<application
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.DelayedInitTest"
tools:targetApi="31"
android:name="io.branch.delayedinittest.DelayedInitTestApplication"
>
<activity
android:name=".MainActivity"
android:exported="true"
android:label="@string/app_name"
android:theme="@style/Theme.DelayedInitTest">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>

<!-- Non AppLink example -->
<intent-filter>
<data android:scheme="branchtest" />
<action android:name="android.intent.action.VIEW" />

<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>

<!-- AppLink example -->

<!-- Custom App link example. You can create your custom app link domain on Branch dash board-->
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />

<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />

<data android:scheme="https" />
<data android:host="bnc.lt" />
<data android:pathPrefix="/xhsd" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />

<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />

<data android:scheme="https" />
<data android:host="bnc.lt" />
<data android:pathPrefix="/Ojqd" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />

<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />

<data android:scheme="https" />
<data android:host="bnc.lt" />
<data android:pathPrefix="/xhsd" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />

<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />

<data android:scheme="https" />
<data android:host="bnc.lt" />
<data android:pathPrefix="/Ojqd" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />

<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />

<data android:scheme="https" />
<data android:host="bnctestbed.app.link" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />

<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />

<data android:scheme="https" />
<data android:host="bnctestbed-alternate.test-app.link" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />

<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />

<data android:scheme="https" />
<data android:host="bnctestbed-alternate.app.link" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />

<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />

<data android:scheme="https" />
<data android:host="bnctestbed-alternate.app.link" />
</intent-filter>
</activity>

<!-- Branch init -->
<!-- REPLACE `BranchKey` with the value from your Branch Dashboard -->
<meta-data android:name="io.branch.sdk.BranchKey" android:value="key_live_hcnegAumkH7Kv18M8AOHhfgiohpXq5tB" />
<!-- REPLACE `BranchKey.test` with the value from your Branch Dashboard -->
<meta-data android:name="io.branch.sdk.BranchKey.test" android:value="key_test_hdcBLUy1xZ1JD0tKg7qrLcgirFmPPVJc" />
<!-- Set to `true` to use `BranchKey.test` -->
<meta-data android:name="io.branch.sdk.TestMode" android:value="false" />

</application>

</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package io.branch.delayedinittest

import android.app.Application
import io.branch.referral.Branch
import io.branch.referral.BranchLogger.BranchLogLevel

class DelayedInitTestApplication: Application() {

override fun onCreate() {
super.onCreate()

Branch.expectDelayedSessionInitialization(true)

Branch.enableLogging(BranchLogLevel.VERBOSE)

Branch.getAutoInstance(this)
}
}
Loading
Loading