Skip to content

Commit

Permalink
Implements startOnScreen api
Browse files Browse the repository at this point in the history
  • Loading branch information
s4cha committed Jan 3, 2018
1 parent be9a4c1 commit 40c8d5e
Show file tree
Hide file tree
Showing 27 changed files with 12,344 additions and 6 deletions.
3,065 changes: 3,065 additions & 0 deletions Carthage/Build/iOS/936B9A45-26C6-337E-AA1E-1226A42F6455.bcsymbolmap

Large diffs are not rendered by default.

3,094 changes: 3,094 additions & 0 deletions Carthage/Build/iOS/9E5A583C-2F39-3F79-B5B7-033319F87ADB.bcsymbolmap

Large diffs are not rendered by default.

3,082 changes: 3,082 additions & 0 deletions Carthage/Build/iOS/B2C2B0FB-E112-39F8-B18C-3B51F3F3FD26.bcsymbolmap

Large diffs are not rendered by default.

3,074 changes: 3,074 additions & 0 deletions Carthage/Build/iOS/D4B4B223-DE6A-3D90-B9A6-2A7ACADC1063.bcsymbolmap

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.
Binary file modified Carthage/Build/iOS/YPImagePicker.framework/Assets.car
Binary file not shown.
Binary file modified Carthage/Build/iOS/YPImagePicker.framework/FSAlbumView.nib
Binary file not shown.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified Carthage/Build/iOS/YPImagePicker.framework/Info.plist
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified Carthage/Build/iOS/YPImagePicker.framework/YPImagePicker
Binary file not shown.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ It comes with adjustable square crop and filters.
[![CI Status](http://img.shields.io/travis/ytakzk/Fusuma.svg?style=flat)](https://travis-ci.org/ytakzk/Fusuma)
[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)
[![codebeat badge](https://codebeat.co/badges/6a591267-c444-4c88-a410-56270d8ed9bc)](https://codebeat.co/projects/github-com-yummypets-ypfusuma)
[![Release version](https://img.shields.io/badge/release-2.3-blue.svg)]()
[![GitHub tag](https://img.shields.io/github/release/Yummypets/YPImagePicker.svg)]()

| | Features |
----------|-----------------
Expand Down Expand Up @@ -98,6 +98,7 @@ config.showsFilters = true
config.shouldSaveNewPicturesToAlbum = true
config.videoCompression = AVAssetExportPresetHighestQuality
config.albumName = "MyGreatAppName"
config.startOnScreen = .library

// Build a picker with your configuration
let picker = YPImagePicker(configuration: config)
Expand Down
4 changes: 4 additions & 0 deletions Source/Album/FSAlbumVC.swift
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,10 @@ PHPhotoLibraryChangeObserver, UIGestureRecognizerDelegate, UICollectionViewDeleg
.addTarget(self,
action: #selector(squareCropButtonTapped),
for: .touchUpInside)

if configuration.startOnScreen == .library {
checkPermission()
}
}

@objc
Expand Down
2 changes: 1 addition & 1 deletion Source/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>2.3.0</string>
<string>2.4.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
Expand Down
10 changes: 9 additions & 1 deletion Source/PickerVC.swift
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,15 @@ public class PickerVC: FSBottomPager, PagerDelegate {
}
}

startOnPage(1)
switch configuration.startOnScreen {
case .library:
startOnPage(0)
case .photo:
startOnPage(1)
case .video:
startOnPage(configuration.showsVideo ? 2 : 1)
}

updateUI()
}

Expand Down
9 changes: 9 additions & 0 deletions Source/YPImagePickerConfiguration.swift
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,18 @@ public struct YPImagePickerConfiguration {
/// Defines the name of the album when saving pictures in the user's photo library.
/// In general that would be your App name. Defaults to "DefaultYPImagePickerAlbumName"
public var albumName = "DefaultYPImagePickerAlbumName"

/// Defines which screen is shown at launch. Video mode will only work if `showsVideo = true`. Default value is `.photo`
public var startOnScreen: YPPickerScreen = .photo
}

public enum LibraryImageSize {
case original
case cappedTo(size: CGFloat)
}

public enum YPPickerScreen {
case library
case photo
case video
}
Binary file modified YPImagePicker.framework.zip
Binary file not shown.
2 changes: 1 addition & 1 deletion YPImagePicker.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'YPImagePicker'
s.version = "2.3.0"
s.version = "2.4.0"
s.summary = "Instagram-like image picker & filters for iOS"
s.homepage = "https://github.com/Yummypets/YPImagePicker"
s.license = { :type => "MIT", :file => "LICENSE" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ class ViewController: UIViewController {
// config.shouldSaveNewPicturesToAlbum = true
config.videoCompression = AVAssetExportPresetHighestQuality
config.albumName = "MyGreatAppName"
config.startOnScreen = .library
// Set it the default conf for all Pickers
// YPImagePicker.setDefaultConfiguration(config)
// And then use the default configuration like so:
Expand Down

0 comments on commit 40c8d5e

Please sign in to comment.