Skip to content

Commit

Permalink
Merge pull request #80 from nohana/release/0.8.0
Browse files Browse the repository at this point in the history
Release/0.8.0
  • Loading branch information
haranicle authored Jun 17, 2017
2 parents 0e98d5a + 919d6d6 commit cf3868f
Show file tree
Hide file tree
Showing 39 changed files with 177 additions and 139 deletions.
20 changes: 20 additions & 0 deletions Demo/Assets.xcassets/AppIcon.appiconset/Contents.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
{
"images" : [
{
"idiom" : "iphone",
"size" : "20x20",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "20x20",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "29x29",
Expand Down Expand Up @@ -32,6 +42,16 @@
"filename" : "180.png",
"scale" : "3x"
},
{
"idiom" : "ipad",
"size" : "20x20",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "20x20",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "29x29",
Expand Down
19 changes: 17 additions & 2 deletions Demo/DemoListViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ class DemoListViewController: UITableViewController, NohanaImagePickerController
Cell(title: "Large thumbnail", selector: #selector(DemoListViewController.showLargeThumbnailPicker)),
Cell(title: "No toolbar", selector: #selector(DemoListViewController.showNoToolbarPicker)),
Cell(title: "Disable to pick assets", selector: #selector(DemoListViewController.showDisableToPickAssetsPicker)),
Cell(title: "Custom UI", selector: #selector(DemoListViewController.showCustomUIPicker)),
]

override func viewDidAppear(_ animated: Bool) {
Expand All @@ -38,6 +39,10 @@ class DemoListViewController: UITableViewController, NohanaImagePickerController
}
}

override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
}

override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return cells.count
}
Expand All @@ -60,8 +65,6 @@ class DemoListViewController: UITableViewController, NohanaImagePickerController
}
})
}


}

// MARK: - Photos
Expand Down Expand Up @@ -123,6 +126,18 @@ class DemoListViewController: UITableViewController, NohanaImagePickerController
present(picker, animated: true, completion: nil)
}

@objc
func showCustomUIPicker() {
let picker = NohanaImagePickerController()
picker.delegate = self
picker.config.color.background = UIColor(red: 0xcc/0xff, green: 0xff/0xff, blue: 0xff/0xff, alpha: 1)
picker.config.color.separator = UIColor(red: 0x00/0xff, green: 0x66/0xff, blue: 0x66/0xff, alpha: 1)
picker.config.strings.albumListTitle = "🏞"
picker.config.image.droppedSmall = UIImage(named: "btn_select_m")
picker.config.image.pickedSmall = UIImage(named: "btn_selected_m")
present(picker, animated: true, completion: nil)
}

// MARK: - NohanaImagePickerControllerDelegate

