react-native-insider 6.6.0-nh → 6.7.0-nh

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.
@@ -1,18 +1,16 @@
1
1
  import { NativeModules } from 'react-native';
2
2
 
3
- const Insider = NativeModules.RNInsider;
4
-
5
- function shouldNotProceed() {
6
- return Insider == null;
7
- }
3
+ import { shouldNotProceed, generateJSONErrorString, checkParameters, showParameterWarningLog } from './Util';
8
4
 
9
- function generateJSONErrorString(error) {
10
- return '[JavaScript Error] ' + error;
11
- }
5
+ const Insider = NativeModules.RNInsider;
12
6
 
13
7
  export default class RNInsiderUser {
14
8
  setGender(value) {
15
- if (shouldNotProceed() || value == null) return this;
9
+ if (shouldNotProceed()) return this;
10
+ if (checkParameters([{ type: 'number', value }])) {
11
+ showParameterWarningLog("setGender", [{ type: 'number', value }]);
12
+ return this;
13
+ }
16
14
  try {
17
15
  Insider.setGender(value);
18
16
  } catch (error) {
@@ -22,7 +20,11 @@ export default class RNInsiderUser {
22
20
  }
23
21
 
24
22
  setBirthday(value) {
25
- if (shouldNotProceed() || value == null) return this;
23
+ if (shouldNotProceed()) return this;
24
+ if (checkParameters([{ type: 'object', value }])) {
25
+ showParameterWarningLog("setBirthday", [{ type: 'object', value }]);
26
+ return this;
27
+ }
26
28
  try {
27
29
  Insider.setBirthday(value.toISOString());
28
30
  } catch (error) {
@@ -32,7 +34,11 @@ export default class RNInsiderUser {
32
34
  }
33
35
 
34
36
  setName(value) {
35
- if (shouldNotProceed() || value == null) return this;
37
+ if (shouldNotProceed()) return this;
38
+ if (checkParameters([{ type: 'string', value }])) {
39
+ showParameterWarningLog("setName", [{ type: 'string', value }]);
40
+ return this;
41
+ }
36
42
  try {
37
43
  Insider.setName(value);
38
44
  } catch (error) {
@@ -42,7 +48,11 @@ export default class RNInsiderUser {
42
48
  }
43
49
 
44
50
  setSurname(value) {
45
- if (shouldNotProceed() || value == null) return this;
51
+ if (shouldNotProceed()) return this;
52
+ if (checkParameters([{ type: 'string', value }])) {
53
+ showParameterWarningLog("setSurname", [{ type: 'string', value }]);
54
+ return this;
55
+ }
46
56
  try {
47
57
  Insider.setSurname(value);
48
58
  } catch (error) {
@@ -52,7 +62,11 @@ export default class RNInsiderUser {
52
62
  }
53
63
 
54
64
  setAge(value) {
55
- if (shouldNotProceed() || value == null) return this;
65
+ if (shouldNotProceed()) return this;
66
+ if (checkParameters([{ type: 'number', value }])) {
67
+ showParameterWarningLog("setAge", [{ type: 'number', value }]);
68
+ return this;
69
+ }
56
70
  try {
57
71
  Insider.setAge(value);
58
72
  } catch (error) {
@@ -62,7 +76,11 @@ export default class RNInsiderUser {
62
76
  }
63
77
 
64
78
  setEmail(value) {
65
- if (shouldNotProceed() || value == null) return this;
79
+ if (shouldNotProceed()) return this;
80
+ if (checkParameters([{ type: 'string', value }])) {
81
+ showParameterWarningLog("setEmail", [{ type: 'string', value }]);
82
+ return this;
83
+ }
66
84
  try {
67
85
  Insider.setEmail(value);
68
86
  } catch (error) {
@@ -72,7 +90,11 @@ export default class RNInsiderUser {
72
90
  }
73
91
 
74
92
  setPhoneNumber(value) {
75
- if (shouldNotProceed() || value == null) return this;
93
+ if (shouldNotProceed()) return this;
94
+ if (checkParameters([{ type: 'string', value }])) {
95
+ showParameterWarningLog("setPhoneNumber", [{ type: 'string', value }]);
96
+ return this;
97
+ }
76
98
  try {
77
99
  Insider.setPhoneNumber(value);
78
100
  } catch (error) {
@@ -82,7 +104,11 @@ export default class RNInsiderUser {
82
104
  }
83
105
 
84
106
  setLanguage(value) {
85
- if (shouldNotProceed() || value == null) return this;
107
+ if (shouldNotProceed()) return this;
108
+ if (checkParameters([{ type: 'string', value }])) {
109
+ showParameterWarningLog("setLanguage", [{ type: 'string', value }]);
110
+ return this;
111
+ }
86
112
  try {
87
113
  Insider.setLanguage(value);
88
114
  } catch (error) {
@@ -92,7 +118,11 @@ export default class RNInsiderUser {
92
118
  }
93
119
 
94
120
  setLocale(value) {
95
- if (shouldNotProceed() || value == null) return this;
121
+ if (shouldNotProceed()) return this;
122
+ if (checkParameters([{ type: 'string', value }])) {
123
+ showParameterWarningLog("setLocale", [{ type: 'string', value }]);
124
+ return this;
125
+ }
96
126
  try {
97
127
  Insider.setLocale(value);
98
128
  } catch (error) {
@@ -102,7 +132,11 @@ export default class RNInsiderUser {
102
132
  }
103
133
 
104
134
  setFacebookID(value) {
105
- if (shouldNotProceed() || value == null) return this;
135
+ if (shouldNotProceed()) return this;
136
+ if (checkParameters([{ type: 'string', value }])) {
137
+ showParameterWarningLog("setFacebookID", [{ type: 'string', value }]);
138
+ return this;
139
+ }
106
140
  try {
107
141
  Insider.setFacebookID(value);
108
142
  } catch (error) {
@@ -112,7 +146,11 @@ export default class RNInsiderUser {
112
146
  }
113
147
 
114
148
  setTwitterID(value) {
115
- if (shouldNotProceed() || value == null) return this;
149
+ if (shouldNotProceed()) return this;
150
+ if (checkParameters([{ type: 'string', value }])) {
151
+ showParameterWarningLog("setTwitterID", [{ type: 'string', value }]);
152
+ return this;
153
+ }
116
154
  try {
117
155
  Insider.setTwitterID(value);
118
156
  } catch (error) {
@@ -122,7 +160,11 @@ export default class RNInsiderUser {
122
160
  }
123
161
 
124
162
  setEmailOptin(value) {
125
- if (shouldNotProceed() || value == null) return this;
163
+ if (shouldNotProceed()) return this;
164
+ if (checkParameters([{ type: 'boolean', value }])) {
165
+ showParameterWarningLog("setEmailOptin", [{ type: 'boolean', value }]);
166
+ return this;
167
+ }
126
168
  try {
127
169
  Insider.setEmailOptin(value);
128
170
  } catch (error) {
@@ -132,7 +174,11 @@ export default class RNInsiderUser {
132
174
  }
133
175
 
134
176
  setSMSOptin(value) {
135
- if (shouldNotProceed() || value == null) return this;
177
+ if (shouldNotProceed()) return this;
178
+ if (checkParameters([{ type: 'boolean', value }])) {
179
+ showParameterWarningLog("setSMSOptin", [{ type: 'boolean', value }]);
180
+ return this;
181
+ }
136
182
  try {
137
183
  Insider.setSMSOptin(value);
138
184
  } catch (error) {
@@ -142,7 +188,11 @@ export default class RNInsiderUser {
142
188
  }
143
189
 
144
190
  setPushOptin(value) {
145
- if (shouldNotProceed() || value == null) return this;
191
+ if (shouldNotProceed()) return this;
192
+ if (checkParameters([{ type: 'boolean', value }])) {
193
+ showParameterWarningLog("setPushOptin", [{ type: 'boolean', value }]);
194
+ return this;
195
+ }
146
196
  try {
147
197
  Insider.setPushOptin(value);
148
198
  } catch (error) {
@@ -152,7 +202,11 @@ export default class RNInsiderUser {
152
202
  }
153
203
 
154
204
  setLocationOptin(value) {
155
- if (shouldNotProceed() || value == null) return this;
205
+ if (shouldNotProceed()) return this;
206
+ if (checkParameters([{ type: 'boolean', value }])) {
207
+ showParameterWarningLog("setLocationOptin", [{ type: 'boolean', value }]);
208
+ return this;
209
+ }
156
210
  try {
157
211
  Insider.setLocationOptin(value);
158
212
  } catch (error) {
@@ -162,7 +216,11 @@ export default class RNInsiderUser {
162
216
  }
163
217
 
164
218
  setWhatsappOptin(value) {
165
- if (shouldNotProceed() || value == null) return this;
219
+ if (shouldNotProceed()) return this;
220
+ if (checkParameters([{ type: 'boolean', value }])) {
221
+ showParameterWarningLog("setWhatsappOptin", [{ type: 'boolean', value }]);
222
+ return this;
223
+ }
166
224
  try {
167
225
  Insider.setWhatsappOptin(value);
168
226
  } catch (error) {
@@ -174,7 +232,7 @@ export default class RNInsiderUser {
174
232
  login(identifiers, insiderIDResult) {
175
233
  if (shouldNotProceed()) { return this; }
176
234
  try {
177
- if (insiderIDResult != null) {
235
+ if (insiderIDResult !== null && insiderIDResult !== undefined) {
178
236
  Insider.loginWithReturningID(identifiers.identifiers, insiderIDResult);
179
237
 
180
238
  return;
@@ -198,7 +256,11 @@ export default class RNInsiderUser {
198
256
  }
199
257
 
200
258
  setCustomAttributeWithString(key, value) {
201
- if (shouldNotProceed() || key == null || value == null) return this;
259
+ if (shouldNotProceed()) return this;
260
+ if (checkParameters([{ type: 'string', value: key }, { type: 'string', value }])) {
261
+ showParameterWarningLog("setCustomAttributeWithString", [{ type: 'string', value: key }, { type: 'string', value }]);
262
+ return this;
263
+ }
202
264
  try {
203
265
  Insider.setCustomAttributeWithString(key, value);
204
266
  } catch (error) {
@@ -208,7 +270,11 @@ export default class RNInsiderUser {
208
270
  }
209
271
 
210
272
  setCustomAttributeWithInt(key, value) {
211
- if (shouldNotProceed() || key == null || value == null) return this;
273
+ if (shouldNotProceed()) return this;
274
+ if (checkParameters([{ type: 'string', value: key }, { type: 'number', value }])) {
275
+ showParameterWarningLog("setCustomAttributeWithInt", [{ type: 'string', value: key }, { type: 'number', value }]);
276
+ return this;
277
+ }
212
278
  try {
213
279
  Insider.setCustomAttributeWithInt(key, value);
214
280
  } catch (error) {
@@ -218,7 +284,11 @@ export default class RNInsiderUser {
218
284
  }
219
285
 
220
286
  setCustomAttributeWithDouble(key, value) {
221
- if (shouldNotProceed() || key == null || value == null) return this;
287
+ if (shouldNotProceed()) return this;
288
+ if (checkParameters([{ type: 'string', value: key }, { type: 'number', value }])) {
289
+ showParameterWarningLog("setCustomAttributeWithDouble", [{ type: 'string', value: key }, { type: 'number', value }]);
290
+ return this;
291
+ }
222
292
  try {
223
293
  Insider.setCustomAttributeWithDouble(key, value);
224
294
  } catch (error) {
@@ -228,7 +298,11 @@ export default class RNInsiderUser {
228
298
  }
229
299
 
230
300
  setCustomAttributeWithBoolean(key, value) {
231
- if (shouldNotProceed() || key == null || value == null) return this;
301
+ if (shouldNotProceed()) return this;
302
+ if (checkParameters([{ type: 'string', value: key }, { type: 'boolean', value }])) {
303
+ showParameterWarningLog("setCustomAttributeWithBoolean", [{ type: 'string', value: key }, { type: 'boolean', value }]);
304
+ return this;
305
+ }
232
306
  try {
233
307
  Insider.setCustomAttributeWithBoolean(key, value);
234
308
  } catch (error) {
@@ -238,7 +312,11 @@ export default class RNInsiderUser {
238
312
  }
239
313
 
240
314
  setCustomAttributeWithDate(key, value) {
241
- if (shouldNotProceed() || key == null || value == null) return this;
315
+ if (shouldNotProceed()) return this;
316
+ if (checkParameters([{ type: 'string', value: key }, { type: 'object', value }])) {
317
+ showParameterWarningLog("setCustomAttributeWithDate", [{ type: 'string', value: key }, { type: 'object', value }]);
318
+ return this;
319
+ }
242
320
  try {
243
321
  Insider.setCustomAttributeWithDate(key, value.toISOString());
244
322
  } catch (error) {
@@ -248,7 +326,11 @@ export default class RNInsiderUser {
248
326
  }
249
327
 
250
328
  setCustomAttributeWithArray(key, value) {
251
- if (shouldNotProceed() || key == null || value == null) return this;
329
+ if (shouldNotProceed()) return this;
330
+ if (checkParameters([{ type: 'string', value: key }, { type: 'object', value }])) {
331
+ showParameterWarningLog("setCustomAttributeWithArray", [{ type: 'string', value: key }, { type: 'object', value }]);
332
+ return this;
333
+ }
252
334
  try {
253
335
  Insider.setCustomAttributeWithArray(key, value);
254
336
  } catch (error) {
@@ -258,7 +340,11 @@ export default class RNInsiderUser {
258
340
  }
259
341
 
260
342
  unsetCustomAttribute(key) {
261
- if (shouldNotProceed() || key == null) return this;
343
+ if (shouldNotProceed()) return this;
344
+ if (checkParameters([{ type: 'string', value: key }])) {
345
+ showParameterWarningLog("unsetCustomAttribute", [{ type: 'string', value: key }]);
346
+ return this;
347
+ }
262
348
  try {
263
349
  Insider.unsetCustomAttribute(key);
264
350
  } catch (error) {
package/src/Util.js ADDED
@@ -0,0 +1,35 @@
1
+ import { NativeModules } from 'react-native';
2
+
3
+ const Insider = NativeModules.RNInsider;
4
+
5
+ export function shouldNotProceed() {
6
+ return Insider === null || Insider === undefined;
7
+ }
8
+
9
+ export function generateJSONErrorString(error) {
10
+ return '[JavaScript Error] ' + error;
11
+ }
12
+
13
+ export function checkParameters(parameters) {
14
+ return parameters.some(param =>
15
+ param.value === null ||
16
+ param.value === undefined ||
17
+ param.type !== typeof param.value
18
+ );
19
+ }
20
+
21
+ export function showParameterWarningLog(functionName, parameters = []) {
22
+ if (!Array.isArray(parameters) || parameters.length === 0) {
23
+ console.warn(`[ReactNative] Parameter validation failed in function: ${functionName} - No valid parameters provided.`);
24
+ return;
25
+ }
26
+
27
+ const invalidParams = parameters
28
+ .filter(param => param.value === null || param.value === undefined || param.type !== typeof param.value)
29
+ .map(param => `Expected ${param.type} but got ${typeof param.value} (${param.value})`);
30
+
31
+ console.warn(
32
+ `[ReactNative] Parameter validation failed in function: ${functionName}\n` +
33
+ `Invalid Parameters:\n${invalidParams.join("\n")}`
34
+ );
35
+ }
@@ -1,17 +0,0 @@
1
- name: CxFlow-GitHub-Pull-Request
2
- on:
3
- pull_request:
4
- types: [ready_for_review]
5
- jobs:
6
- build:
7
- runs-on: self-runner-node
8
- steps:
9
- - name: Trigger to Scanner Lambda
10
- run: |
11
- python -c '
12
- import json,sys,requests;
13
- github = {"repository": "'${{ github.event.repository.name }}'", "ref": "'${{ github.head_ref }}'"};
14
- github_request = {"checkmarx_gitaction": github};
15
- requests.post("'$LambdaWebHook'", json=github_request);'
16
- env:
17
- LambdaWebHook: ${{ secrets.INSECPROXY_HOOK }}
@@ -1,15 +0,0 @@
1
- name: Gitleaks-Action
2
- on: [push]
3
- jobs:
4
- build:
5
- runs-on: self-runner-node
6
- steps:
7
- - name: Trigger to Gitleak
8
- run: |
9
- python -c '
10
- import json,sys,requests;
11
- github = {"repository": "'${{ github.event.repository.name }}'", "ref": "'${{ github.ref_name }}'"};
12
- github_request = {"insider_gitleak": github};
13
- requests.post("'$LambdaWebHook'", json=github_request);'
14
- env:
15
- LambdaWebHook: ${{ secrets.INSECPROXY_HOOK }}
@@ -1,52 +0,0 @@
1
- name: Trivy Vulnerability Scanner
2
- on:
3
- pull_request:
4
- types: [ready_for_review]
5
- jobs:
6
- build:
7
- name: Build
8
- runs-on: self-hosted
9
- steps:
10
- - name: Checkout code
11
- uses: actions/checkout@v2
12
- with:
13
- fetch-depth: 0
14
- - name: Install Trivy
15
- run: |
16
- sudo apt-get install wget apt-transport-https gnupg lsb-release
17
- wget -qO - https://aquasecurity.github.io/trivy-repo/deb/public.key | sudo apt-key add -
18
- echo deb https://aquasecurity.github.io/trivy-repo/deb $(lsb_release -sc) main | sudo tee -a /etc/apt/sources.list.d/trivy.list
19
- sudo apt-get update
20
- sudo apt-get install trivy
21
- - name: Trivy Scanner
22
- run: |
23
- python -c '
24
- import glob, os;
25
- files = glob.glob("**/Dockerfile", recursive=True);
26
- count = 0;
27
- for file in files:
28
- diff_command1 = f"git diff origin/main -- {file} > diff1.txt";
29
- diff_command2 = f"git diff origin/master -- {file} > diff2.txt";
30
- os.system(diff_command1);
31
- os.system(diff_command2);
32
- main_lenght = len(open("./diff1.txt", "r").read());
33
- master_lenght = len(open("./diff2.txt", "r").read());
34
- if len(open("./diff1.txt", "r").read()) + len(open("./diff2.txt", "r").read()) > 0:
35
- build_command = f"docker build -f {file} -t image{count} "+("/".join(file.split("/")[0:-1]) or ".");
36
- os.system(build_command);
37
- os.system(f"trivy image image{count} -f json -o trivy-result{count}.json --severity=CRITICAL,HIGH,MEDIUM");
38
- count+=1;
39
- print("Build Finished")'
40
- - name: Trivy Response Send to Lambda
41
- run: |
42
- python -c '
43
- import json,sys,requests,glob;
44
- files = glob.glob("trivy-result*");
45
- for file in files:
46
- output=open(f"./{file}");
47
- json_result=json.loads(output.read());
48
- github_result = {"repository": "'${{ github.repository }}'", "server_url": "'${{ github.server_url }}'", "run_id": "'${{ github.run_id }}'"};
49
- request = {"trivy_result": json_result, "github": github_result};
50
- requests.post("'$LambdaWebHook'", json=request);'
51
- env:
52
- LambdaWebHook: ${{ secrets.CHECKMARX_LAMBDA_WEBHOOK }}
@@ -1,13 +0,0 @@
1
- arguments=
2
- auto.sync=false
3
- build.scans.enabled=false
4
- connection.gradle.distribution=GRADLE_DISTRIBUTION(VERSION(6.3))
5
- connection.project.dir=
6
- eclipse.preferences.version=1
7
- gradle.user.home=
8
- java.home=/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home
9
- jvm.arguments=
10
- offline.mode=false
11
- override.workspace.settings=true
12
- show.console.view=true
13
- show.executions.view=true