Skip to content
This repository was archived by the owner on Jan 6, 2024. It is now read-only.

Commit b27bd4d

Browse files
committed
Dark mode support
1 parent 2778289 commit b27bd4d

File tree

10 files changed

+57
-37
lines changed

10 files changed

+57
-37
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ Changelog
33

44
### 3.2.0
55

6+
- Dark mode support for default configuration
67
- Code refactoring
78
- Bump to FBSDK 5.13.0
89
- Use Swift Result

Example/GBHFacebookImagePicker/Base.lproj/Main.storyboard

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="12120" systemVersion="16E195" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="TwI-AC-imH">
3-
<device id="retina4_7" orientation="portrait">
4-
<adaptation id="fullscreen"/>
5-
</device>
2+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="15505" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="TwI-AC-imH">
3+
<device id="retina4_7" orientation="portrait" appearance="light"/>
64
<dependencies>
7-
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12088"/>
8-
<capability name="Constraints to layout margins" minToolsVersion="6.0"/>
5+
<deployment identifier="iOS"/>
6+
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15509"/>
97
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
108
</dependencies>
119
<scenes>
@@ -29,18 +27,18 @@
2927
<state key="normal" title="Show album"/>
3028
</button>
3129
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" rowHeight="206" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="Ktn-az-bka">
32-
<rect key="frame" x="0.0" y="64" width="375" height="525"/>
30+
<rect key="frame" x="0.0" y="44" width="375" height="545"/>
3331
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
3432
<prototypes>
3533
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" reuseIdentifier="ImageCellId" rowHeight="206" id="RCu-0z-Obr" customClass="PhotoTableViewCell" customModule="GBHFacebookImagePicker_Example" customModuleProvider="target">
3634
<rect key="frame" x="0.0" y="28" width="375" height="206"/>
3735
<autoresizingMask key="autoresizingMask"/>
3836
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="RCu-0z-Obr" id="5Fm-2I-MW8">
39-
<rect key="frame" x="0.0" y="0.0" width="375" height="205.5"/>
37+
<rect key="frame" x="0.0" y="0.0" width="375" height="206"/>
4038
<autoresizingMask key="autoresizingMask"/>
4139
<subviews>
4240
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="ePs-7W-KPn">
43-
<rect key="frame" x="8" y="8" width="359" height="190"/>
41+
<rect key="frame" x="15" y="11" width="345" height="184"/>
4442
</imageView>
4543
</subviews>
4644
<constraints>
@@ -74,7 +72,7 @@
7472
</view>
7573
<navigationItem key="navigationItem" id="ppu-N5-N0M">
7674
<barButtonItem key="rightBarButtonItem" systemItem="trash" id="sSS-Ki-sdl">
77-
<color key="tintColor" white="0.0" alpha="1" colorSpace="calibratedWhite"/>
75+
<color key="tintColor" systemColor="labelColor" cocoaTouchSystemColor="darkTextColor"/>
7876
<connections>
7977
<action selector="doDeleteClick:" destination="7CW-VE-VXJ" id="Wea-Ng-V7K"/>
8078
</connections>