func nohanaImagePickerDidCancel(_ picker: NohanaImagePickerController) {
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion NohanaImagePicker.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'NohanaImagePicker'
s.version = '0.7.1'
s.version = '0.8.0'
s.summary = 'A multiple image picker for iOS app.'
s.homepage = 'https://github.com/nohana/NohanaImagePicker'
s.license = { :type => 'Apache License v2', :file => 'LICENSE' }
Expand Down
31 changes: 19 additions & 12 deletions NohanaImagePicker.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
objects = {

/* Begin PBXBuildFile section */
F202573A1C7343D20069B33A /* ImageName.swift in Sources */ = {isa = PBXBuildFile; fileRef = F20257391C7343D20069B33A /* ImageName.swift */; };
3569CAA91EC1918E000C41C0 /* NohanaImagePicker.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 3569CAA61EC1918E000C41C0 /* NohanaImagePicker.xcassets */; };
F202573C1C7418920069B33A /* PickedAssetList.swift in Sources */ = {isa = PBXBuildFile; fileRef = F202573B1C7418920069B33A /* PickedAssetList.swift */; };
F208E5541CD7370B00FFC9F6 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = F208E5531CD7370B00FFC9F6 /* AppDelegate.swift */; };
F208E5591CD7370B00FFC9F6 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F208E5571CD7370B00FFC9F6 /* Main.storyboard */; };
Expand All @@ -21,14 +21,13 @@
F218D7DE1C6C3A5B001FCED1 /* AlbumCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = F218D7DD1C6C3A5B001FCED1 /* AlbumCell.swift */; };
F23554261C69D19C00796DCA /* NohanaImagePicker.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F23554251C69D19C00796DCA /* NohanaImagePicker.storyboard */; };
F23554281C69D5DB00796DCA /* NohanaImagePickerController.swift in Sources */ = {isa = PBXBuildFile; fileRef = F23554271C69D5DB00796DCA /* NohanaImagePickerController.swift */; };
F237249B1C6DCF96005D1E8A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = F237249A1C6DCF96005D1E8A /* Images.xcassets */; };
F237249B1C6DCF96005D1E8A /* NohanaImagePicker.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = F237249A1C6DCF96005D1E8A /* NohanaImagePicker.xcassets */; };
F23CC89E1CB745C800BCE443 /* ActivityIndicatable.swift in Sources */ = {isa = PBXBuildFile; fileRef = F23CC89D1CB745C800BCE443 /* ActivityIndicatable.swift */; };
F24EB6901C68AEED0002EC86 /* AlbumListViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = F24EB68F1C68AEED0002EC86 /* AlbumListViewController.swift */; };
F25C10C21C8ED9BF007453C3 /* MomentViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = F25C10C11C8ED9BF007453C3 /* MomentViewController.swift */; };
F25C69881CA23A0A005935D6 /* MomentCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = F25C69871CA23A0A005935D6 /* MomentCell.swift */; };
F25C69901CA27311005935D6 /* EmptyIndicatable.swift in Sources */ = {isa = PBXBuildFile; fileRef = F25C698F1CA27311005935D6 /* EmptyIndicatable.swift */; };
F25C69921CA28728005935D6 /* AlbumListEmptyIndicator.swift in Sources */ = {isa = PBXBuildFile; fileRef = F25C69911CA28728005935D6 /* AlbumListEmptyIndicator.swift */; };
F25C699B1CA2B79A005935D6 /* ColorConfig.swift in Sources */ = {isa = PBXBuildFile; fileRef = F25C699A1CA2B79A005935D6 /* ColorConfig.swift */; };
F26775DE1C701FA7002E786C /* ItemList.swift in Sources */ = {isa = PBXBuildFile; fileRef = F26775DD1C701FA7002E786C /* ItemList.swift */; };
F26775E11C7046C7002E786C /* ExpandingAnimationController.swift in Sources */ = {isa = PBXBuildFile; fileRef = F26775E01C7046C7002E786C /* ExpandingAnimationController.swift */; };
F26775E51C70574F002E786C /* AnimatableNavigationController.swift in Sources */ = {isa = PBXBuildFile; fileRef = F26775E41C70574F002E786C /* AnimatableNavigationController.swift */; };
Expand Down Expand Up @@ -71,7 +70,8 @@
/* End PBXCopyFilesBuildPhase section */

