react-native-beidou 1.1.3 → 1.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/Compass.android.tsx +4 -12
  2. package/Compass.ios.tsx +2 -3
  3. package/android/build.gradle +22 -9
  4. package/android/src/main/AndroidManifest.xml +1 -0
  5. package/android/src/main/java/com/fxzs.rnbeidou/BeiDouBluetoothModule.java +528 -188
  6. package/android/src/main/java/com/fxzs.rnbeidou/BeiDouBluetoothPackage.java +10 -13
  7. package/android/src/main/java/com/fxzs.rnbeidou/BeidouAidlHelper.java +45 -13
  8. package/android/src/main/java/com/fxzs.rnbeidou/SuperSimModule.java +301 -0
  9. package/android/src/main/java/com/fxzs.rnbeidou/view/CompassManager.java +15 -15
  10. package/android/src/main/java/com/fxzs.rnbeidou/view/CompassView.java +10 -4
  11. package/index.ts +128 -228
  12. package/ios/BeiDouBluetoothModule.m +147 -20
  13. package/ios/BeidouBluetooth.framework/BeidouBluetooth +0 -0
  14. package/ios/BeidouBluetooth.framework/FMDB.bundle/Info.plist +0 -0
  15. package/ios/BeidouBluetooth.framework/Info.plist +0 -0
  16. package/ios/BeidouBluetooth.framework/_CodeSignature/CodeDirectory +0 -0
  17. package/ios/BeidouBluetooth.framework/_CodeSignature/CodeRequirements-1 +0 -0
  18. package/ios/BeidouBluetooth.framework/_CodeSignature/CodeResources +4 -4
  19. package/ios/BeidouBluetooth.framework/_CodeSignature/CodeSignature +0 -0
  20. package/ios/CompassView.h +1 -0
  21. package/ios/CompassView.m +3 -0
  22. package/ios/CompassViewComponentView.h +11 -0
  23. package/ios/CompassViewComponentView.mm +64 -0
  24. package/package.json +3 -5
  25. package/react-native-beidou.podspec +6 -3
  26. package/react-native.config.js +2 -5
  27. package/src/CompassViewNativeComponent.ts +13 -0
  28. package/src/NativeBeiDouBluetooth.ts +57 -0
  29. package/src/NativeSuperSim.ts +21 -0
  30. package/BeiDouAIDLTestPage.tsx +0 -1196
  31. package/LogManager.ts +0 -285
  32. package/TestPage.ts +0 -6
  33. package/android/.gradle/8.10/checksums/checksums.lock +0 -0
  34. package/android/.gradle/8.10/dependencies-accessors/gc.properties +0 -0
  35. package/android/.gradle/8.10/fileChanges/last-build.bin +0 -0
  36. package/android/.gradle/8.10/fileHashes/fileHashes.lock +0 -0
  37. package/android/.gradle/8.10/gc.properties +0 -0
  38. package/android/.gradle/8.9/checksums/checksums.lock +0 -0
  39. package/android/.gradle/8.9/dependencies-accessors/gc.properties +0 -0
  40. package/android/.gradle/8.9/fileChanges/last-build.bin +0 -0
  41. package/android/.gradle/8.9/fileHashes/fileHashes.lock +0 -0
  42. package/android/.gradle/8.9/gc.properties +0 -0
  43. package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
  44. package/android/.gradle/buildOutputCleanup/cache.properties +0 -2
  45. package/android/.gradle/config.properties +0 -2
  46. package/android/.gradle/vcs-1/gc.properties +0 -0
  47. package/android/.idea/AndroidProjectSystem.xml +0 -6
  48. package/android/.idea/caches/deviceStreaming.xml +0 -1138
  49. package/android/.idea/gradle.xml +0 -13
  50. package/android/.idea/migrations.xml +0 -10
  51. package/android/.idea/misc.xml +0 -9
  52. package/android/.idea/runConfigurations.xml +0 -17
  53. package/android/.idea/vcs.xml +0 -6
  54. package/android/local.properties +0 -8
  55. package/android/src/main/java/com/fxzs.rnbeidou/LogManager.java +0 -488
@@ -9,6 +9,7 @@
9
9
  #import <BeidouBluetooth/BeidouBluetooth.h>
