Skip to content

Commit

Permalink
Merge pull request #176 from Countly/rc_tests
Browse files Browse the repository at this point in the history
RC Feature Additions
  • Loading branch information
ArtursKadikis authored Jun 27, 2023
2 parents e43a71a + a9f0aa1 commit c9ac7c2
Show file tree
Hide file tree
Showing 31 changed files with 1,903 additions and 606 deletions.
11 changes: 10 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
## 23.2.0
## 23.6.0
* !! Major breaking change !! Automatically downloaded remote config values will no longer be automatically enrolled in their AB tests.
* ! Minor breaking change ! Remote config will now return previously downloaded values when remote-config consent is not given

* Introduced a new set of remote config methods
* Deprecated old remote config methods

* Fixed bug where recording views would force send all stored events
* Fixed bug where exiting temporary ID mode would create unintended requests

* Removed the deprecated enum "DeviceId.Type"
* Removed the deprecated value "ADVERTISING_ID" from the enum "DeviceIdType"
* Removed the deprecated function "Countly.changeDeviceIdWithoutMerge(type, deviceID)"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
import android.widget.Toast;

import androidx.appcompat.app.AppCompatActivity;
import ly.count.android.sdk.RCData;
import ly.count.android.sdk.RCDownloadCallback;
import ly.count.android.sdk.RequestResult;
import org.json.JSONArray;
import org.json.JSONObject;

Expand All @@ -24,9 +27,8 @@ public void onCreate(Bundle savedInstanceState) {
}