GBHFacebookImagePicker/Classes/Controller/AlbumList/FacebookAlbumController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ final class FacebookAlbumController: UIViewController {
5454

5555
private func prepareCloseButton() {
5656
let closeButton = UIBarButtonItem(barButtonSystemItem: .stop, target: self, action: #selector(self.closePicker))
57-
closeButton.tintColor = FacebookImagePicker.pickerConfig.uiConfig.closeButtonColor ?? .black
57+
closeButton.tintColor = FacebookImagePicker.pickerConfig.uiConfig.closeButtonColor
5858
self.navigationItem.rightBarButtonItem = closeButton
5959
}
6060

GBHFacebookImagePicker/Classes/Controller/ContentStateViewController/LoadingViewController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ final class LoadingViewController: UIViewController {
1313
// MARK: - Var
1414

1515
private lazy var activityIndicator: UIActivityIndicatorView = {
16-
let activityIndicator = UIActivityIndicatorView(style: UIActivityIndicatorView.Style.gray)
16+
let activityIndicator = UIActivityIndicatorView(style: Styles().loaderStyle)
1717
activityIndicator.startAnimating()
1818
return activityIndicator
1919
}()

GBHFacebookImagePicker/Classes/Model/Colors.swift

Lines changed: 0 additions & 17 deletions
This file was deleted.

GBHFacebookImagePicker/Classes/Model/FacebookPickerConfig.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@ public struct FacebookPickerConfig {
2727
public var navTintColor: UIColor?
2828

2929
/// Will be applied to the navigation bar
30-
public var backgroundColor: UIColor = .white
30+
public var backgroundColor: UIColor = Styles().backgroundColor
3131

3232
/// Will be applied to the navigation bar
33-
public var closeButtonColor: UIColor?
33+
public var closeButtonColor: UIColor = Styles().label
3434

3535
/// Will be applied to album's title color
36-
public var albumsTitleColor: UIColor?
36+
public var albumsTitleColor: UIColor = Styles().label
3737

3838
/// Will be applied to album's pictures number
3939
public var albumsCountColor: UIColor?
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
//
2+
// Styles.swift
3+
// GBHFacebookImagePicker
4+
//
5+
// Created by Florian Gabach on 07/10/2016.
6+
// Copyright (c) 2016 Florian Gabach <[email protected]>
7+
8+
struct Styles {
9+
// White color : http://www.color-hex.com/color/ffffff
10+
static let whiteCustom = UIColor(red: 246/255.0, green: 246/255.0, blue: 246/255.0, alpha: 1.0)
11+
12+
// Facebook color : http://www.color-hex.com/color/3b5998
13+
static let facebookColor = UIColor(red: 59/255.0, green: 89/255.0, blue: 152/255.0, alpha: 1.0)
14+
15+
// Black color : http://www.color-hex.com/color/000000
16+
var label: UIColor {
17+
if #available(iOS 13.0, *) {
18+
return UIColor.label
19+
} else {
20+
return UIColor.black
21+
}
22+
}
23+
24+
var backgroundColor: UIColor {
25+
if #available(iOS 13.0, *) {
26+
return UIColor.systemBackground
27+
} else {
28+
return UIColor.white
29+
}
30+
}
31+
32+
var loaderStyle: UIActivityIndicatorView.Style {
33+
if #available(iOS 13.0, *) {
34+
return UIActivityIndicatorView.Style.medium
35+
} else {
36+
return UIActivityIndicatorView.Style.gray
37+
}
38+
}
39+
}

GBHFacebookImagePicker/Classes/View/AlbumTableViewCell.swift

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,10 @@ final class AlbumTableViewCell: UITableViewCell, Reusable {
4949

5050
// Album title label
5151
self.textLabel?.font = UIFont.boldSystemFont(ofSize: 16)
52-
self.textLabel?.textColor = FacebookImagePicker.pickerConfig.uiConfig.albumsTitleColor ?? .black
52+
self.textLabel?.textColor = FacebookImagePicker.pickerConfig.uiConfig.albumsTitleColor
5353

54-
// Photo count label
55-
let defaultColor = UIColor.lightGray
56-
self.detailTextLabel?.textColor = FacebookImagePicker.pickerConfig.uiConfig.albumsCountColor ?? defaultColor
54+
// Photo count label
55+
self.detailTextLabel?.textColor = FacebookImagePicker.pickerConfig.uiConfig.albumsCountColor ?? UIColor.lightGray
5756
}
5857

5958
required init?(coder aDecoder: NSCoder) {

GBHFacebookImagePicker/Classes/View/SelectedView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ final class SelectedView: UIView {
5757

5858
// Checkmark background color
5959
let customColor = FacebookImagePicker.pickerConfig.uiConfig.checkViewBackgroundColor
60-
let backgroundColor = customColor ?? Colors.facebookColor
60+
let backgroundColor = customColor ?? Styles.facebookColor
6161

6262
self.checkMarkView?.layer.borderWidth = 1.5
6363
self.checkMarkView?.layer.borderColor = UIColor.white.cgColor

0 commit comments

Comments
 (0)