Skip to content

Commit 0630247

Browse files
authored
fix bug causing presentFeedbackWidget to fail (#248)
* fix bug causing presentFeedbackWidget to fail * versioning and changelog entry
1 parent 0113e50 commit 0630247

File tree

9 files changed

+27
-8
lines changed

9 files changed

+27
-8
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## 23.8.1
2+
* Fixed bug where "presentFeedbackWidget" method would fail with "Property 'eventEmitter' doesn't exist" if callbacks are provided.
3+
4+
* Underlying Android SDK version is 23.8.2
5+
* Underlying iOS SDK version is 23.8.2
6+
17
## 23.8.0
28
* Added new Feedback interface (`Countly.feedback`) on the SDK interface that exposes the calls for feedback widgets.
39
* Added Manual Reporting feature for the Feedback Widgets. This includes two new methods under the new Feedback interface:

Countly.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ Countly.serverUrl = '';
1818
Countly.appKey = '';
1919
let _state = CountlyState;
2020
CountlyState.CountlyReactNative = CountlyReactNative;
21+
CountlyState.eventEmitter = eventEmitter;
2122

2223
Countly.feedback = Feedback;
2324
Countly.feedback.state = CountlyState;

CountlyReactNative.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = 'CountlyReactNative'
3-
s.version = '23.8.0'
3+
s.version = '23.8.1'
44
s.license = {
55
:type => 'COMMUNITY',
66
:text => <<-LICENSE

CountlyState.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@ const CountlyState = {};
22

33
CountlyState.isInitialized = false
44
CountlyState.CountlyReactNative = null;
5+
CountlyState.eventEmitter = null;
56

67
export default CountlyState;

Feedback.js

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,15 @@
11
const Feedback = {};
2+
/*
3+
* Callback to be executed when feedback widget is displayed
4+
*/
5+
let _widgetShownCallback;
6+
/*
7+
* Callback to be executed when feedback widget is closed
8+
*/
9+
let _widgetClosedCallback;
10+
const widgetShownCallbackName = 'widgetShownCallback';
11+
const widgetClosedCallbackName = 'widgetClosedCallback';
12+
213
/**
314
* Get a list of available feedback widgets as an array of objects.
415
* @param {callback listener} onFinished - returns (retrievedWidgets, error)
@@ -37,7 +48,7 @@ async function getAvailableFeedbackWidgets(onFinished) {
3748
function presentFeedbackWidget(feedbackWidget, closeButtonText, widgetShownCallback, widgetClosedCallback) {
3849
if (!Feedback.state.isInitialized) {
3950
const message = "'init' must be called before 'presentFeedbackWidget'";
40-
Feedback.instance.logError('presentFeedbackWidget', msg);
51+
Feedback.instance.logError('presentFeedbackWidget', message);
4152
return { error: message };
4253
}
4354
let message = null;
@@ -62,13 +73,13 @@ function presentFeedbackWidget(feedbackWidget, closeButtonText, widgetShownCallb
6273
}
6374

6475
if (widgetShownCallback) {
65-
_widgetShownCallback = eventEmitter.addListener(widgetShownCallbackName, () => {
76+
_widgetShownCallback = Feedback.state.eventEmitter.addListener(widgetShownCallbackName, () => {
6677
widgetShownCallback();
6778
_widgetShownCallback.remove();
6879
});
6980
}
7081
if (widgetClosedCallback) {
71-
_widgetClosedCallback = eventEmitter.addListener(widgetClosedCallbackName, () => {
82+
_widgetClosedCallback = Feedback.state.eventEmitter.addListener(widgetClosedCallbackName, () => {
7283
widgetClosedCallback();
7384
_widgetClosedCallback.remove();
7485
});

android/src/main/java/ly/count/android/sdk/react/CountlyReactNative.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ public String toString() {
8888
public class CountlyReactNative extends ReactContextBaseJavaModule implements LifecycleEventListener {
8989

9090
public static final String TAG = "CountlyRNPlugin";
91-
private String COUNTLY_RN_SDK_VERSION_STRING = "23.8.0";
91+
private String COUNTLY_RN_SDK_VERSION_STRING = "23.8.1";
9292
private String COUNTLY_RN_SDK_NAME = "js-rnb-android";
9393

9494
private static final CountlyConfig config = new CountlyConfig();

example/install.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ rm App.js
1111
curl https://raw.githubusercontent.com/Countly/countly-sdk-react-native-bridge/master/example/App.js --output App.js
1212
curl https://raw.githubusercontent.com/Countly/countly-sdk-react-native-bridge/master/example/Example.js --output Example.js
1313

14-
14+
1515

1616
cd ./ios
1717
pod install

ios/src/CountlyReactNative.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ @interface CountlyFeedbackWidget ()
2424
+ (CountlyFeedbackWidget *)createWithDictionary:(NSDictionary *)dictionary;
2525
@end
2626

27-
NSString *const kCountlyReactNativeSDKVersion = @"23.8.0";
27+
NSString *const kCountlyReactNativeSDKVersion = @"23.8.1";
2828
NSString *const kCountlyReactNativeSDKName = @"js-rnb-ios";
2929

3030
CLYPushTestMode const CLYPushTestModeProduction = @"CLYPushTestModeProduction";

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "countly-sdk-react-native-bridge",
3-
"version": "23.8.0",
3+
"version": "23.8.1",
44
"author": "Countly <[email protected]> (https://count.ly/)",
55
"bugs": {
66
"url": "https://github.com/Countly/countly-sdk-react-native-bridge/issues"

0 commit comments

Comments
 (0)