rns-nativecall 0.8.3 → 0.8.4

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.
Files changed (2) hide show
  1. package/package.json +15 -6
  2. package/withNativeCallVoip.js +37 -31
package/package.json CHANGED
@@ -1,9 +1,17 @@
1
1
  {
2
2
  "name": "rns-nativecall",
3
- "version": "0.8.3",
3
+ "version": "0.8.4",
4
4
  "description": "High-performance React Native module for handling native VoIP call UI on Android and iOS.",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
7
+ "expo": {
8
+ "autolinking": {
9
+ "ios": {
10
+ "podspec": "rns-nativecall.podspec"
11
+ }
12
+ },
13
+ "plugin": "./app.plugin.js"
14
+ },
7
15
  "homepage": "https://github.com/raiidr/rns-nativecall",
8
16
  "license": "MIT",
9
17
  "author": "Your Name <your.email@example.com>",
@@ -36,10 +44,11 @@
36
44
  ],
37
45
  "peerDependencies": {
38
46
  "expo": ">=45.0.0",
39
- "react-native": ">=0.60.0"
47
+ "react-native": ">=0.60.0",
48
+ "@expo/config-plugins": "^7.0.0 || ^8.0.0 || ^9.0.0"
49
+ },
50
+ "devDependencies": {
51
+ "@expo/config-plugins": "^9.0.0"
40
52
  },
41
- "dependencies": {
42
- "@expo/config-plugins": "^9.0.0",
43
- "rns-nativecall": "^0.7.8"
44
- }
53
+ "dependencies": {}
45
54
  }
@@ -10,8 +10,8 @@ function withMainActivityDataFix(config) {
10
10
  'import android.os.Bundle',
11
11
  'import android.view.WindowManager',
12
12
  'import android.os.Build',
13
- 'import androidx.core.app.ActivityCompat', // ADDED
14
- 'import android.Manifest' // ADDED
13
+ 'import androidx.core.app.ActivityCompat',
14
+ 'import android.Manifest'
15
15
  ];
16
16
 
17
17
  // Add imports if they don't exist
@@ -35,7 +35,7 @@ function withMainActivityDataFix(config) {
35
35
  }
36
36
 
37
37
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1) {
38
- setShowWhenLocked(true) // Set to TRUE so call UI can show over lockscreen
38
+ setShowWhenLocked(true)
39
39
  setTurnScreenOn(true)
40
40
  } else {
41
41
  window.addFlags(
@@ -81,19 +81,20 @@ function withAndroidConfig(config) {
81
81
  const mainActivity = application.activity.find((a) => a.$['android:name'] === '.MainActivity');
82
82
  if (mainActivity) {
83
83
  mainActivity.$['android:launchMode'] = 'singleTop';
84
- mainActivity.$['android:showWhenLocked'] = 'true'; // Changed to true
84
+ mainActivity.$['android:showWhenLocked'] = 'true';
85
85
  mainActivity.$['android:turnScreenOn'] = 'true';
86
86
  }
87
87
 
88
+ //'android.permission.FOREGROUND_SERVICE_PHONE_CALL',
89
+ //'android.permission.MANAGE_ONGOING_CALLS'
90
+ //'android.permission.USE_FULL_SCREEN_INTENT',
91
+
88
92
  const permissions = [
89
- 'android.permission.USE_FULL_SCREEN_INTENT',
90
93
  'android.permission.VIBRATE',
91
94
  'android.permission.FOREGROUND_SERVICE',
92
- 'android.permission.FOREGROUND_SERVICE_PHONE_CALL',
93
95
  'android.permission.POST_NOTIFICATIONS',
94
96
  'android.permission.WAKE_LOCK',
95
97
  'android.permission.DISABLE_KEYGUARD',
96
- 'android.permission.MANAGE_ONGOING_CALLS'
97
98
  ];
98
99
 
99
100
  manifest.manifest['uses-permission'] = manifest.manifest['uses-permission'] || [];
@@ -103,12 +104,10 @@ function withAndroidConfig(config) {
103
104
  }
104
105
  });
105
106
 
106
- // Components Setup
107
107
  application.service = application.service || [];
108
108
  application.activity = application.activity || [];
109
109
  application.receiver = application.receiver || [];
110
110
 
111
- // 1. Services
112
111
  const services = [
113
112
  { name: 'com.rnsnativecall.CallMessagingService', exported: 'false', filter: 'com.google.firebase.MESSAGING_EVENT' },
114
113
  { name: 'com.rnsnativecall.CallForegroundService', type: 'phoneCall' },
@@ -126,18 +125,9 @@ function withAndroidConfig(config) {
126
125
  }
127
126
  });