/* Begin PBXFileReference section */
F20257391C7343D20069B33A /* ImageName.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ImageName.swift; sourceTree = "<group>"; };
3569CAA61EC1918E000C41C0 /* NohanaImagePicker.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = NohanaImagePicker.xcassets; sourceTree = "<group>"; };
3590F1F51EC1A79400F32E06 /* ru */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ru; path = ru.lproj/NohanaImagePicker.strings; sourceTree = "<group>"; };
F202573B1C7418920069B33A /* PickedAssetList.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PickedAssetList.swift; sourceTree = "<group>"; };
F208E5511CD7370B00FFC9F6 /* Demo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Demo.app; sourceTree = BUILT_PRODUCTS_DIR; };
F208E5531CD7370B00FFC9F6 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
Expand All @@ -85,14 +85,13 @@
F218D7DD1C6C3A5B001FCED1 /* AlbumCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AlbumCell.swift; sourceTree = "<group>"; };
F23554251C69D19C00796DCA /* NohanaImagePicker.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = NohanaImagePicker.storyboard; sourceTree = "<group>"; };
F23554271C69D5DB00796DCA /* NohanaImagePickerController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NohanaImagePickerController.swift; sourceTree = "<group>"; };
F237249A1C6DCF96005D1E8A /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = "<group>"; };
F237249A1C6DCF96005D1E8A /* NohanaImagePicker.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = NohanaImagePicker.xcassets; sourceTree = "<group>"; };
F23CC89D1CB745C800BCE443 /* ActivityIndicatable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ActivityIndicatable.swift; sourceTree = "<group>"; };
F24EB68F1C68AEED0002EC86 /* AlbumListViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AlbumListViewController.swift; sourceTree = "<group>"; };
F25C10C11C8ED9BF007453C3 /* MomentViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MomentViewController.swift; sourceTree = "<group>"; };
F25C69871CA23A0A005935D6 /* MomentCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MomentCell.swift; sourceTree = "<group>"; };
F25C698F1CA27311005935D6 /* EmptyIndicatable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = EmptyIndicatable.swift; sourceTree = "<group>"; };
F25C69911CA28728005935D6 /* AlbumListEmptyIndicator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AlbumListEmptyIndicator.swift; sourceTree = "<group>"; };
F25C699A1CA2B79A005935D6 /* ColorConfig.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ColorConfig.swift; sourceTree = "<group>"; };
F26775DD1C701FA7002E786C /* ItemList.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ItemList.swift; sourceTree = "<group>"; };
F26775E01C7046C7002E786C /* ExpandingAnimationController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ExpandingAnimationController.swift; sourceTree = "<group>"; };
F26775E41C70574F002E786C /* AnimatableNavigationController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AnimatableNavigationController.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -132,9 +131,18 @@
/* End PBXFrameworksBuildPhase section */

