Skip to content

Commit

Permalink
Get remote config value for key fix (#239)
Browse files Browse the repository at this point in the history
* Fixed bug in Android where getRemoteConfigValueForKey method returned RCData

* Versioning

* Update CountlyReactNative.java

* Update CountlyReactNative.java

* Update CHANGELOG.md

---------

Co-authored-by: Artūrs Kadiķis <[email protected]>
  • Loading branch information
peterBrxwn and ArtursKadikis authored Sep 27, 2023
1 parent d22603e commit 0f1ac39
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 19 deletions.
18 changes: 12 additions & 6 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## 23.6.1
* Fixed bug for Android devices where "getRemoteConfigValueForKey" and "getRemoteConfigValueForKeyP" methods would return the RCData object.

* Underlying Android SDK version is 23.8.2
* Underlying iOS SDK version is 23.8.2

## 23.6.0
* !! Major breaking change !! 'start' and 'stop' calls have been deprecated. They will do nothing. The SDK will now automatically track sessions based on the app's time in the foreground.
* ! Minor breaking change ! Remote config will now return previously downloaded values when remote-config consent is not given
Expand All @@ -22,20 +28,20 @@
* Added 'setPushTokenType' and 'setPushNotificationChannel' calls to replace deprecated calls to the Countly Config Object.
* Deprecated the following SDK call: 'CountlyConfig.pushTokenType'

* Underlying Android SDK version to 22.09.4
* Underlying iOS SDK version to 23.02.2
* Underlying Android SDK version is 22.09.4
* Underlying iOS SDK version is 23.02.2

## 23.2.3
* Fixed bug where the push notification type was not correctly set during init

* Underlying Android SDK version to 22.09.4
* Underlying iOS SDK version to 23.02.2
* Underlying Android SDK version is 22.09.4
* Underlying iOS SDK version is 23.02.2

## 23.2.2
* Fixed bug that caused an issue in the deprecated init call

* Underlying Android SDK version to 22.09.4
* Underlying iOS SDK version to 23.02.2
* Underlying Android SDK version is 22.09.4
* Underlying iOS SDK version is 23.02.2

## 23.2.1
* Default max segmentation value count changed from 30 to 100
Expand Down
2 changes: 1 addition & 1 deletion CountlyReactNative.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'CountlyReactNative'
s.version = '23.6.0'
s.version = '23.6.1'
s.license = {
:type => 'COMMUNITY',
:text => <<-LICENSE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public String toString() {
public class CountlyReactNative extends ReactContextBaseJavaModule implements LifecycleEventListener {

public static final String TAG = "CountlyRNPlugin";
private String COUNTLY_RN_SDK_VERSION_STRING = "23.6.0";
private String COUNTLY_RN_SDK_VERSION_STRING = "23.6.1";
private String COUNTLY_RN_SDK_NAME = "js-rnb-android";

private static final CountlyConfig config = new CountlyConfig();
Expand Down Expand Up @@ -377,7 +377,7 @@ public void getCurrentDeviceId(Promise promise) {
}

@ReactMethod
public void getDeviceIDType(Promise promise){
public void getDeviceIDType(Promise promise) {
DeviceIdType deviceIDType = Countly.sharedInstance().deviceId().getType();
String deviceIDTypeString = null;
switch (deviceIDType) {
Expand Down Expand Up @@ -1146,25 +1146,25 @@ public void updateRemoteConfigExceptKeys(ReadableArray args, final Callback myCa
@ReactMethod
public void getRemoteConfigValueForKey(ReadableArray args, final Callback myCallback) {
String keyName = args.getString(0);
Object keyValue = Countly.sharedInstance().remoteConfig().getValue(keyName);
if (keyValue == null) {
RCData keyValue = Countly.sharedInstance().remoteConfig().getValue(keyName);
if (keyValue.value == null) {
log("getRemoteConfigValueForKey, [" + keyName + "]: ConfigKeyNotFound", LogLevel.DEBUG);
myCallback.invoke("ConfigKeyNotFound");
} else {
String resultString = (keyValue).toString();
String resultString = (keyValue.value).toString();
log("getRemoteConfigValueForKey, [" + keyName + "]: " + resultString, LogLevel.DEBUG);
myCallback.invoke(resultString);
}
}

@ReactMethod
public void getRemoteConfigValueForKeyP(String keyName, Promise promise) {
Object keyValue = Countly.sharedInstance().remoteConfig().getValue(keyName);
if (keyValue == null) {
RCData keyValue = Countly.sharedInstance().remoteConfig().getValue(keyName);
if (keyValue.value == null) {
log("getRemoteConfigValueForKeyP, [" + keyName + "]: ConfigKeyNotFound", LogLevel.DEBUG);
promise.reject("ConfigKeyNotFound", null, null, null);
} else {
String resultString = (keyValue).toString();
String resultString = (keyValue.value).toString();
log("getRemoteConfigValueForKeyP, [" + keyName + "]: " + resultString, LogLevel.DEBUG);
promise.resolve(resultString);
}
Expand Down Expand Up @@ -1472,7 +1472,7 @@ public void onHostResume() {

@Override
public void onHostPause() {

}

@Override
Expand Down
2 changes: 1 addition & 1 deletion example/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ rm App.js
curl https://raw.githubusercontent.com/Countly/countly-sdk-react-native-bridge/master/example/App.js --output App.js
curl https://raw.githubusercontent.com/Countly/countly-sdk-react-native-bridge/master/example/Example.js --output Example.js

yarn add [email protected].0
yarn add [email protected].1

cd ./ios
pod install
Expand Down
2 changes: 1 addition & 1 deletion ios/src/CountlyReactNative.m
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ @interface CountlyFeedbackWidget ()
+ (CountlyFeedbackWidget *)createWithDictionary:(NSDictionary *)dictionary;
@end

NSString *const kCountlyReactNativeSDKVersion = @"23.6.0";
NSString *const kCountlyReactNativeSDKVersion = @"23.6.1";
NSString *const kCountlyReactNativeSDKName = @"js-rnb-ios";

CLYPushTestMode const CLYPushTestModeProduction = @"CLYPushTestModeProduction";
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "countly-sdk-react-native-bridge",
"version": "23.6.0",
"version": "23.6.1",
"author": "Countly <[email protected]> (https://count.ly/)",
"bugs": {
"url": "https://github.com/Countly/countly-sdk-react-native-bridge/issues"
Expand Down

0 comments on commit 0f1ac39

Please sign in to comment.