10
10
  #import <React/RCTRootView.h>
11
11
  #import "BDTChatDBManager.h"
12
+ #import <Contacts/Contacts.h>
12
13
 
13
14
  @interface BeiDouBluetoothModule () <BDTBluetoothMonitor>
14
15
 
@@ -29,30 +30,33 @@ RCT_EXPORT_MODULE();
29
30
 
30
31
  - (instancetype)init {
31
32
  self = [super init];
32
- if (self) {
33
-
34
- [BDTBluetoothManager shared].delegate = self;
35
-
36
- }
37
33
  return self;
38
34
  }
39
35
 
36
+ - (BDTBluetoothManager *)bluetoothManager {
37
+ BDTBluetoothManager *manager = [BDTBluetoothManager shared];
38
+ if (manager.delegate != self) {
39
+ manager.delegate = self;
40
+ }
41
+ return manager;
42
+ }
43
+
40
44
  -(NSArray<NSString *> *)supportedEvents{
41
- return @[@"suncthing_success",@"nasConnectFailed",@"exitTCN100",@"screenshotNotice",@"noticeUploadSpeed",@"etsNoticeUploadComplete",@"listenUpdateNotice",@"listenBluetoolth",@"listenNetStatus"];
45
+ return @[@"listenBluetoolth",@"beidouBluetoothError"];
42
46
  }
43
47
 
44
48
 
45
49
  /// 开始扫描
46
50
  /// - Parameter param: 当系统或者应用蓝牙开关关闭时会触发此回调 3:用户拒绝授权 4:系统蓝牙开关关闭
