forked from Expensify/App
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathreact-native-device-info+10.3.1+002+turbomodule.patch
3509 lines (3352 loc) · 475 KB
/
react-native-device-info+10.3.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-device-info/README.md b/node_modules/react-native-device-info/README.md
index 43f5292..962ed46 100644
--- a/node_modules/react-native-device-info/README.md
+++ b/node_modules/react-native-device-info/README.md
@@ -194,6 +194,7 @@ The example app in this repository shows an example usage of every single API, c
| [isHeadphonesConnected()](#isHeadphonesConnected) | `Promise<boolean>` | ✅ | ✅ | ❌ | ❌ |
| [isPinOrFingerprintSet()](#ispinorfingerprintset) | `Promise<boolean>` | ✅ | ✅ | ✅ | ❌ |
| [isTablet()](#istablet) | `boolean` | ✅ | ✅ | ✅ | ❌ |
+| [isDisplayZoomed()](#isdisplayzoomed) | `boolean` | ✅ | ❌ | ❌ | ❌ |
| [isTabletMode()](#istabletmode) | `Promise<bool>` | ❌ | ❌ | ✅ | ❌ |
| [supported32BitAbis()](#supported32BitAbis) | `Promise<string[]>` | ❌ | ✅ | ❌ | ❌ |
| [supported64BitAbis()](#supported64BitAbis) | `Promise<string[]>` | ❌ | ✅ | ❌ | ❌ |
@@ -1211,6 +1212,19 @@ let isTablet = DeviceInfo.isTablet();
---
+### isDisplayZoomed()
+
+Tells if the user changed Display Zoom to Zoomed
+
+#### Examples
+
+```js
+let isDisplayZoomed = DeviceInfo.isDisplayZoomed();
+// true
+```
+
+---
+
### isTabletMode()
Tells if the device is in tablet mode.
diff --git a/node_modules/react-native-device-info/RNDeviceInfo.podspec b/node_modules/react-native-device-info/RNDeviceInfo.podspec
index d07bbad..c7a80fd 100644
--- a/node_modules/react-native-device-info/RNDeviceInfo.podspec
+++ b/node_modules/react-native-device-info/RNDeviceInfo.podspec
@@ -2,6 +2,8 @@ require 'json'
package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
+fabric_enabled = ENV['RCT_NEW_ARCH_ENABLED'] == '1'
+
Pod::Spec.new do |s|
s.name = "RNDeviceInfo"
s.version = package['version']
@@ -15,7 +17,13 @@ Pod::Spec.new do |s|
s.tvos.deployment_target = '10.0'
s.source = { :git => "https://github.com/react-native-device-info/react-native-device-info.git", :tag => "v#{s.version}" }
- s.source_files = "ios/**/*.{h,m}"
+ s.source_files = "ios/**/*.{h,m,mm}"
+
+ if fabric_enabled
+ install_modules_dependencies(s)
+ else
+ s.platforms = { :ios => "9.0", :tvos => "9.0" }
- s.dependency 'React-Core'
+ s.dependency "React-Core"
+ end
end
diff --git a/node_modules/react-native-device-info/android/build.gradle b/node_modules/react-native-device-info/android/build.gradle
index de22598..9bfea4b 100644
--- a/node_modules/react-native-device-info/android/build.gradle
+++ b/node_modules/react-native-device-info/android/build.gradle
@@ -21,7 +21,58 @@ def safeExtGet(prop, fallback) {
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
}
+
+def resolveReactNativeDirectory() {
+ // 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 reactNativeFromNodeModulesWithLibrary = file("${projectDir}/../../react-native")
+ if (reactNativeFromNodeModulesWithLibrary.exists()) {
+ return reactNativeFromNodeModulesWithLibrary
+ }
+
+ throw new Exception(
+ "[react-native-clipboard] 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 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()
+
+def isNewArchitectureEnabled() {
+ // To opt-in for the New Architecture, you can either:
+ // - Set `newArchEnabled` to true inside the `gradle.properties` file
+ // - Invoke gradle with `-newArchEnabled=true`
+ // - Set an environment variable `ORG_GRADLE_PROJECT_newArchEnabled=true`
+ return project.hasProperty("newArchEnabled") && project.newArchEnabled == "true"
+}
+
+if (isNewArchitectureEnabled()) {
+ apply plugin: "com.facebook.react"
+}
+
android {
+
+ // Used to override the NDK path/version on internal CI or by allowing
+ // users to customize the NDK path/version from their root project (e.g. for M1 support)
+ if (rootProject.hasProperty("ndkPath")) {
+ ndkPath rootProject.ext.ndkPath
+ }
+ if (rootProject.hasProperty("ndkVersion")) {
+ ndkVersion rootProject.ext.ndkVersion
+ }
+
compileSdkVersion safeExtGet('compileSdkVersion', 30)
defaultConfig {
@@ -37,6 +88,14 @@ android {
testOptions {
unitTests.returnDefaultValues = true
}
+
+ sourceSets.main {
+ java {
+ if (!isNewArchitectureEnabled()) {
+ srcDirs += 'src/paper/java'
+ }
+ }
+ }
}
repositories {
@@ -49,7 +108,12 @@ repositories {
}
dependencies {
- implementation "com.facebook.react:react-native:${safeExtGet('reactNativeVersion', '+')}"
+ if (isNewArchitectureEnabled() && REACT_NATIVE_MINOR_VERSION < 71) {
+ implementation project(":ReactAndroid")
+ } else {
+ //noinspection GradleDynamicVersion
+ implementation 'com.facebook.react:react-native:+'
+ }
implementation "com.android.installreferrer:installreferrer:${safeExtGet('installReferrerVersion', '1.1.2')}"
def firebaseBomVersion = safeExtGet("firebaseBomVersion", null)
def firebaseIidVersion = safeExtGet('firebaseIidVersion', null)
diff --git a/node_modules/react-native-device-info/android/src/main/java/com/learnium/RNDeviceInfo/RNDeviceInfo.java b/node_modules/react-native-device-info/android/src/main/java/com/learnium/RNDeviceInfo/RNDeviceInfo.java
deleted file mode 100644
index e9a08db..0000000
--- a/node_modules/react-native-device-info/android/src/main/java/com/learnium/RNDeviceInfo/RNDeviceInfo.java
+++ /dev/null
@@ -1,39 +0,0 @@
-package com.learnium.RNDeviceInfo;
-
-import com.facebook.react.ReactPackage;
-import com.facebook.react.bridge.JavaScriptModule;
-import com.facebook.react.bridge.NativeModule;
-import com.facebook.react.bridge.ReactApplicationContext;
-import com.facebook.react.uimanager.ViewManager;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import javax.annotation.Nonnull;
-
-@SuppressWarnings("unused")
-public class RNDeviceInfo implements ReactPackage {
-
- @Override
- @Nonnull
- public List<NativeModule> createNativeModules(@Nonnull ReactApplicationContext reactContext) {
- List<NativeModule> modules = new ArrayList<>();
-
- modules.add(new RNDeviceModule(reactContext));
-
- return modules;
- }
-
- // Deprecated RN 0.47
- public List<Class<? extends JavaScriptModule>> createJSModules() {
- return Collections.emptyList();
- }
-
- @Override
- @Nonnull
- public List<ViewManager> createViewManagers(@Nonnull ReactApplicationContext reactContext) {
- return Collections.emptyList();
- }
-
-}
diff --git a/node_modules/react-native-device-info/android/src/main/java/com/learnium/RNDeviceInfo/RNDeviceInfoPackage.java b/node_modules/react-native-device-info/android/src/main/java/com/learnium/RNDeviceInfo/RNDeviceInfoPackage.java
new file mode 100644
index 0000000..e91e5a2
--- /dev/null
+++ b/node_modules/react-native-device-info/android/src/main/java/com/learnium/RNDeviceInfo/RNDeviceInfoPackage.java
@@ -0,0 +1,95 @@
+package com.learnium.RNDeviceInfo;
+
+import com.facebook.react.TurboReactPackage;
+import com.facebook.react.bridge.NativeModule;
+import com.facebook.react.bridge.ReactApplicationContext;
+import com.facebook.react.module.annotations.ReactModule;
+import com.facebook.react.module.annotations.ReactModuleList;
+import com.facebook.react.module.model.ReactModuleInfo;
+import com.facebook.react.module.model.ReactModuleInfoProvider;
+import com.facebook.react.turbomodule.core.interfaces.TurboModule;
+import com.facebook.react.uimanager.ViewManager;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.annotation.Nonnull;
+
+@ReactModuleList(
+ nativeModules = {
+ RNDeviceModule.class,
+ })
+public class RNDeviceInfoPackage extends TurboReactPackage {
+ @Override
+ @Nonnull
+ public List<NativeModule> createNativeModules(@Nonnull ReactApplicationContext reactContext) {
+ List<NativeModule> modules = new ArrayList<>();
+
+ modules.add(new RNDeviceModule(reactContext));
+
+ return modules;
+ }
+
+ @Override
+ public NativeModule getModule(String name, @Nonnull ReactApplicationContext reactContext) {
+ switch (name) {
+ case RNDeviceModule.NAME:
+ return new RNDeviceModule(reactContext);
+ default:
+ return null;
+ }
+ }
+
+ @Override
+ public ReactModuleInfoProvider getReactModuleInfoProvider() {
+ try {
+ Class<?> reactModuleInfoProviderClass =
+ Class.forName("com.learnium.RNDeviceInfo.RNDeviceInfoPackage$$ReactModuleInfoProvider");
+ return (ReactModuleInfoProvider) reactModuleInfoProviderClass.newInstance();
+ } catch (ClassNotFoundException e) {
+ // ReactModuleSpecProcessor does not run at build-time. Create this ReactModuleInfoProvider by
+ // hand.
+ return new ReactModuleInfoProvider() {
+ @Override
+ public Map<String, ReactModuleInfo> getReactModuleInfos() {
+ final Map<String, ReactModuleInfo> reactModuleInfoMap = new HashMap<>();
+
+ Class<? extends NativeModule>[] moduleList =
+ new Class[] {
+ RNDeviceModule.class,
+ };
+
+ for (Class<? extends NativeModule> moduleClass : moduleList) {
+ ReactModule reactModule = moduleClass.getAnnotation(ReactModule.class);
+
+ reactModuleInfoMap.put(
+ reactModule.name(),
+ new ReactModuleInfo(
+ reactModule.name(),
+ moduleClass.getName(),
+ reactModule.canOverrideExistingModule(),
+ reactModule.needsEagerInit(),
+ reactModule.hasConstants(),
+ reactModule.isCxxModule(),
+ TurboModule.class.isAssignableFrom(moduleClass)));
+ }
+
+ return reactModuleInfoMap;
+ }
+ };
+ } catch (InstantiationException | IllegalAccessException e) {
+ throw new RuntimeException(
+ "No ReactModuleInfoProvider for com.learnium.RNDeviceInfo.RNDeviceInfoPackage$$ReactModuleInfoProvider", e);
+ }
+ }
+
+ @Override
+ @Nonnull
+ public List<ViewManager> createViewManagers(@Nonnull ReactApplicationContext reactContext) {
+ return Collections.emptyList();
+ }
+
+}
diff --git a/node_modules/react-native-device-info/android/src/main/java/com/learnium/RNDeviceInfo/RNDeviceModule.java b/node_modules/react-native-device-info/android/src/main/java/com/learnium/RNDeviceInfo/RNDeviceModule.java
index b01e9d2..d954717 100644
--- a/node_modules/react-native-device-info/android/src/main/java/com/learnium/RNDeviceInfo/RNDeviceModule.java
+++ b/node_modules/react-native-device-info/android/src/main/java/com/learnium/RNDeviceInfo/RNDeviceModule.java
@@ -20,8 +20,6 @@ import android.os.Environment;
import android.os.PowerManager;
import android.os.StatFs;
import android.os.BatteryManager;
-import android.os.Debug;
-import android.os.Process;
import android.provider.Settings;
import android.webkit.WebSettings;
import android.telephony.TelephonyManager;
@@ -35,7 +33,6 @@ import androidx.annotation.Nullable;
import com.facebook.react.bridge.Arguments;
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 com.facebook.react.bridge.Promise;
import com.facebook.react.bridge.WritableArray;
@@ -66,7 +63,7 @@ import static android.os.BatteryManager.BATTERY_STATUS_FULL;
import static android.provider.Settings.Secure.getString;
@ReactModule(name = RNDeviceModule.NAME)
-public class RNDeviceModule extends ReactContextBaseJavaModule {
+public class RNDeviceModule extends NativeDeviceInfoModuleSpec {
public static final String NAME = "RNDeviceInfo";
private final DeviceTypeResolver deviceTypeResolver;
private final DeviceIdResolver deviceIdResolver;
@@ -152,7 +149,7 @@ public class RNDeviceModule extends ReactContextBaseJavaModule {
@Override
- public void onCatalystInstanceDestroy() {
+ public void invalidate() {
getReactApplicationContext().unregisterReceiver(receiver);
getReactApplicationContext().unregisterReceiver(headphoneConnectionReceiver);
}
@@ -177,39 +174,13 @@ public class RNDeviceModule extends ReactContextBaseJavaModule {
return null;
}
- @Override
- public Map<String, Object> getConstants() {
- String appVersion, buildNumber, appName;
-
- try {
- appVersion = getPackageInfo().versionName;
- buildNumber = Integer.toString(getPackageInfo().versionCode);
- appName = getReactApplicationContext().getApplicationInfo().loadLabel(getReactApplicationContext().getPackageManager()).toString();
- } catch (Exception e) {
- appVersion = "unknown";
- buildNumber = "unknown";
- appName = "unknown";
- }
-
- final Map<String, Object> constants = new HashMap<>();
-
- constants.put("deviceId", Build.BOARD);
- constants.put("bundleId", getReactApplicationContext().getPackageName());
- constants.put("systemName", "Android");
- constants.put("systemVersion", Build.VERSION.RELEASE);
- constants.put("appVersion", appVersion);
- constants.put("buildNumber", buildNumber);
- constants.put("isTablet", deviceTypeResolver.isTablet());
- constants.put("appName", appName);
- constants.put("brand", Build.BRAND);
- constants.put("model", Build.MODEL);
- constants.put("deviceType", deviceTypeResolver.getDeviceType().getValue());
-
- return constants;
+ @ReactMethod
+ public void addListener(String eventName) {
+ // Keep: Required for RN built in Event Emitter Calls.
}
@ReactMethod
- public void addListener(String eventName) {
+ public void removeListeners(double count) {
// Keep: Required for RN built in Event Emitter Calls.
}
@@ -252,7 +223,7 @@ public class RNDeviceModule extends ReactContextBaseJavaModule {
}
@ReactMethod(isBlockingSynchronousMethod = true)
- public float getFontScaleSync() { return getReactApplicationContext().getResources().getConfiguration().fontScale; }
+ public double getFontScaleSync() { return getReactApplicationContext().getResources().getConfiguration().fontScale; }
@ReactMethod
public void getFontScale(Promise p) { p.resolve(getFontScaleSync()); }
@@ -265,6 +236,68 @@ public class RNDeviceModule extends ReactContextBaseJavaModule {
System.err.println("Unable to determine keyguard status. KeyguardManager was null");
return false;
}
+
+ @Override
+ public void isMouseConnected(Promise promise) {
+ promise.reject("DeviceInfo:isMouseConnected", "isMouseConnected is not supported on Android");
+ }
+
+ @Override
+ public boolean isMouseConnectedSync() {
+ return false;
+ }
+
+ @Override
+ public void isKeyboardConnected(Promise promise) {
+ promise.reject("DeviceInfo:isKeyboardConnected", "isKeyboardConnected is not supported on Android");
+ }
+
+ @Override
+ public boolean isKeyboardConnectedSync() {
+ return false;
+ }
+
+ @Override
+ public void isTabletMode(Promise promise) {
+promise.reject("DeviceInfo:isTabletMode", "isTabletMode is not supported on Android");
+ }
+
+ @Override
+ public void syncUniqueId(Promise promise) {
+promise.reject("DeviceInfo:syncUniqueId", "syncUniqueId is not supported on Android");
+ }
+
+ @Override
+ protected Map<String, Object> getTypedExportedConstants() {
+ String appVersion, buildNumber, appName;
+
+ try {
+ appVersion = getPackageInfo().versionName;
+ buildNumber = Integer.toString(getPackageInfo().versionCode);
+ appName = getReactApplicationContext().getApplicationInfo().loadLabel(getReactApplicationContext().getPackageManager()).toString();
+ } catch (Exception e) {
+ appVersion = "unknown";
+ buildNumber = "unknown";
+ appName = "unknown";
+ }
+
+ final Map<String, Object> constants = new HashMap<>();
+
+ constants.put("deviceId", Build.BOARD);
+ constants.put("bundleId", getReactApplicationContext().getPackageName());
+ constants.put("systemName", "Android");
+ constants.put("systemVersion", Build.VERSION.RELEASE);
+ constants.put("appVersion", appVersion);
+ constants.put("buildNumber", buildNumber);
+ constants.put("isTablet", deviceTypeResolver.isTablet());
+ constants.put("appName", appName);
+ constants.put("brand", Build.BRAND);
+ constants.put("model", Build.MODEL);
+ constants.put("deviceType", deviceTypeResolver.getDeviceType().getValue());
+
+ return constants;
+ }
+
@ReactMethod
public void isPinOrFingerprintSet(Promise p) { p.resolve(isPinOrFingerprintSetSync()); }
@@ -737,6 +770,12 @@ public class RNDeviceModule extends ReactContextBaseJavaModule {
@ReactMethod(isBlockingSynchronousMethod = true)
public String getDeviceSync() { return Build.DEVICE; }
+
+ @Override
+ public void getDeviceToken(Promise promise) {
+ promise.reject("DeviceInfo:getDeviceToken", "getDeviceToken is not supported on Android");
+ }
+
@ReactMethod
public void getDevice(Promise p) { p.resolve(getDeviceSync()); }
@@ -746,7 +785,7 @@ public class RNDeviceModule extends ReactContextBaseJavaModule {
public void getBuildId(Promise p) { p.resolve(getBuildIdSync()); }
@ReactMethod(isBlockingSynchronousMethod = true)
- public int getApiLevelSync() { return Build.VERSION.SDK_INT; }
+ public double getApiLevelSync() { return Build.VERSION.SDK_INT; }
@ReactMethod
public void getApiLevel(Promise p) { p.resolve(getApiLevelSync()); }
@@ -858,11 +897,11 @@ public class RNDeviceModule extends ReactContextBaseJavaModule {
public void getBaseOs(Promise p) { p.resolve(getBaseOsSync()); }
@ReactMethod(isBlockingSynchronousMethod = true)
- public String getPreviewSdkIntSync() {
+ public double getPreviewSdkIntSync() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
- return Integer.toString(Build.VERSION.PREVIEW_SDK_INT);
+ return Build.VERSION.PREVIEW_SDK_INT;
}
- return "unknown";
+ return -1;
}
@ReactMethod
public void getPreviewSdkInt(Promise p) { p.resolve(getPreviewSdkIntSync()); }
@@ -889,6 +928,17 @@ public class RNDeviceModule extends ReactContextBaseJavaModule {
return System.getProperty("http.agent");
}
}
+
+ @Override
+ public void getBrightness(Promise promise) {
+ promise.reject("DeviceInfo:getBrightness", "getBrightness is not supported on Android");
+ }
+
+ @Override
+ public double getBrightnessSync() {
+ return 0;
+ }
+
@ReactMethod
public void getUserAgent(Promise p) { p.resolve(getUserAgentSync()); }
diff --git a/node_modules/react-native-device-info/android/src/paper/java/com/learnium/RNDeviceInfo/NativeDeviceInfoModuleSpec.java b/node_modules/react-native-device-info/android/src/paper/java/com/learnium/RNDeviceInfo/NativeDeviceInfoModuleSpec.java
new file mode 100644
index 0000000..5aad02a
--- /dev/null
+++ b/node_modules/react-native-device-info/android/src/paper/java/com/learnium/RNDeviceInfo/NativeDeviceInfoModuleSpec.java
@@ -0,0 +1,565 @@
+
+/**
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
+ *
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
+ * once the code is regenerated.
+ *
+ * @generated by codegen project: GenerateModuleJavaSpec.js
+ *
+ * @nolint
+ */
+
+package com.learnium.RNDeviceInfo;
+
+import com.facebook.proguard.annotations.DoNotStrip;
+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.bridge.ReactModuleWithSpec;
+import com.facebook.react.bridge.WritableArray;
+import com.facebook.react.bridge.WritableMap;
+import com.facebook.react.common.build.ReactBuildConfig;
+import com.facebook.react.turbomodule.core.interfaces.TurboModule;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+import javax.annotation.Nullable;
+
+public abstract class NativeDeviceInfoModuleSpec extends ReactContextBaseJavaModule implements ReactModuleWithSpec, TurboModule {
+ public NativeDeviceInfoModuleSpec(ReactApplicationContext reactContext) {
+ super(reactContext);
+ }
+
+ @ReactMethod
+ @DoNotStrip
+ public abstract void getPowerState(Promise promise);
+
+ @ReactMethod(isBlockingSynchronousMethod = true)
+ @DoNotStrip
+ public abstract WritableMap getPowerStateSync();
+
+ @ReactMethod
+ @DoNotStrip
+ public abstract void getSupported32BitAbis(Promise promise);
+
+ @ReactMethod(isBlockingSynchronousMethod = true)
+ @DoNotStrip
+ public abstract WritableArray getSupported32BitAbisSync();
+
+ @ReactMethod
+ @DoNotStrip
+ public abstract void getSupported64BitAbis(Promise promise);
+
+ @ReactMethod(isBlockingSynchronousMethod = true)
+ @DoNotStrip
+ public abstract WritableArray getSupported64BitAbisSync();
+
+ @ReactMethod
+ @DoNotStrip
+ public abstract void getSupportedAbis(Promise promise);
+
+ @ReactMethod(isBlockingSynchronousMethod = true)
+ @DoNotStrip
+ public abstract WritableArray getSupportedAbisSync();
+
+ @ReactMethod
+ @DoNotStrip
+ public abstract void getSystemManufacturer(Promise promise);
+
+ @ReactMethod(isBlockingSynchronousMethod = true)
+ @DoNotStrip
+ public abstract String getSystemManufacturerSync();
+
+ @ReactMethod
+ @DoNotStrip
+ public abstract void getAndroidId(Promise promise);
+
+ @ReactMethod(isBlockingSynchronousMethod = true)
+ @DoNotStrip
+ public abstract String getAndroidIdSync();
+
+ @ReactMethod
+ @DoNotStrip
+ public abstract void getApiLevel(Promise promise);
+
+ @ReactMethod(isBlockingSynchronousMethod = true)
+ @DoNotStrip
+ public abstract double getApiLevelSync();
+
+ @ReactMethod
+ @DoNotStrip
+ public abstract void getAvailableLocationProviders(Promise promise);
+
+ @ReactMethod(isBlockingSynchronousMethod = true)
+ @DoNotStrip
+ public abstract WritableMap getAvailableLocationProvidersSync();
+
+ @ReactMethod
+ @DoNotStrip
+ public abstract void getBaseOs(Promise promise);
+
+ @ReactMethod(isBlockingSynchronousMethod = true)
+ @DoNotStrip
+ public abstract String getBaseOsSync();
+
+ @ReactMethod
+ @DoNotStrip
+ public abstract void getBatteryLevel(Promise promise);
+
+ @ReactMethod(isBlockingSynchronousMethod = true)
+ @DoNotStrip
+ public abstract double getBatteryLevelSync();
+
+ @ReactMethod
+ @DoNotStrip
+ public abstract void getBootloader(Promise promise);
+
+ @ReactMethod(isBlockingSynchronousMethod = true)
+ @DoNotStrip
+ public abstract String getBootloaderSync();
+
+ @ReactMethod
+ @DoNotStrip
+ public abstract void getBuildId(Promise promise);
+
+ @ReactMethod(isBlockingSynchronousMethod = true)
+ @DoNotStrip
+ public abstract String getBuildIdSync();
+
+ @ReactMethod
+ @DoNotStrip
+ public abstract void getCarrier(Promise promise);
+
+ @ReactMethod(isBlockingSynchronousMethod = true)
+ @DoNotStrip
+ public abstract String getCarrierSync();
+
+ @ReactMethod
+ @DoNotStrip
+ public abstract void getCodename(Promise promise);
+
+ @ReactMethod(isBlockingSynchronousMethod = true)
+ @DoNotStrip
+ public abstract String getCodenameSync();
+
+ @ReactMethod
+ @DoNotStrip
+ public abstract void getDevice(Promise promise);
+
+ @ReactMethod
+ @DoNotStrip
+ public abstract void getDeviceName(Promise promise);
+
+ @ReactMethod(isBlockingSynchronousMethod = true)
+ @DoNotStrip
+ public abstract String getDeviceNameSync();
+
+ @ReactMethod(isBlockingSynchronousMethod = true)
+ @DoNotStrip
+ public abstract String getDeviceSync();
+
+ @ReactMethod
+ @DoNotStrip
+ public abstract void getDeviceToken(Promise promise);
+
+ @ReactMethod
+ @DoNotStrip
+ public abstract void getDisplay(Promise promise);
+
+ @ReactMethod(isBlockingSynchronousMethod = true)
+ @DoNotStrip
+ public abstract String getDisplaySync();
+
+ @ReactMethod
+ @DoNotStrip
+ public abstract void getFingerprint(Promise promise);
+
+ @ReactMethod(isBlockingSynchronousMethod = true)
+ @DoNotStrip
+ public abstract String getFingerprintSync();
+
+ @ReactMethod
+ @DoNotStrip
+ public abstract void getFirstInstallTime(Promise promise);
+
+ @ReactMethod(isBlockingSynchronousMethod = true)
+ @DoNotStrip
+ public abstract double getFirstInstallTimeSync();
+
+ @ReactMethod
+ @DoNotStrip
+ public abstract void getFontScale(Promise promise);
+
+ @ReactMethod(isBlockingSynchronousMethod = true)
+ @DoNotStrip
+ public abstract double getFontScaleSync();
+
+ @ReactMethod
+ @DoNotStrip
+ public abstract void getFreeDiskStorage(Promise promise);
+
+ @ReactMethod
+ @DoNotStrip
+ public abstract void getFreeDiskStorageOld(Promise promise);
+
+ @ReactMethod(isBlockingSynchronousMethod = true)
+ @DoNotStrip
+ public abstract double getFreeDiskStorageSync();
+
+ @ReactMethod(isBlockingSynchronousMethod = true)
+ @DoNotStrip
+ public abstract double getFreeDiskStorageOldSync();
+
+ @ReactMethod
+ @DoNotStrip
+ public abstract void getHardware(Promise promise);
+
+ @ReactMethod(isBlockingSynchronousMethod = true)
+ @DoNotStrip
+ public abstract String getHardwareSync();
+
+ @ReactMethod
+ @DoNotStrip
+ public abstract void getHost(Promise promise);
+
+ @ReactMethod(isBlockingSynchronousMethod = true)
+ @DoNotStrip
+ public abstract String getHostSync();
+
+ @ReactMethod
+ @DoNotStrip
+ public abstract void getIncremental(Promise promise);
+
+ @ReactMethod(isBlockingSynchronousMethod = true)
+ @DoNotStrip
+ public abstract String getIncrementalSync();
+
+ @ReactMethod
+ @DoNotStrip
+ public abstract void getInstallerPackageName(Promise promise);
+
+ @ReactMethod(isBlockingSynchronousMethod = true)
+ @DoNotStrip
+ public abstract String getInstallerPackageNameSync();
+
+ @ReactMethod
+ @DoNotStrip
+ public abstract void getInstallReferrer(Promise promise);
+
+ @ReactMethod(isBlockingSynchronousMethod = true)
+ @DoNotStrip
+ public abstract String getInstallReferrerSync();
+
+ @ReactMethod
+ @DoNotStrip
+ public abstract void getInstanceId(Promise promise);
+
+ @ReactMethod(isBlockingSynchronousMethod = true)
+ @DoNotStrip
+ public abstract String getInstanceIdSync();
+
+ @ReactMethod
+ @DoNotStrip
+ public abstract void getIpAddress(Promise promise);
+
+ @ReactMethod(isBlockingSynchronousMethod = true)
+ @DoNotStrip
+ public abstract String getIpAddressSync();
+
+ @ReactMethod
+ @DoNotStrip
+ public abstract void getLastUpdateTime(Promise promise);
+
+ @ReactMethod(isBlockingSynchronousMethod = true)
+ @DoNotStrip
+ public abstract double getLastUpdateTimeSync();
+
+ @ReactMethod
+ @DoNotStrip
+ public abstract void getMacAddress(Promise promise);
+
+ @ReactMethod(isBlockingSynchronousMethod = true)
+ @DoNotStrip
+ public abstract String getMacAddressSync();
+
+ @ReactMethod
+ @DoNotStrip
+ public abstract void getMaxMemory(Promise promise);
+
+ @ReactMethod(isBlockingSynchronousMethod = true)
+ @DoNotStrip
+ public abstract double getMaxMemorySync();
+
+ @ReactMethod
+ @DoNotStrip
+ public abstract void getPhoneNumber(Promise promise);
+
+ @ReactMethod(isBlockingSynchronousMethod = true)
+ @DoNotStrip
+ public abstract String getPhoneNumberSync();
+
+ @ReactMethod
+ @DoNotStrip
+ public abstract void getPreviewSdkInt(Promise promise);
+
+ @ReactMethod(isBlockingSynchronousMethod = true)
+ @DoNotStrip
+ public abstract double getPreviewSdkIntSync();
+
+ @ReactMethod
+ @DoNotStrip
+ public abstract void getProduct(Promise promise);
+
+ @ReactMethod(isBlockingSynchronousMethod = true)
+ @DoNotStrip
+ public abstract String getProductSync();
+
+ @ReactMethod
+ @DoNotStrip
+ public abstract void getSecurityPatch(Promise promise);
+
+ @ReactMethod(isBlockingSynchronousMethod = true)
+ @DoNotStrip
+ public abstract String getSecurityPatchSync();
+
+ @ReactMethod
+ @DoNotStrip
+ public abstract void getSerialNumber(Promise promise);
+
+ @ReactMethod(isBlockingSynchronousMethod = true)
+ @DoNotStrip
+ public abstract String getSerialNumberSync();
+
+ @ReactMethod
+ @DoNotStrip
+ public abstract void getSystemAvailableFeatures(Promise promise);
+
+ @ReactMethod(isBlockingSynchronousMethod = true)
+ @DoNotStrip
+ public abstract WritableArray getSystemAvailableFeaturesSync();
+
+ @ReactMethod
+ @DoNotStrip
+ public abstract void getTags(Promise promise);
+
+ @ReactMethod(isBlockingSynchronousMethod = true)
+ @DoNotStrip
+ public abstract String getTagsSync();
+
+ @ReactMethod
+ @DoNotStrip
+ public abstract void getTotalDiskCapacity(Promise promise);
+
+ @ReactMethod
+ @DoNotStrip
+ public abstract void getTotalDiskCapacityOld(Promise promise);
+
+ @ReactMethod(isBlockingSynchronousMethod = true)
+ @DoNotStrip
+ public abstract double getTotalDiskCapacitySync();
+
+ @ReactMethod(isBlockingSynchronousMethod = true)
+ @DoNotStrip
+ public abstract double getTotalDiskCapacityOldSync();
+
+ @ReactMethod
+ @DoNotStrip
+ public abstract void getTotalMemory(Promise promise);
+
+ @ReactMethod(isBlockingSynchronousMethod = true)
+ @DoNotStrip
+ public abstract double getTotalMemorySync();
+
+ @ReactMethod
+ @DoNotStrip
+ public abstract void getType(Promise promise);
+
+ @ReactMethod(isBlockingSynchronousMethod = true)
+ @DoNotStrip
+ public abstract String getTypeSync();
+
+ @ReactMethod
+ @DoNotStrip
+ public abstract void getUniqueId(Promise promise);
+
+ @ReactMethod(isBlockingSynchronousMethod = true)
+ @DoNotStrip
+ public abstract String getUniqueIdSync();
+
+ @ReactMethod
+ @DoNotStrip
+ public abstract void getUsedMemory(Promise promise);
+
+ @ReactMethod(isBlockingSynchronousMethod = true)
+ @DoNotStrip
+ public abstract double getUsedMemorySync();
+
+ @ReactMethod
+ @DoNotStrip
+ public abstract void getUserAgent(Promise promise);
+
+ @ReactMethod(isBlockingSynchronousMethod = true)
+ @DoNotStrip
+ public abstract String getUserAgentSync();
+
+ @ReactMethod
+ @DoNotStrip
+ public abstract void getBrightness(Promise promise);
+
+ @ReactMethod(isBlockingSynchronousMethod = true)
+ @DoNotStrip
+ public abstract double getBrightnessSync();
+
+ @ReactMethod
+ @DoNotStrip
+ public abstract void hasGms(Promise promise);
+
+ @ReactMethod(isBlockingSynchronousMethod = true)
+ @DoNotStrip
+ public abstract boolean hasGmsSync();
+
+ @ReactMethod
+ @DoNotStrip
+ public abstract void hasHms(Promise promise);
+
+ @ReactMethod(isBlockingSynchronousMethod = true)
+ @DoNotStrip
+ public abstract boolean hasHmsSync();
+
+ @ReactMethod
+ @DoNotStrip
+ public abstract void hasSystemFeature(String feature, Promise promise);
+
+ @ReactMethod(isBlockingSynchronousMethod = true)
+ @DoNotStrip
+ public abstract boolean hasSystemFeatureSync(String feature);
+
+ @ReactMethod
+ @DoNotStrip
+ public abstract void isAirplaneMode(Promise promise);
+
+ @ReactMethod(isBlockingSynchronousMethod = true)
+ @DoNotStrip
+ public abstract boolean isAirplaneModeSync();
+
+ @ReactMethod
+ @DoNotStrip
+ public abstract void isBatteryCharging(Promise promise);
+
+ @ReactMethod(isBlockingSynchronousMethod = true)
+ @DoNotStrip
+ public abstract boolean isBatteryChargingSync();
+
+ @ReactMethod
+ @DoNotStrip
+ public abstract void isCameraPresent(Promise promise);
+
+ @ReactMethod(isBlockingSynchronousMethod = true)
+ @DoNotStrip
+ public abstract boolean isCameraPresentSync();
+
+ @ReactMethod
+ @DoNotStrip
+ public abstract void isEmulator(Promise promise);
+
+ @ReactMethod(isBlockingSynchronousMethod = true)
+ @DoNotStrip
+ public abstract boolean isEmulatorSync();
+
+ @ReactMethod
+ @DoNotStrip
+ public abstract void isHeadphonesConnected(Promise promise);
+
+ @ReactMethod(isBlockingSynchronousMethod = true)
+ @DoNotStrip
+ public abstract boolean isHeadphonesConnectedSync();
+