@imatis/react-native-notifications 4.3.3-imatis.2 → 4.3.3-imatis.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,6 +3,7 @@
3
3
  xmlns:android="http://schemas.android.com/apk/res/android"
4
4
  package="com.wix.reactnativenotifications">
5
5
 
6
+ <uses-permission android:name="android.permission.VIBRATE" />
6
7
  <application>
7
8
 
8
9
  <!--
@@ -15,6 +15,8 @@ import android.net.Uri;
15
15
  import android.os.Build;
16
16
  import android.os.Bundle;
17
17
  import android.os.PowerManager;
18
+ import android.os.VibrationEffect;
19
+ import android.os.Vibrator;
18
20
  import android.util.Log;
19
21
 
20
22
  import com.facebook.react.bridge.ReactContext;
@@ -214,7 +216,7 @@ public class PushNotification implements IPushNotification {
214
216
  Log.d(LOGTAG, e.getMessage());
215
217
  }
216
218
 
217
- if(mNotificationProps.getCriticalAlert()){
219
+ if(mNotificationProps.getCriticalAlert() || mNotificationProps.getOverridemute()){
218
220
  try {
219
221
  MediaPlayer mMediaPlayer = new MediaPlayer();
220
222
  mMediaPlayer.setDataSource(mContext.getApplicationContext(), soundUri);
@@ -227,6 +229,18 @@ public class PushNotification implements IPushNotification {
227
229
  mMediaPlayer.start();
228
230
  }
229
231
  });
232
+
233
+ Vibrator v = (Vibrator) mContext.getSystemService(Context.VIBRATOR_SERVICE);
234
+ // Vibrate with wave form
235
+ long[] timings = new long[] { 50, 50, 50, 50, 50, 100, 350, 25, 25, 25, 25, 200 };
236
+ int[] amplitudes = new int[] { 33, 51, 75, 113, 170, 255, 0, 38, 62, 100, 160, 255 };
237
+ int repeatIndex = -1; // Do not repeat.
238
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
239
+ v.vibrate(VibrationEffect.createWaveform(timings, amplitudes, repeatIndex));
240
+ } else {
241
+ //deprecated in API 26
242
+ v.vibrate(3000);
243
+ }
230
244
  } catch (Exception e) {
231
245
  Log.d(LOGTAG, e.getMessage());
232
246
  }
@@ -285,7 +299,7 @@ public class PushNotification implements IPushNotification {
285
299
  }
286
300
 
287
301
  protected void launchOrResumeApp() {
288
- if (NotificationIntentAdapter.canHandleTrampolineActivity(mContext)) {
302
+ if (!NotificationIntentAdapter.cannotHandleTrampolineActivity(mContext)) {
289
303
  final Intent intent = mAppLaunchHelper.getLaunchIntent(mContext);
290
304
  mContext.startActivity(intent);
291
305
  }
@@ -58,6 +58,14 @@ public class PushNotificationProps {
58
58
  return 0.0;
59
59
  }
60
60
 
61
+ public Boolean getOverridemute() {
62
+ String val = mBundle.getString("overridemute");
63
+ if(val != null && !val.isEmpty()){
64
+ return val.toLowerCase().equals("true");
65
+ }
66
+ return false;
67
+ }
68
+
61
69
  public Boolean getOngoing() {
62
70
  return mBundle.getBoolean("ongoing");
63
71
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@imatis/react-native-notifications",
3
- "version": "4.3.3-imatis.2",
3
+ "version": "4.3.3-imatis.3",
4
4
  "description": "Advanced Push Notifications (Silent, interactive notifications) for iOS & Android",
5
5
  "license": "MIT",
6
6
  "keywords": [
@@ -114,4 +114,4 @@
114
114
  "html"
115
115
  ]
116
116
  }
117
- }
117
+ }
package/.detoxrc.json DELETED
@@ -1,37 +0,0 @@
1
- {
2
- "testRunner": "jest",
3
- "runnerConfig": "e2e/config.json",
4
- "skipLegacyWorkersInjection": true,
5
- "devices": {
6
- "simulator": {
7
- "type": "ios.simulator",
8
- "device": {
9
- "type": "iPhone 12 Pro Max"
10
- }
11
- }
12
- },
13
- "apps": {
14
- "ios.release": {
15
- "name": "RNNotifications",
16
- "type": "ios.app",
17
- "binaryPath": "example/ios/DerivedData/NotificationsExampleApp/Build/Products/Release-iphonesimulator/NotificationsExampleApp.app",
18
- "build": "RCT_NO_LAUNCH_PACKAGER=true xcodebuild build -scheme NotificationsExampleApp_release -workspace example/ios/NotificationsExampleApp.xcworkspace -sdk iphonesimulator -configuration Release -derivedDataPath example/ios/DerivedData/NotificationsExampleApp ONLY_ACTIVE_ARCH=YES -quiet -UseModernBuildSystem=NO"
19
- },
20
- "ios.debug": {
21
- "name": "RNNotificationsDebug",
22
- "type": "ios.app",
23
- "binaryPath": "example/ios/DerivedData/NotificationsExampleApp/Build/Products/Debug-iphonesimulator/NotificationsExampleApp.app",
24
- "build": "RCT_NO_LAUNCH_PACKAGER=true xcodebuild build -scheme NotificationsExampleApp -workspace example/ios/NotificationsExampleApp.xcworkspace -sdk iphonesimulator -configuration Debug -derivedDataPath example/ios/DerivedData/NotificationsExampleApp ONLY_ACTIVE_ARCH=YES -quiet -UseModernBuildSystem=NO"
25
- }
26
- },
27
- "configurations": {
28
- "ios.sim.release": {
29
- "device": "simulator",
30
- "app": "ios.release"
31
- },
32
- "ios.sim.debug": {
33
- "device": "simulator",
34
- "app": "ios.debug"
35
- }
36
- }
37
- }