Skip to content
Merged
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
48 changes: 0 additions & 48 deletions .circleci/config.yml

This file was deleted.

Empty file.
4 changes: 0 additions & 4 deletions .circleci/config/keystore.properties

This file was deleted.

49 changes: 49 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: CI

on:
push:
branches: [master]
pull_request:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7

- name: Set up JDK 17
uses: actions/setup-java@v5
with:
distribution: temurin
java-version: 17

- name: Set up Gradle
uses: gradle/actions/setup-gradle@v6

# app/build.gradle reads keystore.properties at configuration time;
# dummy values are enough for unsigned CI builds
- name: Create CI keystore.properties
run: |
cat > keystore.properties <<'EOF'
keyAlias = ci
keyPassword = ci
storeFile = ./../keystore.jks
storePassword = ci
EOF

- name: Run SDK unit tests
run: ./gradlew :sdk:test

- name: Build demo app
run: ./gradlew :app:assembleDebug

- name: Upload test results
if: always()
uses: actions/upload-artifact@v7
with:
name: test-results
path: '**/build/test-results/**/*.xml'
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Talkable Android SDK

[![Build Status](https://circleci.com/gh/talkable/android-sdk.svg?style=svg)](https://circleci.com/gh/talkable/android-sdk)
[![Build Status](https://github.com/talkable/android-sdk/actions/workflows/ci.yml/badge.svg)](https://github.com/talkable/android-sdk/actions/workflows/ci.yml)
[![](https://jitpack.io/v/talkable/android-sdk.svg)](https://jitpack.io/#talkable/android-sdk)

Talkable Android SDK makes it easy to integrate Talkable referral functionality into Android apps.
Expand Down
12 changes: 6 additions & 6 deletions RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,16 +80,16 @@ All version and build configuration lives in `gradle.properties`:

| Property | Description | Example |
|---|---|---|
| `android_build_tools` | Build tools version (shared) | `36.0.0` |
| `android_build_tools` | Build tools version (shared) | `37.0.0` |
| `sdk_compile_sdk` | SDK compile SDK version | `35` |
| `sdk_target_sdk` | SDK target SDK version | `35` |
| `sdk_target_sdk` | SDK target SDK version (instrumented tests only as of AGP 9) | `35` |
| `sdk_min_sdk` | SDK module minimum SDK | `16` |
| `sdk_version_code` | SDK version code (integer) | `43` |
| `sdk_version_name` | SDK version name (semver) | `0.5.14` |
| `app_compile_sdk` | App compile SDK version | `35` |
| `app_target_sdk` | App target SDK version | `35` |
| `app_compile_sdk` | App compile SDK version | `37` |
| `app_target_sdk` | App target SDK version | `37` |
| `app_min_sdk` | App module minimum SDK | `21` |
| `app_version_code` | App module version code | `3` |
| `app_version_name` | App module version name | `1.0.0` |
| `app_version_code` | App module version code | `4` |
| `app_version_name` | App module version name | `1.0.1` |

Both `sdk/build.gradle` and `app/build.gradle` read from these properties. Do not hardcode build config values in the module build files.
34 changes: 17 additions & 17 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,35 +4,35 @@ def keystoreProperties = new Properties()
keystoreProperties.load(new FileInputStream(rootProject.file("keystore.properties")))

android {
namespace 'com.talkable.appdemo'
namespace = 'com.talkable.appdemo'
signingConfigs {
config {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile file(keystoreProperties['storeFile'])
storePassword keystoreProperties['storePassword']
keyAlias = keystoreProperties['keyAlias']
keyPassword = keystoreProperties['keyPassword']
storeFile = file(keystoreProperties['storeFile'])
storePassword = keystoreProperties['storePassword']
}
}
compileSdkVersion Integer.parseInt(project.app_compile_sdk)
compileSdk = Integer.parseInt(project.app_compile_sdk)
defaultConfig {
applicationId "com.talkable.appdemo2"
minSdkVersion Integer.parseInt(project.app_min_sdk)
targetSdkVersion Integer.parseInt(project.app_target_sdk)
versionCode Integer.parseInt(project.app_version_code)
versionName project.app_version_name
applicationId = "com.talkable.appdemo2"
minSdk = Integer.parseInt(project.app_min_sdk)
targetSdk = Integer.parseInt(project.app_target_sdk)
versionCode = Integer.parseInt(project.app_version_code)
versionName = project.app_version_name
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.config
minifyEnabled = false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
signingConfig = signingConfigs.config
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
buildToolsVersion project.android_build_tools
buildToolsVersion = project.android_build_tools
}

dependencies {
Expand Down
1 change: 1 addition & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

<application
android:allowBackup="true"
android:enableOnBackInvokedCallback="false"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
Expand Down
10 changes: 5 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ buildscript {
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:8.5.2'
classpath 'com.github.bjoernq:unmockplugin:0.7.8'
classpath 'com.android.tools.build:gradle:9.3.0'
classpath 'com.github.bjoernq:unmockplugin:0.11.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
Expand All @@ -17,10 +17,10 @@ allprojects {
repositories {
mavenCentral()
google()
maven { url 'https://jitpack.io' }
maven { url = 'https://jitpack.io' }
}
}

task clean(type: Delete) {
delete rootProject.buildDir
tasks.register('clean', Delete) {
delete rootProject.layout.buildDirectory
}
12 changes: 5 additions & 7 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,20 @@
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
android.defaults.buildfeatures.buildconfig=true
android.enableJetifier=true
android.nonFinalResIds=false
android.nonTransitiveRClass=false
android.useAndroidX=true

android_build_tools=36.0.0
android_build_tools=37.0.0

sdk_compile_sdk=35
sdk_target_sdk=35
sdk_min_sdk=16
sdk_version_code=43
sdk_version_name=0.5.14

app_compile_sdk=35
app_target_sdk=35
app_compile_sdk=37
app_target_sdk=37

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

[P2] Migrate custom Back handling before targeting 37

Plain English

On Android 16 and newer, pressing Back while a Talkable popup is open skips the popup-closing behavior and leaves the offer screen instead.

Example

Run the demo on Android 16 or 17, open a Talkable offer and then an in-offer popup, and press system Back. This line raises the app target from 35 to 37, so the platform no longer dispatches TalkableActivity.onBackPressed(). As a result, TalkableOfferFragment.onBackPressed() never publishes close_popups, and the activity follows the default Back action. Android documents this target-36+ change here: behavior changes.

Why this matters

The demo now activates this behavior, and SDK consumers targeting 36 or newer encounter the same broken popup interaction.

Suggested fix

Migrate TalkableActivity to OnBackPressedDispatcher / OnBackPressedCallback and ensure the resolved AndroidX Activity version integrates with predictive Back. For example:

getOnBackPressedDispatcher().addCallback(this, new OnBackPressedCallback(true) {
    @Override
    public void handleOnBackPressed() {
        if (!mTalkableOfferFragment.onBackPressed()) {
            finish();
        }
    }
});

Add an Android 16+ device or instrumentation test that opens a popup and verifies that the first Back action closes it. A manifest opt-out is only a temporary fallback.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good catch — confirmed: TalkableActivity's Back override stops being dispatched once the app targets 36+. Fixed for the demo app in 372e8a6 with the documented enableOnBackInvokedCallback="false" opt-out. The proper OnBackPressedDispatcher migration needs androidx.activity ≥ 1.6.0 in the SDK (the dispatcher only integrates with predictive back from 1.6.0), so it comes with an AndroidX bump and an SDK release — tracked as a follow-up rather than in this PR, which intentionally doesn't change the published SDK.

app_min_sdk=21
app_version_code=3
app_version_name=1.0.0
app_version_code=4
app_version_name=1.0.1
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-9.5.0-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
2 changes: 2 additions & 0 deletions jitpack.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
jdk:
- openjdk17
43 changes: 29 additions & 14 deletions sdk/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,32 +5,49 @@ apply plugin: 'maven-publish'
group='com.github.talkable'

android {
namespace 'com.talkable.sdk'
compileSdkVersion Integer.parseInt(project.sdk_compile_sdk)
namespace = 'com.talkable.sdk'
compileSdk = Integer.parseInt(project.sdk_compile_sdk)

defaultConfig {
minSdkVersion Integer.parseInt(project.sdk_min_sdk)
targetSdkVersion Integer.parseInt(project.sdk_target_sdk)
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
minSdk = Integer.parseInt(project.sdk_min_sdk)
testInstrumentationRunner = 'androidx.test.runner.AndroidJUnitRunner'

// Required for sdk version retrieval to work as of Android Studio 4.1.0: https://issuetracker.google.com/issues/158695880
buildConfigField 'int', 'VERSION_CODE', "${project.sdk_version_code}"
buildConfigField 'String', 'VERSION_NAME', "\"${project.sdk_version_name}\""
}
buildFeatures {
buildConfig = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
minifyEnabled = false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}

testOptions {
// targetSdk on library modules only applies to instrumented tests as of AGP 9
targetSdk = Integer.parseInt(project.sdk_target_sdk)
unitTests.returnDefaultValues = true
unitTests.all {
// PowerMock 1.6.6/Objenesis need reflective access that JDK 17+ encapsulates
jvmArgs '--add-opens=java.base/java.lang=ALL-UNNAMED',
'--add-opens=java.base/java.lang.reflect=ALL-UNNAMED',
'--add-opens=java.base/java.util=ALL-UNNAMED',
'--add-opens=java.base/jdk.internal.reflect=ALL-UNNAMED',
// OkHttp 3.2.0 reflects into the JDK's SSL internals on the test JVM
'--add-opens=java.base/sun.security.ssl=ALL-UNNAMED'
}
}
lint {
abortOnError false
abortOnError = false
}
buildToolsVersion project.android_build_tools
buildToolsVersion = project.android_build_tools

publishing {
singleVariant('release') {
Expand Down Expand Up @@ -60,14 +77,12 @@ dependencies {

testImplementation 'junit:junit:4.13.2'

testImplementation 'org.mockito:mockito-core:1.10.19'
testImplementation('org.powermock:powermock-api-mockito:1.6.6') {
testImplementation 'org.mockito:mockito-core:2.28.2'
testImplementation('org.powermock:powermock-api-mockito2:2.0.9') {
exclude module: 'hamcrest-core'
exclude module: 'objenesis'
}
testImplementation('org.powermock:powermock-module-junit4:1.6.6') {
testImplementation('org.powermock:powermock-module-junit4:2.0.9') {
exclude module: 'hamcrest-core'
exclude module: 'objenesis'
}

androidTestImplementation 'androidx.annotation:annotation:1.8.2'
Expand Down