ZLPhotoConfiguration.m
4.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
//
// ZLPhotoConfiguration.m
// ZLPhotoBrowser
//
// Created by long on 2017/11/16.
// Copyright © 2017年 long. All rights reserved.
//
#import "ZLPhotoConfiguration.h"
@implementation ZLPhotoConfiguration
- (void)dealloc
{
[[NSUserDefaults standardUserDefaults] removeObjectForKey:ZLCustomImageNames];
[[NSUserDefaults standardUserDefaults] removeObjectForKey:ZLLanguageTypeKey];
[[NSUserDefaults standardUserDefaults] removeObjectForKey:ZLCustomLanguageKeyValue];
[[NSUserDefaults standardUserDefaults] synchronize];
// NSLog(@"---- %s", __FUNCTION__);
}
+ (instancetype)defaultPhotoConfiguration
{
ZLPhotoConfiguration *configuration = [ZLPhotoConfiguration new];
configuration.statusBarStyle = UIStatusBarStyleLightContent;
configuration.maxSelectCount = 9;
configuration.maxPreviewCount = 20;
configuration.cellCornerRadio = .0;
configuration.allowMixSelect = YES;
configuration.allowSelectImage = YES;
configuration.allowSelectVideo = YES;
configuration.allowSelectGif = YES;
configuration.allowSelectLivePhoto = NO;
configuration.allowTakePhotoInLibrary = YES;
configuration.allowForceTouch = YES;
configuration.allowEditImage = YES;
configuration.allowEditVideo = NO;
configuration.allowSelectOriginal = YES;
configuration.maxEditVideoTime = 10;
configuration.maxVideoDuration = 120;
configuration.allowSlideSelect = YES;
configuration.allowDragSelect = NO;
configuration.clipRatios = @[GetCustomClipRatio(),
GetClipRatio(1, 1),
GetClipRatio(4, 3),
GetClipRatio(3, 2),
GetClipRatio(16, 9)];
configuration.editAfterSelectThumbnailImage = NO;
configuration.saveNewImageAfterEdit = YES;
configuration.showCaptureImageOnTakePhotoBtn = YES;
configuration.sortAscending = YES;
configuration.showSelectBtn = NO;
configuration.navBarColor = kRGB(19, 153, 231);
// configuration.navBarColor = COLOR_C_NAVColor;
configuration.navTitleColor = [UIColor whiteColor];
configuration.bottomViewBgColor = [UIColor whiteColor];
configuration.bottomBtnsNormalTitleColor = kRGB(80, 180, 234);
// configuration.bottomBtnsNormalTitleColor = COLOR_C_mainColor;
configuration.bottomBtnsDisableBgColor = kRGB(200, 200, 200);
configuration.showSelectedMask = NO;
configuration.selectedMaskColor = [UIColor blackColor];
configuration.customImageNames = nil;
configuration.shouldAnialysisAsset = YES;
configuration.languageType = ZLLanguageSystem;
configuration.useSystemCamera = NO;
configuration.allowRecordVideo = YES;
configuration.maxRecordDuration = 10;
configuration.sessionPreset = ZLCaptureSessionPreset1920x1080;
configuration.exportVideoType = ZLExportVideoTypeMp4;
return configuration;
}
- (void)setMaxSelectCount:(NSInteger)maxSelectCount
{
_maxSelectCount = MAX(maxSelectCount, 1);
}
- (BOOL)showSelectBtn
{
return _maxSelectCount > 1 ? YES : _showSelectBtn;
}
- (void)setAllowSelectLivePhoto:(BOOL)allowSelectLivePhoto
{
if (@available(iOS 9.0, *)) {
_allowSelectLivePhoto = allowSelectLivePhoto;
} else {
_allowSelectLivePhoto = NO;
}
}
- (void)setMaxEditVideoTime:(NSInteger)maxEditVideoTime
{
_maxEditVideoTime = MAX(maxEditVideoTime, 10);
}
- (void)setCustomImageNames:(NSArray<NSString *> *)customImageNames
{
[[NSUserDefaults standardUserDefaults] setValue:customImageNames forKey:ZLCustomImageNames];
[[NSUserDefaults standardUserDefaults] synchronize];
}
- (void)setLanguageType:(ZLLanguageType)languageType
{
[[NSUserDefaults standardUserDefaults] setValue:@(languageType) forKey:ZLLanguageTypeKey];
[[NSUserDefaults standardUserDefaults] synchronize];
[NSBundle resetLanguage];
}
- (void)setCustomLanguageKeyValue:(NSDictionary<NSString *,NSString *> *)customLanguageKeyValue
{
[[NSUserDefaults standardUserDefaults] setValue:customLanguageKeyValue forKey:ZLCustomLanguageKeyValue];
[[NSUserDefaults standardUserDefaults] synchronize];
}
- (void)setMaxRecordDuration:(NSInteger)maxRecordDuration
{
_maxRecordDuration = MAX(maxRecordDuration, 1);
}
@end