Skip to content

Commit

Permalink
release: SDK 2.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
arnaud-roland committed Apr 26, 2024
1 parent a5468fb commit 7cbd16b
Show file tree
Hide file tree
Showing 200 changed files with 28,894 additions and 7,803 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ The Batch Android SDK allows you to build meaningful communication experience in
Our [📕 setup documentation](https://doc.batch.com/ios/prerequisites) details the steps to take for an easy and successful integration.

# Prerequisites
The Batch Android SDK requires Android Studio 4 and Android API 15.
The Batch Android SDK requires Android 5.0 (Lollipop / API Level 21).

# Documentation
- [Setup guide](https://doc.batch.com/android/prerequisites): start your implementation here!
Expand Down
21 changes: 6 additions & 15 deletions Sources/buildSrc/src/main/java/Consts.kt
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
object ProjectConsts {
const val COMPILE_SDK = 34

const val KOTLIN_VERSION = "1.7.21"
const val KOTLIN_COROUTINES_VERSION = "1.6.4"
const val KOTLIN_VERSION = "1.9.0"
const val KOTLIN_COROUTINES_VERSION = "1.7.1"

const val ANDROID_LINT_VERSION = "30.1.2"

const val ANDROID_GRADLE_PLUGIN_VERSION = "8.0.2"
const val ANDROID_GRADLE_PLUGIN_VERSION = "8.3.0"
const val GMS_GRADLE_PLUGIN_VERSION = "4.3.14"
}

object SDKConsts {
const val VERSION = "1.21.1"
const val API_LEVEL = 70
const val VERSION = "2.0.0"
const val API_LEVEL = 200
const val MESSAGING_API_LEVEL = 12

const val MIN_SDK = 15
const val TARGET_SDK = 34
const val MIN_SDK = 21
const val R_PREFIX = "com_batchsdk_"
const val NAMESPACE = "com.batch.android"
const val TEST_NAMESPACE = "com.batch.android.test"
Expand All @@ -28,14 +27,6 @@ object SDKConsts {
// usually wants lower versions for compatibility.
object DependenciesVersions {
const val ANDROIDX = "1.0.0"
const val PLAY_SERVICES = "11.8.0"
}
}

object SampleConsts {
object DependenciesVersions {
const val ANDROIDX = "1.1.0"
const val PLAY_SERVICES = "16.0.0"
}
}

2 changes: 1 addition & 1 deletion Sources/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ org.gradle.jvmargs=-Xmx4096m -Dfile.encoding=UTF-8
org.gradle.caching=true
org.gradle.configureondemand=false
android.useAndroidX=true
android.enableJetifier=true
android.enableJetifier=false
gnsp.disableApplyOnlyOnRootProjectEnforcement=true
kotlin.stdlib.default.dependency=false
4 changes: 2 additions & 2 deletions Sources/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Wed Jul 12 10:10:59 CEST 2023
#Tue Apr 16 15:13:35 CEST 2024
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
1 change: 0 additions & 1 deletion Sources/sdk-stubs/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ android {

defaultConfig {
minSdk = SDKConsts.MIN_SDK
targetSdk = SDKConsts.TARGET_SDK
}

buildTypes {
Expand Down
30 changes: 8 additions & 22 deletions Sources/sdk/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import org.gradle.api.tasks.testing.logging.TestLogEvent
import org.jetbrains.kotlin.gradle.plugin.mpp.pm20.util.archivesName

plugins {
id("com.android.library")
id("org.jetbrains.kotlin.android")
}

// Required for Groovy compatiblity, which cannot use Consts.kt
// Required for Groovy compatibility, which cannot use Consts.kt
ext {
set("mavenGroupId", SDKConsts.MAVEN_GROUP_ID)
set("mavenArtifact", SDKConsts.MAVEN_ARTIFACT)
Expand All @@ -26,7 +25,6 @@ android {

defaultConfig {
minSdk = SDKConsts.MIN_SDK
targetSdk = SDKConsts.TARGET_SDK

buildConfigField("String", "SDK_VERSION", "\"${SDKConsts.VERSION}\"")
buildConfigField("Integer", "API_LEVEL", "${SDKConsts.API_LEVEL}")
Expand Down Expand Up @@ -71,7 +69,6 @@ android {
}

testOptions {
execution = "ANDROIDX_TEST_ORCHESTRATOR"
unitTests {
isReturnDefaultValues = true
isIncludeAndroidResources = true
Expand Down Expand Up @@ -116,42 +113,34 @@ tasks.register("printVersion") {
}

dependencies {

val androidXLibraryVersion = SDKConsts.DependenciesVersions.ANDROIDX
val playServicesVersion = SDKConsts.DependenciesVersions.PLAY_SERVICES
val kotlinVersion = ProjectConsts.KOTLIN_VERSION
val kotlinCoroutinesVersion = ProjectConsts.KOTLIN_COROUTINES_VERSION

compileOnly("com.google.android.gms:play-services-gcm:${playServicesVersion}")
compileOnly("com.google.android.gms:play-services-location:${playServicesVersion}")
compileOnly("com.google.android.gms:play-services-nearby:${playServicesVersion}")
compileOnly("com.google.android.play:review:2.0.1")
compileOnly("com.google.firebase:firebase-iid:21.1.0")
compileOnly("com.google.firebase:firebase-messaging:22.0.0")
api("androidx.core:core:${androidXLibraryVersion}")

compileOnly(project(":sdk-stubs"))
compileOnly(project(":sdk-processor"))
annotationProcessor(project(":sdk-processor"))
lintChecks(project(":sdk-lint"))

api("androidx.core:core:${androidXLibraryVersion}")
compileOnly("androidx.appcompat:appcompat:${androidXLibraryVersion}")
compileOnly("com.google.android.play:review:2.0.1")
compileOnly("com.google.firebase:firebase-messaging:22.0.0")
compileOnly("com.google.android.material:material:${androidXLibraryVersion}")
compileOnly("androidx.appcompat:appcompat:${androidXLibraryVersion}")
compileOnly("androidx.dynamicanimation:dynamicanimation:$androidXLibraryVersion")

androidTestImplementation("junit:junit:4.13.2")
androidTestImplementation("androidx.annotation:annotation:${androidXLibraryVersion}")
androidTestImplementation("androidx.test:core-ktx:1.5.0")
androidTestImplementation("androidx.test:rules:1.5.0")
androidTestImplementation("androidx.test:runner:1.5.2")
androidTestImplementation("androidx.test.ext:junit:1.1.5")
androidTestImplementation("androidx.test.espresso:espresso-intents:3.5.1")
androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1")
androidTestImplementation("androidx.test.ext:truth:1.5.0")

androidTestImplementation("com.google.android.gms:play-services-gcm:${playServicesVersion}")
androidTestImplementation("com.google.android.gms:play-services-location:${playServicesVersion}")
androidTestImplementation("com.google.android.gms:play-services-nearby:${playServicesVersion}")
androidTestImplementation("com.google.firebase:firebase-core:17.4.3")
androidTestImplementation("androidx.appcompat:appcompat:${androidXLibraryVersion}")
androidTestImplementation("androidx.annotation:annotation:${androidXLibraryVersion}")

testImplementation("junit:junit:4.13.2")
testImplementation("org.mockito:mockito-core:5.4.0")
Expand All @@ -162,9 +151,6 @@ dependencies {
testImplementation("androidx.test.espresso:espresso-intents:3.5.1")
testImplementation("androidx.test.espresso:espresso-core:3.5.1")
testImplementation("androidx.test.ext:truth:1.5.0")
testImplementation("com.google.android.gms:play-services-gcm:${playServicesVersion}")
testImplementation("com.google.android.gms:play-services-location:${playServicesVersion}")
testImplementation("com.google.android.gms:play-services-nearby:${playServicesVersion}")
testImplementation("androidx.appcompat:appcompat:${androidXLibraryVersion}")

testImplementation("org.robolectric:robolectric:4.9.2")
Expand Down
4 changes: 2 additions & 2 deletions Sources/sdk/jacoco.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ task testDebugCoverageUnitTest(dependsOn: ['instrument', 'testDebugUnitTest']) {
structure(name: 'TestCoverage') {
classfiles {
fileset(
dir: "$buildDir/intermediates/javac/debug/classes",
dir: "$buildDir/intermediates/javac/debug/compileDebugJavaWithJavac/classes",
excludes: '**/R.class,**/R$*.class,**/BuildConfig.*'
)
}
Expand Down Expand Up @@ -81,7 +81,7 @@ task instrument(dependsOn: 'compileDebugUnitTestSources') {
classpath: configurations.jacocoAnt.asPath)

ant.instrument(destdir: offline_instrumented_outputDir) {
fileset(dir: "$buildDir.path/intermediates/javac/debug/classes")
fileset(dir: "$buildDir.path/intermediates/javac/debug/compileDebugJavaWithJavac/classes")
}
}
}
4 changes: 0 additions & 4 deletions Sources/sdk/proguard-sdk-release.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,8 @@
public *;
}

-keepnames class com.batch.android.BatchPushReceiver

-keepnames class com.batch.android.BatchPushService

-keepnames class com.batch.android.BatchPushInstanceIDService

-keep class com.batch.android.msgpack.core.buffer.MessageBuffer {}

-keep class com.google.android.gms.common.GooglePlayServicesUtil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ public class TestApplication extends Application {
public void onCreate() {
super.onCreate();
FirebaseApp.initializeApp(this);
Batch.setConfig(new com.batch.android.Config("FAKE_API_KEY"));
Batch.start("FAKE_API_KEY");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import androidx.test.ext.junit.runners.AndroidJUnit4;
import androidx.test.filters.SmallTest;
import com.google.android.gms.common.ConnectionResult;
import java.util.concurrent.CountDownLatch;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
Expand All @@ -23,7 +22,6 @@
public class GooglePlayServicesHelperTest {

private Context appContext;
private CountDownLatch latch;

@Before
public void setUp() {
Expand All @@ -33,11 +31,10 @@ public void setUp() {
/**
* Test the version get
*
* @throws Exception
*/
@Test
public void testGetLibVersion() throws Exception {
Integer version = GooglePlayServicesHelper.getGooglePlayServicesLibVersion(appContext);
public void testGetLibVersion() {
Integer version = GooglePlayServicesHelper.getGooglePlayServicesLibVersion();

assertNotNull(version);
assertTrue(version >= 4030500);
Expand All @@ -46,24 +43,21 @@ public void testGetLibVersion() throws Exception {
/**
* Test the availability get
*
* @throws Exception
*/
@Test
public void testGetLibAvailability() throws Exception {
public void testGetLibAvailability() {
Integer availability = GooglePlayServicesHelper.getGooglePlayServicesAvailabilityInteger(appContext);

assertNotNull(availability);
assertTrue(availability == 0);
assertTrue("SUCCESS".equals(GooglePlayServicesHelper.getGooglePlayServicesAvailabilityString(availability)));
assertEquals(0, (int) availability);
assertEquals("SUCCESS", GooglePlayServicesHelper.getGooglePlayServicesAvailabilityString(availability));
}

/**
* Test the google environnement availability response
* Test the google environment availability response
*
* @throws Exception
*/
@Test
public void testCheckGoogleServicesAvailability() throws Exception {
public void testCheckGoogleServicesAvailability() {
final Integer playServicesAvailability = GooglePlayServicesHelper.getGooglePlayServicesAvailabilityInteger(
appContext
);
Expand Down

This file was deleted.

This file was deleted.

Loading

0 comments on commit 7cbd16b

Please sign in to comment.