react-native-contacts 8.0.2 → 8.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -60,12 +60,15 @@ RCT_EXPORT_METHOD(checkPermission:(RCTPromiseResolveBlock) resolve
60
60
  rejecter:(RCTPromiseRejectBlock) __unused reject)
61
61
  {
62
62
  CNAuthorizationStatus authStatus = [CNContactStore authorizationStatusForEntityType:CNEntityTypeContacts];
63
+
63
64
  if (authStatus == CNAuthorizationStatusDenied || authStatus == CNAuthorizationStatusRestricted){
64
65
  resolve(@"denied");
65
66
  } else if (authStatus == CNAuthorizationStatusAuthorized){
66
67
  resolve(@"authorized");
67
- } else if (authStatus == CNAuthorizationStatusLimited) {
68
- resolve(@"limited");
68
+ } else if(@available(iOS 18, *)) {
69
+ if (authStatus == CNAuthorizationStatusLimited) {
70
+ resolve(@"limited");
71
+ }
69
72
  } else {
70
73
  resolve(@"undefined");
71
74
  }
@@ -568,10 +571,17 @@ RCT_EXPORT_METHOD(getPhotoForId:(nonnull NSString *)recordID resolver:(RCTPromis
568
571
  }
569
572
  }];
570
573
  }
571
- else if( [CNContactStore authorizationStatusForEntityType:entityType]== CNAuthorizationStatusAuthorized || [CNContactStore authorizationStatusForEntityType:entityType] == CNAuthorizationStatusLimited)
574
+ else if([CNContactStore authorizationStatusForEntityType:entityType]== CNAuthorizationStatusAuthorized)
572
575
  {
573
576
  resolve([self getFilePathForThumbnailImage:recordID addressBook:contactStore]);
574
577
  }
578
+ else if(@available(iOS 18, *))
579
+ {
580
+ if([CNContactStore authorizationStatusForEntityType:entityType] == CNAuthorizationStatusLimited)
581
+ {
582
+ resolve([self getFilePathForThumbnailImage:recordID addressBook:contactStore]);
583
+ }
584
+ }
575
585
  }
576
586
 
577
587
  -(NSString *) getFilePathForThumbnailImage:(NSString *)recordID
@@ -606,10 +616,17 @@ RCT_EXPORT_METHOD(getContactById:(nonnull NSString *)recordID resolver:(RCTPromi
606
616
  }
607
617
  }];
608
618
  }
609
- else if( [CNContactStore authorizationStatusForEntityType:entityType]== CNAuthorizationStatusAuthorized || [CNContactStore authorizationStatusForEntityType:entityType] == CNAuthorizationStatusLimited))
619
+ else if([CNContactStore authorizationStatusForEntityType:entityType]== CNAuthorizationStatusAuthorized)
610
620
  {
611
621
  resolve([self getContact:recordID addressBook:contactStore withThumbnails:false]);
612
622
  }
623
+ else if(@available(iOS 18, *))
624
+ {
625
+ if([CNContactStore authorizationStatusForEntityType:entityType] == CNAuthorizationStatusLimited)
626
+ {
627
+ resolve([self getContact:recordID addressBook:contactStore withThumbnails:false]);
628
+ }
629
+ }
613
630
  }
614
631
 
615
632
  -(NSDictionary *) getContact:(NSString *)recordID
@@ -1288,8 +1305,10 @@ RCT_EXPORT_METHOD(writePhotoToPath:(nonnull NSString *)path resolver:(RCTPromise
1288
1305
  resolve(@"denied");
1289
1306
  } else if (authStatus == CNAuthorizationStatusAuthorized){
1290
1307
  resolve(@"authorized");
1291
- } else if (authStatus == CNAuthorizationStatusLimited) {
1292
- resolve(@"limited");
1308
+ } else if(@available(iOS 18, *)) {
1309
+ if (authStatus == CNAuthorizationStatusLimited) {
1310
+ resolve(@"limited");
1311
+ }
1293
1312
  } else {
1294
1313
  resolve(@"undefined");
1295
1314
  }
@@ -1440,10 +1459,17 @@ RCT_EXPORT_METHOD(writePhotoToPath:(nonnull NSString *)path resolver:(RCTPromise
1440
1459
  }
1441
1460
  }];
1442
1461
  }
1443
- else if( [CNContactStore authorizationStatusForEntityType:entityType]== CNAuthorizationStatusAuthorized || [CNContactStore authorizationStatusForEntityType:entityType] == CNAuthorizationStatusLimited))
1462
+ else if([CNContactStore authorizationStatusForEntityType:entityType]== CNAuthorizationStatusAuthorized)
1444
1463
  {
1445
1464
  resolve([self getContact:recordID addressBook:contactStore withThumbnails:false]);
1446
1465
  }
1466
+ else if(@available(iOS 18, *))
1467
+ {
1468
+ if([CNContactStore authorizationStatusForEntityType:entityType] == CNAuthorizationStatusLimited)
1469
+ {
1470
+ resolve([self getContact:recordID addressBook:contactStore withThumbnails:false]);
1471
+ }
1472
+ }
1447
1473
  }
1448
1474
 
1449
1475
 
@@ -1490,10 +1516,18 @@ RCT_EXPORT_METHOD(writePhotoToPath:(nonnull NSString *)path resolver:(RCTPromise
1490
1516
  }
1491
1517
  }];
1492
1518
  }
1493
- else if( [CNContactStore authorizationStatusForEntityType:entityType]== CNAuthorizationStatusAuthorized || [CNContactStore authorizationStatusForEntityType:entityType] == CNAuthorizationStatusLimited))
1519
+ else if([CNContactStore authorizationStatusForEntityType:entityType]== CNAuthorizationStatusAuthorized)
1494
1520
  {
1495
1521
  resolve([self getFilePathForThumbnailImage:recordID addressBook:contactStore]);
1496
1522
  }
1523
+ else if(@available(iOS 18, *))
1524
+ {
1525
+ if([CNContactStore authorizationStatusForEntityType:entityType] == CNAuthorizationStatusLimited)
1526
+ {
1527
+ resolve([self getFilePathForThumbnailImage:recordID addressBook:contactStore]);
1528
+ }
1529
+
1530
+ }
1497
1531
  }
1498
1532
 
1499
1533
 
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "type": "git",
5
5
  "url": "https://github.com/rt2zz/react-native-contacts.git"
6
6
  },
7
- "version": "8.0.2",
7
+ "version": "8.0.4",
8
8
  "description": "React Native Contacts (android & ios)",
9
9
  "nativePackage": true,
10
10
  "keywords": [