Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
mmislam101 committed May 30, 2019
2 parents 2dabeed + 05159d9 commit 3d75fcf
Show file tree
Hide file tree
Showing 26 changed files with 1,060 additions and 1,255 deletions.
2 changes: 1 addition & 1 deletion .swift-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.0
4.2
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
language: objective-c
osx_image: xcode9.2
osx_image: xcode10.1
script:
- set -o pipefail
- xcodebuild -version
Expand Down
149 changes: 84 additions & 65 deletions Example/FusumaExample.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0920"
LastUpgradeVersion = "1010"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand All @@ -26,7 +26,6 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
Expand Down Expand Up @@ -56,7 +55,6 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
Expand Down
61 changes: 28 additions & 33 deletions Example/FusumaExample/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,37 +10,32 @@ import UIKit

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

var window: UIWindow?


func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey : Any]? = nil) -> Bool {
// Override point for customization after application launch.
return true
}

func applicationWillResignActive(_ application: UIApplication) {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
}

func applicationDidEnterBackground(_ application: UIApplication) {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}

func applicationWillEnterForeground(_ application: UIApplication) {
// Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
}

func applicationDidBecomeActive(_ application: UIApplication) {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}

func applicationWillTerminate(_ application: UIApplication) {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}


var window: UIWindow?

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
// Override point for customization after application launch.
return true
}

func applicationWillResignActive(_ application: UIApplication) {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
}

func applicationDidEnterBackground(_ application: UIApplication) {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}

func applicationWillEnterForeground(_ application: UIApplication) {
// Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
}

func applicationDidBecomeActive(_ application: UIApplication) {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}

func applicationWillTerminate(_ application: UIApplication) {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,11 @@
"idiom" : "ipad",
"filename" : "Icon-83.5@2x.png",
"scale" : "2x"
},
{
"idiom" : "ios-marketing",
"size" : "1024x1024",
"scale" : "1x"
}
],
"info" : {
Expand Down
3 changes: 0 additions & 3 deletions Example/FusumaExample/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,6 @@
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
</dict>
</plist>
85 changes: 22 additions & 63 deletions Example/FusumaExample/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,84 +9,61 @@
import UIKit

class ViewController: UIViewController, FusumaDelegate {

@IBOutlet weak var imageView: UIImageView!

@IBOutlet weak var showButton: UIButton!

@IBOutlet weak var fileUrlLabel: UILabel!

override func viewDidLoad() {
super.viewDidLoad()

showButton.layer.cornerRadius = 2.0
self.fileUrlLabel.text = ""
}

override func viewDidAppear(_ animated: Bool) {


fileUrlLabel.text = ""
}

override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}

@IBAction func showButtonPressed(_ sender: AnyObject) {

// Show Fusuma
let fusuma = FusumaViewController()

fusuma.delegate = self
fusuma.cropHeightRatio = 1.0
fusuma.allowMultipleSelection = true
// fusuma.availableModes = [.video]
fusuma.allowMultipleSelection = false
fusuma.availableModes = [.library, .video, .camera]
fusuma.photoSelectionLimit = 4
fusumaSavesImage = true

self.present(fusuma, animated: true, completion: nil)
present(fusuma, animated: true, completion: nil)
}

// MARK: FusumaDelegate Protocol
func fusumaImageSelected(_ image: UIImage, source: FusumaMode) {

switch source {

case .camera:

print("Image captured from Camera")

case .library:

print("Image selected from Camera Roll")

default:

print("Image selected")
}

imageView.image = image
}

func fusumaMultipleImageSelected(_ images: [UIImage], source: FusumaMode) {

print("Number of selection images: \(images.count)")

var count: Double = 0

for image in images {

DispatchQueue.main.asyncAfter(deadline: .now() + (3.0 * count)) {

self.imageView.image = image
print("w: \(image.size.width) - h: \(image.size.height)")
}

count += 1
}
}

func fusumaImageSelected(_ image: UIImage, source: FusumaMode, metaData: ImageMetadata) {

print("Image mediatype: \(metaData.mediaType)")
print("Source image size: \(metaData.pixelWidth)x\(metaData.pixelHeight)")
print("Creation date: \(String(describing: metaData.creationDate))")
Expand All @@ -98,67 +75,49 @@ class ViewController: UIViewController, FusumaDelegate {
}

func fusumaVideoCompleted(withFileURL fileURL: URL) {

print("video completed and output to file: \(fileURL)")
self.fileUrlLabel.text = "file output to: \(fileURL.absoluteString)"
}

func fusumaDismissedWithImage(_ image: UIImage, source: FusumaMode) {

switch source {

case .camera:

print("Called just after dismissed FusumaViewController using Camera")

case .library:

print("Called just after dismissed FusumaViewController using Camera Roll")

default:

print("Called just after dismissed FusumaViewController")
}
}

func fusumaCameraRollUnauthorized() {

print("Camera roll unauthorized")

let alert = UIAlertController(title: "Access Requested",
message: "Saving image needs to access your photo album",
preferredStyle: .alert)

alert.addAction(UIAlertAction(title: "Settings", style: .default) { (action) -> Void in

if let url = URL(string:UIApplicationOpenSettingsURLString) {

if let url = URL(string: UIApplication.openSettingsURLString) {
UIApplication.shared.openURL(url)
}
})

alert.addAction(UIAlertAction(title: "Cancel", style: .cancel) { (action) -> Void in

})

guard let vc = UIApplication.shared.delegate?.window??.rootViewController,
let presented = vc.presentedViewController else {

guard let vc = UIApplication.shared.delegate?.window??.rootViewController, let presented = vc.presentedViewController else {
return
}

presented.present(alert, animated: true, completion: nil)
}

func fusumaClosed() {

print("Called when the FusumaViewController disappeared")
}

func fusumaWillClosed() {

print("Called when the close button is pressed")
}

}

2 changes: 1 addition & 1 deletion Fusuma.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "Fusuma"
s.version = "1.2.4"
s.version = "1.3.3"
s.summary = "Instagram-like photo browser with a few line of code written in Swift"
s.homepage = "https://github.com/ytakzk/Fusuma"
s.license = 'MIT'
Expand Down
Loading

0 comments on commit 3d75fcf

Please sign in to comment.