|
@@ -165,6 +165,9 @@
|
|
|
self.motionManager = [[CMMotionManager alloc]init];
|
|
|
self.motionManager.deviceMotionUpdateInterval = 1/5;
|
|
|
|
|
|
+ [self.view addSubview:self.panoramaGuideView];
|
|
|
+ [self panoramaOrientationViewslt:(PanoramaOrientationViewLeft)];
|
|
|
+ self.panoramaGuideView.hidden = YES;
|
|
|
|
|
|
if (!JK_IS_IPHONE_X) {
|
|
|
self.safeBottom.constant = 25;
|
|
@@ -262,6 +265,7 @@
|
|
|
|
|
|
self.ai_fullView.hidden = !(mode == SDK_CAPTURE_MODE_PANORAMA);
|
|
|
[strongSelf modeDidChange:newIndex oldIndex:oldIndex];
|
|
|
+ [strongSelf updateCaptureSessionWith:oldIndex];
|
|
|
if([oldModelNode respondsToSelector:@selector(didQuit)]){
|
|
|
[oldModelNode didQuit];
|
|
|
}
|
|
@@ -273,24 +277,6 @@
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-// if ([SDKParameters shared].retainedMode == SDK_DATA_RETAINED_RETAIN && !self.isContainSingleInReatinMode) {
|
|
|
-// //保留模式无单拍
|
|
|
-// __block NSInteger index = 0;
|
|
|
-// [[SDKParameters shared].modeIndices enumerateObjectsUsingBlock:^(NSNumber * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
|
|
-// if (idx > 0) {
|
|
|
-// index = obj.integerValue;
|
|
|
-// *stop = YES;
|
|
|
-// return;
|
|
|
-// }
|
|
|
-// }];
|
|
|
-// if (newIndex > 0) {
|
|
|
-// newIndex += index;
|
|
|
-// }
|
|
|
-// if (oldIndex > 0) {
|
|
|
-// oldIndex += index;
|
|
|
-// }
|
|
|
-// }
|
|
|
[strongSelf modeWillChange:newIndex oldIndex:oldIndex];
|
|
|
|
|
|
id<OperationNodeProtocol> oldModelNode = strongSelf.currentOperationNode;
|
|
@@ -299,13 +285,14 @@
|
|
|
|
|
|
self.ai_fullView.hidden = !(mode == SDK_CAPTURE_MODE_PANORAMA);
|
|
|
[strongSelf modeDidChange:newIndex oldIndex:oldIndex];
|
|
|
+ [strongSelf updateCaptureSessionWith:oldIndex];
|
|
|
if([oldModelNode respondsToSelector:@selector(didQuit)]){
|
|
|
[oldModelNode didQuit];
|
|
|
}
|
|
|
return YES;
|
|
|
};
|
|
|
|
|
|
-
|
|
|
+
|
|
|
[self modeWillChange:[SDKParameters shared].modeIndex oldIndex:0lu];
|
|
|
self.modeList.mode = [SDKParameters shared].modeIndex;
|
|
|
self.mode = [SDKParameters shared].modeIndex;
|
|
@@ -324,12 +311,12 @@
|
|
|
[self prepareCamera];
|
|
|
}
|
|
|
|
|
|
+ [self modeDidChange:[SDKParameters shared].modeIndex oldIndex:0lu];
|
|
|
+ [self updateCaptureSessionWith:0];
|
|
|
+
|
|
|
self.panGesture = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(panGestureHandler:)];
|
|
|
[self.view addGestureRecognizer:self.panGesture];
|
|
|
|
|
|
-// self.tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapGestureHandler:)];
|
|
|
-// self.tapGesture.delegate = self.tapDelegate;
|
|
|
-// [self.view addGestureRecognizer:self.tapGesture];
|
|
|
|
|
|
UIImageView* loadingImageView = [[UIImageView alloc] initWithImage:[UIImage sdkImageNamed:@"loading"]];
|
|
|
self.loadingIndicator = loadingImageView;
|
|
@@ -352,10 +339,6 @@
|
|
|
|
|
|
self.panoramOrientationGuideView.delegate = self;
|
|
|
|
|
|
- [self.view addSubview:self.panoramaGuideView];
|
|
|
- [self panoramaOrientationViewslt:(PanoramaOrientationViewLeft)];
|
|
|
- self.panoramaGuideView.hidden = YES;
|
|
|
-
|
|
|
|
|
|
self.ablumImageView = [[UIImageView alloc]init];
|
|
|
[self.view addSubview:self.ablumImageView];
|
|
@@ -653,7 +636,7 @@
|
|
|
}
|
|
|
|
|
|
item.keyFrame = dict[@"keyframe"];
|
|
|
- item.isRemake = dict[@"isRemake"];
|
|
|
+ item.isRemake = [dict[@"isRemake"] boolValue];
|
|
|
NSNumber *quantity = dict[@"quantity"];
|
|
|
if (quantity) {
|
|
|
item.quantity = [quantity integerValue];
|
|
@@ -1053,7 +1036,7 @@
|
|
|
}
|
|
|
|
|
|
- (void)showAlertForAuthorization{
|
|
|
- [self showAlertForAuthorizationWithText:@"请在系统设置里打开摄像机访问权限后重试"];
|
|
|
+// [self showAlertForAuthorizationWithText:@"请在系统设置里打开摄像机访问权限后重试"];
|
|
|
}
|
|
|
|
|
|
#pragma mark - Capture
|
|
@@ -1193,6 +1176,7 @@
|
|
|
});
|
|
|
[self stopMotion];
|
|
|
[self.panoramaGuideView showImageWith:nil dir:self.panoramOrientationGuideView.selectedItemIndex];
|
|
|
+ [self updateViewStatus];
|
|
|
|
|
|
}
|
|
|
- (void)updateViewStatusWhenStitchSave:(BOOL)isSaveIng {
|
|
@@ -1489,6 +1473,10 @@
|
|
|
[self.currentOperationNode willQuitOnCompletion:^() {}];
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
- (void)modeDidChange: (NSUInteger)newIndex oldIndex: (NSUInteger)oldIndex{
|
|
|
|
|
|
if(newIndex >= INT_MAX){
|
|
@@ -1503,7 +1491,7 @@
|
|
|
self.effectView.effect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleDark];
|
|
|
}];
|
|
|
}
|
|
|
- dispatch_async(dispatch_get_global_queue(0, 0), ^{
|
|
|
+// dispatch_async(dispatch_get_global_queue(0, 0), ^{
|
|
|
if(newIndex == SDK_CAPTURE_MODE_SINGLE || newIndex == SDK_CAPTURE_MODE_CONTINUOUS){
|
|
|
[[SDKParameters shared].items enumerateObjectsUsingBlock:^(SDKParametersItem * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
|
|
if (obj.model == self.mode) {
|
|
@@ -1512,8 +1500,6 @@
|
|
|
}
|
|
|
}];
|
|
|
|
|
|
-// [[CameraManager shared] setResolutionFor:AVCaptureDevicePositionBack with:self.parameters.resolution.height];
|
|
|
-// [[CameraManager shared] setResolutionFor:AVCaptureDevicePositionFront with:self.parameters.resolution.height];
|
|
|
}
|
|
|
else{
|
|
|
[[SDKParameters shared].items enumerateObjectsUsingBlock:^(SDKParametersItem * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
|
@@ -1525,37 +1511,42 @@
|
|
|
|
|
|
}
|
|
|
|
|
|
- PhotographModeEnum oldModeEnum = (PhotographModeEnum)(oldIndex);
|
|
|
- if((self.mode == SDK_CAPTURE_MODE_PANORAMA || self.mode == SDK_CAPTURE_MODE_INTELLEGENCE_PANORAMA)
|
|
|
- && oldModeEnum != SDK_CAPTURE_MODE_PANORAMA
|
|
|
- && oldModeEnum != SDK_CAPTURE_MODE_INTELLEGENCE_PANORAMA){
|
|
|
-
|
|
|
- if([self.captureSession canAddOutput:self.videoDataOutput]){
|
|
|
- [self.captureSession addOutput:self.videoDataOutput];
|
|
|
- [self.captureSession removeOutput:self.movieFileOutput];
|
|
|
- }
|
|
|
- }
|
|
|
- else if((self.mode == SDK_CAPTURE_MODE_MOVIE)
|
|
|
- && (oldModeEnum == SDK_CAPTURE_MODE_PANORAMA
|
|
|
- || oldModeEnum == SDK_CAPTURE_MODE_INTELLEGENCE_PANORAMA)){
|
|
|
-
|
|
|
- if([self.captureSession canAddOutput:self.movieFileOutput]){
|
|
|
- [self.captureSession addOutput:self.movieFileOutput];
|
|
|
- [self.captureSession removeOutput:self.videoDataOutput];
|
|
|
- }
|
|
|
- }
|
|
|
|
|
|
- dispatch_sync(dispatch_get_main_queue(), ^{
|
|
|
+// dispatch_sync(dispatch_get_main_queue(), ^{
|
|
|
// self.modeList.userInteractionEnabled = YES;
|
|
|
self.effectView.effect = nil;
|
|
|
- });
|
|
|
- });
|
|
|
+// });
|
|
|
+// });
|
|
|
[self updateUIByMode];
|
|
|
[self switchDevicePositionBack];
|
|
|
[self updateNumberLabel];
|
|
|
|
|
|
}
|
|
|
|
|
|
+- (void)updateCaptureSessionWith:(NSInteger)oldIndex {
|
|
|
+ PhotographModeEnum oldModeEnum = (PhotographModeEnum)(oldIndex);
|
|
|
+ if((self.mode == SDK_CAPTURE_MODE_PANORAMA || self.mode == SDK_CAPTURE_MODE_INTELLEGENCE_PANORAMA)
|
|
|
+ && oldModeEnum != SDK_CAPTURE_MODE_PANORAMA
|
|
|
+ && oldModeEnum != SDK_CAPTURE_MODE_INTELLEGENCE_PANORAMA){
|
|
|
+
|
|
|
+ if([self.captureSession canAddOutput:self.videoDataOutput]){
|
|
|
+ [self.captureSession addOutput:self.videoDataOutput];
|
|
|
+ [self.captureSession removeOutput:self.movieFileOutput];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if((self.mode == SDK_CAPTURE_MODE_MOVIE)
|
|
|
+ && (oldModeEnum == SDK_CAPTURE_MODE_PANORAMA
|
|
|
+ || oldModeEnum == SDK_CAPTURE_MODE_INTELLEGENCE_PANORAMA)){
|
|
|
+
|
|
|
+ if([self.captureSession canAddOutput:self.movieFileOutput]){
|
|
|
+ [self.captureSession addOutput:self.movieFileOutput];
|
|
|
+ [self.captureSession removeOutput:self.videoDataOutput];
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
- (void)setupMicrophone{
|
|
|
NSError* audioError = nil;
|
|
|
AVCaptureDevice* audioDevice = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeAudio];
|
|
@@ -2167,6 +2158,46 @@
|
|
|
- (void)updateViewStatus {
|
|
|
dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
UIImage *image = nil;
|
|
|
+ NSMutableArray *continousMutArray = [NSMutableArray array];
|
|
|
+ [self.resourceModel.continousArray enumerateObjectsUsingBlock:^(LenzResourceItemModel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
|
|
+ if (obj.path && obj.image) {
|
|
|
+ [continousMutArray addObject:obj];
|
|
|
+ }
|
|
|
+ }];
|
|
|
+ self.resourceModel.continousArray = continousMutArray;
|
|
|
+
|
|
|
+ NSMutableArray *singleMutArray = [NSMutableArray array];
|
|
|
+ [self.resourceModel.singleArray enumerateObjectsUsingBlock:^(LenzResourceItemModel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
|
|
+ if (obj.path && obj.image) {
|
|
|
+ [singleMutArray addObject:obj];
|
|
|
+ }
|
|
|
+ }];
|
|
|
+ self.resourceModel.singleArray = singleMutArray;
|
|
|
+
|
|
|
+ NSMutableArray *movieMutArray = [NSMutableArray array];
|
|
|
+ [self.resourceModel.movieArray enumerateObjectsUsingBlock:^(LenzResourceItemModel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
|
|
+ if (obj.path && obj.image) {
|
|
|
+ [movieMutArray addObject:obj];
|
|
|
+ }
|
|
|
+ }];
|
|
|
+ self.resourceModel.movieArray = movieMutArray;
|
|
|
+
|
|
|
+ NSMutableArray *panoramMutArray = [NSMutableArray array];
|
|
|
+ [self.resourceModel.panoramArray enumerateObjectsUsingBlock:^(LenzResourceItemModel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
|
|
+ if (obj.path && obj.image) {
|
|
|
+ [panoramMutArray addObject:obj];
|
|
|
+ }
|
|
|
+ }];
|
|
|
+ self.resourceModel.panoramArray = panoramMutArray;
|
|
|
+
|
|
|
+ NSMutableArray *aiPanoramMutArray = [NSMutableArray array];
|
|
|
+ [self.resourceModel.aiPanoramArray enumerateObjectsUsingBlock:^(LenzResourceItemModel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
|
|
+ if (obj.path && obj.image) {
|
|
|
+ [aiPanoramMutArray addObject:obj];
|
|
|
+ }
|
|
|
+ }];
|
|
|
+ self.resourceModel.aiPanoramArray = aiPanoramMutArray;
|
|
|
+
|
|
|
switch (self.resourceModel.lastIndex) {
|
|
|
case SDK_CAPTURE_MODE_CONTINUOUS: {
|
|
|
if (self.resourceModel.continousArray.count > 0) {
|