Skip to content

Commit 38ac479

Browse files
authored
Push notifications disabled for iOS (#45)
* Push notifications disabled for iOS * — Version update to 20.11.3 — Underlying android sdk updated — Changlelog updated * Text change
1 parent 6573e6c commit 38ac479

File tree

9 files changed

+31
-7
lines changed

9 files changed

+31
-7
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 20.11.3
2+
* Added "disablePushNotifications" method to disable push notifications for iOS.
3+
* Updated underlying android SDK to 20.11.3
4+
15
## 20.11.2
26
* !! Due to cocoapods issue with Xcode 12, we have added the iOS SDK as source code instead of Pod. Due to that change if you have already add the reference of files "CountlyNotificationService.h/m" then you need to update these files references by adding the files from "Pods/Development Pods/CountlyReactNative" and remove the old reference files.
37

Countly.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,16 @@ Countly.recordView = function(recordView, segments){
129129
CountlyReactNative.recordView(args);
130130
};
131131

132+
/**
133+
* Disable push notifications feature, by default it is enabled.
134+
* Currently implemented for iOS only
135+
* Should be called before Countly init
136+
*/
137+
Countly.disablePushNotifications = function(){
138+
if (!Platform.OS.match("ios")) return "disablePushNotifications : To be implemented";
139+
CountlyReactNative.disablePushNotifications();
140+
}
141+
132142
/**
133143
*
134144
* Set messaging mode for push notifications

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 = '20.11.2'
3+
s.version = '20.11.3'
44
s.license = {
55
:type => 'COMMUNITY',
66
:text => <<-LICENSE

android/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ repositories {
4444

4545
dependencies {
4646
implementation "com.facebook.react:react-native:${safeExtGet('reactNativeVersion', '+')}"
47-
implementation 'ly.count.android:sdk:20.11.2'
47+
implementation 'ly.count.android:sdk:20.11.3'
4848

4949
//if any version higher than 18.0.0 is used then it forces AndroidX
5050
implementation 'com.google.firebase:firebase-messaging:18.0.0'

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
@@ -74,7 +74,7 @@ public String toString(){
7474
public class CountlyReactNative extends ReactContextBaseJavaModule implements LifecycleEventListener {
7575

7676
public static final String TAG = "CountlyRNPlugin";
77-
private String COUNTLY_RN_SDK_VERSION_STRING = "20.11.2";
77+
private String COUNTLY_RN_SDK_VERSION_STRING = "20.11.3";
7878
private String COUNTLY_RN_SDK_NAME = "js-rnb-android";
7979

8080
private static 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.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,4 +68,5 @@ typedef void (^Result)(id _Nullable result);
6868
- (void)enableAttribution;
6969
- (void)recordAttributionID:(NSArray*_Nullable)arguments;
7070
- (void)appLoadingFinished;
71+
- (void)disablePushNotifications;
7172
@end

ios/src/CountlyReactNative.m

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,15 @@ @interface CountlyFeedbackWidget ()
2121
+ (CountlyFeedbackWidget *)createWithDictionary:(NSDictionary *)dictionary;
2222
@end
2323

24-
NSString* const kCountlyReactNativeSDKVersion = @"20.11.2";
24+
NSString* const kCountlyReactNativeSDKVersion = @"20.11.3";
2525
NSString* const kCountlyReactNativeSDKName = @"js-rnb-ios";
2626

2727
CountlyConfig* config = nil;
2828
NSDictionary *lastStoredNotification = nil;
2929
Result notificationListener = nil;
3030
NSMutableArray *notificationIDs = nil; // alloc here
3131
NSMutableArray<CLYFeature>* countlyFeatures = nil;
32+
BOOL enablePushNotifications = true;
3233

3334
@implementation CountlyReactNative
3435

@@ -59,7 +60,9 @@ @implementation CountlyReactNative
5960

6061
CountlyCommon.sharedInstance.SDKName = kCountlyReactNativeSDKName;
6162
CountlyCommon.sharedInstance.SDKVersion = kCountlyReactNativeSDKVersion;
62-
[self addCountlyFeature:CLYPushNotifications];
63+
if(enablePushNotifications) {
64+
[self addCountlyFeature:CLYPushNotifications];
65+
}
6366

6467
if (serverurl != nil && [serverurl length] > 0) {
6568
dispatch_async(dispatch_get_main_queue(), ^
@@ -172,6 +175,12 @@ @implementation CountlyReactNative
172175
});
173176
}
174177

178+
RCT_EXPORT_METHOD(disablePushNotifications)
179+
{
180+
dispatch_async(dispatch_get_main_queue(), ^ {
181+
enablePushNotifications = false;
182+
});
183+
}
175184

176185
RCT_EXPORT_METHOD(sendPushToken:(NSArray*)arguments)
177186
{

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": "20.11.2",
3+
"version": "20.11.3",
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)