Skip to content

Commit

Permalink
release: SDK 1.21.0
Browse files Browse the repository at this point in the history
  • Loading branch information
arnaud-roland committed Jan 5, 2024
1 parent 5bad6fd commit 20db236
Show file tree
Hide file tree
Showing 38 changed files with 10,141 additions and 638 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,5 @@ node_modules/
**/.idea/saveactions_settings.xml
**/.idea/assetWizardSettings.xml
**/.idea/jarRepositories.xml
**/.idea/androidTestResultsUserPreferences.xml
**/.idea/other.xml
4 changes: 2 additions & 2 deletions Sources/buildSrc/src/main/java/Consts.kt
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ object ProjectConsts {
}

object SDKConsts {
const val VERSION = "1.20.1"
const val API_LEVEL = 61
const val VERSION = "1.21.0"
const val API_LEVEL = 70
const val MESSAGING_API_LEVEL = 12

const val MIN_SDK = 15
Expand Down
5 changes: 1 addition & 4 deletions Sources/sdk/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,10 @@ dependencies {
val kotlinVersion = ProjectConsts.KOTLIN_VERSION
val kotlinCoroutinesVersion = ProjectConsts.KOTLIN_COROUTINES_VERSION

compileOnly("com.google.android.gms:play-services-ads:${playServicesVersion}")
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:core:1.9.0")
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")
compileOnly(project(":sdk-stubs"))
Expand All @@ -148,7 +147,6 @@ dependencies {
androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1")
androidTestImplementation("androidx.test.ext:truth:1.5.0")

androidTestImplementation("com.google.android.gms:play-services-ads:${playServicesVersion}")
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}")
Expand All @@ -164,7 +162,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-ads:${playServicesVersion}")
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}")
Expand Down
9 changes: 0 additions & 9 deletions Sources/sdk/proguard-consumer-rules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,3 @@
public static int GOOGLE_PLAY_SERVICES_VERSION_CODE;
public *** isGooglePlayServicesAvailable(...);
}

-keepclassmembers class com.google.android.gms.ads.identifier.AdvertisingIdClient {
public *** getAdvertisingIdInfo(...);
}