public void onClickRemoteConfigUpdate(View v) {
Countly.sharedInstance().remoteConfig().update(new RemoteConfigCallback() {
@Override
public void callback(String error) {
Countly.sharedInstance().remoteConfig().downloadAllKeys(new RCDownloadCallback() {
@Override public void callback(RequestResult downloadResult, String error, boolean fullValueUpdate, Map<String, RCData> downloadedValues) {
if (error == null) {
Toast.makeText(getApplicationContext(), "Update finished", Toast.LENGTH_SHORT).show();
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
import java.util.Arrays;
import java.util.Map;
import ly.count.android.sdk.Countly;
import ly.count.android.sdk.RequestResponse;
import ly.count.android.sdk.RCVariantCallback;
import ly.count.android.sdk.RequestResult;

public class ActivityExampleTests extends AppCompatActivity {

Expand All @@ -22,10 +22,10 @@ public void onCreate(Bundle savedInstanceState) {

// For fetching all variants with a button click
public void onClickFetchAllVariants(View v) {
Countly.sharedInstance().remoteConfig().testingFetchVariantInformation(new RCVariantCallback() {
Countly.sharedInstance().remoteConfig().testingDownloadVariantInformation(new RCVariantCallback() {
@Override
public void callback(RequestResponse result, String error) {
if (result == RequestResponse.SUCCESS) {
public void callback(RequestResult result, String error) {
if (result == RequestResult.Success) {
Toast.makeText(getApplicationContext(), "Fetch finished", Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(getApplicationContext(), "Error: " + result, Toast.LENGTH_SHORT).show();
Expand Down Expand Up @@ -75,8 +75,8 @@ public void onClickEnrollVariant(View v) {

Countly.sharedInstance().remoteConfig().testingEnrollIntoVariant(key, variant, new RCVariantCallback() {
@Override
public void callback(RequestResponse result, String error) {
if (result == RequestResponse.SUCCESS) {
public void callback(RequestResult result, String error) {
if (result == RequestResult.Success) {
Toast.makeText(getApplicationContext(), "Fetch finished", Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(getApplicationContext(), "Error: " + result, Toast.LENGTH_SHORT).show();
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ org.gradle.configureondemand=true
android.useAndroidX=true
android.enableJetifier=true
# RELEASE FIELD SECTION
VERSION_NAME=22.09.4
VERSION_NAME=23.6.0
GROUP=ly.count.android
POM_URL=https://github.com/Countly/countly-sdk-android
POM_SCM_URL=https://github.com/Countly/countly-sdk-android
Expand Down
55 changes: 27 additions & 28 deletions sdk-native/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,49 +2,48 @@ apply plugin: 'com.android.library'
apply plugin: "com.vanniktech.maven.publish"

buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.vanniktech:gradle-maven-publish-plugin:0.21.0' //for publishing
}
repositories {
mavenCentral()
}
dependencies {
classpath 'com.vanniktech:gradle-maven-publish-plugin:0.21.0' //for publishing
}
}

android {
compileSdkVersion 31
compileSdkVersion 33

defaultConfig {
minSdkVersion 17
targetSdkVersion 31
defaultConfig {
minSdkVersion 17
targetSdkVersion 33

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}

buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
buildToolsVersion '33.0.0'
}
buildToolsVersion '33.0.0'
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation fileTree(dir: 'libs', include: ['*.jar'])

//testImplementation 'junit:junit:4.13.2'
//androidTestImplementation 'androidx.test:runner:1.3.0'
//androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
//testImplementation 'junit:junit:4.13.2'
//androidTestImplementation 'androidx.test:runner:1.3.0'
//androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}

task copyLibs(type: Copy) {
from "libs"
into "src/main/jniLibs"
from "libs"
into "src/main/jniLibs"
}

tasks.whenTaskAdded { task ->
if (task.name.startsWith('assemble')) {
task.dependsOn('copyLibs')
}
if (task.name.startsWith('assemble')) {
task.dependsOn('copyLibs')
}
}
11 changes: 4 additions & 7 deletions sdk/build.gradle
Original file line number Diff line number Diff line change
@@ -1,18 +1,12 @@
apply plugin: 'com.android.library'
apply plugin: "com.vanniktech.maven.publish" //for publishing

//Plugin for generating test coverage reports.
//This plugin required android build tools 3.6.4 and gradle 5.6.4
//They are generated by calling the following from the root folder:
// ./gradlew createDebugCoverageReport
//apply plugin: 'jacoco-android'

buildscript {
repositories {
mavenCentral()
}
dependencies {
//classpath 'com.dicedmelon.gradle:jacoco-android:0.1.4'
//classpath "com.vanniktech:gradle-android-junit-jacoco-plugin:0.16.0" //test coverage reports
classpath 'com.vanniktech:gradle-maven-publish-plugin:0.21.0' //for publishing
}
}
Expand Down Expand Up @@ -66,3 +60,6 @@ dependencies {
androidTestImplementation "org.mockito:mockito-android:${mockitoVersion}"
//androidTestImplementation "com.squareup.okhttp3:mockwebserver:4.9.0"
}

//Plugin for generating test coverage reports.
//apply plugin: "com.vanniktech.android.junit.jacoco"
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ public void testPrepareCommonRequest() {
break;
case "sdk_version":
if (a == 0) {
Assert.assertTrue(pair[1].equals("22.09.4"));
Assert.assertTrue(pair[1].equals("23.6.0"));
} else if (a == 1) {
Assert.assertTrue(pair[1].equals("123sdf.v-213"));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,8 @@ public boolean filterCrash(String crash) {
Assert.assertTrue(config.autoTrackingUseShortName);
Assert.assertEquals(hv, config.customNetworkRequestHeaders);
Assert.assertTrue(config.pushIntentAddMetadata);
Assert.assertTrue(config.enableRemoteConfigAutomaticDownload);
Assert.assertEquals(rcc2, config.remoteConfigCallbackNew);
Assert.assertTrue(config.enableRemoteConfigAutomaticDownloadTriggers);
Assert.assertEquals(rcc2, config.remoteConfigCallbackLegacy);
Assert.assertTrue(config.shouldRequireConsent);
Assert.assertArrayEquals(fn, config.enabledFeatureNames);
Assert.assertTrue(config.httpPostForced);
Expand Down Expand Up @@ -249,8 +249,8 @@ void assertDefaultValues(CountlyConfig config, boolean includeConstructorValues)
Assert.assertFalse(config.autoTrackingUseShortName);
Assert.assertNull(config.customNetworkRequestHeaders);
Assert.assertFalse(config.pushIntentAddMetadata);
Assert.assertFalse(config.enableRemoteConfigAutomaticDownload);
Assert.assertNull(config.remoteConfigCallbackNew);
Assert.assertFalse(config.enableRemoteConfigAutomaticDownloadTriggers);
Assert.assertNull(config.remoteConfigCallbackLegacy);
Assert.assertFalse(config.shouldRequireConsent);
Assert.assertNull(config.enabledFeatureNames);
Assert.assertFalse(config.httpPostForced);
Expand Down
Loading

0 comments on commit c9ac7c2

Please sign in to comment.