128
127
 
129
- // 2. Activities (NotificationOverlayActivity is critical for Foldables)
130
128
  const activities = [
131
- {
132
- name: 'com.rnsnativecall.AcceptCallActivity',
133
- theme: '@android:style/Theme.Translucent.NoTitleBar',
134
- launchMode: 'singleInstance'
135
- },
136
- {
137
- name: 'com.rnsnativecall.NotificationOverlayActivity',
138
- theme: '@android:style/Theme.NoTitleBar.Fullscreen',
139
- launchMode: 'singleInstance'
140
- }
129
+ { name: 'com.rnsnativecall.AcceptCallActivity', theme: '@android:style/Theme.Translucent.NoTitleBar', launchMode: 'singleInstance' },
130
+ { name: 'com.rnsnativecall.NotificationOverlayActivity', theme: '@android:style/Theme.NoTitleBar.Fullscreen', launchMode: 'singleInstance' }
141
131
  ];
142
132
 
143
133
  activities.forEach(act => {
@@ -157,14 +147,8 @@ function withAndroidConfig(config) {
157
147
  }
158
148
  });
159
149
 
160
- // 3. Receiver
161
150
  if (!application.receiver.some(r => r.$['android:name'] === 'com.rnsnativecall.CallActionReceiver')) {
162
- application.receiver.push({
163
- $: {
164
- 'android:name': 'com.rnsnativecall.CallActionReceiver',
165
- 'android:exported': 'false'
166
- }
167
- });
151
+ application.receiver.push({ $: { 'android:name': 'com.rnsnativecall.CallActionReceiver', 'android:exported': 'false' } });
168
152
  }
169
153
 
170
154
  return config;
@@ -172,24 +156,46 @@ function withAndroidConfig(config) {
172
156
  }
173
157
 
174
158
  /** 3. IOS CONFIG **/
175
- function withIosConfig(config) {
159
+ // Notice we accept (config, props) directly
160
+ function withIosConfig(config, props = {}) {
161
+ const iosBackgroundAudio = props.iosBackgroundAudio;
162
+
163
+ console.log(`[rns-nativecall] iosBackgroundAudio setting:`, iosBackgroundAudio);
164
+
176
165
  return withInfoPlist(config, (config) => {
177
166
  const infoPlist = config.modResults;
178
167
  if (!infoPlist.UIBackgroundModes) infoPlist.UIBackgroundModes = [];
179
168
 
180
- ['voip', 'audio', 'remote-notification'].forEach(mode => {
169
+ // Explicit check: only disable if strictly false
170
+ const enableAudio = iosBackgroundAudio !== false;
171
+
172
+ if (enableAudio) {
173
+ if (!infoPlist.UIBackgroundModes.includes('audio')) {
174
+ infoPlist.UIBackgroundModes.push('audio');
175
+ }
176
+ } else {
177
+ infoPlist.UIBackgroundModes = infoPlist.UIBackgroundModes.filter(
178
+ (mode) => mode !== 'audio'
179
+ );
180
+ console.log(`[rns-nativecall] 'audio' background mode removed.`);
181
+ }
182
+
183
+ ['voip', 'remote-notification'].forEach(mode => {
181
184
  if (!infoPlist.UIBackgroundModes.includes(mode)) {
182
185
  infoPlist.UIBackgroundModes.push(mode);
183
186
  }
184
187
  });
188
+
185
189
  return config;
186
190
  });
187
191
  }
188
192
 
189
- module.exports = (config) => {
193
+ // Main Plugin Entry
194
+ module.exports = (config, props) => {
190
195
  return withPlugins(config, [
191
196
  withAndroidConfig,
192
197
  withMainActivityDataFix,
193
- withIosConfig
198
+ // Standard way to pass props to a plugin function
199
+ [withIosConfig, props]
194
200
  ]);
195
201
  };