/* Begin PBXGroup section */
3569CAA31EC1918E000C41C0 /* Resources */ = {
isa = PBXGroup;
children = (
3569CAA61EC1918E000C41C0 /* NohanaImagePicker.xcassets */,
);
path = Resources;
sourceTree = "<group>";
};
F208E5521CD7370B00FFC9F6 /* Demo */ = {
isa = PBXGroup;
children = (
3569CAA31EC1918E000C41C0 /* Resources */,
F208E5531CD7370B00FFC9F6 /* AppDelegate.swift */,
F208E5681CD738CD00FFC9F6 /* DemoListViewController.swift */,
F208E5571CD7370B00FFC9F6 /* Main.storyboard */,
Expand Down Expand Up @@ -163,7 +171,7 @@
children = (
F23554251C69D19C00796DCA /* NohanaImagePicker.storyboard */,
F27029CD1C71C43A001647AB /* NohanaImagePicker.strings */,
F237249A1C6DCF96005D1E8A /* Images.xcassets */,
F237249A1C6DCF96005D1E8A /* NohanaImagePicker.xcassets */,
);
name = Resources;
sourceTree = "<group>";
Expand Down Expand Up @@ -194,12 +202,10 @@
children = (
F26775DD1C701FA7002E786C /* ItemList.swift */,
F202573B1C7418920069B33A /* PickedAssetList.swift */,
F20257391C7343D20069B33A /* ImageName.swift */,
F26775E71C7073CD002E786C /* Size.swift */,
F2DA29761C7749D600B0A8E3 /* NotificationInfo.swift */,
F25C698F1CA27311005935D6 /* EmptyIndicatable.swift */,
F23CC89D1CB745C800BCE443 /* ActivityIndicatable.swift */,
F25C699A1CA2B79A005935D6 /* ColorConfig.swift */,
);
name = Common;
sourceTree = "<group>";
Expand Down Expand Up @@ -328,6 +334,7 @@
en,
Base,
ja,
ru,
);
mainGroup = F2C08D6A1C68651900B00181;
productRefGroup = F2C08D751C68651900B00181 /* Products */;
Expand All @@ -346,6 +353,7 @@
buildActionMask = 2147483647;
files = (
F208E55E1CD7370B00FFC9F6 /* LaunchScreen.storyboard in Resources */,
3569CAA91EC1918E000C41C0 /* NohanaImagePicker.xcassets in Resources */,
F208E55B1CD7370B00FFC9F6 /* Assets.xcassets in Resources */,
F208E5591CD7370B00FFC9F6 /* Main.storyboard in Resources */,
);
Expand All @@ -357,7 +365,7 @@
files = (
F23554261C69D19C00796DCA /* NohanaImagePicker.storyboard in Resources */,
F27029CB1C71C43A001647AB /* NohanaImagePicker.strings in Resources */,
F237249B1C6DCF96005D1E8A /* Images.xcassets in Resources */,
F237249B1C6DCF96005D1E8A /* NohanaImagePicker.xcassets in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -385,7 +393,6 @@
F25C10C21C8ED9BF007453C3 /* MomentViewController.swift in Sources */,
F25C69881CA23A0A005935D6 /* MomentCell.swift in Sources */,
F2FE1F781C901D9400FDBE7B /* MomentSectionHeaderView.swift in Sources */,
F202573A1C7343D20069B33A /* ImageName.swift in Sources */,
F23554281C69D5DB00796DCA /* NohanaImagePickerController.swift in Sources */,
F25C69921CA28728005935D6 /* AlbumListEmptyIndicator.swift in Sources */,
F2131F431C79615700797887 /* SwipeInteractionController.swift in Sources */,
Expand All @@ -400,7 +407,6 @@
F2DF3B2B1C6CC4DB00C1C0E4 /* AssetDetailListViewController.swift in Sources */,
F218D7D61C6B3D22001FCED1 /* PhotoKitAlbumList.swift in Sources */,
F24EB6901C68AEED0002EC86 /* AlbumListViewController.swift in Sources */,
F25C699B1CA2B79A005935D6 /* ColorConfig.swift in Sources */,
F28F4AC31C6C49EE00B7D725 /* PhotoKitAssetList.swift in Sources */,
F26775EA1C71645A002E786C /* ContractingAnimationController.swift in Sources */,
);
Expand Down Expand Up @@ -438,6 +444,7 @@
children = (
F27029CC1C71C43A001647AB /* en */,
F27029CF1C71C4FE001647AB /* ja */,
3590F1F51EC1A79400F32E06 /* ru */,
);
name = NohanaImagePicker.strings;
sourceTree = "<group>";
Expand Down
6 changes: 3 additions & 3 deletions NohanaImagePicker/AlbumListEmptyIndicator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,21 @@

class AlbumListEmptyIndicator: UILabel {

init(message: String, description: String, frame: CGRect) {
init(message: String, description: String, frame: CGRect, config: NohanaImagePickerController.Config) {
super.init(frame: frame)

let centerStyle = NSMutableParagraphStyle()
centerStyle.alignment = NSTextAlignment.center

let messageAttributes = [
NSForegroundColorAttributeName : ColorConfig.emptyIndicator,
NSForegroundColorAttributeName : config.color.empty ?? UIColor(red: 0x88/0xff, green: 0x88/0xff, blue: 0x88/0xff, alpha: 1),
NSFontAttributeName : UIFont.systemFont(ofSize: 26),
NSParagraphStyleAttributeName : centerStyle
]
let messageText = NSAttributedString(string: message, attributes: messageAttributes)

let descriptionAttributes = [
NSForegroundColorAttributeName : ColorConfig.emptyIndicator,
NSForegroundColorAttributeName : config.color.empty ?? UIColor(red: 0x88/0xff, green: 0x88/0xff, blue: 0x88/0xff, alpha: 1),
NSFontAttributeName : UIFont.systemFont(ofSize: 14),
NSParagraphStyleAttributeName : centerStyle
]
Expand Down
20 changes: 11 additions & 9 deletions NohanaImagePicker/AlbumListViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@ class AlbumListViewController: UITableViewController, EmptyIndicatable, Activity
override func viewDidLoad() {
super.viewDidLoad()
if let nohanaImagePickerController = nohanaImagePickerController {
title = NSLocalizedString("albumlist.title", tableName: "NohanaImagePicker", bundle: nohanaImagePickerController.assetBundle, comment: "")
view.backgroundColor = nohanaImagePickerController.config.color.background ?? .white
title = nohanaImagePickerController.config.strings.albumListTitle ?? NSLocalizedString("albumlist.title", tableName: "NohanaImagePicker", bundle: nohanaImagePickerController.assetBundle, comment: "")
setUpToolbarItems()
navigationController?.setToolbarHidden(nohanaImagePickerController.toolbarHidden ,animated: false)
}
setUpEmptyIndicator()
setUpActivityIndicator()
self.view.backgroundColor = ColorConfig.backgroundColor
}

deinit {
Expand Down Expand Up @@ -135,11 +135,12 @@ class AlbumListViewController: UITableViewController, EmptyIndicatable, Activity

switch sectionType {
case .moment:
guard let cell = tableView.dequeueReusableCell(withIdentifier: "MomentAlbumCell") as? AlbumCell else {
guard let cell = tableView.dequeueReusableCell(withIdentifier: "MomentAlbumCell") as? MomentCell else {
fatalError("failed to dequeueReusableCellWithIdentifier(\"MomentAlbumCell\")")
}
if let nohanaImagePickerController = nohanaImagePickerController {
cell.titleLabel?.text = NSLocalizedString("albumlist.moment.title", tableName: "NohanaImagePicker", bundle: nohanaImagePickerController.assetBundle, comment: "")
cell.config = nohanaImagePickerController.config
cell.titleLabel?.text = nohanaImagePickerController.config.strings.albumListMomentTitle ?? NSLocalizedString("albumlist.moment.title", tableName: "NohanaImagePicker", bundle: nohanaImagePickerController.assetBundle, comment: "")
}
return cell
case .albums:
Expand Down Expand Up @@ -220,9 +221,10 @@ class AlbumListViewController: UITableViewController, EmptyIndicatable, Activity
return
}
emptyIndicator = AlbumListEmptyIndicator(
message: NSLocalizedString("albumlist.empty.message", tableName: "NohanaImagePicker", bundle: nohanaImagePickerController.assetBundle, comment: ""),
description: NSLocalizedString("albumlist.empty.description", tableName: "NohanaImagePicker", bundle: nohanaImagePickerController.assetBundle, comment: ""),
frame: frame)
message: nohanaImagePickerController.config.strings.albumListEmptyMessage ?? NSLocalizedString("albumlist.empty.message", tableName: "NohanaImagePicker", bundle: nohanaImagePickerController.assetBundle, comment: ""),
description: nohanaImagePickerController.config.strings.albumListEmptyDescription ?? NSLocalizedString("albumlist.empty.description", tableName: "NohanaImagePicker", bundle: nohanaImagePickerController.assetBundle, comment: ""),
frame: frame,
config: nohanaImagePickerController.config)
}

func isEmpty() -> Bool {
Expand Down Expand Up @@ -272,11 +274,11 @@ extension UIViewController {
return
}
if nohanaImagePickerController.maximumNumberOfSelection == 0 {
let title = String(format: NSLocalizedString("toolbar.title.nolimit", tableName: "NohanaImagePicker", bundle: nohanaImagePickerController.assetBundle, comment: ""),
let title = String(format: nohanaImagePickerController.config.strings.toolbarTitleNoLimit ?? NSLocalizedString("toolbar.title.nolimit", tableName: "NohanaImagePicker", bundle: nohanaImagePickerController.assetBundle, comment: ""),
nohanaImagePickerController.pickedAssetList.count)
infoButton.title = title
} else {
let title = String(format: NSLocalizedString("toolbar.title.haslimit", tableName: "NohanaImagePicker", bundle: nohanaImagePickerController.assetBundle, comment: ""),
let title = String(format: nohanaImagePickerController.config.strings.toolbarTitleHasLimit ?? NSLocalizedString("toolbar.title.haslimit", tableName: "NohanaImagePicker", bundle: nohanaImagePickerController.assetBundle, comment: ""),
nohanaImagePickerController.pickedAssetList.count,
nohanaImagePickerController.maximumNumberOfSelection)
infoButton.title = title
Expand Down
Loading

0 comments on commit cf3868f

Please sign in to comment.