Skip to content

Commit 1b4445d

Browse files
Adding improvements (#32)
* Updating SDK versions. Fixing test bug. * Updated JSON library version from "20180813" to "20230227" * Deprecating config calls
1 parent cd1e0de commit 1b4445d

File tree

11 files changed

+82
-80
lines changed

11 files changed

+82
-80
lines changed

.idea/modules/sdk-java/countly-sdk-java.sdk-java.iml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/modules/sdk-java/countly-sdk-java.sdk-java.main.iml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/modules/sdk-java/countly-sdk-java.sdk-java.test.iml

Lines changed: 1 addition & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

CHANGELOG.md

Lines changed: 46 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,46 @@
1-
22.06.0
2-
* The "resetDeviceId", "login", and "logout" have been deprecated.
3-
* ! Minor breaking change ! The following methods and their functionality are deprecated from the "Config" class and will not function anymore:
4-
- "enableTestMode"
5-
- "disableTestMode"
6-
- "isTestModeEnabled".
7-
- "setLoggingTag"
8-
* ! Minor breaking change ! The "TestMode" functionality is being removed from the SDK.
9-
* ! Minor breaking change ! It is not possible to set the logging tag anymore.
10-
* Fixed a bug where the wrong platform field value was being sent in the view request.
11-
12-
20.11.5
13-
* Fixed a bug where the backend mode module produces "null pointer exceptions" in case not initialized.
14-
15-
20.11.4
16-
* Adding mitigations to an issue that would surface when stopping a view that was not started.
17-
18-
20.11.3
19-
* Fixed a threading issue in the backend mode feature.
20-
21-
20.11.2
22-
* Added backend mode feature and a new configuration field to enable it.
23-
24-
20.11.1
25-
* Fixed a bug related to server response handling.
26-
* Fixed a potential issue with parameters tampering protection while adding checksum.
27-
28-
20.11.0
29-
* Added a new method to retrieve the current device id.
30-
* Added new methods to change device ID with and without server merge.
31-
* "Countly::getSession" has been deprecated and this is going to be removed in the future.
32-
* "resetDeviceId" in the SDK public methods has been deprecated and this is going to be removed in the future.
33-
34-
19.09-sdk2-rc
35-
* initial SDK release
36-
* MavenCentral rerelease
1+
22.09.0
2+
* The "resetDeviceId", "login", and "logout" have been deprecated.
3+
* ! Minor breaking change ! The following methods and their functionality are deprecated from the "Config" class and will not function anymore:
4+
- "enableTestMode"
5+
- "disableTestMode"
6+
- "isTestModeEnabled"
7+
- "setLoggingTag"
8+
- "setSdkName"
9+
- "setSdkVersion"
10+
- "getSdkName"
11+
- "getSdkVersion"
12+
- "isDeviceIdFallbackAllowed"
13+
- "setDeviceIdFallbackAllowed"
14+
- "overrideModule"
15+
- "getModuleOverride"
16+
* ! Minor breaking change ! The "TestMode" functionality is being removed from the SDK.
17+
* ! Minor breaking change ! The module override functionality is being removed from the SDK.
18+
* ! Minor breaking change ! It is not possible to set the logging tag anymore.
19+
* Fixed a bug where the wrong platform field value was being sent in the view request.
20+
* Updated JSON library version from "20180813" to "20230227".
21+
22+
20.11.5
23+
* Fixed a bug where the backend mode module produces "null pointer exceptions" in case not initialized.
24+
25+
20.11.4
26+
* Adding mitigations to an issue that would surface when stopping a view that was not started.
27+
28+
20.11.3
29+
* Fixed a threading issue in the backend mode feature.
30+
31+
20.11.2
32+
* Added backend mode feature and a new configuration field to enable it.
33+
34+
20.11.1
35+
* Fixed a bug related to server response handling.
36+
* Fixed a potential issue with parameters tampering protection while adding checksum.
37+
38+
20.11.0
39+
* Added a new method to retrieve the current device id.
40+
* Added new methods to change device ID with and without server merge.
41+
* "Countly::getSession" has been deprecated and this is going to be removed in the future.
42+
* "resetDeviceId" in the SDK public methods has been deprecated and this is going to be removed in the future.
43+
44+
19.09-sdk2-rc
45+
* initial SDK release
46+
* MavenCentral rerelease

app-java/src/main/java/ly/count/java/demo/Sample.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ public static void main(String[] args) throws Exception {
109109
.setDeviceIdStrategy(Config.DeviceIdStrategy.UUID)
110110
.enableFeatures(Config.Feature.Events, Config.Feature.Sessions, Config.Feature.CrashReporting, Config.Feature.Views, Config.Feature.UserProfiles, Config.Feature.Location)
111111
.setRequiresConsent(true)
112-
.enableParameterTamperingProtection("test-salt-checksum")
112+
//.enableParameterTamperingProtection("test-salt-checksum")
113113
.setLogListener(new LogCallback() {
114114
@Override
115115
public void LogHappened(String logMessage, Config.LoggingLevel logLevel) {

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ buildscript {
2020
}
2121

2222
allprojects {
23-
ext.CLY_VERSION = "20.11.1"
23+
ext.CLY_VERSION = "20.11.5"
2424
ext.POWERMOCK_VERSION = "1.7.1"
2525

2626
tasks.withType(Javadoc) {

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
# org.gradle.parallel=true
1919

2020
# RELEASE FIELD SECTION
21-
VERSION_NAME=20.11.5
21+
VERSION_NAME=22.09.0
2222
GROUP=ly.count.sdk
2323

2424
POM_URL=https://github.com/Countly/countly-sdk-java

sdk-java/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ buildscript {
1313
}
1414

1515
dependencies {
16-
implementation 'org.json:json:20180813'
16+
implementation 'org.json:json:20230227'
1717

1818
testImplementation 'junit:junit:4.12'
1919
testImplementation 'org.mockito:mockito-core:2.8.9'
2020
testImplementation "org.powermock:powermock-core:${POWERMOCK_VERSION}"
2121
testImplementation "org.powermock:powermock-module-junit4:${POWERMOCK_VERSION}"
22-
testImplementation 'com.squareup.okhttp3:mockwebserver:3.7.0'
22+
//testImplementation 'com.squareup.okhttp3:mockwebserver:3.7.0'
2323
}
2424

2525
apply plugin: "com.vanniktech.maven.publish"

sdk-java/src/main/java/ly/count/sdk/java/Config.java

Lines changed: 23 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,8 @@ public static Config.Feature byIndex(int index) {
118118
}
119119

120120
/**
121-
* Holder class for various ids metadata and id itself. Final, unmodifiable.
121+
* Holder class for various ids met
122+
* adata and id itself. Final, unmodifiable.
122123
*/
123124
public static final class DID implements Byteable {
124125
public static final int STRATEGY_UUID = 0;
@@ -273,10 +274,10 @@ public boolean restore(byte[] data) {
273274
/**
274275
* Countly SDK version to be sent in HTTP requests
275276
*/
276-
protected String sdkVersion = "20.11.5";
277+
protected String sdkVersion = "22.09.0";
277278

278279
/**
279-
* Countly SDK name to be sent in HTTP requests
280+
* Countly Application name to be sent in HTTP requests
280281
*/
281282
protected String applicationName;
282283

@@ -603,10 +604,10 @@ public Config(String serverURL, String serverAppKey) {
603604
* Whether to allow fallback from unavailable device id strategy to Countly OpenUDID derivative.
604605
*
605606
* @param deviceIdFallbackAllowed true if fallback is allowed
607+
* @deprecated this will do nothing
606608
* @return {@code this} instance for method chaining
607609
*/
608610
public Config setDeviceIdFallbackAllowed(boolean deviceIdFallbackAllowed) {
609-
this.deviceIdFallbackAllowed = deviceIdFallbackAllowed;
610611
return this;
611612
}
612613

@@ -924,29 +925,21 @@ public Config setSessionCooldownPeriod(int sessionCooldownPeriod) {
924925
* Change name of SDK used in HTTP requests
925926
*
926927
* @param sdkName new name of SDK
928+
* @deprecated Calling this function will do nothing
927929
* @return {@code this} instance for method chaining
928930
*/
929931
public Config setSdkName(String sdkName) {
930-
if (Utils.isEmptyOrNull(sdkName)) {
931-
System.out.print("[ConfigCore] sdkName cannot be empty");
932-
} else {
933-
this.sdkName = sdkName;
934-
}
935932
return this;
936933
}
937934

938935
/**
939936
* Change version of SDK used in HTTP requests
940937
*
941938
* @param sdkVersion new version of SDK
939+
* @deprecated Calling this function will do nothing
942940
* @return {@code this} instance for method chaining
943941
*/
944942
public Config setSdkVersion(String sdkVersion) {
945-
if (Utils.isEmptyOrNull(sdkVersion)) {
946-
System.out.print("[ConfigCore] sdkVersion cannot be empty");
947-
} else {
948-
this.sdkVersion = sdkVersion;
949-
}
950943
return this;
951944
}
952945

@@ -1159,18 +1152,20 @@ public Config setCrashProcessorClass(Class<? extends CrashProcessor> crashProces
11591152
*
11601153
* @param feature feature index to override
11611154
* @param cls {@link Class} to use instead of Countly SDK standard class
1155+
* @deprecated this will do nothing
11621156
* @return {@code this} instance for method chaining
11631157
*/
11641158
protected Config overrideModule(Integer feature, Class<? extends Module> cls) {
1165-
if (feature == null || cls == null) {
1166-
System.out.print("[ConfigCore] Feature & class cannot be null");
1167-
} else {
1168-
if (moduleOverrides == null) {
1169-
moduleOverrides = new HashMap<>();
1170-
}
1171-
moduleOverrides.put(feature, cls);
1172-
}
11731159
return this;
1160+
//if (feature == null || cls == null) {
1161+
// System.out.print("[ConfigCore] Feature & class cannot be null");
1162+
//} else {
1163+
// if (moduleOverrides == null) {
1164+
// moduleOverrides = new HashMap<>();
1165+
// }
1166+
// moduleOverrides.put(feature, cls);
1167+
//}
1168+
//return this;
11741169
}
11751170

11761171
/**
@@ -1314,7 +1309,7 @@ public int getDeviceIdStrategy() {
13141309

13151310
/**
13161311
* Whether to allow fallback from unavailable device id strategy to any other available.
1317-
*
1312+
* @deprecated this will always return "true"
13181313
* @return true if fallback is allowed
13191314
*/
13201315
public boolean isDeviceIdFallbackAllowed() {
@@ -1359,7 +1354,7 @@ public String getParameterTamperingProtectionSalt() {
13591354

13601355
/**
13611356
* Getter for {@link #sdkName}
1362-
*
1357+
* @deprecated this will be removed
13631358
* @return {@link #sdkName} value
13641359
*/
13651360
public String getSdkName() {
@@ -1368,7 +1363,7 @@ public String getSdkName() {
13681363

13691364
/**
13701365
* Getter for {@link #sdkVersion}
1371-
*
1366+
* @deprecated this will be removed
13721367
* @return {@link #sdkVersion} value
13731368
*/
13741369
public String getSdkVersion() {
@@ -1539,11 +1534,12 @@ public String getCrashProcessorClass() {
15391534

15401535
/**
15411536
* Getter for {@link #moduleOverrides}
1542-
*
1537+
* @deprecated this always return "null"
15431538
* @return {@link #moduleOverrides} value for {@code Feature} specified
15441539
*/
15451540
public Class<? extends Module> getModuleOverride(int feature) {
1546-
return moduleOverrides == null ? null : moduleOverrides.get(feature);
1541+
return null;
1542+
//return moduleOverrides == null ? null : moduleOverrides.get(feature);
15471543
}
15481544

15491545
/**

sdk-java/src/test/java/ly/count/sdk/java/internal/BaseTestsCore.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ private void setUpSDK(Config config, boolean limited) throws Exception {
9494
Log L = new Log(Config.LoggingLevel.VERBOSE, null);
9595

9696
this.dummy = mock(ModuleBase.class);
97-
Utils.reflectiveSetField(SDKInterface.class, "testDummyModule", dummy);
97+
Utils.reflectiveSetField(SDKCore.class, "testDummyModule", dummy);
9898
this.sdk = mock(SDKCore.class);
9999
this.sdk.init(new CtxImpl(this.sdk, new InternalConfig(defaultConfig()), getContext(), L));
100100
this.config = this.sdk.config();
@@ -129,6 +129,6 @@ public void tearDown() throws Exception {
129129
this.sdk.stop(ctx, true);
130130
this.sdk = null;
131131
}
132-
Utils.reflectiveSetField(SDKInterface.class, "testDummyModule", null);
132+
Utils.reflectiveSetField(SDKCore.class, "testDummyModule", null);
133133
}
134134
}

0 commit comments

Comments
 (0)