-keepclassmembers class com.google.android.gms.ads.identifier.AdvertisingIdClient$Info {
public *** getId();
public *** isLimitAdTrackingEnabled();
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;

import android.content.Context;
import androidx.test.core.app.ApplicationProvider;
Expand Down Expand Up @@ -71,31 +70,4 @@ public void testCheckGoogleServicesAvailability() throws Exception {
assertNotNull(playServicesAvailability);
assertEquals(ConnectionResult.SUCCESS, (int) playServicesAvailability);
}

/**
* Test the advertising id value response
*
* @throws Exception
*/
@Test
public void testGetAdvertisingIDValue() throws Exception {
latch = new CountDownLatch(1);
GooglePlayServicesHelper.getAdvertisingIDValue(
appContext,
new GooglePlayServicesHelper.AdvertisingValueListener() {
@Override
public void onValue(String value, boolean limited) {
assertNotNull(value);
latch.countDown();
}

@Override
public void onError(Exception e) {
fail("Error occured : " + e.getMessage());
latch.countDown();
}
}
);
latch.await();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@

import com.batch.android.annotation.PublicSDK;

/**
* @deprecated Batch doesn't collects the Android Advertising Identifier anymore.
*/
@PublicSDK
@Deprecated
public interface AdsIdentifierProvider {
/**
* Is this provider available to use? This is the place to check if the libraries are here at
Expand All @@ -22,8 +26,10 @@ public interface AdsIdentifierProvider {

/**
* Interface used to callback from
* @deprecated Batch doesn't collects the Android Advertising Identifier anymore.
*/
@PublicSDK
@Deprecated
interface AdsIdentifierListener {
/**
* Called on success with the id & if the user selected to opt-out from ads
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@

import com.batch.android.annotation.PublicSDK;

/**
*
* @deprecated Batch doesn't collects the Android Advertising Identifier anymore.
*/
@PublicSDK
@Deprecated
public class AdsIdentifierProviderAvailabilityException extends Exception {

public AdsIdentifierProviderAvailabilityException(String message) {
Expand Down
111 changes: 22 additions & 89 deletions Sources/sdk/src/main/java/com/batch/android/AdvertisingID.java
Original file line number Diff line number Diff line change
@@ -1,134 +1,67 @@
package com.batch.android;

import android.content.Context;
import androidx.annotation.Nullable;
import com.batch.android.core.Logger;
import com.batch.android.di.providers.PushModuleProvider;
import com.batch.android.processor.Module;
import com.batch.android.processor.Singleton;

/**
* Object that encapsulate advertising ID
*
* @deprecated Batch doesn't collects the Android Advertising Identifier anymore.
* @hide
*/
@Module
@Singleton
@Deprecated
public final class AdvertisingID {

private static final String TAG = "AdvertisingID";

/**
* Advertising ID value return when not available :
*
* - For Apps with target API level set to 31 (Android 12) or later must declare the normal
* permission com.google.android.gms.AD_ID in the AndroidManifest.xml in order to use
* the getId API
*
* - For all users who have opted out of ads personalization in their device settings
*/
private static final String UNAVAILABLE_AD_ID = "00000000-0000-0000-0000-000000000000";

/**
* Advertising ID
*/
private String advertisingID;

/**
* Is use of advertising id limited
*/
private boolean limited;

/**
* Is advertising ID already available
*/
private boolean advertisingIdReady = false;

// ------------------------------------------------->

public AdvertisingID() {
// Start Advertising ID async get
initAdvertisingID();
}

/**
* Start the thread to retrieve the advertising ID asynchronously
*/
private void initAdvertisingID() {
AdsIdentifierProvider provider = PushModuleProvider.get().getAdsIdentifierProvider();
if (provider != null) {
try {
provider.checkAvailability();
} catch (AdsIdentifierProviderAvailabilityException e) {
Logger.error(TAG, "Could not get Advertising Id: " + e.getMessage());
return;
}

provider.getAdsIdentifier(
new AdsIdentifierProvider.AdsIdentifierListener() {
@Override
public void onSuccess(String id, boolean limited) {
advertisingID = UNAVAILABLE_AD_ID.equals(id) ? null : id;
AdvertisingID.this.limited = limited;
advertisingIdReady = true;
Logger.internal(TAG, "Advertising ID retrieved");
}

@Override
public void onError(Exception e) {
Logger.error(TAG, "Error while retrieving Advertising ID", e);
advertisingIdReady = true;
}
}
);
}
}

// --------------------------------------------->
public AdvertisingID() {}

/**
* Tell if the process to retrieve advertising ID is already complete
*
* @return true if the process is completed
* @return This method always return false.
* @deprecated Batch doesn't support advertising id anymore.
*/
@Deprecated
public boolean isReady() {
return advertisingIdReady;
return false;
}

/**
* Get the advertising ID
*
* @return The advertising ID if available, null otherwise
* @throws IllegalStateException if the advertising id is not available yet (check {@link #isReady()})
* @return This method always return null.
* @throws IllegalStateException Cannot throw
* @deprecated Batch doesn't support advertising id anymore.
*/
@Deprecated
@Nullable
public String get() throws IllegalStateException {
if (!advertisingIdReady) {
throw new IllegalStateException("Advertising ID is not ready yet");
}

return advertisingID;
return null;
}

/**
* Is the use of the advertising ID limited
*
* @return true if the advertising ID limited
* @throws IllegalStateException if the advertising id is not available yet (check {@link #isReady()})
* @return This method always return false.
* @throws IllegalStateException Cannot throw
* @deprecated Batch doesn't support advertising id anymore.
*/
@Deprecated
public boolean isLimited() throws IllegalStateException {
if (!advertisingIdReady) {
throw new IllegalStateException("Advertising ID is not ready yet");
}

return limited;
return false;
}

/**
* Is the advertising ID not null
*
* @return true if its not
* @return This method always return false.
* @deprecated Batch doesn't support advertising id anymore.
*/
@Deprecated
public boolean isNotNull() {
return advertisingID != null;
return false;
}
}
Loading

0 comments on commit 20db236

Please sign in to comment.