@@ -14,7 +14,7 @@ public class IONCAMRTakePhotoOptions: IONCAMRMediaOptions, Decodable {
1414 let encodingType : IONCAMREncodingType
1515
1616 private enum CodingKeys : String , CodingKey {
17- case quality, width, height, correctOrientation, encodingType, saveToGallery, cameraDirection, allowEdit, includeMetadata
17+ case quality, width, height, correctOrientation, encodingType, saveToGallery, cameraDirection, allowEdit, includeMetadata, presentationStyle
1818 }
1919
2020 required public convenience init ( from decoder: Decoder ) throws {
@@ -26,30 +26,20 @@ public class IONCAMRTakePhotoOptions: IONCAMRMediaOptions, Decodable {
2626
2727 let quality = try container. decodeIfPresent ( Int . self, forKey: . quality) ?? 90
2828 if quality < 0 || quality > 100 { throw throwError ( field: " quality " ) }
29-
3029 var size : IONCAMRSize ? = nil
3130 let width = try container. decodeIfPresent ( Int . self, forKey: . width)
3231 let height = try container. decodeIfPresent ( Int . self, forKey: . height)
3332 if let width = width, let height = height {
3433 size = try IONCAMRSize ( width: width, height: height)
3534 }
36-
3735 let correctOrientation = try container. decodeIfPresent ( Bool . self, forKey: . correctOrientation) ?? false
38- guard
39- let encodingType = IONCAMREncodingType ( rawValue: try container. decodeIfPresent ( Int . self, forKey: . encodingType) ?? 0 )
40- else {
41- throw throwError ( field: " encodingType " )
42- }
43-
36+ let encodingType = try container. decodeIfPresent ( IONCAMREncodingType . self, forKey: . encodingType) ?? . jpeg
4437 let saveToGallery = try container. decodeIfPresent ( Bool . self, forKey: . saveToGallery) ?? false
45- guard
46- let cameraDirection = IONCAMRDirection ( rawValue: try container. decodeIfPresent ( String . self, forKey: . cameraDirection) ?? IONCAMRDirection . back. rawValue)
47- else {
48- throw throwError ( field: " cameraDirection " )
49- }
50-
38+ let cameraDirection = try container. decodeIfPresent ( IONCAMRDirection . self, forKey: . cameraDirection) ?? . back
5139 let allowEdit = try container. decodeIfPresent ( Bool . self, forKey: . allowEdit) ?? false
5240 let includeMetadata = try container. decodeIfPresent ( Bool . self, forKey: . includeMetadata) ?? false
41+ let presentationStyle = try container. decodeIfPresent ( IONCAMRPresentationStyle . self, forKey: . presentationStyle) ?? . fullScreen
42+
5343 try self . init (
5444 quality: quality,
5545 size: size,
@@ -58,7 +48,8 @@ public class IONCAMRTakePhotoOptions: IONCAMRMediaOptions, Decodable {
5848 saveToGallery: saveToGallery,
5949 cameraDirection: cameraDirection,
6050 allowEdit: allowEdit,
61- returnMetadata: includeMetadata
51+ returnMetadata: includeMetadata,
52+ presentationStyle: presentationStyle
6253 )
6354 }
6455
@@ -70,7 +61,8 @@ public class IONCAMRTakePhotoOptions: IONCAMRMediaOptions, Decodable {
7061 saveToGallery: Bool ,
7162 cameraDirection: IONCAMRDirection ,
7263 allowEdit: Bool ,
73- returnMetadata: Bool
64+ returnMetadata: Bool ,
65+ presentationStyle: IONCAMRPresentationStyle = . fullScreen
7466 ) throws {
7567 func throwError( field: String ) -> IONCAMRTakePhotoOptionsError {
7668 IONCAMRTakePhotoOptionsError . invalid ( field: field)
@@ -85,8 +77,14 @@ public class IONCAMRTakePhotoOptions: IONCAMRMediaOptions, Decodable {
8577 self . size = size
8678 self . correctOrientation = correctOrientation
8779 self . encodingType = encodingType
80+ self . presentationStyle = presentationStyle
8881 super. init (
89- mediaType: . picture, saveToGallery: saveToGallery, returnMetadata: returnMetadata, direction: cameraDirection, allowEdit: allowEdit
82+ mediaType: . picture,
83+ saveToGallery: saveToGallery,
84+ returnMetadata: returnMetadata,
85+ direction: cameraDirection,
86+ allowEdit: allowEdit,
87+ presentationStyle: presentationStyle
9088 )
9189 }
9290}
0 commit comments