47
51
  RCT_EXPORT_METHOD(startScanForService:(RCTResponseSenderBlock)callBack) {
48
- [[BDTBluetoothManager shared] startScanningForServices:nil callBack:^(NSInteger statu) {
52
+ [[self bluetoothManager] startScanningForServices:nil callBack:^(NSInteger statu) {
49
53
  callBack(@[@(statu)]);
50
54
  }];
51
55
  }
52
56
 
53
57
  /// 结束扫描
54
58
  RCT_EXPORT_METHOD(stopScanning) {
55
- [[BDTBluetoothManager shared] stopScanning];
59
+ [[self bluetoothManager] stopScanning];
56
60
  }
57
61
 
58
62
  /// 获取扫描到的蓝牙设备列表
@@ -61,7 +65,7 @@ RCT_EXPORT_METHOD(stopScanning) {
61
65
  RCT_EXPORT_METHOD(getDiscoveredDevices:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) {
62
66
 
63
67
  @try {
64
- NSArray<BDTBluetoothDevice *> * deviceArr = [[BDTBluetoothManager shared] getDiscoveredDevices];
68
+ NSArray<BDTBluetoothDevice *> * deviceArr = [[self bluetoothManager] getDiscoveredDevices];
65
69
  NSMutableArray *deviceArray = [NSMutableArray array];
66
70
  for (BDTBluetoothDevice *device in deviceArr) {
67
71
  NSMutableDictionary *infoDic = [NSMutableDictionary dictionary];
@@ -98,7 +102,7 @@ RCT_EXPORT_METHOD(connectToDeviceFromCloudDeviceNO:(NSString *)deviceNO
98
102
  timeout:(nonnull NSNumber *)second
99
103
  resolve:(RCTPromiseResolveBlock)resolve
100
104
  rejecter:(RCTPromiseRejectBlock)reject) {
101
- [[BDTBluetoothManager shared] connectPeripheralDeviceNO:deviceNO timeout:[second intValue] callback:^(NSInteger state) {
105
+ [[self bluetoothManager] connectPeripheralDeviceNO:deviceNO timeout:[second intValue] callback:^(NSInteger state) {
102
106
  if (state == 1) {
103
107
  resolve(@"1");
104
108
  } else {
@@ -113,7 +117,7 @@ RCT_EXPORT_METHOD(connectToDeviceFromCloudDeviceNO:(NSString *)deviceNO
113
117
  /// - Parameter resolve: 连接成功回调
114
118
  /// - Parameter reject: 连接失败回调
115
119
  RCT_EXPORT_METHOD(disConnectWithDeviceUUID:(NSString *)identifier resolve:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) {
116
- [[BDTBluetoothManager shared] disconnect:identifier callback:^(NSInteger result) {
120
+ [[self bluetoothManager] disconnect:identifier callback:^(NSInteger result) {
117
121
  if (result == 1) {
118
122
  NSLog(@"断开连接成功");
119
123
  resolve(@"1");
@@ -148,7 +152,7 @@ RCT_EXPORT_METHOD(writeData:(NSString *)base64String
148
152
  }
149
153
  uint8_t commandValue = [command shortValue];
150
154
  BOOL isEncrypted = [encrypted boolValue];
151
- [[BDTBluetoothManager shared] sendBusinessData:decodedData
155
+ [[self bluetoothManager] sendBusinessData:decodedData
152
156
  deviceId:deviceNO
153
157
  command:commandValue
154
158
  opcode:0
@@ -198,7 +202,7 @@ RCT_EXPORT_METHOD(writeInfo:(nullable NSString *)base64Payload
198
202
  uint8_t opCodeValue = [opCode shortValue];
199
203
  uint16_t attrTypeValue = [attrType shortValue];
200
204
  BOOL isEncrypted = [encrypted boolValue];
201
- [[BDTBluetoothManager shared] sendBusinessData:decodedData
205
+ [[self bluetoothManager] sendBusinessData:decodedData
202
206
  deviceId:deviceNO
203
207
  command:commandValue
204
208
  opcode:opCodeValue
@@ -253,7 +257,7 @@ RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(generateRandom16BytesString) {
253
257
  /// 获取蓝牙状态
254
258
  /// - Parameter callback: 0:未决定蓝牙权限 1:蓝牙权限受限 2:拒绝蓝牙权限 3:已授权蓝牙权限
255
259
  RCT_EXPORT_METHOD(getBluetoothState:(RCTResponseSenderBlock)callback) {
256
- NSInteger state = [[BDTBluetoothManager shared] getBluetoothState];
260
+ NSInteger state = [[self bluetoothManager] getBluetoothState];
257
261
  NSNumber *stateNum = [NSNumber numberWithInteger:state];
258
262
  callback(@[stateNum]);
259
263
  }
@@ -280,9 +284,14 @@ RCT_EXPORT_METHOD(getBluetoothState:(RCTResponseSenderBlock)callback) {
280
284
 
281
285
 
282
286
  RCT_EXPORT_METHOD(fetchCurrentWifiName:(RCTResponseSenderBlock)callback) {
283
- NSString *name = [[BDTBluetoothManager shared] fetchCurrentWiFiSSID];
284
- NSLog(@"wifi名称:%@",name);
285
- callback(@[name]);
287
+ NSString *name = [[self bluetoothManager] fetchCurrentWiFiSSID];
288
+ if (name == nil || name.length == 0 || [name isEqualToString:@"(null)"]) {
289
+ name = @"未连接";
290
+ }
291
+ NSLog(@"wifi名称:%@", name);
292
+ if (callback) {
293
+ callback(@[name]);
294
+ }
286
295
  }
287
296
 
288
297
 
@@ -357,7 +366,7 @@ RCT_EXPORT_METHOD(startMiniAppForBluetoolthDevice:(NSString *)bundleFilePath
357
366
  //跳转到指南针界面
358
367
  RCT_EXPORT_METHOD(jumpCompassView) {
359
368
  dispatch_async(dispatch_get_main_queue(), ^{
360
- [[BDTBluetoothManager shared] jumpCompassView];
369
+ [[self bluetoothManager] jumpCompassView];
361
370
  });
362
371
  }
363
372
 
@@ -407,15 +416,133 @@ RCT_EXPORT_METHOD(getMessagesForPhone:(NSString *)phone
407
416
  RCT_EXPORT_METHOD(setBLEKey:(NSString *)bleKey
408
417
  resolve:(RCTPromiseResolveBlock)resolve
409
418
  rejecter:(RCTPromiseRejectBlock)reject) {
410
- [BDTBluetoothManager shared].bleKeyHex = bleKey;
419
+ [self bluetoothManager].bleKeyHex = bleKey;
411
420
  resolve(@(1)); // 可以返回任意值,表示成功
412
421
  }
413
422
 
423
+ RCT_EXPORT_METHOD(getContacts:(RCTPromiseResolveBlock)resolve
424
+ rejecter:(RCTPromiseRejectBlock)reject) {
425
+ CNAuthorizationStatus status = [CNContactStore authorizationStatusForEntityType:CNEntityTypeContacts];
426
+ CNContactStore *store = [[CNContactStore alloc] init];
427
+
428
+ void (^fetchContactsBlock)(void) = ^{
429
+ NSMutableArray *result = [NSMutableArray array];
430
+ NSArray *keysToFetch = @[
431
+ CNContactIdentifierKey,
432
+ CNContactGivenNameKey,
433
+ CNContactMiddleNameKey,
434
+ CNContactFamilyNameKey,
435
+ CNContactOrganizationNameKey,
436
+ CNContactPhoneNumbersKey
437
+ ];
438
+
439
+ CNContactFetchRequest *request = [[CNContactFetchRequest alloc] initWithKeysToFetch:keysToFetch];
440
+ request.sortOrder = CNContactSortOrderUserDefault;
441
+
442
+ NSError *fetchError = nil;
443
+ BOOL success = [store enumerateContactsWithFetchRequest:request
444
+ error:&fetchError
445
+ usingBlock:^(CNContact * _Nonnull contact, BOOL * _Nonnull stop) {
446
+ NSMutableOrderedSet *phonesSet = [NSMutableOrderedSet orderedSet];
447
+ for (CNLabeledValue<CNPhoneNumber *> *labeledValue in contact.phoneNumbers) {
448
+ NSString *rawNumber = labeledValue.value.stringValue ?: @"";
449
+ NSString *digits = [[rawNumber componentsSeparatedByCharactersInSet:[[NSCharacterSet decimalDigitCharacterSet] invertedSet]]
450
+ componentsJoinedByString:@""];
451
+ if (digits.length == 0) {
452
+ continue;
453
+ }
454
+ // 统一处理中国区号前缀,保持和业务侧11位手机号规则兼容
455
+ if ([digits hasPrefix:@"0086"] && digits.length > 11) {
456
+ digits = [digits substringFromIndex:4];
457
+ } else if ([digits hasPrefix:@"86"] && digits.length > 11) {
458
+ digits = [digits substringFromIndex:2];
459
+ }
460
+ if (digits.length == 0) {
461
+ continue;
462
+ }
463
+ [phonesSet addObject:digits];
464
+ }
465
+
466
+ if (phonesSet.count == 0) {
467
+ return;
468
+ }
469
+
470
+ NSString *name = [NSString stringWithFormat:@"%@%@%@",
471
+ contact.familyName ?: @"",
472
+ contact.middleName ?: @"",
473
+ contact.givenName ?: @""];
474
+ if (name.length == 0) {
475
+ name = contact.organizationName ?: @"";
476
+ }
477
+ if (name.length == 0) {
478
+ name = @"未知联系人";
479
+ }
480
+
481
+ NSMutableString *latin = [name mutableCopy];
482
+ CFStringTransform((__bridge CFMutableStringRef)latin, NULL, kCFStringTransformToLatin, NO);
483
+ latin = [[latin stringByFoldingWithOptions:NSDiacriticInsensitiveSearch
484
+ locale:[NSLocale currentLocale]] mutableCopy];
485
+
486
+ NSString *firstLetter = @"#";
487
+ if (latin.length > 0) {
488
+ NSString *c = [[latin substringToIndex:1] uppercaseString];
489
+ NSCharacterSet *letterSet = [NSCharacterSet characterSetWithCharactersInString:@"ABCDEFGHIJKLMNOPQRSTUVWXYZ"];
490
+ if ([c rangeOfCharacterFromSet:letterSet].location != NSNotFound) {
491
+ firstLetter = c;
492
+ }
493
+ }
494
+
495
+ NSDictionary *item = @{
496
+ @"id": contact.identifier ?: @"",
497
+ @"name": name,
498
+ @"firstLetter": firstLetter,
499
+ @"phoneNumbers": phonesSet.array
500
+ };
501
+ [result addObject:item];
502
+ }];
503
+
504
+ if (!success || fetchError) {
505
+ reject(@"CONTACTS_ERROR", fetchError.localizedDescription ?: @"读取通讯录失败", fetchError);
506
+ return;
507
+ }
508
+ resolve(result);
509
+ };
510
+
511
+ if (status == CNAuthorizationStatusAuthorized) {
512
+ fetchContactsBlock();
513
+ return;
514
+ }
515
+
516
+ if (status == CNAuthorizationStatusNotDetermined) {
517
+ [store requestAccessForEntityType:CNEntityTypeContacts completionHandler:^(BOOL granted, NSError * _Nullable error) {
518
+ dispatch_async(dispatch_get_main_queue(), ^{
519
+ if (error) {
520
+ reject(@"PERMISSION_ERROR", error.localizedDescription ?: @"通讯录权限请求失败", error);
521
+ return;
522
+ }
523
+ if (!granted) {
524
+ reject(@"PERMISSION_DENIED", @"缺少通讯录权限", nil);
525
+ return;
526
+ }
527
+ fetchContactsBlock();
528
+ });
529
+ }];
530
+ return;
531
+ }
532
+
533
+ if (status == CNAuthorizationStatusRestricted) {
534
+ reject(@"PERMISSION_RESTRICTED", @"通讯录权限受限", nil);
535
+ return;
536
+ }
537
+
538
+ reject(@"PERMISSION_DENIED", @"缺少通讯录权限", nil);
539
+ }
540
+
414
541
  /**
415
542
  判断蓝牙权限:0-未明确 1-受限的/未授权 2-拒绝 3-已授权
416
543
  */
417
544
  RCT_EXPORT_METHOD(initializeBluetooth:(RCTResponseSenderBlock)callBack){
418
- [[BDTBluetoothManager shared] getBluetoothAuthorizationStatus:^(NSString *status) {
545
+ [[self bluetoothManager] getBluetoothAuthorizationStatus:^(NSString *status) {
419
546
  callBack(@[status]);
420
547
  }];
421
548
  }
@@ -6,11 +6,11 @@
6
6
  <dict>
7
7
  <key>.DS_Store</key>
8
8
  <data>
9
- 7xO+IM9LM37K4Eu6kj0XuMkeOA4=
9
+ cRXTcSAXZYQHOO3aez8s8FQBBYk=
10
10
  </data>
11
11
  <key>FMDB.bundle/Info.plist</key>
12
12
  <data>
13
- YbOcdNhJc+cRHTTiKtlpFGTYrkk=
13
+ Rq8A+n6NWCkmlfKf7h7xU5ViHag=
14
14
  </data>
15
15
  <key>FMDB.bundle/PrivacyInfo.xcprivacy</key>
16
16
  <data>
@@ -38,7 +38,7 @@
38
38
  </data>
39
39
  <key>Info.plist</key>
40
40
  <data>
41
- niEQ4R1NMt9znoOfKZHqo3IsMQY=
41
+ B/ITQW6fj+Dc5Myk9CpAsQm3sdU=
42
42
  </data>
43
43
  <key>Modules/module.modulemap</key>
44
44
  <data>
@@ -51,7 +51,7 @@
51
51
  <dict>
52
52
  <key>hash2</key>
53
53
  <data>
54
- rZml5/t9RGeZsbAX3DM4md4BS3w4qjEEztuz895nu+8=
54
+ Rmhe5qmUY/VTF2ntR5ylsGXvM5MdBUX8lGkf9J3DcWw=
55
55
  </data>
56
56
  </dict>
57
57
  <key>FMDB.bundle/PrivacyInfo.xcprivacy</key>
package/ios/CompassView.h CHANGED
@@ -14,6 +14,7 @@ NS_ASSUME_NONNULL_BEGIN
14
14
 
15
15
  /// RN 回调 block
16
16
  @property (nonatomic, copy) RCTBubblingEventBlock onHeadingChange;
17
+ @property (nonatomic, copy, nullable) void (^headingChangeHandler)(CGFloat radians, CGFloat degrees);
17
18
 
18
19
  @end
19
20
 
package/ios/CompassView.m CHANGED
@@ -68,6 +68,9 @@
68
68
  if (self.onHeadingChange) {
69
69
  self.onHeadingChange(@{@"radians": @(radians), @"degrees": @(magneticHeading)});
70
70
  }
71
+ if (self.headingChangeHandler) {
72
+ self.headingChangeHandler(radians, magneticHeading);
73
+ }
71
74
 
72
75
  });
73
76
  }
@@ -0,0 +1,11 @@
1
+ #ifdef RCT_NEW_ARCH_ENABLED
2
+ #import <React/RCTViewComponentView.h>
3
+ #import <UIKit/UIKit.h>
4
+
5
+ NS_ASSUME_NONNULL_BEGIN
6
+
7
+ @interface CompassViewComponentView : RCTViewComponentView
8
+ @end
9
+
10
+ NS_ASSUME_NONNULL_END
11
+ #endif
@@ -0,0 +1,64 @@
1
+ #ifdef RCT_NEW_ARCH_ENABLED
2
+
3
+ #import "CompassViewComponentView.h"
4
+ #import "CompassView.h"
5
+
6
+ #import <react/renderer/components/BeiDouBluetoothModuleSpec/ComponentDescriptors.h>
7
+ #import <react/renderer/components/BeiDouBluetoothModuleSpec/EventEmitters.h>
8
+ #import <react/renderer/components/BeiDouBluetoothModuleSpec/Props.h>
9
+ #import <react/renderer/components/BeiDouBluetoothModuleSpec/RCTComponentViewHelpers.h>
10
+
11
+ using namespace facebook::react;
12
+
13
+ @interface CompassViewComponentView () <RCTCompassViewViewProtocol>
14
+ @end
15
+
16
+ @implementation CompassViewComponentView {
17
+ CompassView *_contentView;
18
+ }
19
+
20
+ + (ComponentDescriptorProvider)componentDescriptorProvider
21
+ {
22
+ return concreteComponentDescriptorProvider<CompassViewComponentDescriptor>();
23
+ }
24
+
25
+ - (instancetype)initWithFrame:(CGRect)frame
26
+ {
27
+ if (self = [super initWithFrame:frame]) {
28
+ _contentView = [[CompassView alloc] init];
29
+ self.contentView = _contentView;
30
+
31
+ __weak __typeof(self) weakSelf = self;
32
+ _contentView.headingChangeHandler = ^(CGFloat radians, CGFloat degrees) {
33
+ __strong __typeof(self) strongSelf = weakSelf;
34
+ if (!strongSelf || strongSelf->_eventEmitter == nullptr) {
35
+ return;
36
+ }
37
+ CompassViewEventEmitter::OnHeadingChange event = {
38
+ .radians = (double)radians,
39
+ .degrees = (double)degrees,
40
+ };
41
+ [strongSelf eventEmitter].onHeadingChange(event);
42
+ };
43
+ }
44
+ return self;
45
+ }
46
+
47
+ - (void)updateProps:(Props::Shared const &)props oldProps:(Props::Shared const &)oldProps
48
+ {
49
+ [super updateProps:props oldProps:oldProps];
50
+ }
51
+
52
+ - (const CompassViewEventEmitter &)eventEmitter
53
+ {
54
+ return static_cast<const CompassViewEventEmitter &>(*_eventEmitter);
55
+ }
56
+
57
+ Class<RCTComponentViewProtocol> CompassViewCls(void)
58
+ {
59
+ return CompassViewComponentView.class;
60
+ }
61
+
62
+ @end
63
+
64
+ #endif
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-beidou",
3
- "version": "1.1.3",
3
+ "version": "1.1.6",
4
4
  "description": "A React Native module for BeiDou Bluetooth communication.",
5
5
  "main": "index.ts",
6
6
  "types": "index.ts",
@@ -13,10 +13,8 @@
13
13
  "Compass.ios.tsx",
14
14
  "Compass.tsx",
15
15
  "react-native.config.js",
16
- "BeiDouAIDLTestPage.tsx",
17
- "TestPage.ts",
18
16
  "react-native-beidou.podspec",
19
- "LogManager.ts"
17
+ "src"
20
18
  ],
21
19
  "keywords": [
22
20
  "react-native",
@@ -27,7 +25,7 @@
27
25
  "license": "MIT",
28
26
  "peerDependencies": {
29
27
  "react": "*",
30
- "react-native": "*"
28
+ "react-native": "0.68.7"
31
29
  },
32
30
  "dependencies": {}
33
31
  }
@@ -1,6 +1,6 @@
1
1
  Pod::Spec.new do |s|
2
2
  s.name = "react-native-beidou"
3
- s.version = "1.1.3" # 与 package.json 中的版本保持一致
3
+ s.version = "1.1.6" # 与 package.json 中的版本保持一致
4
4
  s.summary = "React Native Beidou Module"
5
5
  s.description = <<-DESC
6
6
  A React Native module for Beidou functionality.
@@ -8,8 +8,11 @@ Pod::Spec.new do |s|
8
8
  s.homepage = "https://www.npmjs.com/package/react-native-beidou" # 替换为实际地址
9
9
  s.license = { :type => "MIT", :file => "LICENSE" }
10
10
  s.author = { "David" => "mr_jianwei@163.com" } # 替换为你的信息
11
- s.platform = :ios, "11.0"
12
- s.source = { :path => "." }
11
+ s.platform = :ios, "12.4"
12
+ s.source = {
13
+ :git => "https://www.npmjs.com/package/react-native-beidou.git",
14
+ :branch => "main"
15
+ }
13
16
 
14
17
  # 指定源文件路径
15
18
  s.source_files = "ios/**/*.{h,m,mm,swift}"
@@ -5,10 +5,7 @@ module.exports = {
5
5
  sourceDir: "./android",
6
6
  packageImportPath: "import com.fxzs.rnbeidou.BeiDouBluetoothPackage;",
7
7
  packageInstance: "new com.fxzs.rnbeidou.BeiDouBluetoothPackage()"
8
- },
9
- ios: {
10
- // 显式指定 podspec 路径 (可选,通常不需要,但为了排错可以加上)
11
- podspecPath: "./react-native-beidou.podspec",
12
- } }
8
+ }
9
+ }
13
10
  }
14
11
  };
@@ -0,0 +1,13 @@
1
+ import type { NativeSyntheticEvent, ViewProps } from 'react-native';
2
+ import { requireNativeComponent } from 'react-native';
3
+
4
+ export type CompassHeadingChangeEvent = {
5
+ radians: number;
6
+ degrees: number;
7
+ };
8
+
9
+ export interface NativeProps extends ViewProps {
10
+ onHeadingChange?: (event: NativeSyntheticEvent<CompassHeadingChangeEvent>) => void;
11
+ }
12
+
13
+ export default requireNativeComponent<NativeProps>('CompassView');
@@ -0,0 +1,57 @@
1
+ import { NativeModules } from 'react-native';
2
+
3
+ export interface Spec {
4
+ insertMsg(phone: string, content: string, timestamp: number, isSend: boolean): void;
5
+ getAllConversations(): Promise<string>;
6
+ getMessagesForPhone(phone: string, page: number, pageSize: number, callback: (json: string) => void): void;
7
+ startScanForService(callback: () => void): void;
8
+ stopScanning(): void;
9
+ getDiscoveredDevices(): Promise<string>;
10
+ connectToDeviceFromCloudDeviceNO(deviceNO: string, a: number): Promise<string>;
11
+ getAndroidNetWorkInfo(callback: (net: number) => void): void;
12
+ checkBlueToothPermission(callback: (ret: string) => void): void;
13
+ shouldShowBlueToothPermissionRationale(params: string, callback: (ret: string) => void): void;
14
+ initializeBluetooth(callback: (ret: string) => void): void;
15
+ generateRandom16BytesString(): string;
16
+ writeData(randomString: string, deviceNo: string, command: number, attrType: number, writeCallback: (result: number) => void): void;
17
+ writeInfo(base64Payload: string | null, deviceNO: string, command: number, opCode: number, attrType: number, encrypted: boolean): Promise<Object>;
18
+ writeValueInfo(randomString: string, deviceNo: string, command: number, attrType: number, value: number, writeCallback: (result: number) => void): void;
19
+ disConnectWithDeviceUUID(deviceNo: string): Promise<number>;
20
+ fetchCurrentWifiName(callback: (wifiName: string) => void): void;
21
+ getSimCardList(): Promise<Object>;
22
+ getContacts(): Promise<Object>;
23
+
24
+ // AIDL Service methods
25
+ bindBeidouServiceMethod(packageName: string, actionName: string): Promise<boolean>;
26
+ unbindBeidouServiceMethod(): Promise<boolean>;
27
+ BDAuthenticate(slotId: number): Promise<boolean>;
28
+ getBDMsgStatus(slotId: number): Promise<Object>;
29
+ checkValidatedKey(slotId: number): Promise<number>;
30
+
31
+ commonBDMsgEncrypt(slotId: number, speedType: string, receiveList: string[] | null, inputMsg: string): Promise<Object>;
32
+ positionBDMsgEncrypt(slotId: number, speedType: string, receiveList: string[] | null, inputMsg: string, longitude: number, latitude: number): Promise<Object>;
33
+
34
+ commonEmergencyBDMsgEncrypt(slotId: number, speedType: string, receiveList: string[] | null, inputMsg: string): Promise<Object>;
35
+ positionEmergencyBDMsgEncrypt(slotId: number, speedType: string, receiveList: string[] | null, inputMsg: string, longitude: number, latitude: number): Promise<Object>;
36
+
37
+ commonRichMediaBDMsgEncrypt(slotId: number, speedType: string, receiveList: string[] | null, msgType: string, inputRichMediaData: number[] | null): Promise<Object>;
38
+ positionRichMediaBDMsgEncrypt(slotId: number, speedType: string, receiveList: string[] | null, msgType: string, inputRichMediaData: number[] | null, longitude: number, latitude: number): Promise<Object>;
39
+
40
+ commonRichMediaAndTextBDMsgEncrypt(slotId: number, speedType: string, receiveList: string[] | null, text: string, msgType: string, inputRichMediaData: number[] | null): Promise<Object>;
41
+ positionRichMediaAndTextBDMsgEncrypt(slotId: number, speedType: string, receiveList: string[] | null, text: string, msgType: string, inputRichMediaData: number[] | null, longitude: number, latitude: number): Promise<Object>;
42
+
43
+ BDMailboxQueryEncrypt(slotId: number): Promise<Object>;
44
+ EmergencyBDMailboxQueryEncrypt(slotId: number, replyMobile: string): Promise<Object>;
45
+
46
+ BDMsgDecrypt(slotId: number, msg: number[] | null, len: number): Promise<Object>;
47
+ DLEphemerisFile(slotId: number, type: string, version: string): Promise<Object>;
48
+
49
+ setBLEKey(bleKey: string): Promise<number>;
50
+ getGpsLocation(): Promise<Object>;
51
+
52
+ // Logger methods
53
+ }
54
+
55
+ const { BeiDouBluetoothModule } = NativeModules;
56
+
57
+ export default BeiDouBluetoothModule as Spec;
@@ -0,0 +1,21 @@
1
+ import { NativeModules } from 'react-native';
2
+
3
+ export interface SuperSimSpec {
4
+ getSimType(slotId: number): Promise<number>;
5
+ getKsKeyAndAuthResult(slotId: number): Promise<object | null>;
6
+ checkKeyIsExistAndValidate(slotId: number): Promise<number>;
7
+ commonMessageEncryptBDMsg(slotId: number, recipients: string[] | null, message: string): Promise<object | null>;
8
+ positionReportEncryptBDMsg(
9
+ slotId: number,
10
+ recipients: string[] | null,
11
+ message: string,
12
+ longitude: number,
13
+ latitude: number
14
+ ): Promise<object | null>;
15
+ mailboxQueryEncryptBDMsg(slotId: number): Promise<object | null>;
16
+ mailboxReplyDecryptBDMsg(slotId: number, data: number[] | null, dataLength: number): Promise<object | null>;
17
+ getCurrentUserInfo(slotId: number): Promise<object | null>;
18
+ mailboxSynchronizeDecryptBDMsg(slotId: number): Promise<object | null>;
19
+ }
20
+
21
+ export default NativeModules.SuperSimModule as SuperSimSpec | undefined;