lxy 1 year ago
parent
commit
26271297c3

+ 2 - 2
Example/Podfile.lock

@@ -1,5 +1,5 @@
 PODS:
-  - LenzSDK (1.0.8):
+  - LenzSDK (1.0.9):
     - Masonry (= 1.1.0)
     - SVProgressHUD (~> 2.2.5)
     - TensorFlowLite (~> 1.13.1)
@@ -24,7 +24,7 @@ EXTERNAL SOURCES:
     :path: "../"
 
 SPEC CHECKSUMS:
-  LenzSDK: 4a3eec90aab5ad9284e1bc0bc3c1f4ee33fe2edf
+  LenzSDK: 91877897d2941b5d040f06acfdc904617774e89a
   Masonry: 678fab65091a9290e40e2832a55e7ab731aad201
   SVProgressHUD: 1428aafac632c1f86f62aa4243ec12008d7a51d6
   TensorFlowLite: 8b9dc4eb32eac0f8cb660c66bca7604da56dcc5a

+ 2 - 2
Example/Pods/Local Podspecs/LenzSDK.podspec.json

@@ -1,6 +1,6 @@
 {
   "name": "LenzSDK",
-  "version": "1.0.8",
+  "version": "1.0.9",
   "summary": "A short description of LenzSDK.",
   "description": "this  is the long description",
   "homepage": "http://39.96.8.150:10080/l405023944/LenzSDK_iOS.git",
@@ -13,7 +13,7 @@
   },
   "source": {
     "git": "http://39.96.8.150:10080/l405023944/LenzSDK_iOS.git",
-    "tag": "1.0.8"
+    "tag": "1.0.9"
   },
   "platforms": {
     "ios": "11.0"

+ 2 - 2
Example/Pods/Manifest.lock

@@ -1,5 +1,5 @@
 PODS:
-  - LenzSDK (1.0.8):
+  - LenzSDK (1.0.9):
     - Masonry (= 1.1.0)
     - SVProgressHUD (~> 2.2.5)
     - TensorFlowLite (~> 1.13.1)
@@ -24,7 +24,7 @@ EXTERNAL SOURCES:
     :path: "../"
 
 SPEC CHECKSUMS:
-  LenzSDK: 4a3eec90aab5ad9284e1bc0bc3c1f4ee33fe2edf
+  LenzSDK: 91877897d2941b5d040f06acfdc904617774e89a
   Masonry: 678fab65091a9290e40e2832a55e7ab731aad201
   SVProgressHUD: 1428aafac632c1f86f62aa4243ec12008d7a51d6
   TensorFlowLite: 8b9dc4eb32eac0f8cb660c66bca7604da56dcc5a

File diff suppressed because it is too large
+ 499 - 489
Example/Pods/Pods.xcodeproj/project.pbxproj


+ 1 - 1
Example/Pods/Target Support Files/LenzSDK/ResourceBundle-LenzCameraNativeModuleForRN-LenzSDK-Info.plist

@@ -13,7 +13,7 @@
   <key>CFBundlePackageType</key>
   <string>BNDL</string>
   <key>CFBundleShortVersionString</key>
-  <string>1.0.8</string>
+  <string>1.0.9</string>
   <key>CFBundleSignature</key>
   <string>????</string>
   <key>CFBundleVersion</key>

+ 87 - 20
LenzCameraNativeModuleForRN/Classes/inner/PCSBaseViewController/PCSBaseViewController.m

@@ -186,7 +186,7 @@
     
     __weak typeof(self) weakself = self;
     [self.modeList reloadWith:self.operationNodesArray];
-    self.modeList.indexChangedHandler = ^BOOL(NSUInteger newIndex, NSUInteger oldIndex) {
+    self.modeList.indexChangedHandler = ^BOOL(NSUInteger newMode, NSUInteger oldMode, NSUInteger newIndex) {
         __strong typeof(weakself) strongSelf = weakself;
         
         if ([SDKParameters shared].retainedMode == SDK_DATA_RETAINED_CLEAR) {
@@ -257,15 +257,15 @@
                     }
                     self.modeList.index = newIndex;
                     [self.modeList updateItemsConstraints];
-                    [strongSelf modeWillChange:newIndex oldIndex:oldIndex];
+                    [strongSelf modeWillChange:newMode oldIndex:oldMode];
                     
                     id<OperationNodeProtocol> oldModelNode = strongSelf.currentOperationNode;
-                    PhotographModeEnum mode = (PhotographModeEnum)MODE_LIST_INDEX_2_MODE_ENUM(newIndex);
+                    PhotographModeEnum mode = (PhotographModeEnum)MODE_LIST_INDEX_2_MODE_ENUM(newMode);
                     strongSelf.mode = mode;
 
                     self.ai_fullView.hidden = !(mode == SDK_CAPTURE_MODE_PANORAMA);
-                    [strongSelf modeDidChange:newIndex oldIndex:oldIndex];
-                    [strongSelf updateCaptureSessionWith:oldIndex];
+                    [strongSelf modeDidChange:newMode oldIndex:oldMode];
+                    [strongSelf updateCaptureSessionWith:oldMode];
                     if([oldModelNode respondsToSelector:@selector(didQuit)]){
                         [oldModelNode didQuit];
                     }
@@ -277,15 +277,15 @@
             }
         }
         
-        [strongSelf modeWillChange:newIndex oldIndex:oldIndex];
+        [strongSelf modeWillChange:newMode oldIndex:oldMode];
         
         id<OperationNodeProtocol> oldModelNode = strongSelf.currentOperationNode;
-        PhotographModeEnum mode = (PhotographModeEnum)MODE_LIST_INDEX_2_MODE_ENUM(newIndex);
+        PhotographModeEnum mode = (PhotographModeEnum)MODE_LIST_INDEX_2_MODE_ENUM(newMode);
         strongSelf.mode = mode;
 
         self.ai_fullView.hidden = !(mode == SDK_CAPTURE_MODE_PANORAMA);
-        [strongSelf modeDidChange:newIndex oldIndex:oldIndex];
-        [strongSelf updateCaptureSessionWith:oldIndex];
+        [strongSelf modeDidChange:newMode oldIndex:oldMode];
+        [strongSelf updateCaptureSessionWith:oldMode];
         if([oldModelNode respondsToSelector:@selector(didQuit)]){
             [oldModelNode didQuit];
         }
@@ -553,6 +553,7 @@
     if(self.mode != SDK_CAPTURE_MODE_SINGLE) {
         PCSPreviewViewController *vc = [[PCSPreviewViewController alloc]init];
         vc.model = self.resourceModel;
+        vc.selectIndex = self.mode;
         vc.dataChangeBlock = ^{
             [self updateViewStatus];
         };
@@ -949,11 +950,13 @@
 }
 
 - (void)takeStillPhoto:(AVCaptureVideoPreviewLayer*)previewLayer {
-    
+    if ([self showAuthorCamerIfNeed]) {
+        return;
+    }
     AVCaptureConnection *connection = [self.photoOutput connectionWithMediaType:AVMediaTypeVideo];
     
     if(connection == nil){
-        [self showAlertForAuthorization];
+//        [self showAlertForAuthorization];
         return;
     }
     if (connection.supportsVideoOrientation) {
@@ -1036,7 +1039,62 @@
 }
 
 - (void)showAlertForAuthorization{
-//    [self showAlertForAuthorizationWithText:@"请在系统设置里打开摄像机访问权限后重试"];
+    [self showAlertForAuthorizationWithText:@"请在系统设置里打开摄像机访问权限后重试"];
+}
+    
+- (BOOL)showAuthorCamerIfNeed {
+    __block BOOL showAlert = NO;
+    switch ([AVCaptureDevice authorizationStatusForMediaType:AVMediaTypeVideo]) {
+
+        case AVAuthorizationStatusNotDetermined:{
+            [AVCaptureDevice requestAccessForMediaType:AVMediaTypeVideo completionHandler:^(BOOL granted) {
+                if(!granted){
+                    [self showAlertForAuthorizationWithText:@"请在系统设置里打开摄像机访问权限后重试"];
+                    showAlert = YES;
+                }
+            }];
+            break;
+        }
+        case AVAuthorizationStatusDenied:{
+            [self showAlertForAuthorizationWithText:@"请在系统设置里打开摄像机访问权限后重试"];
+            showAlert =  YES;
+            break;
+        }
+        default:
+            showAlert = NO;
+            break;
+    }
+    return showAlert;
+}
+    
+- (BOOL)showAudioCamerIfNeed {
+    __block BOOL showAlert = NO;
+    
+    switch ([AVCaptureDevice authorizationStatusForMediaType:AVMediaTypeAudio]) {
+
+        case AVAuthorizationStatusNotDetermined:{
+            [AVCaptureDevice requestAccessForMediaType:AVMediaTypeAudio completionHandler:^(BOOL granted) {
+                if(!granted){
+                    [self setupMicrophone];
+                    [self showAlertForAuthorizationWithText:@"请在系统设置里打开麦克风访问权限后重试"];
+                    showAlert = YES;
+                }
+
+            }];
+            break;
+        }
+        case AVAuthorizationStatusDenied:{
+            [self showAlertForAuthorizationWithText:@"请在系统设置里打开麦克风访问权限后重试"];
+            showAlert =  YES;
+            break;
+        }
+
+        default:
+            showAlert = NO;
+            break;
+    }
+    
+    return showAlert;
 }
 
 #pragma mark - Capture
@@ -1045,7 +1103,12 @@
 }
 
 - (BOOL)startRecording{
-
+    if ([self showAuthorCamerIfNeed]) {
+        return NO;
+    }
+    if ([self showAudioCamerIfNeed]) {
+        return NO;
+    }
     if(self.movieFileOutput.isRecording){
         return NO;
     }
@@ -1144,7 +1207,7 @@
         if([self configureVideoWritter]){
             AVCaptureConnection *connection = [self.videoDataOutput connectionWithMediaType:AVMediaTypeVideo];
             if(connection == nil){
-                [self showAlertForAuthorization];
+//                [self showAlertForAuthorization];
                 return;
             }
             [connection setVideoOrientation:orientation];
@@ -1574,6 +1637,8 @@
 - (void)panoramaOrientationViewslt:(PanoramaOrientationViewDirectionEnum)direction{
 //    NSLog(@"方向%ld",direction);
     self.panoramaGuideView.hidden = NO;
+//    self.ai_fullView.hidden = NO;
+    
 //    [LenStitcher videoResetPath];
     [UIView animateWithDuration:0.25 animations:^{
         [self.panoramaGuideView mas_remakeConstraints:^(MASConstraintMaker *make) {
@@ -1597,6 +1662,8 @@
                     break;
                 case PanoramaOrientationViewAny: {
                     self.panoramaGuideView.hidden = YES;
+//                    self.ai_fullView.hidden = YES;
+
                 }
                     break;
                 default:
@@ -2485,14 +2552,14 @@
 - (void)captureOutput:(AVCaptureOutput *)output didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer fromConnection:(AVCaptureConnection *)connection {
     @autoreleasepool {
         if (connection == [self.videoDataOutput connectionWithMediaType:AVMediaTypeVideo]) {
-            NSLog(@"11111");
+            
             [self.stitchkLock lock];
 //            dispatch_semaphore_wait(self.videoStitchSemaphore, DISPATCH_TIME_FOREVER);
             OperationNodeVideoBase *base = nil;
             if ([self.currentOperationNode isKindOfClass:[OperationNodeVideoBase class]]) {
                 base = (OperationNodeVideoBase *)self.currentOperationNode;
             }
-            NSLog(@"2222");
+            
 
             if (self.isVideoStitchStopedWhenRecording &&
                 (self.stitchResult != LenVideoStitchResultFail && self.stitchResult != LenVideoStitchResultStitchFail)) {
@@ -2505,7 +2572,7 @@
                                   isStop:self.isVideoStitchStopedWhenRecording
                                 complete:^(LenVideoStitchResult result, LenVideoStitchNeedSave needSave) {
                 self.stitchResult = result;
-                NSLog(@"333");
+                
 
                 self.isVideoStitchStopedWhenRecording = NO;
                 UIImage *image = [LenStitcher getCurrentPanoramaShowImage];
@@ -2617,11 +2684,11 @@
                         [SVProgressHUD dismissWithDelay:3 completion:^{
                         }];
                     } else if(result == LenVideoStitchResultSlowMore) {
-                        [SVProgressHUD showImage:[UIImage imageNamed:@""] status:@"特征点变少,放慢速度"];
+                        [SVProgressHUD showImage:[UIImage imageNamed:@""] status:@"移动速度过快,请匀速拍摄"];
                     } else if (result == LenVideoStitchResultSlow) {
-                        [SVProgressHUD showImage:[UIImage imageNamed:@""] status:@"特征点极少,即将失败"];
+                        [SVProgressHUD showImage:[UIImage imageNamed:@""] status:@"图像中目标物体较少,请对准货架进行拍摄"];
                     } else {
-                        [SVProgressHUD showImage:[UIImage imageNamed:@""] status:@"请勿往反方向移动"];
+//                        [SVProgressHUD showImage:[UIImage imageNamed:@""] status:@"请勿往反方向移动"];
                     }
                 }
                 

+ 1 - 0
LenzCameraNativeModuleForRN/Classes/inner/PCSBaseViewController/PCSPreviewViewController.h

@@ -16,6 +16,7 @@ typedef void(^PCSDataDidChangeBlock)(void);
 
 @property (nonatomic) PCSDataDidChangeBlock dataChangeBlock;
 @property (nonatomic) LenzCachedResourceModel *model;
+@property (nonatomic) SDKCaptureModeIndex selectIndex;
 
 @end
 

+ 4 - 4
LenzCameraNativeModuleForRN/Classes/inner/PCSBaseViewController/PCSPreviewViewController.m

@@ -220,20 +220,20 @@
 //    [self.view layoutIfNeeded];
 //    [self updateScrollWith:self.currentIndex];
     self.currentIndexPath = nil;
-    if (self.model.continousArray.count > 0) {
+    if (self.model.continousArray.count > 0 && self.selectIndex == SDK_CAPTURE_MODE_CONTINUOUS) {
         self.currentIndex = 1;
         self.currentIndexPath = [NSIndexPath indexPathForItem:self.model.continousArray.count - 1 inSection:0];
     }
-    if (self.model.movieArray.count > 0) {
+    if (self.model.movieArray.count > 0 && self.selectIndex == SDK_CAPTURE_MODE_MOVIE) {
         self.currentIndex = 2;
         self.currentIndexPath = [NSIndexPath indexPathForItem:self.model.movieArray.count - 1 inSection:1];
     }
-    if (self.model.panoramArray.count > 0) {
+    if (self.model.panoramArray.count > 0 && self.selectIndex == SDK_CAPTURE_MODE_PANORAMA) {
         self.currentIndex = 3;
         self.currentIndexPath = [NSIndexPath indexPathForItem:self.model.panoramArray.count - 1 inSection:2];
     }
     
-    if (self.model.aiPanoramArray.count > 0) {
+    if (self.model.aiPanoramArray.count > 0 && self.selectIndex == SDK_CAPTURE_MODE_INTELLEGENCE_PANORAMA) {
         self.currentIndex = 4;
         self.currentIndexPath = [NSIndexPath indexPathForItem:self.model.aiPanoramArray.count - 1 inSection:3];
     }

+ 1 - 1
LenzCameraNativeModuleForRN/Classes/inner/UI/ModeListView/PCSModeList.h

@@ -11,7 +11,7 @@
 
 NS_ASSUME_NONNULL_BEGIN
 
-typedef BOOL(^PCSModeListIndexChanged)(NSUInteger newIndex, NSUInteger oldIndex);
+typedef BOOL(^PCSModeListIndexChanged)(NSUInteger newMode, NSUInteger oldMode, NSUInteger newIndex);
 
 @interface PCSModeList : UIView
 

+ 2 - 2
LenzCameraNativeModuleForRN/Classes/inner/UI/ModeListView/PCSModeList.m

@@ -105,7 +105,7 @@
     if (oldIndex != self.index) {
         if(self.indexChangedHandler){
             
-            if (self.indexChangedHandler(self.selectMode, oldMode)) {
+            if (self.indexChangedHandler(self.selectMode, oldMode, self.index)) {
                 [self updateItemsConstraints];
             } else {
                 self.index = oldIndex;
@@ -193,7 +193,7 @@
             
             if (oldIndex != self.index) {
                 if(self.indexChangedHandler){
-                    if (self.indexChangedHandler(self.selectMode, oldMode)) {
+                    if (self.indexChangedHandler(self.selectMode, oldMode, self.index)) {
                         [self updateItemsConstraints];
                     } else {
                         self.index = oldIndex;

+ 1 - 1
LenzCameraNativeModuleForRN/Classes/inner/UI/PanoramaGuideView/PanoramaGuideView.m

@@ -521,7 +521,7 @@ CGFloat const PanoramaGuideViewWOrH = 120;
 
 - (YYLabel *)label{
     if (_label == nil) {
-        NSAttributedString *att = [[NSAttributedString alloc]initWithString:@"全景拍摄时请保持移动手机"];
+        NSAttributedString *att = [[NSAttributedString alloc]initWithString:@"请沿箭头方向匀速拍摄"];
         _label = [[YYLabel alloc]init];
         _label.numberOfLines = 0;
         _label.backgroundColor = [UIColor jk_colorWithHexString:@"000000" andAlpha:0.35];

+ 2 - 0
USEREDME.md

@@ -4,6 +4,8 @@
 ```
  platform :ios, '12.0'
 source 'https://github.com/CocoaPods/Specs.git'
+# source 'https://mirrors.tuna.tsinghua.edu.cn/git/CocoaPods/Specs.git' 国内源使用该种方式指定
+
 source 'http://39.96.8.150:10080/l405023944/LenzSDK_iOS.git'
 target 'Demo' do
   pod 'LenzSDK' ,'~> 1.0.0'

Some files were not shown because too many files changed in this diff