forked from Expensify/App
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path@react-native-community+netinfo+11.2.1+002+turbomodule.patch
3078 lines (2980 loc) · 338 KB
/
@react-native-community+netinfo+11.2.1+002+turbomodule.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
diff --git a/node_modules/@react-native-community/netinfo/android/build.gradle b/node_modules/@react-native-community/netinfo/android/build.gradle
index 0d617ed..97439e6 100644
--- a/node_modules/@react-native-community/netinfo/android/build.gradle
+++ b/node_modules/@react-native-community/netinfo/android/build.gradle
@@ -3,9 +3,10 @@ buildscript {
// This avoids unnecessary downloads and potential conflicts when the library is included as a
// module dependency in an application project.
if (project == rootProject) {
- repositories {
- google()
- mavenCentral()
+ repositories {
+ google()
+ mavenCentral()
+ gradlePluginPortal()
}
dependencies {
@@ -26,8 +27,54 @@ def getExtOrIntegerDefault(name) {
return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties['ReactNativeNetInfo_' + name]).toInteger()
}
+def isNewArchitectureEnabled() {
+ return project.hasProperty("newArchEnabled") && project.newArchEnabled == "true"
+}
+
+def resolveReactNativeDirectory() {
+ def reactNativeLocation = getExtOrInitialValue("REACT_NATIVE_NODE_MODULES_DIR", null)
+ if (reactNativeLocation != null) {
+ return file(reactNativeLocation)
+ }
+
+ // monorepo workaround
+ // react-native can be hoisted or in project's own node_modules
+ def reactNativeFromProjectNodeModules = file("${rootProject.projectDir}/../node_modules/react-native")
+ if (reactNativeFromProjectNodeModules.exists()) {
+ return reactNativeFromProjectNodeModules
+ }
+
+ def reactNativeFromNodeModulesWithRNCNetInfo = file("${projectDir}/../../react-native")
+ if (reactNativeFromNodeModulesWithRNCNetInfo.exists()) {
+ return reactNativeFromNodeModulesWithRNCNetInfo
+ }
+
+ throw new Exception(
+ "[react-native-netinfo] Unable to resolve react-native location in " +
+ "node_modules. You should add project extension property (in app/build.gradle) " +
+ "`REACT_NATIVE_NODE_MODULES_DIR` with path to react-native."
+ )
+}
+
+def getReactNativeMinorVersion() {
+ def REACT_NATIVE_DIR = resolveReactNativeDirectory()
+
+ def reactProperties = new Properties()
+ file("$REACT_NATIVE_DIR/ReactAndroid/gradle.properties").withInputStream { reactProperties.load(it) }
+
+ def REACT_NATIVE_VERSION = reactProperties.getProperty("VERSION_NAME")
+ def REACT_NATIVE_MINOR_VERSION = REACT_NATIVE_VERSION.startsWith("0.0.0-") ? 1000 : REACT_NATIVE_VERSION.split("\\.")[1].toInteger()
+
+ return REACT_NATIVE_MINOR_VERSION
+}
+
+
apply plugin: 'com.android.library'
+if (isNewArchitectureEnabled()) {
+ apply plugin: 'com.facebook.react'
+}
+
android {
compileSdkVersion getExtOrIntegerDefault('compileSdkVersion')
@@ -45,10 +92,21 @@ android {
defaultConfig {
minSdkVersion getExtOrIntegerDefault('minSdkVersion')
targetSdkVersion getExtOrIntegerDefault('targetSdkVersion')
+ buildConfigField("boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString())
+ }
+ sourceSets {
+ main {
+ if (isNewArchitectureEnabled()) {
+ java.srcDirs += ['src/newarch']
+ } else {
+ java.srcDirs += ['src/oldarch']
+ }
+ }
}
lintOptions{
abortOnError false
}
+
}
repositories {
@@ -63,6 +121,9 @@ repositories {
dependencies {
//noinspection GradleDynamicVersion
- implementation 'com.facebook.react:react-native:+'
-
+ if (isNewArchitectureEnabled() && getReactNativeMinorVersion() < 71) {
+ implementation project(":ReactAndroid")
+ } else {
+ implementation 'com.facebook.react:react-native:+'
+ }
}
diff --git a/node_modules/@react-native-community/netinfo/android/src/main/java/com/reactnativecommunity/netinfo/NetInfoModuleImpl.java b/node_modules/@react-native-community/netinfo/android/src/main/java/com/reactnativecommunity/netinfo/NetInfoModuleImpl.java
index 2c3280b..52ea692 100644
--- a/node_modules/@react-native-community/netinfo/android/src/main/java/com/reactnativecommunity/netinfo/NetInfoModuleImpl.java
+++ b/node_modules/@react-native-community/netinfo/android/src/main/java/com/reactnativecommunity/netinfo/NetInfoModuleImpl.java
@@ -9,13 +9,11 @@ package com.reactnativecommunity.netinfo;
import android.os.Build;
import com.facebook.react.bridge.Promise;
import com.facebook.react.bridge.ReactApplicationContext;
-import com.facebook.react.bridge.ReactContextBaseJavaModule;
import com.facebook.react.bridge.ReactMethod;
import com.facebook.react.module.annotations.ReactModule;
/** Module that monitors and provides information about the connectivity state of the device. */
-@ReactModule(name = NetInfoModule.NAME)
-public class NetInfoModule extends ReactContextBaseJavaModule implements AmazonFireDeviceConnectivityPoller.ConnectivityChangedCallback {
+public class NetInfoModuleImpl implements AmazonFireDeviceConnectivityPoller.ConnectivityChangedCallback {
public static final String NAME = "RNCNetInfo";
private final ConnectivityReceiver mConnectivityReceiver;
@@ -23,8 +21,7 @@ public class NetInfoModule extends ReactContextBaseJavaModule implements AmazonF
private int numberOfListeners = 0;
- public NetInfoModule(ReactApplicationContext reactContext) {
- super(reactContext);
+ public NetInfoModuleImpl(ReactApplicationContext reactContext) {
// Create the connectivity receiver based on the API level we are running on
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
mConnectivityReceiver = new NetworkCallbackConnectivityReceiver(reactContext);
@@ -35,23 +32,17 @@ public class NetInfoModule extends ReactContextBaseJavaModule implements AmazonF
mAmazonConnectivityChecker = new AmazonFireDeviceConnectivityPoller(reactContext, this);
}
- @Override
+
public void initialize() {
mConnectivityReceiver.register();
mAmazonConnectivityChecker.register();
}
- @Override
- public void onCatalystInstanceDestroy() {
+ public void invalidate() {
mAmazonConnectivityChecker.unregister();
mConnectivityReceiver.unregister();
- mConnectivityReceiver.hasListener = false;
}
- @Override
- public String getName() {
- return NAME;
- }
@ReactMethod
public void getCurrentState(final String requestedInterface, final Promise promise) {
@@ -63,14 +54,14 @@ public class NetInfoModule extends ReactContextBaseJavaModule implements AmazonF
mConnectivityReceiver.setIsInternetReachableOverride(isConnected);
}
- @ReactMethod
+
public void addListener(String eventName) {
numberOfListeners++;
mConnectivityReceiver.hasListener = true;
}
- @ReactMethod
- public void removeListeners(Integer count) {
+
+ public void removeListeners(double count) {
numberOfListeners -= count;
if (numberOfListeners == 0) {
mConnectivityReceiver.hasListener = false;
diff --git a/node_modules/@react-native-community/netinfo/android/src/main/java/com/reactnativecommunity/netinfo/NetInfoPackage.java b/node_modules/@react-native-community/netinfo/android/src/main/java/com/reactnativecommunity/netinfo/NetInfoPackage.java
index fcd4a5e..1bf0b62 100644
--- a/node_modules/@react-native-community/netinfo/android/src/main/java/com/reactnativecommunity/netinfo/NetInfoPackage.java
+++ b/node_modules/@react-native-community/netinfo/android/src/main/java/com/reactnativecommunity/netinfo/NetInfoPackage.java
@@ -1,34 +1,46 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
package com.reactnativecommunity.netinfo;
-import com.facebook.react.ReactPackage;
-import com.facebook.react.bridge.JavaScriptModule;
+import androidx.annotation.Nullable;
import com.facebook.react.bridge.NativeModule;
import com.facebook.react.bridge.ReactApplicationContext;
-import com.facebook.react.uimanager.ViewManager;
-import java.util.Arrays;
+import com.facebook.react.module.model.ReactModuleInfo;
+import com.facebook.react.module.model.ReactModuleInfoProvider;
+import com.facebook.react.TurboReactPackage;
+
import java.util.Collections;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
-public class NetInfoPackage implements ReactPackage {
- @Override
- public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
- return Arrays.<NativeModule>asList(new NetInfoModule(reactContext));
- }
+public class NetInfoPackage extends TurboReactPackage {
- // Deprecated from RN 0.47
- public List<Class<? extends JavaScriptModule>> createJSModules() {
- return Collections.emptyList();
- }
+ @Nullable
+ @Override
+ public NativeModule getModule(String name, ReactApplicationContext reactContext) {
+ if (name.equals(NetInfoModuleImpl.NAME)) {
+ return new NetInfoModule(reactContext);
+ } else {
+ return null;
+ }
+ }
- @Override
- @SuppressWarnings("rawtypes")
- public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
- return Collections.emptyList();
- }
+ @Override
+ public ReactModuleInfoProvider getReactModuleInfoProvider() {
+ return () -> {
+ final Map<String, ReactModuleInfo> moduleInfos = new HashMap<>();
+ boolean turboModulesEnabled = BuildConfig.IS_NEW_ARCHITECTURE_ENABLED;
+ moduleInfos.put(
+ NetInfoModuleImpl.NAME,
+ new ReactModuleInfo(
+ NetInfoModuleImpl.NAME,
+ NetInfoModuleImpl.NAME,
+ false, // canOverrideExistingModule
+ false, // needsEagerInit
+ true, // hasConstants
+ false, // isCxxModule
+ turboModulesEnabled // isTurboModule
+ ));
+ return moduleInfos;
+ };
+ }
}
diff --git a/node_modules/@react-native-community/netinfo/android/src/newarch/com/reactnativecommunity/netinfo/NetInfoModule.java b/node_modules/@react-native-community/netinfo/android/src/newarch/com/reactnativecommunity/netinfo/NetInfoModule.java
new file mode 100644
index 0000000..26c83b6
--- /dev/null
+++ b/node_modules/@react-native-community/netinfo/android/src/newarch/com/reactnativecommunity/netinfo/NetInfoModule.java
@@ -0,0 +1,51 @@
+package com.reactnativecommunity.netinfo;
+
+import com.facebook.react.bridge.ReactApplicationContext;
+import com.facebook.react.bridge.Promise;
+import com.facebook.react.bridge.ReactMethod;
+import com.facebook.react.bridge.ReadableMap;
+
+public class NetInfoModule extends NativeRNCNetInfoSpec {
+
+ private NetInfoModuleImpl implementation;
+
+ NetInfoModule(ReactApplicationContext context) {
+ super(context);
+ implementation = new NetInfoModuleImpl(context);
+ }
+
+ @Override
+ public String getName() {
+ return NetInfoModuleImpl.NAME;
+ }
+
+ @ReactMethod
+ public void getCurrentState(final String requestedInterface, final Promise promise) {
+ implementation.getCurrentState(requestedInterface, promise);
+ }
+
+ @ReactMethod
+ public void configure(ReadableMap config) {
+ // iOS only
+ }
+
+ @ReactMethod
+ public void addListener(String eventName) {
+ implementation.addListener(eventName);
+ }
+
+ @ReactMethod
+ public void removeListeners(double count) {
+ implementation.removeListeners(count);
+ }
+
+ @Override
+ public void invalidate() {
+ implementation.invalidate();
+ }
+
+ @Override
+ public void initialize() {
+ implementation.initialize();
+ }
+}
diff --git a/node_modules/@react-native-community/netinfo/android/src/oldarch/com/reactnativecommunity/netinfo/NetInfoModule.java b/node_modules/@react-native-community/netinfo/android/src/oldarch/com/reactnativecommunity/netinfo/NetInfoModule.java
new file mode 100644
index 0000000..c61a84d
--- /dev/null
+++ b/node_modules/@react-native-community/netinfo/android/src/oldarch/com/reactnativecommunity/netinfo/NetInfoModule.java
@@ -0,0 +1,59 @@
+
+
+package com.reactnativecommunity.netinfo;
+
+import com.facebook.react.bridge.NativeModule;
+import com.facebook.react.bridge.Promise;
+import com.facebook.react.bridge.ReactApplicationContext;
+import com.facebook.react.bridge.ReactContext;
+import com.facebook.react.bridge.ReactContextBaseJavaModule;
+import com.facebook.react.bridge.ReactMethod;
+import java.util.Map;
+import java.util.HashMap;
+import com.facebook.react.bridge.ReadableMap;
+
+public class NetInfoModule extends ReactContextBaseJavaModule {
+
+ private NetInfoModuleImpl implementation;
+
+ NetInfoModule(ReactApplicationContext context) {
+ super(context);
+ implementation = new NetInfoModuleImpl(context);
+ }
+
+ @Override
+ public String getName() {
+ return NetInfoModuleImpl.NAME;
+ }
+
+ @ReactMethod
+ public void getCurrentState(final String requestedInterface, final Promise promise) {
+ implementation.getCurrentState(requestedInterface, promise);
+ }
+
+ @Override
+ public void invalidate() {
+ implementation.invalidate();
+ }
+
+
+ @Override
+ public void initialize() {
+ implementation.initialize();
+ }
+
+ @ReactMethod
+ public void addListener(String eventName) {
+ implementation.addListener(eventName);
+ }
+
+ @ReactMethod
+ public void configure(ReadableMap config) {
+ // iOS only
+ }
+
+ @ReactMethod
+ public void removeListeners(double count) {
+ implementation.removeListeners(count);
+ }
+}
diff --git a/node_modules/@react-native-community/netinfo/ios/RNCNetInfo.mm b/node_modules/@react-native-community/netinfo/ios/RNCNetInfo.mm
index e83b8c4..be520d9 100644
--- a/node_modules/@react-native-community/netinfo/ios/RNCNetInfo.mm
+++ b/node_modules/@react-native-community/netinfo/ios/RNCNetInfo.mm
@@ -8,6 +8,10 @@
#import "RNCNetInfo.h"
#import "RNCConnectionStateWatcher.h"
+#ifdef RCT_NEW_ARCH_ENABLED
+#import "RNCNetInfoSpec.h"
+#endif
+
#include <ifaddrs.h>
#include <arpa/inet.h>
@@ -15,13 +19,18 @@
#import <CoreTelephony/CTCarrier.h>
#import <CoreTelephony/CTTelephonyNetworkInfo.h>
#endif
-@import SystemConfiguration.CaptiveNetwork;
+#import <SystemConfiguration/CaptiveNetwork.h>
+
#import <React/RCTAssert.h>
#import <React/RCTBridge.h>
#import <React/RCTEventDispatcher.h>
+#ifdef RCT_NEW_ARCH_ENABLED
+@interface RNCNetInfo () <RNCConnectionStateWatcherDelegate, NativeRNCNetInfoSpec>
+#else
@interface RNCNetInfo () <RNCConnectionStateWatcherDelegate>
+#endif
@property (nonatomic, strong) RNCConnectionStateWatcher *connectionStateWatcher;
@property (nonatomic) BOOL isObserving;
@@ -97,6 +106,7 @@ - (void)connectionStateWatcher:(RNCConnectionStateWatcher *)connectionStateWatch
resolve([self currentDictionaryFromUpdateState:state withInterface:requestedInterface]);
}
+
RCT_EXPORT_METHOD(configure:(NSDictionary *)config)
{
self.config = config;
@@ -265,4 +275,10 @@ - (NSString *)bssid
}
#endif
+#ifdef RCT_NEW_ARCH_ENABLED
+- (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:(const facebook::react::ObjCTurboModule::InitParams &)params {
+ return std::make_shared<facebook::react::NativeRNCNetInfoSpecJSI>(params);
+}
+#endif
+
@end
diff --git a/node_modules/@react-native-community/netinfo/jest/netinfo-mock.js b/node_modules/@react-native-community/netinfo/jest/netinfo-mock.js
index 7f5769c..99b1aa3 100644
--- a/node_modules/@react-native-community/netinfo/jest/netinfo-mock.js
+++ b/node_modules/@react-native-community/netinfo/jest/netinfo-mock.js
@@ -14,18 +14,17 @@ const defaultState = {
};
const NetInfoStateType = {
- unknown: "unknown",
- none: "none",
- cellular: "cellular",
- wifi: "wifi",
- bluetooth: "bluetooth",
- ethernet: "ethernet",
- wimax: "wimax",
- vpn: "vpn",
- other: "other",
+ unknown: 'unknown',
+ none: 'none',
+ cellular: 'cellular',
+ wifi: 'wifi',
+ bluetooth: 'bluetooth',
+ ethernet: 'ethernet',
+ wimax: 'wimax',
+ vpn: 'vpn',
+ other: 'other',
};
-
const RNCNetInfoMock = {
NetInfoStateType,
configure: jest.fn(),
diff --git a/node_modules/@react-native-community/netinfo/lib/commonjs/index.js b/node_modules/@react-native-community/netinfo/lib/commonjs/index.js
index f5afe24..8f06bc8 100644
--- a/node_modules/@react-native-community/netinfo/lib/commonjs/index.js
+++ b/node_modules/@react-native-community/netinfo/lib/commonjs/index.js
@@ -11,26 +11,19 @@ var _exportNames = {
useNetInfo: true,
useNetInfoInstance: true
};
+exports.addEventListener = addEventListener;
exports.configure = configure;
+exports.default = void 0;
exports.fetch = fetch;
exports.refresh = refresh;
-exports.addEventListener = addEventListener;
exports.useNetInfo = useNetInfo;
exports.useNetInfoInstance = useNetInfoInstance;
-exports.default = void 0;
-
var _react = require("react");
-
var _reactNative = require("react-native");
-
var _defaultConfiguration = _interopRequireDefault(require("./internal/defaultConfiguration"));
-
var _nativeInterface = _interopRequireDefault(require("./internal/nativeInterface"));
-
var _state2 = _interopRequireDefault(require("./internal/state"));
-
var Types = _interopRequireWildcard(require("./internal/types"));
-
Object.keys(Types).forEach(function (key) {
if (key === "default" || key === "__esModule") return;
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
@@ -42,13 +35,9 @@ Object.keys(Types).forEach(function (key) {
}
});
});
-
-function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
-
-function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
-
+function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
+function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
@@ -57,14 +46,16 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
*
* @format
*/
+
// Stores the currently used configuration
-let _configuration = _defaultConfiguration.default; // Stores the singleton reference to the state manager
+let _configuration = _defaultConfiguration.default;
+// Stores the singleton reference to the state manager
let _state = null;
-
const createState = () => {
return new _state2.default(_configuration);
};
+
/**
* Configures the library with the given configuration. Note that calling this will stop all
* previously added listeners from being called again. It is best to call this right when your
@@ -72,23 +63,20 @@ const createState = () => {
*
* @param configuration The new configuration to set.
*/
-
-
function configure(configuration) {
- _configuration = { ..._defaultConfiguration.default,
+ _configuration = {
+ ..._defaultConfiguration.default,
...configuration
};
-
if (_state) {
_state.tearDown();
-
_state = createState();
}
-
if (_reactNative.Platform.OS === 'ios') {
_nativeInterface.default.configure(configuration);
}
}
+
/**
* Returns a `Promise` that resolves to a `NetInfoState` object.
* This function operates on the global singleton instance configured using `configure()`
@@ -97,29 +85,25 @@ function configure(configuration) {
*
* @returns A Promise which contains the current connection state.
*/
-
-
function fetch(requestedInterface) {
if (!_state) {
_state = createState();
}
-
return _state.latest(requestedInterface);
}
+
/**
* Force-refreshes the internal state of the global singleton managed by this library.
*
* @returns A Promise which contains the updated connection state.
*/
-
-
function refresh() {
if (!_state) {
_state = createState();
}
-
return _state._fetchCurrentState();
}
+
/**
* Subscribe to the global singleton's connection information. The callback is called with a parameter of type
* [`NetInfoState`](README.md#netinfostate) whenever the connection state changes. Your listener
@@ -131,19 +115,16 @@ function refresh() {
*
* @returns A function which can be called to unsubscribe.
*/
-
-
function addEventListener(listener) {
if (!_state) {
_state = createState();
}
-
_state.add(listener);
-
return () => {
_state && _state.remove(listener);
};
}
+
/**
* A React Hook into this library's singleton which updates when the connection state changes.
*
@@ -151,13 +132,10 @@ function addEventListener(listener) {
*
* @returns The connection state.
*/
-
-
function useNetInfo(configuration) {
if (configuration) {
configure(configuration);
}
-
const [netInfo, setNetInfo] = (0, _react.useState)({
type: Types.NetInfoStateType.unknown,
isConnected: null,
@@ -169,6 +147,7 @@ function useNetInfo(configuration) {
}, []);
return netInfo;
}
+
/**
* A React Hook which manages an isolated instance of the network info manager.
* This is not a hook into a singleton shared state. NetInfo.configure, NetInfo.addEventListener,
@@ -178,8 +157,6 @@ function useNetInfo(configuration) {
*
* @returns the netInfo state and a refresh function
*/
-
-
function useNetInfoInstance(isPaused = false, configuration) {
const [networkInfoManager, setNetworkInfoManager] = (0, _react.useState)();
const [netInfo, setNetInfo] = (0, _react.useState)({
@@ -192,8 +169,8 @@ function useNetInfoInstance(isPaused = false, configuration) {
if (isPaused) {
return;
}
-
- const config = { ..._defaultConfiguration.default,
+ const config = {
+ ..._defaultConfiguration.default,
...configuration
};
const state = new _state2.default(config);
@@ -209,8 +186,7 @@ function useNetInfoInstance(isPaused = false, configuration) {
refresh
};
}
-
-var _default = {
+var _default = exports.default = {
configure,
fetch,
refresh,
@@ -218,5 +194,4 @@ var _default = {
useNetInfo,
useNetInfoInstance
};
-exports.default = _default;
//# sourceMappingURL=index.js.map
\ No newline at end of file
diff --git a/node_modules/@react-native-community/netinfo/lib/commonjs/index.js.map b/node_modules/@react-native-community/netinfo/lib/commonjs/index.js.map
index c778a40..51f1ed7 100644
--- a/node_modules/@react-native-community/netinfo/lib/commonjs/index.js.map
+++ b/node_modules/@react-native-community/netinfo/lib/commonjs/index.js.map
@@ -1 +1 @@
-{"version":3,"sources":["index.ts"],"names":["_configuration","DEFAULT_CONFIGURATION","_state","createState","State","configure","configuration","tearDown","Platform","OS","NativeInterface","fetch","requestedInterface","latest","refresh","_fetchCurrentState","addEventListener","listener","add","remove","useNetInfo","netInfo","setNetInfo","type","Types","NetInfoStateType","unknown","isConnected","isInternetReachable","details","useNetInfoInstance","isPaused","networkInfoManager","setNetworkInfoManager","config","state"],"mappings":";;;;;;;;;;;;;;;;;;;;;AASA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAkKA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;;;;;;AAhLA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AASA;AACA,IAAIA,cAAc,GAAGC,6BAArB,C,CAEA;;AACA,IAAIC,MAAoB,GAAG,IAA3B;;AACA,MAAMC,WAAW,GAAG,MAAa;AAC/B,SAAO,IAAIC,eAAJ,CAAUJ,cAAV,CAAP;AACD,CAFD;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASK,SAAT,CACLC,aADK,EAEC;AACNN,EAAAA,cAAc,GAAG,EACf,GAAGC,6BADY;AAEf,OAAGK;AAFY,GAAjB;;AAKA,MAAIJ,MAAJ,EAAY;AACVA,IAAAA,MAAM,CAACK,QAAP;;AACAL,IAAAA,MAAM,GAAGC,WAAW,EAApB;AACD;;AAED,MA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AEG,EAFH;AAIA,SAAOD,OAAP;AACD;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASS,kBAAT,CACLC,QAAQ,GAAG,KADN,EAELzB,aAFK,EAGL;AACA,QAAM,CAAC0B,kBAAD,EAAqBC,qBAArB,IAA8C,sBAApD;AACA,QAAM,CAACZ,OAAD,EAAUC,UAAV,IAAwB,qBAA6B;AACzDC,IAAAA,IAAI,EAAEC,KAAK,CAACC,gBAAN,CAAuBC,OAD4B;AAEzDC,IAAAA,WAAW,EAAE,IAF4C;AAGzDC,IAAAA,mBAAmB,EAAE,IAHoC;AAIzDC,IAAAA,OAAO,EAAE;AAJgD,GAA7B,CAA9B;AAOA,wBAAU,MAAM;AACd,QAAIE,QAAJ,EAAc;AACZ;AACD;;AACD,UAAMG,MAAM,GAAG,EACb,GAAGjC,6BADU;AAEb,SAAGK;AAFU,KAAf;AAIA,UAAM6B,KAAK,GAAG,IAAI/B,eAAJ,CAAU8B,MAAV,CAAd;AACAD,IAAAA,qBAAqB,CAACE,KAAD,CAArB;AACAA,IAAAA,KAAK,CAACjB,GAAN,CAAUI,UAAV;AACA,WAAOa,KAAK,CAAC5B,QAAb;AACD,GAZD,EAYG,CAACwB,QAAD,EAAWzB,aAAX,CAZH;AAcA,QAAMQ,OAAO,GAAG,wBAAY,MAAM;AAChCkB,IAAAA,kBAAkB,IAAIA,kBAAkB,CAACjB,kBAAnB,EAAtB;AACD,GAFe,EAEb,CAACiB,kBAAD,CAFa,CAAhB;AAIA,SAAO;AACLX,IAAAA,OADK;AAELP,IAAAA;AAFK,GAAP;AAID;;eAIc;AACbT,EAAAA,SADa;AAEbM,EAAAA,KAFa;AAGbG,EAAAA,OAHa;AAIbE,EAAAA,gBAJa;AAKbI,EAAAA,UALa;AAMbU,EAAAA;AANa,C","sourcesContent":["/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n */\n\nimport {useState, useEffect, useCallback} from 'react';\nimport {Platform} from 'react-native';\nimport DEFAULT_CONFIGURATION from './internal/defaultConfiguration';\nimport NativeInterface from './internal/nativeInterface';\nimport State from './internal/state';\nimport * as Types from './internal/types';\n\n// Stores the currently used configuration\nlet _configuration = DEFAULT_CONFIGURATION;\n\n// Stores the singleton reference to the state manager\nlet _state: State | null = null;\nconst createState = (): State => {\n return new State(_configuration);\n};\n\n/**\n * Configures the library with the given configuration. Note that calling this will stop all\n * previously added listeners from being called again. It is best to call this right when your\n * application is started to avoid issues. The configuration sets up a global singleton instance.\n *\n * @param configuration The new configuration to set.\n */\nexport function configure(\n configuration: Partial<Types.NetInfoConfiguration>,\n): void {\n _configuration = {\n ...DEFAULT_CONFIGURATION,\n ...configuration,\n };\n\n if (_state) {\n _state.tearDown();\n _state = createState();\n }\n\n if (Platform.OS === 'ios') {\n NativeInterface.configure(configuration);\n }\n}\n\n/**\n * Returns a `Promise` that resolves to a `NetInfoState` object.\n * This function operates on the global singleton instance configured using `configure()`\n *\n * @param [requestedInterface] interface from which to obtain the information\n *\n * @returns A Promise which contains the current connection state.\n */\nexport function fetch(\n requestedInterface?: string,\n): Promise<Types.NetInfoState> {\n if (!_state) {\n _state = createState();\n }\n return _state.latest(requestedInterface);\n}\n\n/**\n * Force-refreshes the internal state of the global singleton managed by this library.\n *\n * @returns A Promise which contains the updated connection state.\n */\nexport function refresh(): Promise<Types.NetInfoState> {\n if (!_state) {\n _state = createState();\n }\n return _state._fetchCurrentState();\n}\n\n/**\n * Subscribe to the global singleton's connection information. The callback is called with a parameter of type\n * [`NetInfoState`](README.md#netinfostate) whenever the connection state changes. Your listener\n * will be called with the latest information soon after you subscribe and then with any\n * subsequent changes afterwards. You should not assume that the listener is called in the same\n * way across devices or platforms.\n *\n * @param listener The listener which is called when the network state changes.\n *\n * @returns A function which can be called to unsubscribe.\n */\nexport function addEventListener(\n listener: Types.NetInfoChangeHandler,\n): Types.NetInfoSubscription {\n if (!_state) {\n _state = createState();\n }\n\n _state.add(listener);\n return (): void => {\n _state && _state.remove(listener);\n };\n}\n\n/**\n * A React Hook into this library's singleton which updates when the connection state changes.\n *\n * @param {Partial<Types.NetInfoConfiguration>} configuration - Configure the isolated network checker managed by this hook\n *\n * @returns The connection state.\n */\nexport function useNetInfo(\n configuration?: Partial<Types.NetInfoConfiguration>,\n): Types.NetInfoState {\n if (configuration) {\n configure(configuration);\n }\n\n const [netInfo, setNetInfo] = useState<Types.NetInfoState>({\n type: Types.NetInfoStateType.unknown,\n isConnected: null,\n isInternetReachable: null,\n details: null,\n });\n\n useEffect((): (() => void) => {\n return addEventListener(setNetInfo);\n }, []);\n\n return netInfo;\n}\n\n/**\n * A React Hook which manages an isolated instance of the network info manager.\n * This is not a hook into a singleton shared state. NetInfo.configure, NetInfo.addEventListener,\n * NetInfo.fetch, NetInfo.refresh are performed on a global singleton and have no affect on this hook.\n * @param {boolean} isPaused - Pause the internal network checks.\n * @param {Partial<Types.NetInfoConfiguration>} configuration - Configure the isolated network checker managed by this hook\n *\n * @returns the netInfo state and a refresh function\n */\nexport function useNetInfoInstance(\n isPaused = false,\n configuration?: Partial<Types.NetInfoConfiguration>,\n) {\n const [networkInfoManager, setNetworkInfoManager] = useState<State>();\n const [netInfo, setNetInfo] = useState<Types.NetInfoState>({\n type: Types.NetInfoStateType.unknown,\n isConnected: null,\n isInternetReachable: null,\n details: null,\n });\n\n useEffect(() => {\n if (isPaused) {\n return;\n }\n const config = {\n ...DEFAULT_CONFIGURATION,\n ...configuration,\n };\n const state = new State(config);\n setNetworkInfoManager(state);\n state.add(setNetInfo);\n return state.tearDown;\n }, [isPaused, configuration]);\n\n const refresh = useCallback(() => {\n networkInfoManager && networkInfoManager._fetchCurrentState();\n }, [networkInfoManager]);\n\n return {\n netInfo,\n refresh,\n };\n}\n\nexport * from './internal/types';\n\nexport default {\n configure,\n fetch,\n refresh,\n addEventListener,\n useNetInfo,\n useNetInfoInstance,\n};\n"]}
\ No newline at end of file
+{"version":3,"names":["_react","require","_reactNative","_defaultConfiguration","_interopRequireDefault","_nativeInterface","_state2","Types","_interopRequireWildcard","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","n","__proto__","a","getOwnPropertyDescriptor","u","i","set","obj","_configuration","DEFAULT_CONFIGURATION","_state","createState","State","configure","configuration","tearDown","Platform","OS","NativeInterface","fetch","requestedInterface","latest","refresh","_fetchCurrentState","addEventListener","listener","add","remove","useNetInfo","netInfo","setNetInfo","useState","type","NetInfoStateType","unknown","isConnected","isInternetReachable","details","useEffect","useNetInfoInstance","isPaused","networkInfoManager","setNetworkInfoManager","config","state","useCallback","_default"],"sources":["index.ts"],"sourcesContent":["/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n */\n\nimport {useState, useEffect, useCallback} from 'react';\nimport {Platform} from 'react-native';\nimport DEFAULT_CONFIGURATION from './internal/defaultConfiguration';\nimport NativeInterface from './internal/nativeInterface';\nimport State from './internal/state';\nimport * as Types from './internal/types';\n\n// Stores the currently used configuration\nlet _configuration = DEFAULT_CONFIGURATION;\n\n// Stores the singleton reference to the state manager\nlet _state: State | null = null;\nconst createState = (): State => {\n return new State(_configuration);\n};\n\n/**\n * Configures the library with the given configuration. Note that calling this will stop all\n * previously added listeners from being called again. It is best to call this right when your\n * application is started to avoid issues. The configuration sets up a global singleton instance.\n *\n * @param configuration The new configuration to set.\n */\nexport function configure(\n configuration: Partial<Types.NetInfoConfiguration>,\n): void {\n _configuration = {\n ...DEFAULT_CONFIGURATION,\n ...configuration,\n };\n\n if (_state) {\n _state.tearDown();\n _state = createState();\n }\n\n if (Platform.OS === 'ios') {\n NativeInterface.configure(configuration);\n }\n}\n\n/**\n * Returns a `Promise` that resolves to a `NetInfoState` object.\n * This function operates on the global singleton instance configured using `configure()`\n *\n * @param [requestedInterface] interface from which to obtain the information\n *\n * @returns A Promise which contains the current connection state.\n */\nexport function fetch(\n requestedInterface?: string,\n): Promise<Types.NetInfoState> {\n if (!_state) {\n _state = createState();\n }\n return _state.latest(requestedInterface);\n}\n\n/**\n * Force-refreshes the internal state of the global singleton managed by this library.\n *\n * @returns A Promise which contains the updated connection state.\n */\nexport function refresh(): Promise<Types.NetInfoState> {\n if (!_state) {\n _state = createState();\n }\n return _state._fetchCurrentState();\n}\n\n/**\n * Subscribe to the global singleton's connection information. The callback is called with a parameter of type\n * [`NetInfoState`](README.md#netinfostate) whenever the connection state changes. Your listener\n * will be called with the latest information soon after you subscribe and then with any\n * subsequent changes afterwards. You should not assume that the listener is called in the same\n * way across devices or platforms.\n *\n * @param listener The listener which is called when the network state changes.\n *\n * @returns A function which can be called to unsubscribe.\n */\nexport function addEventListener(\n listener: Types.NetInfoChangeHandler,\n): Types.NetInfoSubscription {\n if (!_state) {\n _state = createState();\n }\n\n _state.add(listener);\n return (): void => {\n _state && _state.remove(listener);\n };\n}\n\n/**\n * A React Hook into this library's singleton which updates when the connection state changes.\n *\n * @param {Partial<Types.NetInfoConfiguration>} configuration - Configure the isolated network checker managed by this hook\n *\n * @returns The connection state.\n */\nexport function useNetInfo(\n configuration?: Partial<Types.NetInfoConfiguration>,\n): Types.NetInfoState {\n if (configuration) {\n configure(configuration);\n }\n\n const [netInfo, setNetInfo] = useState<Types.NetInfoState>({\n type: Types.NetInfoStateType.unknown,\n isConnected: null,\n isInternetReachable: null,\n details: null,\n });\n\n useEffect((): (() => void) => {\n return addEventListener(setNetInfo);\n }, []);\n\n return netInfo;\n}\n\n/**\n * A React Hook which manages an isolated instance of the network info manager.\n * This is not a hook into a singleton shared state. NetInfo.configure, NetInfo.addEventListener,\n * NetInfo.fetch, NetInfo.refresh are performed on a global singleton and have no affect on this hook.\n * @param {boolean} isPaused - Pause the internal network checks.\n * @param {Partial<Types.NetInfoConfiguration>} configuration - Configure the isolated network checker managed by this hook\n *\n * @returns the netInfo state and a refresh function\n */\nexport function useNetInfoInstance(\n isPaused = false,\n configuration?: Partial<Types.NetInfoConfiguration>,\n) {\n const [networkInfoManager, setNetworkInfoManager] = useState<State>();\n const [netInfo, setNetInfo] = useState<Types.NetInfoState>({\n type: Types.NetInfoStateType.unknown,\n isConnected: null,\n isInternetReachable: null,\n details: null,\n });\n\n useEffect(() => {\n if (isPaused) {\n return;\n }\n const config = {\n ...DEFAULT_CONFIGURATION,\n ...configuration,\n };\n const state = new State(config);\n setNetworkInfoManager(state);\n state.add(setNetInfo);\n return state.tearDown;\n }, [isPaused, configuration]);\n\n const refresh = useCallback(() => {\n networkInfoManager && networkInfoManager._fetchCurrentState();\n }, [networkInfoManager]);\n\n return {\n netInfo,\n refresh,\n };\n}\n\nexport * from './internal/types';\n\nexport default {\n configure,\n fetch,\n refresh,\n addEventListener,\n useNetInfo,\n useNetInfoInstance,\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AASA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,qBAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,gBAAA,GAAAD,sBAAA,CAAAH,OAAA;AACA,IAAAK,OAAA,GAAAF,sBAAA,CAAAH,OAAA;AACA,IAAAM,KAAA,GAAAC,uBAAA,CAAAP,OAAA;AAkKAQ,MAAA,CAAAC,IAAA,CAAAH,KAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAL,KAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAb,KAAA,CA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ACrB,OAAOc,KAAK,CAAC7B,QAAQ;EACvB,CAAC,EAAE,CAACyB,QAAQ,EAAE1B,aAAa,CAAC,CAAC;EAE7B,MAAMQ,OAAO,GAAG,IAAAuB,kBAAW,EAAC,MAAM;IAChCJ,kBAAkB,IAAIA,kBAAkB,CAAClB,kBAAkB,CAAC,CAAC;EAC/D,CAAC,EAAE,CAACkB,kBAAkB,CAAC,CAAC;EAExB,OAAO;IACLZ,OAAO;IACPP;EACF,CAAC;AACH;AAAC,IAAAwB,QAAA,GAAA1D,OAAA,CAAAU,OAAA,GAIc;EACbe,SAAS;EACTM,KAAK;EACLG,OAAO;EACPE,gBAAgB;EAChBI,UAAU;EACVW;AACF,CAAC"}
\ No newline at end of file
diff --git a/node_modules/@react-native-community/netinfo/lib/commonjs/internal/NativeRNCNetInfo.js b/node_modules/@react-native-community/netinfo/lib/commonjs/internal/NativeRNCNetInfo.js
new file mode 100644
index 0000000..e3949ec
--- /dev/null
+++ b/node_modules/@react-native-community/netinfo/lib/commonjs/internal/NativeRNCNetInfo.js
@@ -0,0 +1,10 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.default = void 0;
+var _reactNative = require("react-native");
+/* eslint-disable @typescript-eslint/ban-types */
+var _default = exports.default = _reactNative.TurboModuleRegistry.getEnforcing('RNCNetInfo');
+//# sourceMappingURL=NativeRNCNetInfo.js.map
\ No newline at end of file
diff --git a/node_modules/@react-native-community/netinfo/lib/commonjs/internal/NativeRNCNetInfo.js.map b/node_modules/@react-native-community/netinfo/lib/commonjs/internal/NativeRNCNetInfo.js.map
new file mode 100644
index 0000000..86d23d4
--- /dev/null
+++ b/node_modules/@react-native-community/netinfo/lib/commonjs/internal/NativeRNCNetInfo.js.map
@@ -0,0 +1 @@
+{"version":3,"names":["_reactNative","require","_default","exports","default","TurboModuleRegistry","getEnforcing"],"sources":["NativeRNCNetInfo.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/ban-types */\nimport type { TurboModule } from 'react-native';\nimport { TurboModuleRegistry } from 'react-native';\n\nexport interface Spec extends TurboModule {\n configure: (config: Object) => void;\n getCurrentState(requestedInterface?: string): Promise<Object>;\n // Events\n addListener: (eventName: string) => void;\n removeListeners: (count: number) => void;\n}\n\nexport default TurboModuleRegistry.getEnforcing<Spec>('RNCNetInfo');\n\n"],"mappings":";;;;;;AAEA,IAAAA,YAAA,GAAAC,OAAA;AAFA;AAAA,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAYeC,gCAAmB,CAACC,YAAY,CAAO,YAAY,CAAC"}
\ No newline at end of file
diff --git a/node_modules/@react-native-community/netinfo/lib/commonjs/internal/defaultConfiguration.js b/node_modules/@react-native-community/netinfo/lib/commonjs/internal/defaultConfiguration.js
index 166a58d..c5b4e66 100644
--- a/node_modules/@react-native-community/netinfo/lib/commonjs/internal/defaultConfiguration.js
+++ b/node_modules/@react-native-community/netinfo/lib/commonjs/internal/defaultConfiguration.js
@@ -19,6 +19,5 @@ const DEFAULT_CONFIGURATION = {
shouldFetchWiFiSSID: false,
useNativeReachability: true
};
-var _default = DEFAULT_CONFIGURATION;
-exports.default = _default;
+var _default = exports.default = DEFAULT_CONFIGURATION;
//# sourceMappingURL=defaultConfiguration.js.map
\ No newline at end of file
diff --git a/node_modules/@react-native-community/netinfo/lib/commonjs/internal/defaultConfiguration.js.map b/node_modules/@react-native-community/netinfo/lib/commonjs/internal/defaultConfiguration.js.map
index 03f9097..be92be9 100644
--- a/node_modules/@react-native-community/netinfo/lib/commonjs/internal/defaultConfiguration.js.map
+++ b/node_modules/@react-native-community/netinfo/lib/commonjs/internal/defaultConfiguration.js.map
@@ -1 +1 @@
-{"version":3,"sources":["defaultConfiguration.ts"],"names":["DEFAULT_CONFIGURATION","reachabilityUrl","reachabilityMethod","reachabilityHeaders","reachabilityTest","response","Promise","resolve","status","reachabilityShortTimeout","reachabilityLongTimeout","reachabilityRequestTimeout","reachabilityShouldRun","shouldFetchWiFiSSID","useNativeReachability"],"mappings":";;;;;;AAEA,MAAMA,qBAAiD,GAAG;AACxDC,EAAAA,eAAe,EAAE,0CADuC;AAExDC,EAAAA,kBAAkB,EAAE,MAFoC;AAGxDC,EAAAA,mBAAmB,EAAE,EAHmC;AAIxDC,EAAAA,gBAAgB,EAAGC,QAAD,IAChBC,OAAO,CAACC,OAAR,CAAgBF,QAAQ,CAACG,MAAT,KAAoB,GAApC,CALsD;AAMxDC,EAAAA,wBAAwB,EAAE,IAAI,IAN0B;AAMpB;AACpCC,EAAAA,uBAAuB,EAAE,KAAK,IAP0B;AAOpB;AACpCC,EAAAA,0BAA0B,EAAE,KAAK,IARuB;AAQjB;AACvCC,EAAAA,qBAAqB,EAAE,MAAe,IATkB;AAUxDC,EAAAA,mBAAmB,EAAE,KAVmC;AAWxDC,EAAAA,qBAAqB,EAAE;AAXiC,CAA1D;eAced,qB","sourcesContent":["import * as Types from './types';\n\nconst DEFAULT_CONFIGURATION: Types.NetInfoConfiguration = {\n reachabilityUrl: 'https://clients3.google.com/generate_204',\n reachabilityMethod: 'HEAD',\n reachabilityHeaders: {},\n reachabilityTest: (response: Response): Promise<boolean> =>\n Promise.resolve(response.status === 204),\n reachabilityShortTimeout: 5 * 1000, // 5s\n reachabilityLongTimeout: 60 * 1000, // 60s\n reachabilityRequestTimeout: 15 * 1000, // 15s\n reachabilityShouldRun: (): boolean => true,\n shouldFetchWiFiSSID: false,\n useNativeReachability: true\n};\n\nexport default DEFAULT_CONFIGURATION;"]}
\ No newline at end of file
+{"version":3,"names":["DEFAULT_CONFIGURATION","reachabilityUrl","reachabilityMethod","reachabilityHeaders","reachabilityTest","response","Promise","resolve","status","reachabilityShortTimeout","reachabilityLongTimeout","reachabilityRequestTimeout","reachabilityShouldRun","shouldFetchWiFiSSID","useNativeReachability","_default","exports","default"],"sources":["defaultConfiguration.ts"],"sourcesContent":["import * as Types from './types';\n\nconst DEFAULT_CONFIGURATION: Types.NetInfoConfiguration = {\n reachabilityUrl: 'https://clients3.google.com/generate_204',\n reachabilityMethod: 'HEAD',\n reachabilityHeaders: {},\n reachabilityTest: (response: Response): Promise<boolean> =>\n Promise.resolve(response.status === 204),\n reachabilityShortTimeout: 5 * 1000, // 5s\n reachabilityLongTimeout: 60 * 1000, // 60s\n reachabilityRequestTimeout: 15 * 1000, // 15s\n reachabilityShouldRun: (): boolean => true,\n shouldFetchWiFiSSID: false,\n useNativeReachability: true\n};\n\nexport default DEFAULT_CONFIGURATION;"],"mappings":";;;;;;AAEA,MAAMA,qBAAiD,GAAG;EACxDC,eAAe,EAAE,0CAA0C;EAC3DC,kBAAkB,EAAE,MAAM;EAC1BC,mBAAmB,EAAE,CAAC,CAAC;EACvBC,gBAAgB,EAAGC,QAAkB,IACnCC,OAAO,CAACC,OAAO,CAACF,QAAQ,CAACG,MAAM,KAAK,GAAG,CAAC;EAC1CC,wBAAwB,EAAE,CAAC,GAAG,IAAI;EAAE;EACpCC,uBAAuB,EAAE,EAAE,GAAG,IAAI;EAAE;EACpCC,0BAA0B,EAAE,EAAE,GAAG,IAAI;EAAE;EACvCC,qBAAqB,EAAEA,CAAA,KAAe,IAAI;EAC1CC,mBAAmB,EAAE,KAAK;EAC1BC,qBAAqB,EAAE;AACzB,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEajB,qBAAqB"}
\ No newline at end of file
diff --git a/node_modules/@react-native-community/netinfo/lib/commonjs/internal/defaultConfiguration.web.js b/node_modules/@react-native-community/netinfo/lib/commonjs/internal/defaultConfiguration.web.js
index 410b7b0..a1e0456 100644
--- a/node_modules/@react-native-community/netinfo/lib/commonjs/internal/defaultConfiguration.web.js
+++ b/node_modules/@react-native-community/netinfo/lib/commonjs/internal/defaultConfiguration.web.js
@@ -19,6 +19,5 @@ const DEFAULT_CONFIGURATION = {
shouldFetchWiFiSSID: true,
useNativeReachability: true
};
-var _default = DEFAULT_CONFIGURATION;
-exports.default = _default;
+var _default = exports.default = DEFAULT_CONFIGURATION;
//# sourceMappingURL=defaultConfiguration.web.js.map
\ No newline at end of file
diff --git a/node_modules/@react-native-community/netinfo/lib/commonjs/internal/defaultConfiguration.web.js.map b/node_modules/@react-native-community/netinfo/lib/commonjs/internal/defaultConfiguration.web.js.map
index edf0c39..d6ee21a 100644
--- a/node_modules/@react-native-community/netinfo/lib/commonjs/internal/defaultConfiguration.web.js.map
+++ b/node_modules/@react-native-community/netinfo/lib/commonjs/internal/defaultConfiguration.web.js.map
@@ -1 +1 @@
-{"version":3,"sources":["defaultConfiguration.web.ts"],"names":["DEFAULT_CONFIGURATION","reachabilityUrl","reachabilityMethod","reachabilityHeaders","reachabilityTest","response","Promise","resolve","status","reachabilityShortTimeout","reachabilityLongTimeout","reachabilityRequestTimeout","reachabilityShouldRun","shouldFetchWiFiSSID","useNativeReachability"],"mappings":";;;;;;AAEA,MAAMA,qBAAiD,GAAG;AACxDC,EAAAA,eAAe,EAAE,GADuC;AAExDC,EAAAA,kBAAkB,EAAE,MAFoC;AAGxDC,EAAAA,mBAAmB,EAAE,EAHmC;AAIxDC,EAAAA,gBAAgB,EAAGC,QAAD,IAChBC,OAAO,CAACC,OAAR,CAAgBF,QAAQ,CAACG,MAAT,KAAoB,GAApC,CALsD;AAMxDC,EAAAA,wBAAwB,EAAE,IAAI,IAN0B;AAMpB;AACpCC,EAAAA,uBAAuB,EAAE,KAAK,IAP0B;AAOpB;AACpCC,EAAAA,0BAA0B,EAAE,KAAK,IARuB;AAQjB;AACvCC,EAAAA,qBAAqB,EAAE,MAAe,IATkB;AAUxDC,EAAAA,mBAAmB,EAAE,IAVmC;AAWxDC,EAAAA,qBAAqB,EAAE;AAXiC,CAA1D;eAced,qB","sourcesContent":["import * as Types from './types';\n\nconst DEFAULT_CONFIGURATION: Types.NetInfoConfiguration = {\n reachabilityUrl: '/',\n reachabilityMethod: \"HEAD\",\n reachabilityHeaders: {},\n reachabilityTest: (response: Response): Promise<boolean> =>\n Promise.resolve(response.status === 200),\n reachabilityShortTimeout: 5 * 1000, // 5s\n reachabilityLongTimeout: 60 * 1000, // 60s\n reachabilityRequestTimeout: 15 * 1000, // 15s\n reachabilityShouldRun: (): boolean => true,\n shouldFetchWiFiSSID: true,\n useNativeReachability: true\n};\n\nexport default DEFAULT_CONFIGURATION"]}
\ No newline at end of file
+{"version":3,"names":["DEFAULT_CONFIGURATION","reachabilityUrl","reachabilityMethod","reachabilityHeaders","reachabilityTest","response","Promise","resolve","status","reachabilityShortTimeout","reachabilityLongTimeout","reachabilityRequestTimeout","reachabilityShouldRun","shouldFetchWiFiSSID","useNativeReachability","_default","exports","default"],"sources":["defaultConfiguration.web.ts"],"sourcesContent":["import * as Types from './types';\n\nconst DEFAULT_CONFIGURATION: Types.NetInfoConfiguration = {\n reachabilityUrl: '/',\n reachabilityMethod: \"HEAD\",\n reachabilityHeaders: {},\n reachabilityTest: (response: Response): Promise<boolean> =>\n Promise.resolve(response.status === 200),\n reachabilityShortTimeout: 5 * 1000, // 5s\n reachabilityLongTimeout: 60 * 1000, // 60s\n reachabilityRequestTimeout: 15 * 1000, // 15s\n reachabilityShouldRun: (): boolean => true,\n shouldFetchWiFiSSID: true,\n useNativeReachability: true\n};\n\nexport default DEFAULT_CONFIGURATION"],"mappings":";;;;;;AAEA,MAAMA,qBAAiD,GAAG;EACxDC,eAAe,EAAE,GAAG;EACpBC,kBAAkB,EAAE,MAAM;EAC1BC,mBAAmB,EAAE,CAAC,CAAC;EACvBC,gBAAgB,EAAGC,QAAkB,IACnCC,OAAO,CAACC,OAAO,CAACF,QAAQ,CAACG,MAAM,KAAK,GAAG,CAAC;EAC1CC,wBAAwB,EAAE,CAAC,GAAG,IAAI;EAAE;EACpCC,uBAAuB,EAAE,EAAE,GAAG,IAAI;EAAE;EACpCC,0BAA0B,EAAE,EAAE,GAAG,IAAI;EAAE;EACvCC,qBAAqB,EAAEA,CAAA,KAAe,IAAI;EAC1CC,mBAAmB,EAAE,IAAI;EACzBC,qBAAqB,EAAE;AACzB,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEajB,qBAAqB"}
\ No newline at end of file
diff --git a/node_modules/@react-native-community/netinfo/lib/commonjs/internal/internetReachability.js b/node_modules/@react-native-community/netinfo/lib/commonjs/internal/internetReachability.js
index 45296d9..5169ed8 100644
--- a/node_modules/@react-native-community/netinfo/lib/commonjs/internal/internetReachability.js
+++ b/node_modules/@react-native-community/netinfo/lib/commonjs/internal/internetReachability.js
@@ -4,9 +4,9 @@ Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
-
-function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
-
+function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
+function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
+function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
@@ -15,57 +15,45 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
*
* @format
*/
+
class InternetReachability {
constructor(configuration, listener) {
_defineProperty(this, "_configuration", void 0);
-
_defineProperty(this, "_listener", void 0);
-
_defineProperty(this, "_isInternetReachable", undefined);
-
_defineProperty(this, "_currentInternetReachabilityCheckHandler", null);
-
_defineProperty(this, "_currentTimeoutHandle", null);
-
_defineProperty(this, "_setIsInternetReachable", isInternetReachable => {
if (this._isInternetReachable === isInternetReachable) {
return;
}
-
this._isInternetReachable = isInternetReachable;
-
this._listener(this._isInternetReachable);
});
-
_defineProperty(this, "_setExpectsConnection", expectsConnection => {
// Cancel any pending check
if (this._currentInternetReachabilityCheckHandler !== null) {
this._currentInternetReachabilityCheckHandler.cancel();
-
this._currentInternetReachabilityCheckHandler = null;
- } // Cancel any pending timeout
-
-
+ }
+ // Cancel any pending timeout
if (this._currentTimeoutHandle !== null) {
clearTimeout(this._currentTimeoutHandle);
this._currentTimeoutHandle = null;
}
-
if (expectsConnection && this._configuration.reachabilityShouldRun()) {
// If we expect a connection, start the process for finding if we have one
// Set the state to "null" if it was previously false
if (!this._isInternetReachable) {
this._setIsInternetReachable(null);
- } // Start a network request to check for internet
-
-
+ }
+ // Start a network request to check for internet
this._currentInternetReachabilityCheckHandler = this._checkInternetReachability();
} else {
// If we don't expect a connection or don't run reachability check, just change the state to "false"
this._setIsInternetReachable(false);
}
});
-
_defineProperty(this, "_checkInternetReachability", () => {
const controller = new AbortController();
const responsePromise = fetch(this._configuration.reachabilityUrl, {
@@ -73,16 +61,17 @@ class InternetReachability {
method: this._configuration.reachabilityMethod,
cache: 'no-cache',
signal: controller.signal
- }); // Create promise that will reject after the request timeout has been reached
+ });
+ // Create promise that will reject after the request timeout has been reached
let timeoutHandle;
- const timeoutPromise = new Promise(() => {
- timeoutHandle = setTimeout(() => controller.abort('timedout'), this._configuration.reachabilityRequestTimeout);
- }); // Create promise that makes it possible to cancel a pending request through a reject
- // eslint-disable-next-line @typescript-eslint/no-empty-function
+ const timeoutPromise = new Promise((_, reject) => {
+ timeoutHandle = setTimeout(() => reject('timedout'), this._configuration.reachabilityRequestTimeout);
+ });
+ // Create promise that makes it possible to cancel a pending request through a reject
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
let cancel = () => {};
-
const cancelPromise = new Promise((_, reject) => {
cancel = () => reject('canceled');
});
@@ -90,18 +79,25 @@ class InternetReachability {
return this._configuration.reachabilityTest(response);
}).then(result => {
this._setIsInternetReachable(result);
-
const nextTimeoutInterval = this._isInternetReachable ? this._configuration.reachabilityLongTimeout : this._configuration.reachabilityShortTimeout;
this._currentTimeoutHandle = setTimeout(this._checkInternetReachability, nextTimeoutInterval);
+ }).catch(error => {
+ if (error !== 'canceled') {
+ this._setIsInternetReachable(false);
+ this._currentTimeoutHandle = setTimeout(this._checkInternetReachability, this._configuration.reachabilityShortTimeout);
+ }
}).catch(error => {
if ('canceled' === error) {
controller.abort();
} else {
+ if ('timedout' === error) {
+ controller.abort();
+ }
this._setIsInternetReachable(false);
-
this._currentTimeoutHandle = setTimeout(this._checkInternetReachability, this._configuration.reachabilityShortTimeout);
}
- }) // Clear request timeout and propagate any errors
+ })
+ // Clear request timeout and propagate any errors
.then(() => {
clearTimeout(timeoutHandle);
}, error => {
@@ -113,7 +109,6 @@ class InternetReachability {
cancel
};
});
-
_defineProperty(this, "update", state => {
if (typeof state.isInternetReachable === 'boolean' && this._configuration.useNativeReachability) {
this._setIsInternetReachable(state.isInternetReachable);
@@ -121,31 +116,25 @@ class InternetReachability {
this._setExpectsConnection(state.isConnected);
}
});
-
_defineProperty(this, "currentState", () => {
return this._isInternetReachable;
});
-
_defineProperty(this, "tearDown", () => {
// Cancel any pending check
if (this._currentInternetReachabilityCheckHandler !== null) {
this._currentInternetReachabilityCheckHandler.cancel();
-
this._currentInternetReachabilityCheckHandler = null;
- } // Cancel any pending timeout
-
+ }
+ // Cancel any pending timeout
if (this._currentTimeoutHandle !== null) {
clearTimeout(this._currentTimeoutHandle);
this._currentTimeoutHandle = null;
}
});
-
this._configuration = configuration;
this._listener = listener;
}
-
}
-
exports.default = InternetReachability;
//# sourceMappingURL=internetReachability.js.map
\ No newline at end of file
diff --git a/node_modules/@react-native-community/netinfo/lib/commonjs/internal/internetReachability.js.map b/node_modules/@react-native-community/netinfo/lib/commonjs/internal/internetReachability.js.map
index 6d12691..63bd2df 100644
--- a/node_modules/@react-native-community/netinfo/lib/commonjs/internal/internetReachability.js.map
+++ b/node_modules/@react-native-community/netinfo/lib/commonjs/internal/internetReachability.js.map
@@ -1 +1 @@
-{"version":3,"sources":["internetReachability.ts"],"names":["InternetReachability","constructor","configuration","listener","undefined","isInternetReachable","_isInternetReachable","_listener","expectsConnection","_currentInternetReachabilityCheckHandler","cancel","_currentTimeoutHandle","clearTimeout","_configuration","reachabilityShouldRun","_setIsInternetReachable","_checkInternetReachability","controller","AbortController","responsePromise","fetch","reachabilityUrl","headers","reachabilityHeaders","method","reachabilityMethod","cache","signal","timeoutHandle","timeoutPromise","Promise","setTimeout","abort","reachabilityRequestTimeout","cancelPromise","_","reject","promise","race","then","response","reachabilityTest","result","nextTimeoutInterval","reachabilityLongTimeout","reachabilityShortTimeout","catch","error","state","useNativeReachability","_setExpectsConnection","isConnected"],"mappings":";;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAUe,MAAMA,oBAAN,CAA2B;AAOxCC,EAAAA,WAAW,CACTC,aADS,EAETC,QAFS,EAGT;AAAA;;AAAA;;AAAA,kDAPyDC,SAOzD;;AAAA,sEAN0F,IAM1F;;AAAA,mDALoE,IAKpE;;AAAA,qDAMAC,mBADgC,IAEvB;AACT,UAAI,KAAKC,oBAAL,KAA8BD,mBAAlC,EAAuD;AACrD;AACD;;AAED,WAAKC,oBAAL,GAA4BD,mBAA5B;;AACA,WAAKE,SAAL,CAAe,KAAKD,oBAApB;AACD,KAdC;;AAAA,mDAgB+BE,iBAAD,IAA6C;AAC3E;AACA,UAAI,KAAKC,wCAAL,KAAkD,IAAtD,EAA4D;AAC1D,aAAKA,wCAAL,CAA8CC,MAA9C;;AACA,aAAKD,wCAAL,GAAgD,IAAhD;AACD,OAL0E,CAM3E;;;AACA,UAAI,KAAKE,qBAAL,KAA+B,IAAnC,EAAyC;AACvCC,QAAAA,YAAY,CAAC,KAAKD,qBAAN,CAAZ;AACA,aAAKA,qBAAL,GAA6B,IAA7B;AACD;;AAED,UAAIH,iBAAiB,IAAI,KAAKK,cAAL,CAAoBC,qBAApB,EAAzB,EAAsE;AACpE;AACA;AACA,YAAI,CAAC,KAAKR,oBAAV,EAAgC;AAC9B,eAAKS,uBAAL,CAA6B,IAA7B;A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AgD,IAAhD;AACD,OAL2B,CAO5B;;;AACA,UAAI,KAAKE,qBAAL,KAA+B,IAAnC,EAAyC;AACvCC,QAAAA,YAAY,CAAC,KAAKD,qBAAN,CAAZ;AACA,aAAKA,qBAAL,GAA6B,IAA7B;AACD;AACF,KAnJC;;AACA,SAAKE,cAAL,GAAsBX,aAAtB;AACA,SAAKK,SAAL,GAAiBJ,QAAjB;AACD;;AAbuC","sourcesContent":["/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n */\n\nimport * as PrivateTypes from './privateTypes';\nimport * as Types from './types';\n\ninterface InternetReachabilityCheckHandler {\n promise: Promise<void>;\n cancel: () => void;\n}\n\nexport default class InternetReachability {\n private _configuration: Types.NetInfoConfiguration;\n private _listener: PrivateTypes.NetInfoInternetReachabilityChangeListener;\n private _isInternetReachable: boolean | null | undefined = undefined;\n private _currentInternetReachabilityCheckHandler: InternetReachabilityCheckHandler | null = null;\n private _currentTimeoutHandle: ReturnType<typeof setTimeout> | null = null;\n\n constructor(\n configuration: Types.NetInfoConfiguration,\n listener: PrivateTypes.NetInfoInternetReachabilityChangeListener,\n ) {\n this._configuration = configuration;\n this._listener = listener;\n }\n\n private _setIsInternetReachable = (\n isInternetReachable: boolean | null,\n ): void => {\n if (this._isInternetReachable === isInternetReachable) {\n return;\n }\n\n this._isInternetReachable = isInternetReachable;\n this._listener(this._isInternetReachable);\n };\n\n private _setExpectsConnection = (expectsConnection: boolean | null): void => {\n // Cancel any pending check\n if (this._currentInternetReachabilityCheckHandler !== null) {\n this._currentInternetReachabilityCheckHandler.cancel();\n this._currentInternetReachabilityCheckHandler = null;\n }\n // Cancel any pending timeout\n if (this._currentTimeoutHandle !== null) {\n clearTimeout(this._currentTimeoutHandle);\n this._currentTimeoutHandle = null;\n }\n\n if (expectsConnection && this._configuration.reachabilityShouldRun()) {\n // If we expect a connection, start the process for finding if we have one\n // Set the state to \"null\" if it was previously false\n if (!this._isInternetReachable) {\n this._setIsInternetReachable(null);\n }\n // Start a network request to check for internet\n this._currentInternetReachabilityCheckHandler = this._checkInternetReachability();\n } else {\n // If we don't expect a connection or don't run reachability check, just change the state to \"false\"\n this._setIsInternetReachable(false);\n }\n };\n\n private _checkInternetReachability = (): InternetReachabilityCheckHandler => {\n const controller = new AbortController();\n\n const responsePromise = fetch(this._configuration.reachabilityUrl, {\n headers: this._configuration.reachabilityHeaders,\n method: this._configuration.reachabilityMethod,\n cache: 'no-cache',\n signal: controller.signal,\n });\n\n // Create promise that will reject after the request timeout has been reached\n let timeoutHandle: ReturnType<typeof setTimeout>;\n const timeoutPromise = new Promise<Response>((): void => {\n timeoutHandle = setTimeout(\n (): void => controller.abort('timedout'),\n this._configuration.reachabilityRequestTimeout,\n );\n });\n\n // Create promise that makes it possible to cancel a pending request through a reject\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n let cancel: () => void = (): void => {};\n const cancelPromise = new Promise<Response>((_, reject): void => {\n cancel = (): void => reject('canceled');\n });\n\n const promise = Promise.race([\n responsePromise,\n timeoutPromise,\n cancelPromise,\n ])\n .then(\n (response): Promise<boolean> => {\n return this._configuration.reachabilityTest(response);\n },\n )\n .then(\n (result): void => {\n this._setIsInternetReachable(result);\n const nextTimeoutInterval = this._isInternetReachable\n ? this._configuration.reachabilityLongTimeout\n : this._configuration.reachabilityShortTimeout;\n this._currentTimeoutHandle = setTimeout(\n this._checkInternetReachability,\n nextTimeoutInterval,\n );\n },\n )\n .catch(\n (error: Error | 'timedout' | 'canceled'): void => {\n if ('canceled' === error) {\n controller.abort();\n } else {\n this._setIsInternetReachable(false);\n this._currentTimeoutHandle = setTimeout(\n this._checkInternetReachability,\n this._configuration.reachabilityShortTimeout,\n );\n }\n },\n )\n // Clear request timeout and propagate any errors\n .then(\n (): void => {\n clearTimeout(timeoutHandle);\n },\n (error: Error): void => {\n clearTimeout(timeoutHandle);\n throw error;\n },\n );\n\n return {\n promise,\n cancel,\n };\n };\n\n public update = (state: PrivateTypes.NetInfoNativeModuleState): void => {\n if (\n typeof state.isInternetReachable === 'boolean' &&\n this._configuration.useNativeReachability\n ) {\n this._setIsInternetReachable(state.isInternetReachable);\n } else {\n this._setExpectsConnection(state.isConnected);\n }\n };\n\n public currentState = (): boolean | null | undefined => {\n return this._isInternetReachable;\n };\n\n public tearDown = (): void => {\n // Cancel any pending check\n if (this._currentInternetReachabilityCheckHandler !== null) {\n this._currentInternetReachabilityCheckHandler.cancel();\n this._currentInternetReachabilityCheckHandler = null;\n }\n\n // Cancel any pending timeout\n if (this._currentTimeoutHandle !== null) {\n clearTimeout(this._currentTimeoutHandle);\n this._currentTimeoutHandle = null;\n }\n };\n}\n"]}
\ No newline at end of file
+{"version":3,"names":["InternetReachability","constructor","configuration","listener","_defineProperty","undefined","isInternetReachable","_isInternetReachable","_listener","expectsConnection","_currentInternetReachabilityCheckHandler","cancel","_currentTimeoutHandle","clearTimeout","_configuration","reachabilityShouldRun","_setIsInternetReachable","_checkInternetReachability","controller","AbortController","responsePromise","fetch","reachabilityUrl","headers","reachabilityHeaders","method","reachabilityMethod","cache","signal","timeoutHandle","timeoutPromise","Promise","_","reject","setTimeout","reachabilityRequestTimeout","cancelPromise","promise","race","then","response","reachabilityTest","result","nextTimeoutInterval","reachabilityLongTimeout","reachabilityShortTimeout","catch","error","abort","state","useNativeReachability","_setExpectsConnection","isConnected","exports","default"],"sources":["internetReachability.ts"],"sourcesContent":["/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n */\n\nimport * as PrivateTypes from './privateTypes';\nimport * as Types from './types';\n\ninterface InternetReachabilityCheckHandler {\n promise: Promise<void>;\n cancel: () => void;\n}\n\nexport default class InternetReachability {\n private _configuration: Types.NetInfoConfiguration;\n private _listener: PrivateTypes.NetInfoInternetReachabilityChangeListener;\n private _isInternetReachable: boolean | null | undefined = undefined;\n private _currentInternetReachabilityCheckHandler: InternetReachabilityCheckHandler | null =\n null;\n private _currentTimeoutHandle: ReturnType<typeof setTimeout> | null = null;\n\n constructor(\n configuration: Types.NetInfoConfiguration,\n listener: PrivateTypes.NetInfoInternetReachabilityChangeListener,\n ) {\n this._configuration = configuration;\n this._listener = listener;\n }\n\n private _setIsInternetReachable = (\n isInternetReachable: boolean | null,\n ): void => {\n if (this._isInternetReachable === isInternetReachable) {\n return;\n }\n\n this._isInternetReachable = isInternetReachable;\n this._listener(this._isInternetReachable);\n };\n\n private _setExpectsConnection = (expectsConnection: boolean | null): void => {\n // Cancel any pending check\n if (this._currentInternetReachabilityCheckHandler !== null) {\n this._currentInternetReachabilityCheckHandler.cancel();\n this._currentInternetReachabilityCheckHandler = null;\n }\n // Cancel any pending timeout\n if (this._currentTimeoutHandle !== null) {\n clearTimeout(this._currentTimeoutHandle);\n this._currentTimeoutHandle = null;\n }\n\n if (expectsConnection && this._configuration.reachabilityShouldRun()) {\n // If we expect a connection, start the process for finding if we have one\n // Set the state to \"null\" if it was previously false\n if (!this._isInternetReachable) {\n this._setIsInternetReachable(null);\n }\n // Start a network request to check for internet\n this._currentInternetReachabilityCheckHandler =\n this._checkInternetReachability();\n } else {\n // If we don't expect a connection or don't run reachability check, just change the state to \"false\"\n this._setIsInternetReachable(false);\n }\n };\n\n private _checkInternetReachability = (): InternetReachabilityCheckHandler => {\n const controller = new AbortController();\n\n const responsePromise = fetch(this._configuration.reachabilityUrl, {\n headers: this._configuration.reachabilityHeaders,\n method: this._configuration.reachabilityMethod,\n cache: 'no-cache',\n signal: controller.signal,\n });\n\n // Create promise that will reject after the request timeout has been reached\n let timeoutHandle: ReturnType<typeof setTimeout>;\n const timeoutPromise = new Promise<Response>((_, reject): void => {\n timeoutHandle = setTimeout(\n (): void => reject('timedout'),\n this._configuration.reachabilityRequestTimeout,\n );\n });\n\n // Create promise that makes it possible to cancel a pending request through a reject\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n let cancel: () => void = (): void => {};\n const cancelPromise = new Promise<Response>((_, reject): void => {\n cancel = (): void => reject('canceled');\n });\n\n const promise = Promise.race([\n responsePromise,\n timeoutPromise,\n cancelPromise,\n ])\n .then((response): Promise<boolean> => {\n return this._configuration.reachabilityTest(response);\n })\n .then((result): void => {\n this._setIsInternetReachable(result);\n const nextTimeoutInterval = this._isInternetReachable\n ? this._configuration.reachabilityLongTimeout\n : this._configuration.reachabilityShortTimeout;\n this._currentTimeoutHandle = setTimeout(\n this._checkInternetReachability,\n nextTimeoutInterval,\n );\n })\n .catch((error: Error | 'timedout' | 'canceled'): void => {\n if (error !== 'canceled') {\n this._setIsInternetReachable(false);\n this._currentTimeoutHandle = setTimeout(\n this._checkInternetReachability,\n this._configuration.reachabilityShortTimeout,\n );\n }\n })\n .catch(\n (error: Error | 'timedout' | 'canceled'): void => {\n if ('canceled' === error) {\n controller.abort();\n } else {\n if ('timedout' === error) {\n controller.abort();\n }\n \n this._setIsInternetReachable(false);\n this._currentTimeoutHandle = setTimeout(\n this._checkInternetReachability,\n this._configuration.reachabilityShortTimeout,\n );\n }\n },\n )\n // Clear request timeout and propagate any errors\n .then(\n (): void => {\n clearTimeout(timeoutHandle);\n },\n (error: Error): void => {\n clearTimeout(timeoutHandle);\n throw error;\n },\n );\n\n return {\n promise,\n cancel,\n };\n };\n\n public update = (state: PrivateTypes.NetInfoNativeModuleState): void => {\n if (\n typeof state.isInternetReachable === 'boolean' &&\n this._configuration.useNativeReachability\n ) {\n this._setIsInternetReachable(state.isInternetReachable);\n } else {\n this._setExpectsConnection(state.isConnected);\n }\n };\n\n public currentState = (): boolean | null | undefined => {\n return this._isInternetReachable;\n };\n\n public tearDown = (): void => {\n // Cancel any pending check\n if (this._currentInternetReachabilityCheckHandler !== null) {\n this._currentInternetReachabilityCheckHandler.cancel();\n this._currentInternetReachabilityCheckHandler = null;\n }\n\n // Cancel any pending timeout\n if (this._currentTimeoutHandle !== null) {\n clearTimeout(this._currentTimeoutHandle);\n this._currentTime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CAACG,oBAAoB;IAClC,CAAC;IAAAH,eAAA,mBAEiB,MAAY;MAC5B;MACA,IAAI,IAAI,CAACM,wCAAwC,KAAK,IAAI,EAAE;QAC1D,IAAI,CAACA,wCAAwC,CAACC,MAAM,CAAC,CAAC;QACtD,IAAI,CAACD,wCAAwC,GAAG,IAAI;MACtD;;MAEA;MACA,IAAI,IAAI,CAACE,qBAAqB,KAAK,IAAI,EAAE;QACvCC,YAAY,CAAC,IAAI,CAACD,qBAAqB,CAAC;QACxC,IAAI,CAACA,qBAAqB,GAAG,IAAI;MACnC;IACF,CAAC;IA5JC,IAAI,CAACE,cAAc,GAAGZ,aAAa;IACnC,IAAI,CAACM,SAAS,GAAGL,QAAQ;EAC3B;AA2JF;AAACkD,OAAA,CAAAC,OAAA,GAAAtD,oBAAA"}
\ No newline at end of file
diff --git a/node_modules/@react-native-community/netinfo/lib/commonjs/internal/nativeInterface.js b/node_modules/@react-native-community/netinfo/lib/commonjs/internal/nativeInterface.js
index 7a50da5..cb7d968 100644
--- a/node_modules/@react-native-community/netinfo/lib/commonjs/internal/nativeInterface.js
+++ b/node_modules/@react-native-community/netinfo/lib/commonjs/internal/nativeInterface.js
@@ -4,13 +4,9 @@ Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
-
var _reactNative = require("react-native");
-
var _nativeModule = _interopRequireDefault(require("./nativeModule"));
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
@@ -19,6 +15,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
*
* @format
*/
+
// Produce an error if we don't have the native module
if (!_nativeModule.default) {
throw new Error(`@react-native-community/netinfo: NativeModule.RNCNetInfo is null. To fix this issue try these steps:
@@ -31,27 +28,26 @@ if (!_nativeModule.default) {
If none of these fix the issue, please open an issue on the Github repository: https://github.com/react-native-community/react-native-netinfo`);
}
+
/**
* We export the native interface in this way to give easy shared access to it between the
* JavaScript code and the tests
*/
-
-
let nativeEventEmitter = null;
-var _default = { ..._nativeModule.default,
-
+var _default = exports.default = {
+ configure: _nativeModule.default.configure,
+ addListener: _nativeModule.default.addListener,
+ removeListeners: _nativeModule.default.removeListeners,
+ getCurrentState: _nativeModule.default.getCurrentState,
get eventEmitter() {
if (!nativeEventEmitter) {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
/// @ts-ignore
nativeEventEmitter = new _reactNative.NativeEventEmitter(_nativeModule.default);
- } // eslint-disable-next-line @typescript-eslint/ban-ts-comment
+ }
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
/// @ts-ignore
-
-
return nativeEventEmitter;
}
-
};
-exports.default = _default;
//# sourceMappingURL=nativeInterface.js.map
\ No newline at end of file
diff --git a/node_modules/@react-native-community/netinfo/lib/commonjs/internal/nativeInterface.js.map b/node_modules/@react-native-community/netinfo/lib/commonjs/internal/nativeInterface.js.map
index 1e7ac57..33b4bc0 100644
--- a/node_modules/@react-native-community/netinfo/lib/commonjs/internal/nativeInterface.js.map
+++ b/node_modules/@react-native-community/netinfo/lib/commonjs/internal/nativeInterface.js.map