Skip to content
This repository was archived by the owner on Oct 4, 2023. It is now read-only.

Commit 4a1bdbc

Browse files
authored
Adding support for dark mode in limited permission help (ivpusic#1680)
1 parent cd26484 commit 4a1bdbc

File tree

3 files changed

+19
-6
lines changed

3 files changed

+19
-6
lines changed

ios/QBImagePicker/QBImagePicker/QBAlbumsViewController.m

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,14 @@ static bool isLimitedPermission() {
2929
return false;
3030
}
3131

32+
static bool isDarkMode() {
33+
if (@available(iOS 13.0, *)) {
34+
UITraitCollection *current = UITraitCollection.currentTraitCollection;
35+
return current.userInterfaceStyle == UIUserInterfaceStyleDark;
36+
}
37+
return false;
38+
}
39+
3240
@interface QBImagePickerController (Private)
3341

3442
@property (nonatomic, strong) NSBundle *assetBundle;
@@ -317,11 +325,16 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
317325
UITableViewCell *cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:nil];
318326
cell.tag = indexPath.row;
319327
cell.selectionStyle = UITableViewCellSelectionStyleNone;
320-
[cell setBackgroundColor:[UIColor colorWithRed: 0.97 green: 0.97 blue: 0.97 alpha: 1.00]];
321-
322328
UIButton *manageButton = [UIButton buttonWithType:UIButtonTypeSystem];
323-
[manageButton setBackgroundColor:[UIColor colorWithRed: 0.87 green: 0.87 blue: 0.87 alpha: 1.00]];
324-
[manageButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
329+
if (isDarkMode()) {
330+
[cell setBackgroundColor:[UIColor colorWithRed: 0.03 green: 0.03 blue: 0.03 alpha: 1.00]];
331+
[manageButton setBackgroundColor:[UIColor colorWithRed: 0.13 green: 0.13 blue: 0.13 alpha: 1.00]];
332+
[manageButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
333+
} else {
334+
[cell setBackgroundColor:[UIColor colorWithRed: 0.95 green: 0.95 blue: 0.95 alpha: 1.00]];
335+
[manageButton setBackgroundColor:[UIColor colorWithRed: 0.85 green: 0.85 blue: 0.85 alpha: 1.00]];
336+
[manageButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
337+
}
325338
[manageButton addTarget:self action:@selector(managePermissionAction:) forControlEvents:UIControlEventTouchUpInside];
326339
manageButton.layer.cornerRadius = 12;
327340
manageButton.contentEdgeInsets = UIEdgeInsetsMake(4, 12, 4, 12);

ios/QBImagePicker/QBImagePicker/ja.lproj/QBImagePicker.strings

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"assets.toolbar.items-selected" = "%ld 項目を選択中";
2222

2323
"permission.help" = "選択した限られた数の写真とビデオに許可を与えました。";
24-
"permission.manage" = "MANAGE";
24+
"permission.manage" = "管理";
2525
"permission.title" = "アプリ内のすべての写真にアクセスするには、デバイス設定でライブラリ全体へのアクセスを許可します。";
2626
"permission.choose_more" = "写真をもっと選択";
2727
"permission.change_settings" = "設定の変更";

ios/QBImagePicker/QBImagePicker/zh-Hans.lproj/QBImagePicker.strings

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"assets.toolbar.items-selected" = "选择了%ld项";
2222

2323
"permission.help" = "您已授予有限数量的选定照片和视频的权限。";
24-
"permission.manage" = "MANAGE";
24+
"permission.manage" = "管理";
2525
"permission.title" = "要访问您在应用程序中的所有照片,请在设备设置中授予访问您的完整图库的权限。";
2626
"permission.choose_more" = "选择更多照片";
2727
"permission.change_settings" = "更改设置";

0 commit comments

Comments
 (0)