├── .gitignore ├── .gitmodules ├── .uncrustifyconfig ├── CHANGELOG ├── Docs ├── 10.png ├── 110.png ├── 140.png ├── 150.png ├── 160.png ├── 20.png ├── 35.png ├── 40.png ├── 410.png ├── 70.png ├── 80.png ├── Wiki │ ├── 1.-Installation.md │ ├── 1.1-iOS-Integration.md │ ├── 1.2-OS-X-Integration.md │ ├── 2.-Usage.md │ ├── 2.1-iOS-Usage-Instructions.md │ ├── 2.2-OS-X-Usage-Instructions.md │ ├── 2.3-Delegate-Methods.md │ ├── 2.4-Supported-Sources.md │ ├── 2.5-Advanced-Configuration.md │ ├── 3.-Programmatic-API-Usage.md │ ├── 4.-Theming-in-iOS.md │ ├── 5.-Common-Tips.md │ ├── 6.-Demo.md │ └── Home.md ├── filepicker.png ├── theming-2.jpg └── theming.jpg ├── FPPicker Mac API Demo ├── FPPicker Mac API Demo.xcodeproj │ ├── project.pbxproj │ └── xcshareddata │ │ └── xcschemes │ │ └── FPPicker Mac API Demo.xcscheme └── FPPicker Mac API Demo │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Base.lproj │ └── Main.storyboard │ ├── Images.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json │ ├── Info.plist │ ├── ViewController.h │ ├── ViewController.m │ └── main.m ├── FPPicker Mac Demo ├── FPPicker Mac Demo.xcodeproj │ ├── project.pbxproj │ └── xcshareddata │ │ └── xcschemes │ │ └── FPPicker Mac Demo.xcscheme └── FPPicker Mac Demo │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Base.lproj │ └── MainMenu.xib │ ├── FPPicker Mac Demo-Info.plist │ ├── FPPicker Mac Demo-Prefix.pch │ ├── ImageBrowserBackgroundLayer.h │ ├── ImageBrowserBackgroundLayer.m │ ├── ImageBrowserCell.h │ ├── ImageBrowserCell.m │ ├── ImageBrowserItem.h │ ├── ImageBrowserItem.m │ ├── ImageBrowserView.h │ ├── ImageBrowserView.m │ ├── Images.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json │ ├── Resources │ ├── glossy.png │ ├── metal_background.tif │ └── pin.tiff │ ├── ViewController.h │ ├── ViewController.m │ ├── en.lproj │ ├── Credits.rtf │ └── InfoPlist.strings │ └── main.m ├── FPPicker Mac.xcodeproj ├── project.pbxproj └── xcshareddata │ └── xcschemes │ └── FPPickerMac.xcscheme ├── FPPicker Tests ├── Functional Tests │ ├── FPConfigTests.m │ ├── FPLibraryTests.m │ ├── FPPicker Functional Tests-Info.plist │ ├── FPPicker Functional Tests-Prefix.pch │ ├── FPProgressTrackerTests.m │ ├── FPSessionTests.m │ ├── FPSourceTests.m │ ├── FPUtilsTests.m │ ├── Fixtures │ │ ├── failureResponse.json │ │ ├── outline.png │ │ ├── successfulMultipartEndResponse.json │ │ ├── successfulMultipartStartResponse.json │ │ ├── successfulMultipartUploadResponse.json │ │ └── successfulResponse.json │ ├── TestHelpers.h │ └── en.lproj │ │ └── InfoPlist.strings └── Shared │ ├── FPConfig+DestroyableSingleton.h │ ├── NSDictionary+FPMerge.h │ ├── NSDictionary+FPMerge.m │ ├── OHHTTPStubs+ConveniencyMethods.h │ └── OHHTTPStubs+ConveniencyMethods.m ├── FPPicker iOS API Demo ├── FPPicker iOS API Demo.xcodeproj │ ├── project.pbxproj │ └── xcshareddata │ │ └── xcschemes │ │ └── FPPicker iOS API Demo.xcscheme └── FPPicker iOS API Demo │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Base.lproj │ ├── LaunchScreen.xib │ └── Main.storyboard │ ├── Images.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json │ ├── Info.plist │ ├── RootViewController.h │ ├── RootViewController.m │ └── main.m ├── FPPicker iOS Demo ├── FPPicker iOS Demo.xcodeproj │ ├── project.pbxproj │ └── xcshareddata │ │ └── xcschemes │ │ └── FPPicker iOS Demo.xcscheme └── FPPicker iOS Demo │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Base.lproj │ ├── LaunchScreen.xib │ ├── Main_iPad.storyboard │ └── Main_iPhone.storyboard │ ├── FPPicker iOS Demo-Info.plist │ ├── FPPicker iOS Demo-Prefix.pch │ ├── Images.xcassets │ ├── AppIcon.appiconset │ │ └── Contents.json │ └── Contents.json │ ├── ViewController.h │ ├── ViewController.m │ ├── en.lproj │ └── InfoPlist.strings │ └── main.m ├── FPPicker.podspec ├── FPPicker.xcodeproj ├── project.pbxproj └── xcshareddata │ └── xcschemes │ ├── FPPicker Mac.xcscheme │ ├── FPPicker Resources Mac.xcscheme │ ├── FPPicker Resources.xcscheme │ └── FPPicker.xcscheme ├── FPPicker.xcworkspace ├── .LSOverride └── contents.xcworkspacedata ├── FPPicker ├── Platforms │ ├── Mac │ │ ├── FPAuthController.h │ │ ├── FPAuthController.m │ │ ├── FPBaseSourceController.h │ │ ├── FPBaseSourceController.m │ │ ├── FPBorderView.h │ │ ├── FPBorderView.m │ │ ├── FPDialogController.h │ │ ├── FPDialogController.m │ │ ├── FPFileDownloadController.h │ │ ├── FPFileDownloadController.m │ │ ├── FPFileTransferController.h │ │ ├── FPFileTransferController.m │ │ ├── FPFileUploadController.h │ │ ├── FPFileUploadController.m │ │ ├── FPImageBrowserCell.h │ │ ├── FPImageBrowserCell.m │ │ ├── FPImageBrowserView.h │ │ ├── FPImageBrowserView.m │ │ ├── FPImageSearchSourceController.h │ │ ├── FPImageSearchSourceController.m │ │ ├── FPInternalHeaders.h │ │ ├── FPNavigationController.h │ │ ├── FPNavigationController.m │ │ ├── FPNavigationHistory.h │ │ ├── FPNavigationHistory.m │ │ ├── FPPickerController.h │ │ ├── FPPickerController.m │ │ ├── FPPickerMac.h │ │ ├── FPRemoteSourceController.h │ │ ├── FPRemoteSourceController.m │ │ ├── FPRepresentedSource.h │ │ ├── FPRepresentedSource.m │ │ ├── FPSaveController.h │ │ ├── FPSaveController.m │ │ ├── FPSourceListController.h │ │ ├── FPSourceListController.m │ │ ├── FPSourcePath.h │ │ ├── FPSourcePath.m │ │ ├── FPSourceResultsController.h │ │ ├── FPSourceResultsController.m │ │ ├── FPSourceViewController.h │ │ ├── FPSourceViewController.m │ │ ├── FPTableCellView.h │ │ ├── FPTableCellView.m │ │ ├── FPTableView.h │ │ ├── FPTableView.m │ │ ├── FPThumbnail.h │ │ ├── FPThumbnail.m │ │ ├── FPUtils+Mac.h │ │ ├── FPUtils+Mac.m │ │ ├── FPView.h │ │ ├── FPView.m │ │ ├── FPWindow.h │ │ └── FPWindow.m │ └── iOS │ │ ├── FPAuthController.h │ │ ├── FPAuthController.m │ │ ├── FPBarButtonItem.h │ │ ├── FPBarButtonItem.m │ │ ├── FPImagePickerController.h │ │ ├── FPImagePickerController.m │ │ ├── FPInfoViewController.h │ │ ├── FPInfoViewController.m │ │ ├── FPInternalHeaders.h │ │ ├── FPLibrary+iOS.h │ │ ├── FPLibrary+iOS.m │ │ ├── FPLocalAlbumController.h │ │ ├── FPLocalAlbumController.m │ │ ├── FPLocalController.h │ │ ├── FPLocalController.m │ │ ├── FPPicker.h │ │ ├── FPPickerController.h │ │ ├── FPPickerController.m │ │ ├── FPSaveController.h │ │ ├── FPSaveController.m │ │ ├── FPSaveSourceController.h │ │ ├── FPSaveSourceController.m │ │ ├── FPSearchController.h │ │ ├── FPSearchController.m │ │ ├── FPSourceController.h │ │ ├── FPSourceController.m │ │ ├── FPSourceListController.h │ │ ├── FPSourceListController.m │ │ ├── FPTableViewCell.h │ │ ├── FPTableViewCell.m │ │ ├── FPTableWithUploadButtonViewController.h │ │ ├── FPTableWithUploadButtonViewController.m │ │ ├── FPTheme.h │ │ ├── FPTheme.m │ │ ├── FPThemeApplier.h │ │ ├── FPThemeApplier.m │ │ ├── FPThumbCell.h │ │ ├── FPThumbCell.m │ │ ├── FPUtils+iOS.h │ │ ├── FPUtils+iOS.m │ │ ├── FPiOSMacros.h │ │ ├── UILabel+Appearance.h │ │ └── UILabel+Appearance.m └── Shared │ ├── FPAPIClient.h │ ├── FPAPIClient.m │ ├── FPConfig.h │ ├── FPConfig.m │ ├── FPConstants.h │ ├── FPConstants.m │ ├── FPExternalHeaders.h │ ├── FPLibrary.h │ ├── FPLibrary.m │ ├── FPMacros.h │ ├── FPMediaInfo.h │ ├── FPMediaInfo.m │ ├── FPMultipartUploader.h │ ├── FPMultipartUploader.m │ ├── FPPrivateConfig.h │ ├── FPProgressTracker.h │ ├── FPProgressTracker.m │ ├── FPSession+ConvenienceMethods.h │ ├── FPSession+ConvenienceMethods.m │ ├── FPSession.h │ ├── FPSession.m │ ├── FPSharedInternalHeaders.h │ ├── FPSimpleAPI.h │ ├── FPSimpleAPI.m │ ├── FPSinglepartUploader.h │ ├── FPSinglepartUploader.m │ ├── FPSource+SupportedSources.h │ ├── FPSource+SupportedSources.m │ ├── FPSource.h │ ├── FPSource.m │ ├── FPTypedefs.h │ ├── FPUploader.h │ ├── FPUploader.m │ ├── FPUtils+ResourceHelpers.h │ ├── FPUtils+ResourceHelpers.m │ ├── FPUtils.h │ ├── FPUtils.m │ ├── NSData+FPHexString.h │ └── NSData+FPHexString.m ├── LICENSE.md ├── Podfile ├── Podfile.lock ├── README.md ├── Resources-Mac ├── FPFileTransferController.xib ├── FPPicker Mac-Info.plist ├── FPPicker-Mac-Prefix.pch ├── FPPickerController.xib ├── FPSaveController.xib └── en.lproj │ └── InfoPlist.strings ├── Resources-Shared ├── CloudDrive.png ├── CloudDrive@2x.png ├── FPPicker_Resources-Info.plist ├── FilepickerSettings.plist ├── GoogleDrive.png ├── GoogleDrive@2x.png ├── Instagram.png ├── Instagram@2x.png ├── SelectOverlayiOS7.png ├── SelectOverlayiOS7@2x.png ├── allowedUrlPrefix.plist ├── disallowedUrlPrefix.plist ├── en.lproj │ └── InfoPlist.strings ├── glyphicons_008_film.png ├── glyphicons_008_film@2x.png ├── glyphicons_011_camera.png ├── glyphicons_011_camera@2x.png ├── glyphicons_020_home.png ├── glyphicons_020_home@2x.png ├── glyphicons_027_search.png ├── glyphicons_027_search@2x.png ├── glyphicons_036_file.png ├── glyphicons_036_file@2x.png ├── glyphicons_144_folder_open.png ├── glyphicons_144_folder_open@2x.png ├── glyphicons_154_show_big_thumbnails.png ├── glyphicons_154_show_big_thumbnails@2x.png ├── glyphicons_180_facetime_video.png ├── glyphicons_180_facetime_video@2x.png ├── glyphicons_300_microphone.png ├── glyphicons_300_microphone@2x.png ├── glyphicons_361_dropbox.png ├── glyphicons_361_dropbox@2x.png ├── glyphicons_366_picasa.png ├── glyphicons_366_picasa@2x.png ├── glyphicons_371_evernote.png ├── glyphicons_371_evernote@2x.png ├── glyphicons_381_github.png ├── glyphicons_381_github@2x.png ├── glyphicons_390_facebook.png ├── glyphicons_390_facebook@2x.png ├── glyphicons_395_flickr.png ├── glyphicons_395_flickr@2x.png ├── glyphicons_399_e-mail.png ├── glyphicons_399_e-mail@2x.png ├── glyphicons_sb1_gmail.png ├── glyphicons_sb1_gmail@2x.png ├── glyphicons_sb2_box.png ├── glyphicons_sb2_box@2x.png ├── glyphicons_sb3_skydrive.png ├── glyphicons_sb3_skydrive@2x.png ├── logo_small.png ├── logo_small@2x.png ├── placeholder.png ├── select.png ├── select@2x.png └── xui-2.3.2.min.js └── Resources-iOS ├── FPPicker-Info.plist └── FPPicker-Prefix.pch /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | 3 | # Xcode 4 | *.pbxuser 5 | *.mode1v3 6 | *.mode2v3 7 | *.perspectivev3 8 | *.xcuserstate 9 | project.xcworkspace/ 10 | xcuserdata/ 11 | Pods/ 12 | API_KEY 13 | *.xccheckout 14 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ink/ios-picker/00a17e82e7bb6858d354d89483020156ed0184f9/.gitmodules -------------------------------------------------------------------------------- /Docs/10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ink/ios-picker/00a17e82e7bb6858d354d89483020156ed0184f9/Docs/10.png -------------------------------------------------------------------------------- /Docs/110.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ink/ios-picker/00a17e82e7bb6858d354d89483020156ed0184f9/Docs/110.png -------------------------------------------------------------------------------- /Docs/140.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ink/ios-picker/00a17e82e7bb6858d354d89483020156ed0184f9/Docs/140.png -------------------------------------------------------------------------------- /Docs/150.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ink/ios-picker/00a17e82e7bb6858d354d89483020156ed0184f9/Docs/150.png -------------------------------------------------------------------------------- /Docs/160.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ink/ios-picker/00a17e82e7bb6858d354d89483020156ed0184f9/Docs/160.png -------------------------------------------------------------------------------- /Docs/20.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ink/ios-picker/00a17e82e7bb6858d354d89483020156ed0184f9/Docs/20.png -------------------------------------------------------------------------------- /Docs/35.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ink/ios-picker/00a17e82e7bb6858d354d89483020156ed0184f9/Docs/35.png -------------------------------------------------------------------------------- /Docs/40.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ink/ios-picker/00a17e82e7bb6858d354d89483020156ed0184f9/Docs/40.png -------------------------------------------------------------------------------- /Docs/410.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ink/ios-picker/00a17e82e7bb6858d354d89483020156ed0184f9/Docs/410.png -------------------------------------------------------------------------------- /Docs/70.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ink/ios-picker/00a17e82e7bb6858d354d89483020156ed0184f9/Docs/70.png -------------------------------------------------------------------------------- /Docs/80.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ink/ios-picker/00a17e82e7bb6858d354d89483020156ed0184f9/Docs/80.png -------------------------------------------------------------------------------- /Docs/Wiki/1.-Installation.md: -------------------------------------------------------------------------------- 1 | ## How to integrate FPPicker into your app 2 | 3 | Filepicker can be easily integrated into your iOS or OS X app by using [CocoaPods](http://cocoapods.org/): 4 | 5 | - [iOS Integration](https://github.com/Ink/ios-picker/wiki/1.1-iOS-Integration) 6 | - [OS X Integration](https://github.com/Ink/ios-picker/wiki/1.2-OS-X-Integration) 7 | -------------------------------------------------------------------------------- /Docs/Wiki/1.1-iOS-Integration.md: -------------------------------------------------------------------------------- 1 | 1. Get an API Key 2 | - Go to [Filepicker.io](www.filepicker.io) to register an account. 3 | - API Keys are typically randomized and 20 characters long. 4 | 5 | 2. Add `FPPicker` to your `Podfile` 6 | 7 | ```ruby 8 | platform :ios, '8.0' 9 | 10 | use_frameworks! 11 | 12 | target :'MyImagesApp' do 13 | pod 'FPPicker', '~> 5.0.0' 14 | end 15 | ``` 16 | 17 | 3. Run `pod install` 18 | 19 | 4. Setup 20 | - Add `@import FPPicker;` to your app delegate (i.e., typically `AppDelegate.m`) 21 | - Add the following code on your app delegate and use the API Key you got after registering: 22 | 23 | ```objc 24 | + (void)initialize 25 | { 26 | [FPConfig sharedInstance].APIKey = @"SET_FILEPICKER.IO_APIKEY_HERE"; 27 | } 28 | ``` 29 | 5. In Use 30 | 1. `@import FPPicker;` into your `ViewController.h` or anywhere else you may want to use Filepicker. 31 | 32 | 2. Make your controller conform to the FPPickerControllerDelegate (and optionally to the FPSaveControllerDelegate): 33 | ```objc 34 | @interface ViewController () 36 | @end 37 | ``` 38 | 3. Instantiate the objects and configure them 39 | ```objc 40 | FPPickerController *pickerController = [FPPickerController new]; 41 | pickerController.fpdelegate = self; 42 | (...) 43 | 44 | FPSaveController *saveController = [FPSaveController new]; 45 | saveController.fpdelegate = self; 46 | (...) 47 | 48 | ``` 49 | 4. Implement the delegate methods 50 | ```objc 51 | #pragma mark - FPPickerController Delegate Methods 52 | 53 | - (void)fpPickerController:(FPPickerController *)pickerController didFinishPickingMediaWithInfo:(FPMediaInfo *)info 54 | { 55 | // Handle accordingly 56 | } 57 | 58 | - (void)fpPickerControllerDidCancel:(FPPickerController *)pickerController 59 | { 60 | // Handle accordingly 61 | } 62 | 63 | #pragma mark - FPSaveController Delegate Methods 64 | 65 | - (void)fpSaveController:(FPSaveController *)saveController didFinishSavingMediaWithInfo:(FPMediaInfo *)info 66 | { 67 | // Handle accordingly 68 | } 69 | 70 | - (void)fpSaveControllerDidCancel:(FPSaveController *)saveController 71 | { 72 | // Handle accordingly 73 | } 74 | 75 | (...) 76 | ``` 77 | -------------------------------------------------------------------------------- /Docs/Wiki/1.2-OS-X-Integration.md: -------------------------------------------------------------------------------- 1 | 1. Get an API Key 2 | - Go to [Filepicker.io](www.filepicker.io) to register an account. 3 | - API Keys are typically randomized and 20 characters long. 4 | 5 | 2. Add `FPPicker` to your `Podfile` 6 | 7 | ```ruby 8 | platform :osx, '10.9' 9 | 10 | use_frameworks! 11 | 12 | target :'MyImagesApp' do 13 | pod 'FPPicker', '~> 5.0.0' 14 | end 15 | ``` 16 | 17 | 3. Run `pod install` 18 | 19 | 4. Setup 20 | - Add `@import FPPickerMac;` to your app delegate (i.e., typically `AppDelegate.m`) 21 | - Add the following code on your app delegate and use the API Key you got after registering: 22 | 23 | ```objc 24 | + (void)initialize 25 | { 26 | [FPConfig sharedInstance].APIKey = @"SET_FILEPICKER.IO_APIKEY_HERE"; 27 | } 28 | ``` 29 | 5. In Use 30 | 1. `@import FPPickerMac;` into your `ViewController.h` or anywhere else you may want to use Filepicker. 31 | 32 | 2. Make your controller conform to the FPPickerControllerDelegate (and optionally to the FPSaveControllerDelegate): 33 | ```objc 34 | @interface ViewController () 36 | @end 37 | ``` 38 | 3. Instantiate the objects and configure them 39 | ```objc 40 | FPPickerController *pickerController = [FPPickerController new]; 41 | pickerController.delegate = self; 42 | (...) 43 | 44 | FPSaveController *saveController = [FPSaveController new]; 45 | saveController.delegate = self; 46 | (...) 47 | 48 | ``` 49 | 4. Implement the delegate methods 50 | ```objc 51 | #pragma mark - FPPickerController Delegate Methods 52 | 53 | - (void)FPPickerController:(FPPickerController *)pickerController didFinishPickingMediaWithInfo:(FPMediaInfo *)info 54 | { 55 | // Handle accordingly 56 | } 57 | 58 | - (void)FPPickerControllerDidCancel:(FPPickerController *)pickerController 59 | { 60 | // Handle accordingly 61 | } 62 | 63 | #pragma mark - FPSaveController Delegate Methods 64 | 65 | - (void)FPSaveController:(FPSaveController *)saveController didFinishSavingMediaWithInfo:(FPMediaInfo *)info 66 | { 67 | // Handle accordingly 68 | } 69 | 70 | - (void)FPSaveControllerDidCancel:(FPSaveController *)saveController 71 | { 72 | // Handle accordingly 73 | } 74 | 75 | (...) 76 | ``` 77 | -------------------------------------------------------------------------------- /Docs/Wiki/2.-Usage.md: -------------------------------------------------------------------------------- 1 | - [iOS Usage Instructions](https://github.com/Ink/ios-picker/wiki/2.1-iOS-Usage-Instructions) 2 | - [OS X Usage Instructions](https://github.com/Ink/ios-picker/wiki/2.2-OS-X-Usage-Instructions) 3 | - [Delegate Methods](https://github.com/Ink/ios-picker/wiki/2.3-Delegate-Methods) 4 | - [Supported Sources](https://github.com/Ink/ios-picker/wiki/2.4-Supported-Sources) 5 | - [Advanced Configuration](https://github.com/Ink/ios-picker/wiki/2.5.-Advanced-Configuration) 6 | -------------------------------------------------------------------------------- /Docs/Wiki/2.2-OS-X-Usage-Instructions.md: -------------------------------------------------------------------------------- 1 | #### Importing 2 | 3 | ```objc 4 | @import FPPickerMac; 5 | ``` 6 | 7 | #### Opening Files 8 | 9 | ```objc 10 | // To create the object 11 | 12 | FPPickerController *pickerController = [FPPickerController new]; 13 | 14 | // Set the delegate 15 | 16 | pickerController.delegate = self; 17 | 18 | // Ask for specific data types. (Optional) Default is all files 19 | 20 | pickerController.dataTypes = @[@"text/plain"]; 21 | 22 | // Select and order the sources (Optional) Default is all sources 23 | 24 | pickerController.sourceNames = @[FPSourceImagesearch, FPSourceDropbox]; 25 | 26 | /* Control if we should download the files for you. 27 | * Default is YES. 28 | * When a user selects a remote file, we'll download it and return the filedata to you. 29 | */ 30 | 31 | pickerController.shouldDownload = YES; 32 | 33 | // Display it 34 | 35 | [pickerController open]; 36 | 37 | ``` 38 | 39 | #### Saving Files 40 | 41 | ```objc 42 | // To create the object 43 | 44 | FPSaveController *saveController = [FPSaveController new]; 45 | 46 | // Set the delegate 47 | 48 | saveController.delegate = self; 49 | 50 | // Ask for specific data mimetypes. (Optional) Default is all files 51 | 52 | saveController.dataTypes = @[@"text/plain"]; 53 | 54 | // Select and order the sources (Optional) Default is all sources 55 | 56 | saveController.sourceNames = @[ 57 | FPSourceCamera, 58 | FPSourceCameraRoll, 59 | FPSourceDropbox, 60 | FPSourceFacebook, 61 | FPSourceGmail, 62 | FPSourceBox, 63 | FPSourceGithub, 64 | FPSourceGoogleDrive, 65 | FPSourceImagesearch 66 | ]; 67 | 68 | // Set the data and data type to be saved 69 | 70 | saveController.data = bitmapData; 71 | saveController.dataType = browserItem.mimetype; 72 | saveController.proposedFilename = browserItem.title; 73 | 74 | // Display it 75 | 76 | [saveController open]; 77 | ``` 78 | 79 | ## More Information 80 | 81 | - [Delegate Methods](https://github.com/Ink/ios-picker/wiki/2.3-Delegate-Methods) 82 | - [Supported Sources](https://github.com/Ink/ios-picker/wiki/2.4-Supported-Sources) 83 | -------------------------------------------------------------------------------- /Docs/Wiki/2.3-Delegate-Methods.md: -------------------------------------------------------------------------------- 1 | #### FPPickerControllerDelegate 2 | 3 | ```objc 4 | - (void)fpPickerController:(FPPickerController *)pickerController didFinishPickingMediaWithInfo:(FPMediaInfo *)info; 5 | ``` 6 | - Called after Filepicker finished picking a media. 7 | - At this point the associated media file should be present in `info.mediaURL`. 8 | - Properties in `info`: 9 | - `mediaURL` 10 | - A local `NSURL` pointing to the file 11 | - e.g: `assets-library://asset/asset.JPG?id=1000000001&ext=JPG` 12 | - `mediaType` 13 | - The `UTType` for the file 14 | - e.g: `public.image` 15 | - `remoteURL` 16 | - A `NSString` with the URL for the file 17 | - e.g: https://www.filepicker.io/api/file/we9f3kf93qls0) 18 | - `filename` 19 | - A `NSString` with the filename 20 | - e.g: `202342304.jpg` 21 | - `filesize` *(when available)* 22 | - A `NSNumber` with the filesize in bytes 23 | - e.g: `1048576` 24 | - `key` *(when available)* 25 | - An S3 key if the developer has set up Amazon S3 account at Filepicker.io 26 | - e.g: JENAoTrDSPGFMrdxMd2R_photo.jpg 27 | - `source` *(when available)* 28 | - A `FPSource` used for retrieving the media 29 | - `originalAsset` *(when available; iOS only)* 30 | - A `ALAsset` pointing to the original asset from the camera roll 31 | - `thumbnailImage` *(when available; iOS only)* 32 | - A thumbnail-sized `UIImage` representing the media (only applies to image media) 33 | - Methods in `info`: 34 | - `containsImageAtMediaURL` 35 | - YES if `mediaURL` contains an image; no otherwise 36 | - `containsVideoAtMediaURL` 37 | - YES if `mediaURL` contains a video; no otherwise 38 | 39 | ```objc 40 | - (void)fpPickerController:(FPPickerController *)pickerController didPickMediaWithInfo:(FPMediaInfo *)info; 41 | ``` 42 | - Called after Filepicker picked a media. 43 | - Properties in `info`: 44 | - `thumbnailImage` *(when available; iOS only)* 45 | - A thumbnail-sized `UIImage` representing the media 46 | 47 | ```objc 48 | - (void)fpPickerControllerDidCancel:(FPPickerController *)pickerController; 49 | ``` 50 | - Typically called when the picking process is cancelled or a file can't be handled. 51 | 52 | ```objc 53 | - (void)fpPickerController:(FPPickerController *)pickerController didFinishPickingMultipleMediaWithResults:(NSArray *)results; 54 | ``` 55 | - Called after Filepicker finished picking multiple media. 56 | - At this point the associated media file for each item should be present at info.mediaURL. 57 | 58 | #### FPSaveControllerDelegate Methods 59 | 60 | ```objc 61 | - (void)fpSaveController:(FPSaveController *)saveController didFinishSavingMediaWithInfo:(FPMediaInfo *)info; 62 | ``` 63 | - Called after Filepicker finished saving a media. 64 | 65 | ```objc 66 | - (void)fpSaveController:(FPSaveController *)saveController didError:(NSError *)error; 67 | ``` 68 | - Called when Filepicker failed saving a media. 69 | 70 | ```objc 71 | - (void)fpSaveControllerDidCancel:(FPSaveController *)saveController; 72 | ``` 73 | - Typically called when the save process is cancelled or a file can't be handled. 74 | -------------------------------------------------------------------------------- /Docs/Wiki/2.4-Supported-Sources.md: -------------------------------------------------------------------------------- 1 | | Source | Description| 2 | | -------------:|:--------:| 3 | |`FPSourceCamera`|The local camera| 4 | |`FPSourceCameraRoll`|The local photos| 5 | |`FPSourceDropbox`|[www.dropbox.com](https://www.dropbox.com)| 6 | |`FPSourceFacebook`|[www.facebook.com](https://www.facebook.com)| 7 | |`FPSourceGmail`|[www.gmail.com](https://www.gmail.com)| 8 | |`FPSourceBox`|[www.box.com](https://www.box.com)| 9 | |`FPSourceGithub`|[www.github.com](https://www.github.com)| 10 | |`FFPSourceGoogleDrive`|[drive.google.com](https://drive.google.com)| 11 | |`FPSourceImagesearch`|[Flickr Public Domain Image Search](https://www.flickr.com/groups/publicdomain)| 12 | |`FPSourceInstagram`|[www.instagram.com](https://www.instagram.com)| 13 | |`FPSourceFlickr`|[www.flickr.com](https://www.flickr.com)| 14 | |`FPSourcePicasa`|[picasa.google.com](https://picasa.google.com)| 15 | |`FPSourceSkydrive`|[onedrive.live.com](https://onedrive.live.com)| 16 | |`FPSourceEvernote`|[www.evernote.com](https://www.evernote.com)| 17 | |`FPSourceCloudDrive`|[www.amazon.com/clouddrive](https://www.amazon.com/clouddrive)| 18 | -------------------------------------------------------------------------------- /Docs/Wiki/2.5-Advanced-Configuration.md: -------------------------------------------------------------------------------- 1 | If you need to enable security or customize store options, please follow the instructions below: 2 | 3 | ### Enabling Security 4 | 5 | - **App Secret Key** 6 | 7 | - Add `@import FPPicker;` (iOS) or `@import FPPickerMac;` (OS X) to your app delegate (i.e., typically `AppDelegate.m`) 8 | - Add the following code on your app delegate and use the API Key you got after registering: 9 | 10 | ```objc 11 | + (void)initialize 12 | { 13 | (...) 14 | [FPConfig sharedInstance].appSecretKey = @"SET_FILEPICKER.IO_APPSECRETKEY_HERE"; 15 | (...) 16 | } 17 | ``` 18 | ##### NOTE: This setting is required if security is enabled in [Developer Portal](https://developers.filepicker.io/apps/). 19 | 20 | ### Customizing Store Options 21 | 22 | - Add `@import FPPicker;` (iOS) or `@import FPPickerMac;` (OS X) to your app delegate (i.e., typically `AppDelegate.m`) 23 | - Add the following code on your app delegate: 24 | 25 | 1. **Store Access** 26 | 27 | Indicates that the file should be stored in a way that allows public access 28 | going directly to the underlying file store. 29 | 30 | ```objc 31 | + (void)initialize 32 | { 33 | (...) 34 | [FPConfig sharedInstance].storeAccess = @"private"; 35 | (...) 36 | } 37 | ``` 38 | 39 | - Valid values are `public` or `private`. 40 | - Defaults to `private`. 41 | 42 | 2. **Store Container** 43 | 44 | The bucket or container in the specified file store where the file should end up. 45 | 46 | ```objc 47 | + (void)initialize 48 | { 49 | (...) 50 | [FPConfig sharedInstance].storeContainer = @"some-alt-container"; 51 | (...) 52 | } 53 | ``` 54 | 55 | 3. **Store Location** 56 | 57 | Where to store the file. 58 | 59 | ```objc 60 | + (void)initialize 61 | { 62 | (...) 63 | [FPConfig sharedInstance].storeLocation = @"S3"; 64 | (...) 65 | } 66 | ``` 67 | 68 | - Valid values are `S3`, `azure`, `dropbox` and `rackspace`. 69 | - Defaults to `S3`. 70 | 71 | 4. **Store Path** 72 | 73 | The path to store the file at within the specified file store. 74 | 75 | For S3, this is the key where the file will be stored at. 76 | 77 | **NOTE:** For S3, please remember adding a trailing slash to the path (i.e. `my-custom-path/`) 78 | 79 | ```objc 80 | + (void)initialize 81 | { 82 | (...) 83 | [FPConfig sharedInstance].storePath = @"some-path-within-bucket/"; 84 | (...) 85 | } 86 | ``` 87 | -------------------------------------------------------------------------------- /Docs/Wiki/5.-Common-Tips.md: -------------------------------------------------------------------------------- 1 | - **The app builds, but crashes when I try to present the modal.** (iOS only) 2 | 3 | It may be that you haven't set your API Key as it's checked the first time it's loaded. 4 | 5 | - Go to [Filepicker.io](www.filepicker.io) to register an account. 6 | - Add `#import ` to your app delegate (i.e., typically `AppDelegate.m`) 7 | - Add the following code on your app delegate and use the API Key you got after registering: 8 | 9 | ```objc 10 | + (void)initialize 11 | { 12 | (...) 13 | [FPConfig sharedInstance].APIKey = @"SET_FILEPICKER.IO_APIKEY_HERE"; 14 | (...) 15 | } 16 | ``` 17 | - **I'm using a popover in iPad and the login screens look terrible.** (iOS only) 18 | 19 | Our ability to deliver mobile pages is partly dependent on the service itself. Some have no mobile page at all. Others examine the user agent string and return the iPad version, not a popover friendly one. I've had good luck changing my user-agent string for a couple services. 20 | 21 | Add this to your `AppDelegate.m`: 22 | 23 | ```objc 24 | /* 25 | * This makes the login screens look much nicer on iPad 26 | */ 27 | 28 | + (void)initialize 29 | { 30 | // Set user agent (the only problem is that we can't modify the User-Agent later in the program) 31 | 32 | NSDictionary *dictionary = @{ 33 | @"UserAgent":@"Mozilla/5.0 (iPhone; CPU iPhone OS 5_0 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Version/5.1 Mobile/9A334 Safari/7534.48.3" 34 | }; 35 | 36 | [[NSUserDefaults standardUserDefaults] registerDefaults:dictionary]; 37 | } 38 | ``` 39 | -------------------------------------------------------------------------------- /Docs/Wiki/6.-Demo.md: -------------------------------------------------------------------------------- 1 | ### Running the Demo Projects 2 | 3 | 1. Get an API Key 4 | - Go to [Filepicker.io](www.filepicker.io) to register an account. 5 | - API Keys are typically randomized and 20 characters long. 6 | 7 | 2. Open any of the demo projects: 8 | 9 | - `FPPicker iOS Demo/FPPicker iOS Demo.xcodeproj` 10 | - `FPPicker iOS API Demo/FPPicker iOS API Demo.xcodeproj` 11 | - `FPPicker Mac Demo/FPPicker Mac Demo.xcodeproj` 12 | - `FPPicker Mac API Demo/FPPicker Mac API Demo.xcodeproj` 13 | 14 | 3. Set your Filepicker API Key 15 | - Open `AppDelegate.m` and set the API Key you got after registering: 16 | 17 | ```objc 18 | + (void)initialize 19 | { 20 | (...) 21 | [FPConfig sharedInstance].APIKey = @"SET_FILEPICKER.IO_APIKEY_HERE"; 22 | (...) 23 | } 24 | ``` 25 | 4. Build and Run 26 | -------------------------------------------------------------------------------- /Docs/Wiki/Home.md: -------------------------------------------------------------------------------- 1 | # Ink Filepicker iOS / OS X Library 2 | 3 | The easiest way to import content into your application. 4 | [http://filepicker.io](http://filepicker.io) 5 | 6 | 7 | 8 | ## Requirements 9 | 10 | - iOS 8.0 or later 11 | - OS X 10.9 or later 12 | - Xcode 6 13 | - [CocoaPods](http://cocoapods.org) 14 | 15 | ##### NOTE: If you want to continue developing for iOS 6 and 7, please use the 3.x version (tag v3.2.9). 16 | 17 | ## Installation 18 | 19 | Filepicker can be easily integrated into your iOS or OS X app by using [CocoaPods](http://cocoapods.org/). 20 | 21 | To learn more, please check our [Installation Instructions](https://github.com/Ink/ios-picker/wiki/1.-Installation). 22 | 23 | ## Wiki Pages 24 | 25 | 1. [Installation](https://github.com/Ink/ios-picker/wiki/1.-Installation) 26 | 2. [Usage](https://github.com/Ink/ios-picker/wiki/2.-Usage) 27 | 3. [Programmatic API Usage](https://github.com/Ink/ios-picker/wiki/3.-Programmatic-API-Usage) *(new in v5)* 28 | 4. [Theming in iOS](https://github.com/Ink/ios-picker/wiki/4.-Theming-in-iOS) *(new in v5)* 29 | 5. [Common Tips](https://github.com/Ink/ios-picker/wiki/5.-Common-Tips) 30 | 6. [Demo Projects](https://github.com/Ink/ios-picker/wiki/6.-Demo-Projects) 31 | 32 | ## License 33 | 34 | See [LICENSE.md](https://github.com/Ink/ios-picker/blob/develop/LICENSE.md) 35 | -------------------------------------------------------------------------------- /Docs/filepicker.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ink/ios-picker/00a17e82e7bb6858d354d89483020156ed0184f9/Docs/filepicker.png -------------------------------------------------------------------------------- /Docs/theming-2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ink/ios-picker/00a17e82e7bb6858d354d89483020156ed0184f9/Docs/theming-2.jpg -------------------------------------------------------------------------------- /Docs/theming.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ink/ios-picker/00a17e82e7bb6858d354d89483020156ed0184f9/Docs/theming.jpg -------------------------------------------------------------------------------- /FPPicker Mac API Demo/FPPicker Mac API Demo/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // FPPicker Mac API Demo 4 | // 5 | // Created by Ruben Nine on 13/08/15. 6 | // Copyright (c) 2015 Filepicker.io. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : NSObject 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /FPPicker Mac API Demo/FPPicker Mac API Demo/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // FPPicker Mac API Demo 4 | // 5 | // Created by Ruben Nine on 13/08/15. 6 | // Copyright (c) 2015 Filepicker.io. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | @import FPPickerMac; 11 | 12 | @interface AppDelegate () 13 | 14 | @end 15 | 16 | @implementation AppDelegate 17 | 18 | + (void)initialize 19 | { 20 | [super initialize]; 21 | 22 | //! Filepicker.io configuration (required) 23 | 24 | [FPConfig sharedInstance].APIKey = @"SET_FILEPICKER.IO_APIKEY_HERE"; 25 | 26 | //! Filepicker.io configuration (optional) 27 | 28 | //! [FPConfig sharedInstance].appSecretKey = @"SET_FILEPICKER.IO_APPSECRETKEY_HERE"; 29 | //! [FPConfig sharedInstance].storeAccess = @"private"; 30 | //! [FPConfig sharedInstance].storeContainer = @"some-alt-container"; 31 | //! [FPConfig sharedInstance].storeLocation = @"S3"; 32 | //! [FPConfig sharedInstance].storePath = @"some-path-within-bucket/"; 33 | } 34 | 35 | - (void)applicationDidFinishLaunching:(NSNotification *)aNotification 36 | { 37 | // Insert code here to initialize your application 38 | } 39 | 40 | - (void)applicationWillTerminate:(NSNotification *)aNotification 41 | { 42 | // Insert code here to tear down your application 43 | } 44 | 45 | @end 46 | -------------------------------------------------------------------------------- /FPPicker Mac API Demo/FPPicker Mac API Demo/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "mac", 5 | "size" : "16x16", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "mac", 10 | "size" : "16x16", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "mac", 15 | "size" : "32x32", 16 | "scale" : "1x" 17 | }, 18 | { 19 | "idiom" : "mac", 20 | "size" : "32x32", 21 | "scale" : "2x" 22 | }, 23 | { 24 | "idiom" : "mac", 25 | "size" : "128x128", 26 | "scale" : "1x" 27 | }, 28 | { 29 | "idiom" : "mac", 30 | "size" : "128x128", 31 | "scale" : "2x" 32 | }, 33 | { 34 | "idiom" : "mac", 35 | "size" : "256x256", 36 | "scale" : "1x" 37 | }, 38 | { 39 | "idiom" : "mac", 40 | "size" : "256x256", 41 | "scale" : "2x" 42 | }, 43 | { 44 | "idiom" : "mac", 45 | "size" : "512x512", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "mac", 50 | "size" : "512x512", 51 | "scale" : "2x" 52 | } 53 | ], 54 | "info" : { 55 | "version" : 1, 56 | "author" : "xcode" 57 | } 58 | } -------------------------------------------------------------------------------- /FPPicker Mac API Demo/FPPicker Mac API Demo/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1 25 | LSMinimumSystemVersion 26 | $(MACOSX_DEPLOYMENT_TARGET) 27 | NSHumanReadableCopyright 28 | Copyright © 2015 Filepicker.io. All rights reserved. 29 | NSMainStoryboardFile 30 | Main 31 | NSPrincipalClass 32 | NSApplication 33 | NSAppTransportSecurity 34 | 35 | NSExceptionDomains 36 | 37 | facebook.com 38 | 39 | NSTemporaryExceptionRequiresForwardSecrecy 40 | 41 | NSIncludesSubdomains 42 | 43 | 44 | 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /FPPicker Mac API Demo/FPPicker Mac API Demo/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // FPPicker Mac API Demo 4 | // 5 | // Created by Ruben Nine on 13/08/15. 6 | // Copyright (c) 2015 Filepicker.io. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : NSViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /FPPicker Mac API Demo/FPPicker Mac API Demo/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // FPPicker Mac API Demo 4 | // 5 | // Created by Ruben Nine on 13/08/15. 6 | // Copyright (c) 2015 Filepicker.io. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | int main(int argc, const char * argv[]) { 12 | return NSApplicationMain(argc, argv); 13 | } 14 | -------------------------------------------------------------------------------- /FPPicker Mac Demo/FPPicker Mac Demo/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // FPPicker Mac Demo 4 | // 5 | // Created by Ruben Nine on 14/08/14. 6 | // Copyright (c) 2014 Filepicker.io. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : NSObject 12 | 13 | @property (assign) IBOutlet NSWindow *window; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /FPPicker Mac Demo/FPPicker Mac Demo/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // FPPicker Mac Demo 4 | // 5 | // Created by Ruben Nine on 14/08/14. 6 | // Copyright (c) 2014 Filepicker.io. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | @import FPPickerMac; 12 | 13 | @implementation AppDelegate 14 | 15 | + (void)initialize 16 | { 17 | //! Filepicker.io configuration (required) 18 | 19 | [FPConfig sharedInstance].APIKey = @"SET_FILEPICKER.IO_APIKEY_HERE"; 20 | 21 | //! Filepicker.io configuration (optional) 22 | 23 | //! [FPConfig sharedInstance].appSecretKey = @"SET_FILEPICKER.IO_APPSECRETKEY_HERE"; 24 | //! [FPConfig sharedInstance].storeAccess = @"private"; 25 | //! [FPConfig sharedInstance].storeContainer = @"some-alt-container"; 26 | //! [FPConfig sharedInstance].storeLocation = @"S3"; 27 | //! [FPConfig sharedInstance].storePath = @"some-path-within-bucket/"; 28 | } 29 | 30 | - (void)applicationDidFinishLaunching:(NSNotification *)aNotification 31 | { 32 | // Insert code here to initialize your application 33 | } 34 | 35 | @end 36 | -------------------------------------------------------------------------------- /FPPicker Mac Demo/FPPicker Mac Demo/FPPicker Mac Demo-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1 25 | LSMinimumSystemVersion 26 | ${MACOSX_DEPLOYMENT_TARGET} 27 | NSHumanReadableCopyright 28 | Copyright © 2014 Filepicker.io. All rights reserved. 29 | NSMainNibFile 30 | MainMenu 31 | NSPrincipalClass 32 | NSApplication 33 | NSAppTransportSecurity 34 | 35 | NSExceptionDomains 36 | 37 | facebook.com 38 | 39 | NSTemporaryExceptionRequiresForwardSecrecy 40 | 41 | NSIncludesSubdomains 42 | 43 | 44 | 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /FPPicker Mac Demo/FPPicker Mac Demo/FPPicker Mac Demo-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header 3 | // 4 | // The contents of this file are implicitly included at the beginning of every source file. 5 | // 6 | 7 | #ifdef __OBJC__ 8 | #import 9 | #endif 10 | -------------------------------------------------------------------------------- /FPPicker Mac Demo/FPPicker Mac Demo/ImageBrowserBackgroundLayer.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | 4 | @interface ImageBrowserBackgroundLayer : CALayer 5 | 6 | @property (weak) IKImageBrowserView *owner; 7 | 8 | @end 9 | -------------------------------------------------------------------------------- /FPPicker Mac Demo/FPPicker Mac Demo/ImageBrowserBackgroundLayer.m: -------------------------------------------------------------------------------- 1 | #import "ImageBrowserBackgroundLayer.h" 2 | 3 | @implementation ImageBrowserBackgroundLayer 4 | 5 | @synthesize owner; 6 | 7 | - (instancetype)init 8 | { 9 | self = [super init]; 10 | 11 | if (self) 12 | { 13 | //needs to redraw when bounds change 14 | self.needsDisplayOnBoundsChange = YES; 15 | } 16 | 17 | return self; 18 | } 19 | 20 | - (id)actionForKey:(NSString *)event 21 | { 22 | return nil; 23 | } 24 | 25 | - (void)drawInContext:(CGContextRef)context 26 | { 27 | //retrieve bounds and visible rect 28 | 29 | NSRect visibleRect = [owner visibleRect]; 30 | NSRect bounds = [owner bounds]; 31 | 32 | //retrieve background image 33 | 34 | CGImageRef image = NULL; 35 | 36 | NSString *path = [[NSBundle mainBundle] pathForResource:@"metal_background" 37 | ofType:@"tif"]; 38 | 39 | if (!path) 40 | { 41 | return; 42 | } 43 | 44 | CGImageSourceRef imageSource = CGImageSourceCreateWithURL((CFURLRef)[NSURL fileURLWithPath: path], NULL); 45 | 46 | if (!imageSource) 47 | { 48 | return; 49 | } 50 | 51 | image = CGImageSourceCreateImageAtIndex(imageSource, 0, NULL); 52 | 53 | if (!image) 54 | { 55 | CFRelease(imageSource); 56 | 57 | return; 58 | } 59 | 60 | float width = (float) CGImageGetWidth(image); 61 | float height = (float) CGImageGetHeight(image); 62 | 63 | //compute coordinates to fill the view 64 | float left, top, right, bottom; 65 | 66 | top = bounds.size.height - NSMaxY(visibleRect); 67 | top = fmod(top, height); 68 | top = height - top; 69 | 70 | right = NSMaxX(visibleRect); 71 | bottom = -height; 72 | 73 | // tile the image and take in account the offset to 'emulate' a scrolling background 74 | 75 | for (top = visibleRect.size.height - top; top > bottom; top -= height) 76 | { 77 | for (left = 0; left 2 | #import 3 | 4 | 5 | @interface ImageBrowserCell : IKImageBrowserCell 6 | 7 | @end 8 | -------------------------------------------------------------------------------- /FPPicker Mac Demo/FPPicker Mac Demo/ImageBrowserItem.h: -------------------------------------------------------------------------------- 1 | // 2 | // Image.h 3 | // FPPicker Mac Demo 4 | // 5 | // Created by Ruben Nine on 24/10/14. 6 | // Copyright (c) 2014 Filepicker.io. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ImageBrowserItem : NSObject 12 | 13 | @property (nonatomic, strong) NSImage *image; 14 | @property (nonatomic, strong) NSString *title; 15 | @property (nonatomic, strong) NSString *mimetype; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /FPPicker Mac Demo/FPPicker Mac Demo/ImageBrowserItem.m: -------------------------------------------------------------------------------- 1 | // 2 | // Image.m 3 | // FPPicker Mac Demo 4 | // 5 | // Created by Ruben Nine on 24/10/14. 6 | // Copyright (c) 2014 Filepicker.io. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "ImageBrowserItem.h" 11 | 12 | @implementation ImageBrowserItem 13 | 14 | #pragma mark - IKImageBrowserItem Data Source Protocol Methods 15 | 16 | - (NSString *)imageRepresentationType 17 | { 18 | return IKImageBrowserNSImageRepresentationType; 19 | } 20 | 21 | - (id)imageRepresentation 22 | { 23 | return self.image; 24 | } 25 | 26 | - (NSString *)imageUID 27 | { 28 | return [NSString stringWithFormat:@"%ld", (long)self.image.hash]; 29 | } 30 | 31 | - (NSString *)imageTitle 32 | { 33 | return self.title; 34 | } 35 | 36 | @end 37 | -------------------------------------------------------------------------------- /FPPicker Mac Demo/FPPicker Mac Demo/ImageBrowserView.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | 4 | 5 | @interface ImageBrowserView : IKImageBrowserView { 6 | NSRect lastVisibleRect; 7 | } 8 | 9 | @end 10 | -------------------------------------------------------------------------------- /FPPicker Mac Demo/FPPicker Mac Demo/ImageBrowserView.m: -------------------------------------------------------------------------------- 1 | #import "ImageBrowserView.h" 2 | #import "ImageBrowserCell.h" 3 | 4 | 5 | @implementation ImageBrowserView 6 | 7 | - (IKImageBrowserCell *)newCellForRepresentedItem:(id)cell 8 | { 9 | return [ImageBrowserCell new]; 10 | } 11 | 12 | - (void)drawRect:(NSRect)rect 13 | { 14 | //retrieve the visible area 15 | NSRect visibleRect = [self visibleRect]; 16 | 17 | //compare with the visible rect at the previous frame 18 | if (!NSEqualRects(visibleRect, lastVisibleRect)) 19 | { 20 | //we did scroll or resize, redraw the background 21 | [[self backgroundLayer] setNeedsDisplay]; 22 | 23 | //update last visible rect 24 | lastVisibleRect = visibleRect; 25 | } 26 | 27 | [super drawRect:rect]; 28 | } 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /FPPicker Mac Demo/FPPicker Mac Demo/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "mac", 5 | "size" : "16x16", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "mac", 10 | "size" : "16x16", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "mac", 15 | "size" : "32x32", 16 | "scale" : "1x" 17 | }, 18 | { 19 | "idiom" : "mac", 20 | "size" : "32x32", 21 | "scale" : "2x" 22 | }, 23 | { 24 | "idiom" : "mac", 25 | "size" : "128x128", 26 | "scale" : "1x" 27 | }, 28 | { 29 | "idiom" : "mac", 30 | "size" : "128x128", 31 | "scale" : "2x" 32 | }, 33 | { 34 | "idiom" : "mac", 35 | "size" : "256x256", 36 | "scale" : "1x" 37 | }, 38 | { 39 | "idiom" : "mac", 40 | "size" : "256x256", 41 | "scale" : "2x" 42 | }, 43 | { 44 | "idiom" : "mac", 45 | "size" : "512x512", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "mac", 50 | "size" : "512x512", 51 | "scale" : "2x" 52 | } 53 | ], 54 | "info" : { 55 | "version" : 1, 56 | "author" : "xcode" 57 | } 58 | } -------------------------------------------------------------------------------- /FPPicker Mac Demo/FPPicker Mac Demo/Resources/glossy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ink/ios-picker/00a17e82e7bb6858d354d89483020156ed0184f9/FPPicker Mac Demo/FPPicker Mac Demo/Resources/glossy.png -------------------------------------------------------------------------------- /FPPicker Mac Demo/FPPicker Mac Demo/Resources/metal_background.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ink/ios-picker/00a17e82e7bb6858d354d89483020156ed0184f9/FPPicker Mac Demo/FPPicker Mac Demo/Resources/metal_background.tif -------------------------------------------------------------------------------- /FPPicker Mac Demo/FPPicker Mac Demo/Resources/pin.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ink/ios-picker/00a17e82e7bb6858d354d89483020156ed0184f9/FPPicker Mac Demo/FPPicker Mac Demo/Resources/pin.tiff -------------------------------------------------------------------------------- /FPPicker Mac Demo/FPPicker Mac Demo/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // FPPicker Mac Demo 4 | // 5 | // Created by Ruben Nine on 18/08/14. 6 | // Copyright (c) 2014 Filepicker.io. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @interface ViewController : NSViewController 13 | 14 | @property (nonatomic, weak) IBOutlet IKImageBrowserView *imageBrowser; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /FPPicker Mac Demo/FPPicker Mac Demo/en.lproj/Credits.rtf: -------------------------------------------------------------------------------- 1 | {\rtf0\ansi{\fonttbl\f0\fswiss Helvetica;} 2 | {\colortbl;\red255\green255\blue255;} 3 | \paperw9840\paperh8400 4 | \pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural 5 | 6 | \f0\b\fs24 \cf0 Engineering: 7 | \b0 \ 8 | Some people\ 9 | \ 10 | 11 | \b Human Interface Design: 12 | \b0 \ 13 | Some other people\ 14 | \ 15 | 16 | \b Testing: 17 | \b0 \ 18 | Hopefully not nobody\ 19 | \ 20 | 21 | \b Documentation: 22 | \b0 \ 23 | Whoever\ 24 | \ 25 | 26 | \b With special thanks to: 27 | \b0 \ 28 | Mom\ 29 | } 30 | -------------------------------------------------------------------------------- /FPPicker Mac Demo/FPPicker Mac Demo/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /FPPicker Mac Demo/FPPicker Mac Demo/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // FPPicker Mac Demo 4 | // 5 | // Created by Ruben Nine on 14/08/14. 6 | // Copyright (c) 2014 Filepicker.io. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | int main(int argc, const char * argv[]) 12 | { 13 | return NSApplicationMain(argc, argv); 14 | } 15 | -------------------------------------------------------------------------------- /FPPicker Mac.xcodeproj/xcshareddata/xcschemes/FPPickerMac.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 42 | 43 | 52 | 53 | 54 | 55 | 61 | 62 | 64 | 65 | 68 | 69 | 70 | -------------------------------------------------------------------------------- /FPPicker Tests/Functional Tests/FPPicker Functional Tests-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundlePackageType 14 | BNDL 15 | CFBundleShortVersionString 16 | 1.0 17 | CFBundleSignature 18 | ???? 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /FPPicker Tests/Functional Tests/FPPicker Functional Tests-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header 3 | // 4 | // The contents of this file are implicitly included at the beginning of every source file. 5 | // 6 | 7 | #ifdef __OBJC__ 8 | #import 9 | #import 10 | #import "TestHelpers.h" 11 | #endif 12 | -------------------------------------------------------------------------------- /FPPicker Tests/Functional Tests/FPSessionTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // FPSessionTests.m 3 | // FPPicker 4 | // 5 | // Created by Ruben Nine on 14/07/14. 6 | // Copyright (c) 2014 Filepicker.io. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | // Collaborators 12 | 13 | #import "FPSession.h" 14 | 15 | @interface FPSessionTests : XCTestCase 16 | 17 | @end 18 | 19 | @implementation FPSessionTests 20 | 21 | - (void)setUp 22 | { 23 | [super setUp]; 24 | // Put setup code here. This method is called before the invocation of each test method in the class. 25 | } 26 | 27 | - (void)tearDown 28 | { 29 | // Put teardown code here. This method is called after the invocation of each test method in the class. 30 | [super tearDown]; 31 | } 32 | 33 | - (void)testJSONSessionStringForAPIKeyAndMimetypes 34 | { 35 | FPSession *session = [FPSession new]; 36 | 37 | NSString *emptyJSON = [session JSONSessionString]; 38 | 39 | XCTAssertEqualObjects(emptyJSON, 40 | @"{\"app\":{}}", 41 | @"Should represent an empty session"); 42 | 43 | session = [FPSession new]; 44 | 45 | session.APIKey = @"MY-API-KEY"; 46 | 47 | NSString *JSONWithAPIKey = [session JSONSessionString]; 48 | 49 | XCTAssertEqualObjects(JSONWithAPIKey, 50 | @"{\"app\":{\"apikey\":\"MY-API-KEY\"}}", 51 | @"Should contain an 'apikey' entry"); 52 | 53 | session = [FPSession new]; 54 | 55 | session.APIKey = @"MY-API-KEY"; 56 | session.mimetypes = @"image/png"; 57 | 58 | NSString *JSONWithAPIKeyAndMimetype = [session JSONSessionString]; 59 | 60 | XCTAssertEqualObjects(JSONWithAPIKeyAndMimetype, 61 | @"{\"app\":{\"apikey\":\"MY-API-KEY\"},\"mimetypes\":\"image\\/png\"}", 62 | @"Should contain both an 'apikey' and a 'mimetypes' entry"); 63 | 64 | session = [FPSession new]; 65 | 66 | session.APIKey = @"MY-API-KEY"; 67 | session.mimetypes = @[@"image/png", @"image/jpeg"]; 68 | 69 | NSString *JSONWithAPIKeyAndMimetypes = [session JSONSessionString]; 70 | 71 | XCTAssertEqualObjects(JSONWithAPIKeyAndMimetypes, 72 | @"{\"app\":{\"apikey\":\"MY-API-KEY\"},\"mimetypes\":[\"image\\/png\",\"image\\/jpeg\"]}", 73 | @"Should contain both an 'apikey' and a 'mimetypes' entry"); 74 | } 75 | 76 | @end 77 | -------------------------------------------------------------------------------- /FPPicker Tests/Functional Tests/FPSourceTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // FPSourceTests.m 3 | // FPPicker 4 | // 5 | // Created by Ruben Nine on 16/06/14. 6 | // Copyright (c) 2014 Filepicker.io. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | // Collaborators 12 | #import "FPSource.h" 13 | 14 | @interface FPSourceTests : XCTestCase 15 | 16 | @end 17 | 18 | @implementation FPSourceTests 19 | 20 | - (void)setUp 21 | { 22 | [super setUp]; 23 | // Put setup code here. This method is called before the invocation of each test method in the class. 24 | } 25 | 26 | - (void)tearDown 27 | { 28 | // Put teardown code here. This method is called after the invocation of each test method in the class. 29 | [super tearDown]; 30 | } 31 | 32 | @end 33 | -------------------------------------------------------------------------------- /FPPicker Tests/Functional Tests/Fixtures/failureResponse.json: -------------------------------------------------------------------------------- 1 | { 2 | "result": "error" 3 | } -------------------------------------------------------------------------------- /FPPicker Tests/Functional Tests/Fixtures/outline.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ink/ios-picker/00a17e82e7bb6858d354d89483020156ed0184f9/FPPicker Tests/Functional Tests/Fixtures/outline.png -------------------------------------------------------------------------------- /FPPicker Tests/Functional Tests/Fixtures/successfulMultipartEndResponse.json: -------------------------------------------------------------------------------- 1 | { 2 | "data": { 3 | "data": { 4 | "filename": "outline.png", 5 | "size": 126640, 6 | "type": "image/png" 7 | }, 8 | "url": "https://www.filepicker.io/api/file/Z7aGazYTXiIQTIcHiYgR" 9 | }, 10 | "result": "ok" 11 | } -------------------------------------------------------------------------------- /FPPicker Tests/Functional Tests/Fixtures/successfulMultipartStartResponse.json: -------------------------------------------------------------------------------- 1 | { 2 | "data": { 3 | "id": "BQOwM2NHSFOsNKM3STwG" 4 | }, 5 | "result": "ok" 6 | } -------------------------------------------------------------------------------- /FPPicker Tests/Functional Tests/Fixtures/successfulMultipartUploadResponse.json: -------------------------------------------------------------------------------- 1 | { 2 | "result": "ok" 3 | } -------------------------------------------------------------------------------- /FPPicker Tests/Functional Tests/Fixtures/successfulResponse.json: -------------------------------------------------------------------------------- 1 | { 2 | "data": { 3 | "data": { 4 | "filename": "outline.png", 5 | "size": 126640, 6 | "type": "image/png" 7 | }, 8 | "url": "https://www.filepicker.io/api/file/Z7aGazYTXiIQTIcHiYgR" 9 | }, 10 | "result": "ok" 11 | } -------------------------------------------------------------------------------- /FPPicker Tests/Functional Tests/TestHelpers.h: -------------------------------------------------------------------------------- 1 | // 2 | // TestHelpers.h 3 | // FPPicker Functional Tests 4 | // 5 | // Created by Ruben Nine on 11/06/14. 6 | // Copyright (c) 2014 Filepicker.io. All rights reserved. 7 | // 8 | 9 | // Mocking, stubbing classes 10 | 11 | #import "OCMock.h" 12 | #import "OHHTTPStubs.h" 13 | 14 | // Categories 15 | 16 | #import "NSDictionary+FPMerge.h" 17 | #import "OHHTTPStubs+ConveniencyMethods.h" 18 | #import "FPConfig+DestroyableSingleton.h" 19 | 20 | 21 | /** 22 | Runs the loop once so the run loop has a chance to process some events 23 | */ 24 | static inline void runTheRunLoopOnce() 25 | { 26 | [[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode 27 | beforeDate:[NSDate distantFuture]]; 28 | } 29 | -------------------------------------------------------------------------------- /FPPicker Tests/Functional Tests/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /FPPicker Tests/Shared/FPConfig+DestroyableSingleton.h: -------------------------------------------------------------------------------- 1 | // 2 | // FPConfig+DestroyableSingleton.h 3 | // FPPicker 4 | // 5 | // Created by Ruben Nine on 17/06/14. 6 | // Copyright (c) 2014 Filepicker.io. All rights reserved. 7 | // 8 | 9 | #include "FPConfig.h" 10 | 11 | @interface FPConfig (DestroyableSingleton) 12 | 13 | + (void)destroyAndRecreateSingleton; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /FPPicker Tests/Shared/NSDictionary+FPMerge.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSDictionary+FPMerge.h 3 | // FPPicker 4 | // 5 | // Created by Ruben Nine on 16/06/14. 6 | // Copyright (c) 2014 Filepicker.io. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface NSDictionary (FPMerge) 12 | 13 | + (NSDictionary *)mergeDictionary:(NSDictionary *)dictionary 14 | into:(NSDictionary *)anotherDictionary; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /FPPicker Tests/Shared/NSDictionary+FPMerge.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSDictionary+FPMerge.m 3 | // FPPicker 4 | // 5 | // Created by Ruben Nine on 16/06/14. 6 | // Copyright (c) 2014 Filepicker.io. All rights reserved. 7 | // 8 | 9 | #import "NSDictionary+FPMerge.h" 10 | 11 | @implementation NSDictionary (FPMerge) 12 | 13 | + (NSDictionary *)mergeDictionary:(NSDictionary *)dictionary 14 | into:(NSDictionary *)anotherDictionary 15 | { 16 | NSMutableDictionary *tmpMutableDictionary = [dictionary mutableCopy]; 17 | 18 | [tmpMutableDictionary addEntriesFromDictionary:anotherDictionary]; 19 | 20 | return [tmpMutableDictionary copy]; 21 | } 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /FPPicker Tests/Shared/OHHTTPStubs+ConveniencyMethods.h: -------------------------------------------------------------------------------- 1 | // 2 | // OHHTTPStubs+ConveniencyMethods.h 3 | // TestedApp 4 | // 5 | // Created by Ruben Nine on 11/06/14. 6 | // Copyright (c) 2014 Filepicker.io. All rights reserved. 7 | // 8 | 9 | #import "OHHTTPStubs.h" 10 | 11 | typedef enum : NSUInteger 12 | { 13 | OHHTTPMatchHost = (1 << 0), 14 | OHHTTPMatchPath = (1 << 1), 15 | OHHTTPMatchQueryString = (1 << 2), 16 | OHHTTPMatchScheme = (1 << 3), 17 | OHHTTPMatchAll = OHHTTPMatchHost | OHHTTPMatchPath | OHHTTPMatchScheme | OHHTTPMatchQueryString 18 | } OHHTTPMatchingMode; 19 | 20 | @interface OHHTTPStubs (ConveniencyMethods) 21 | 22 | + (void)stubHTTPRequestWithNSURL:(NSURL *)url 23 | andHTTPMethod:()HTTPMethod 24 | matching:(OHHTTPMatchingMode)matchingOptions 25 | withFixtureFile:(NSString *)fixtureFile 26 | statusCode:(int)statusCode 27 | andHeaders:(NSDictionary *)headers; 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /FPPicker Tests/Shared/OHHTTPStubs+ConveniencyMethods.m: -------------------------------------------------------------------------------- 1 | // 2 | // OHHTTPStubs+ConveniencyMethods.m 3 | // TestedApp 4 | // 5 | // Created by Ruben Nine on 11/06/14. 6 | // Copyright (c) 2014 Filepicker.io. All rights reserved. 7 | // 8 | 9 | #import "OHHTTPStubs+ConveniencyMethods.h" 10 | 11 | @implementation OHHTTPStubs (ConveniencyMethods) 12 | 13 | + (void)stubHTTPRequestWithNSURL:(NSURL *)url 14 | andHTTPMethod:()HTTPMethod 15 | matching:(OHHTTPMatchingMode)matchingOptions 16 | withFixtureFile:(NSString *)fixtureFile 17 | statusCode:(int)statusCode 18 | andHeaders:(NSDictionary *)headers 19 | { 20 | OHHTTPStubsTestBlock testBlock = ^BOOL (NSURLRequest *request) { 21 | BOOL shouldStub = NO; 22 | 23 | if (matchingOptions & OHHTTPMatchHost) 24 | { 25 | shouldStub = [request.URL.host isEqualToString:url.host]; 26 | 27 | if (!shouldStub) 28 | { 29 | NSLog(@"(OHHTTPS DEBUG) ✖︎ Host %@ does not match %@", url.host, request.URL.host); 30 | 31 | return NO; 32 | } 33 | } 34 | 35 | if (matchingOptions & OHHTTPMatchPath) 36 | { 37 | shouldStub = [request.URL.path isEqualToString:url.path]; 38 | 39 | if (!shouldStub) 40 | { 41 | NSLog(@"(OHHTTPS DEBUG) ✖︎ Path %@ does not match %@", url.path, request.URL.path); 42 | 43 | return NO; 44 | } 45 | } 46 | 47 | if (matchingOptions & OHHTTPMatchQueryString) 48 | { 49 | shouldStub = !request.URL.query && !url.query; // if both are nil, they are also a match 50 | 51 | if (!shouldStub) 52 | { 53 | shouldStub = [request.URL.query isEqualToString:url.query]; 54 | } 55 | 56 | if (!shouldStub) 57 | { 58 | NSLog(@"(OHHTTPS DEBUG) ✖︎ Query string %@ does not match %@", url.query, request.URL.query); 59 | 60 | return NO; 61 | } 62 | } 63 | 64 | if (matchingOptions & OHHTTPMatchScheme) 65 | { 66 | shouldStub = [request.URL.scheme isEqualToString:url.scheme]; 67 | 68 | if (!shouldStub) 69 | { 70 | NSLog(@"(OHHTTPS DEBUG) ✖︎ Scheme %@ does not match %@", url.scheme, request.URL.scheme); 71 | 72 | return NO; 73 | } 74 | } 75 | 76 | return YES; 77 | }; 78 | 79 | OHHTTPStubsResponseBlock responseBlock = ^OHHTTPStubsResponse *(NSURLRequest *request) { 80 | NSString *fixture = OHPathForFileInBundle(fixtureFile, nil); 81 | 82 | return [OHHTTPStubsResponse responseWithFileAtPath:fixture 83 | statusCode:statusCode 84 | headers:headers]; 85 | }; 86 | 87 | 88 | [OHHTTPStubs stubRequestsPassingTest:testBlock 89 | withStubResponse:responseBlock]; 90 | } 91 | 92 | @end 93 | -------------------------------------------------------------------------------- /FPPicker iOS API Demo/FPPicker iOS API Demo/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // FPPicker iOS API Demo 4 | // 5 | // Created by Ruben Nine on 13/08/15. 6 | // Copyright (c) 2015 Filepicker.io. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | 16 | @end 17 | 18 | -------------------------------------------------------------------------------- /FPPicker iOS API Demo/FPPicker iOS API Demo/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "ipad", 35 | "size" : "29x29", 36 | "scale" : "1x" 37 | }, 38 | { 39 | "idiom" : "ipad", 40 | "size" : "29x29", 41 | "scale" : "2x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "40x40", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "40x40", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "76x76", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "76x76", 61 | "scale" : "2x" 62 | } 63 | ], 64 | "info" : { 65 | "version" : 1, 66 | "author" : "xcode" 67 | } 68 | } -------------------------------------------------------------------------------- /FPPicker iOS API Demo/FPPicker iOS API Demo/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | UISupportedInterfaceOrientations~ipad 40 | 41 | UIInterfaceOrientationPortrait 42 | UIInterfaceOrientationPortraitUpsideDown 43 | UIInterfaceOrientationLandscapeLeft 44 | UIInterfaceOrientationLandscapeRight 45 | 46 | NSAppTransportSecurity 47 | 48 | NSExceptionDomains 49 | 50 | facebook.com 51 | 52 | NSTemporaryExceptionRequiresForwardSecrecy 53 | 54 | NSIncludesSubdomains 55 | 56 | 57 | 58 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /FPPicker iOS API Demo/FPPicker iOS API Demo/RootViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // RootViewController.h 3 | // FPPicker iOS API Demo 4 | // 5 | // Created by Ruben Nine on 13/08/15. 6 | // Copyright (c) 2015 Filepicker.io. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface RootViewController : UITableViewController 12 | 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /FPPicker iOS API Demo/FPPicker iOS API Demo/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // FPPicker iOS API Demo 4 | // 5 | // Created by Ruben Nine on 13/08/15. 6 | // Copyright (c) 2015 Filepicker.io. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "AppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) { 13 | @autoreleasepool { 14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /FPPicker iOS Demo/FPPicker iOS Demo/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // FPPicker iOS Demo 4 | // 5 | // Created by Ruben Nine on 13/06/14. 6 | // Copyright (c) 2014 Ruben Nine. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class ViewController; 12 | 13 | @interface AppDelegate : UIResponder 14 | 15 | @property (strong, nonatomic) UIWindow *window; 16 | @property (strong, nonatomic) ViewController *viewController; 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /FPPicker iOS Demo/FPPicker iOS Demo/FPPicker iOS Demo-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIcons 12 | 13 | CFBundleIcons~ipad 14 | 15 | CFBundleIdentifier 16 | $(PRODUCT_BUNDLE_IDENTIFIER) 17 | CFBundleInfoDictionaryVersion 18 | 6.0 19 | CFBundleName 20 | ${PRODUCT_NAME} 21 | CFBundlePackageType 22 | APPL 23 | CFBundleShortVersionString 24 | 1.0 25 | CFBundleSignature 26 | ???? 27 | CFBundleVersion 28 | 1.0 29 | LSRequiresIPhoneOS 30 | 31 | UILaunchStoryboardName 32 | LaunchScreen 33 | UIMainStoryboardFile 34 | Main_iPhone 35 | UIMainStoryboardFile~ipad 36 | Main_iPad 37 | UIRequiredDeviceCapabilities 38 | 39 | armv7 40 | 41 | UISupportedInterfaceOrientations 42 | 43 | UIInterfaceOrientationPortrait 44 | UIInterfaceOrientationLandscapeLeft 45 | UIInterfaceOrientationLandscapeRight 46 | 47 | UISupportedInterfaceOrientations~ipad 48 | 49 | UIInterfaceOrientationPortrait 50 | UIInterfaceOrientationPortraitUpsideDown 51 | UIInterfaceOrientationLandscapeLeft 52 | UIInterfaceOrientationLandscapeRight 53 | 54 | NSAppTransportSecurity 55 | 56 | NSExceptionDomains 57 | 58 | facebook.com 59 | 60 | NSTemporaryExceptionRequiresForwardSecrecy 61 | 62 | NSIncludesSubdomains 63 | 64 | 65 | 66 | 67 | 68 | 69 | -------------------------------------------------------------------------------- /FPPicker iOS Demo/FPPicker iOS Demo/FPPicker iOS Demo-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header 3 | // 4 | // The contents of this file are implicitly included at the beginning of every source file. 5 | // 6 | 7 | #import 8 | 9 | #ifndef __IPHONE_7_1 10 | #warning "This project uses features only available in iOS SDK 7.1 and later." 11 | #endif 12 | 13 | #ifdef __OBJC__ 14 | #import 15 | #import 16 | #endif 17 | -------------------------------------------------------------------------------- /FPPicker iOS Demo/FPPicker iOS Demo/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "ipad", 35 | "size" : "29x29", 36 | "scale" : "1x" 37 | }, 38 | { 39 | "idiom" : "ipad", 40 | "size" : "29x29", 41 | "scale" : "2x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "40x40", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "40x40", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "76x76", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "76x76", 61 | "scale" : "2x" 62 | } 63 | ], 64 | "info" : { 65 | "version" : 1, 66 | "author" : "xcode" 67 | } 68 | } -------------------------------------------------------------------------------- /FPPicker iOS Demo/FPPicker iOS Demo/Images.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /FPPicker iOS Demo/FPPicker iOS Demo/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // FPPicker iOS Demo 4 | // 5 | // Created by Ruben Nine on 13/06/14. 6 | // Copyright (c) 2014 Ruben Nine. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | @property (nonatomic, weak) IBOutlet UIImageView *imageView; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /FPPicker iOS Demo/FPPicker iOS Demo/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /FPPicker iOS Demo/FPPicker iOS Demo/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // FPPicker iOS Demo 4 | // 5 | // Created by Ruben Nine on 13/06/14. 6 | // Copyright (c) 2014 Ruben Nine. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #import "AppDelegate.h" 12 | 13 | int main(int argc, char * argv[]) 14 | { 15 | @autoreleasepool { 16 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /FPPicker.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | s.name = 'FPPicker' 3 | s.version = '5.1.6' 4 | s.summary = 'SDK to access Filepicker.io API' 5 | 6 | s.description = <<-DESC 7 | Filepicker helps developers connect with all the data sources they might have. 8 | This is an SDK that lets developers easily add a bunch of cloud file handling features without coding. 9 | DESC 10 | 11 | s.homepage = 'https://github.com/Ink/ios-picker/' 12 | s.screenshots = 'https://github.com/Ink/ios-picker/raw/develop/Docs/filepicker.png' 13 | s.license = { :type => 'MIT', :file => 'LICENSE.md' } 14 | s.author = { 'Filepicker.io' => 'contact@filepicker.io' } 15 | 16 | s.source = { 17 | :git => 'https://github.com/Ink/ios-picker.git', 18 | :tag => "v#{s.version}" 19 | } 20 | 21 | s.ios.deployment_target = '8.0' 22 | s.osx.deployment_target = '10.9' 23 | 24 | s.ios.prefix_header_file = 'Resources-iOS/FPPicker-Prefix.pch' 25 | s.osx.prefix_header_file = 'Resources-Mac/FPPicker-Mac-Prefix.pch' 26 | 27 | shared_public_header_files = %w( 28 | FPPicker/Shared/FPExternalHeaders.h 29 | FPPicker/Shared/FPConfig.h 30 | FPPicker/Shared/FPConstants.h 31 | FPPicker/Shared/FPMediaInfo.h 32 | FPPicker/Shared/FPSource+SupportedSources.h 33 | FPPicker/Shared/FPSimpleAPI.h 34 | FPPicker/Shared/FPSource.h 35 | ) 36 | 37 | s.ios.public_header_files = %w( 38 | FPPicker/Platforms/iOS/FPPicker.h 39 | FPPicker/Platforms/iOS/FPPickerController.h 40 | FPPicker/Platforms/iOS/FPSaveController.h 41 | FPPicker/Platforms/iOS/FPTheme.h 42 | FPPicker/Platforms/iOS/FPAuthController.h 43 | ).concat(shared_public_header_files) 44 | 45 | s.osx.public_header_files = %w( 46 | FPPicker/Platforms/Mac/FPPickerMac.h 47 | FPPicker/Platforms/Mac/FPPickerController.h 48 | FPPicker/Platforms/Mac/FPSaveController.h 49 | FPPicker/Platforms/Mac/FPAuthController.h 50 | ).concat(shared_public_header_files) 51 | 52 | s.ios.source_files = 'FPPicker/Shared/*.{h,m}', 'FPPicker/Platforms/iOS/*.{h,m}' 53 | s.osx.source_files = 'FPPicker/Shared/*.{h,m}', 'FPPicker/Platforms/Mac/*.{h,m}' 54 | 55 | s.ios.frameworks = 'AssetsLibrary', 'CoreFoundation', 'CoreGraphics', 'MobileCoreServices', 'QuartzCore', 'SystemConfiguration' 56 | s.osx.frameworks = 'WebKit', 'Quartz' 57 | 58 | s.dependency 'AFNetworking', '~> 2.6.0' 59 | s.ios.dependency 'MBProgressHUD', '~> 0.9' 60 | s.osx.dependency 'PureLayout', '~> 2.0.6' 61 | 62 | s.requires_arc = true 63 | 64 | s.ios.resource_bundle = { 'FPPicker' => 'Resources-Shared/*.*' } 65 | s.osx.resource_bundle = { 'FPPicker' => 'Resources-Shared/*.*', 'FPPickerMac' => 'Resources-Mac/*.*' } 66 | end 67 | -------------------------------------------------------------------------------- /FPPicker.xcodeproj/xcshareddata/xcschemes/FPPicker Resources.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 34 | 35 | 45 | 46 | 52 | 53 | 54 | 55 | 56 | 57 | 63 | 64 | 66 | 67 | 70 | 71 | 72 | -------------------------------------------------------------------------------- /FPPicker.xcodeproj/xcshareddata/xcschemes/FPPicker.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 34 | 35 | 45 | 46 | 52 | 53 | 54 | 55 | 56 | 57 | 63 | 64 | 70 | 71 | 72 | 73 | 75 | 76 | 79 | 80 | 81 | -------------------------------------------------------------------------------- /FPPicker.xcworkspace/.LSOverride: -------------------------------------------------------------------------------- 1 | /Applications/Xcode.app -------------------------------------------------------------------------------- /FPPicker.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 12 | 13 | 15 | 16 | 18 | 19 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /FPPicker/Platforms/Mac/FPAuthController.h: -------------------------------------------------------------------------------- 1 | // 2 | // FPAuthController.h 3 | // FPPicker Mac 4 | // 5 | // Created by Ruben Nine on 06/08/14. 6 | // Copyright (c) 2014 Filepicker.io. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | #import "FPSource.h" 12 | 13 | typedef void (^FPAuthSuccessBlock)(void); 14 | typedef void (^FPAuthFailureBlock)(NSError *__nonnull error); 15 | 16 | NS_ASSUME_NONNULL_BEGIN 17 | @interface FPAuthController : NSViewController 18 | 19 | - (instancetype)initWithSource:(FPSource *)source; 20 | 21 | - (void)displayAuthSheetInModalWindow:(NSWindow *)modalWindow 22 | success:(FPAuthSuccessBlock)success 23 | failure:(FPAuthFailureBlock)failure; 24 | 25 | + (void)clearAuthCredentials; 26 | 27 | @end 28 | NS_ASSUME_NONNULL_END 29 | -------------------------------------------------------------------------------- /FPPicker/Platforms/Mac/FPBaseSourceController.h: -------------------------------------------------------------------------------- 1 | // 2 | // FPBaseSourceController.h 3 | // FPPicker 4 | // 5 | // Created by Ruben on 9/25/14. 6 | // Copyright (c) 2014 Filepicker.io. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "FPTypedefs.h" 11 | 12 | @class FPBaseSourceController; 13 | @class FPRepresentedSource; 14 | 15 | @protocol FPBaseSourceControllerDelegate 16 | 17 | - (void)sourceDidStartContentLoad:(FPBaseSourceController *)sender; 18 | - (void)source:(FPBaseSourceController *)sender didFinishContentLoad:(id)content; 19 | - (void)source:(FPBaseSourceController *)sender didReceiveNewContent:(id)content; 20 | - (void)sourceController:(FPBaseSourceController *)sender didFailContentLoadWithError:(NSError *)error; 21 | 22 | @end 23 | 24 | @interface FPBaseSourceController : NSObject 25 | 26 | @property (nonatomic, weak) id delegate; 27 | 28 | /** 29 | Please use the designated initializer instead. 30 | */ 31 | - (id)init __unavailable; 32 | 33 | - (instancetype)initWithRepresentedSource:(FPRepresentedSource *)representedSource NS_DESIGNATED_INITIALIZER; 34 | 35 | - (void)loadContentsAtPathInvalidatingCache:(BOOL)invalidateCache; 36 | 37 | @end 38 | -------------------------------------------------------------------------------- /FPPicker/Platforms/Mac/FPBaseSourceController.m: -------------------------------------------------------------------------------- 1 | // 2 | // FPBaseSourceController.m 3 | // FPPicker 4 | // 5 | // Created by Ruben on 9/25/14. 6 | // Copyright (c) 2014 Filepicker.io. All rights reserved. 7 | // 8 | 9 | #import "FPBaseSourceController.h" 10 | #import "FPInternalHeaders.h" 11 | 12 | @interface FPBaseSourceController () 13 | 14 | @property (nonatomic, strong) FPRepresentedSource *representedSource; 15 | 16 | @end 17 | 18 | @implementation FPBaseSourceController 19 | 20 | #pragma mark - Public Methods 21 | 22 | - (instancetype)initWithRepresentedSource:(FPRepresentedSource *)representedSource 23 | { 24 | self = [super init]; 25 | 26 | if (self) 27 | { 28 | self.representedSource = representedSource; 29 | } 30 | 31 | return self; 32 | } 33 | 34 | - (void)loadContentsAtPathInvalidatingCache:(BOOL)invalidateCache 35 | { 36 | NSAssert(NO, @"This method must be implemented by subclasses."); 37 | } 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /FPPicker/Platforms/Mac/FPBorderView.h: -------------------------------------------------------------------------------- 1 | // 2 | // FPBorderView.h 3 | // FPPicker 4 | // 5 | // Created by Ruben Nine on 20/08/14. 6 | // Copyright (c) 2014 Filepicker.io. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "FPView.h" 11 | 12 | typedef enum : NSUInteger 13 | { 14 | FPBorderTop = (1 << 0), 15 | FPBorderBottom = (1 << 1), 16 | FPBorderTopBottom = FPBorderTop | FPBorderBottom, 17 | } FPBorderStyle; 18 | 19 | IB_DESIGNABLE 20 | @interface FPBorderView : FPView 21 | 22 | @property (nonatomic, assign) IBInspectable FPBorderStyle borderStyle; 23 | @property (nonatomic, strong) IBInspectable NSColor *borderColor; 24 | @property (nonatomic, strong) IBInspectable NSColor *borderShadowColor; 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /FPPicker/Platforms/Mac/FPBorderView.m: -------------------------------------------------------------------------------- 1 | // 2 | // FPBorderView.m 3 | // FPPicker 4 | // 5 | // Created by Ruben Nine on 20/08/14. 6 | // Copyright (c) 2014 Filepicker.io. All rights reserved. 7 | // 8 | 9 | #import "FPBorderView.h" 10 | 11 | @implementation FPBorderView 12 | 13 | #pragma mark - Accessors 14 | 15 | - (NSColor *)borderColor 16 | { 17 | if (!_borderColor) 18 | { 19 | _borderColor = [NSColor lightGrayColor]; 20 | } 21 | 22 | return _borderColor; 23 | } 24 | 25 | - (NSColor *)borderShadowColor 26 | { 27 | if (!_borderShadowColor) 28 | { 29 | _borderShadowColor = [[NSColor whiteColor] colorWithAlphaComponent:0.33]; 30 | } 31 | 32 | return _borderShadowColor; 33 | } 34 | 35 | #pragma mark - Public Methods 36 | 37 | - (void)drawRect:(NSRect)dirtyRect 38 | { 39 | [super drawRect:dirtyRect]; 40 | 41 | if (self.borderStyle != 0) 42 | { 43 | // Drawing code here. 44 | 45 | NSShadow *shadow = [NSShadow new]; 46 | 47 | [shadow setShadowColor:self.borderShadowColor]; 48 | [shadow setShadowBlurRadius:0]; 49 | 50 | [self.borderColor setStroke]; 51 | 52 | NSBezierPath *bezierPath = [NSBezierPath bezierPath]; 53 | 54 | [bezierPath setLineWidth:2.0]; 55 | 56 | if (self.borderStyle & FPBorderTop) 57 | { 58 | [shadow setShadowOffset:NSMakeSize(0.1, -1.1)]; 59 | [shadow set]; 60 | 61 | CGPoint topLPoint = NSMakePoint(NSMinX(self.bounds), NSMaxY(self.bounds)); 62 | CGPoint topRPoint = NSMakePoint(NSMaxX(self.bounds), topLPoint.y); 63 | 64 | [bezierPath moveToPoint:topLPoint]; 65 | [bezierPath lineToPoint:topRPoint]; 66 | [bezierPath stroke]; 67 | } 68 | 69 | if (self.borderStyle & FPBorderBottom) 70 | { 71 | [shadow setShadowOffset:NSMakeSize(0.1, 1.1)]; 72 | [shadow set]; 73 | 74 | CGPoint bottomLPoint = NSMakePoint(NSMinX(self.bounds), NSMinY(self.bounds)); 75 | CGPoint bottomRPoint = NSMakePoint(NSMaxX(self.bounds), bottomLPoint.y); 76 | 77 | [bezierPath removeAllPoints]; 78 | [bezierPath moveToPoint:bottomLPoint]; 79 | [bezierPath lineToPoint:bottomRPoint]; 80 | [bezierPath stroke]; 81 | } 82 | } 83 | } 84 | 85 | @end 86 | -------------------------------------------------------------------------------- /FPPicker/Platforms/Mac/FPDialogController.h: -------------------------------------------------------------------------------- 1 | // 2 | // FPDialogController.h 3 | // FPPicker 4 | // 5 | // Created by Ruben Nine on 17/10/14. 6 | // Copyright (c) 2014 Filepicker.io. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class FPBaseSourceController; 12 | @class FPRepresentedSource; 13 | @class FPDialogController; 14 | 15 | @protocol FPDialogControllerDelegate 16 | 17 | - (void)dialogControllerPressedCancelButton:(FPDialogController *)dialogController; 18 | - (void)dialogControllerPressedActionButton:(FPDialogController *)dialogController; 19 | 20 | @optional 21 | 22 | - (void)dialogControllerDidLoadWindow:(FPDialogController *)dialogController; 23 | 24 | @end 25 | 26 | @interface FPDialogController : NSWindowController 27 | 28 | @property (nonatomic, assign) CGFloat minSplitPaneWidth; 29 | @property (nonatomic, assign) CGFloat maxSplitPaneWidth; 30 | @property (nonatomic, weak) id delegate; 31 | 32 | - (void)open; 33 | - (void)close; 34 | 35 | - (void)setupSourceListWithSourceNames:(NSArray *)sourceNames 36 | andDataTypes:(NSArray *)dataTypes; 37 | 38 | - (void)cancelAllOperations; 39 | - (void)setupDialogForOpening; 40 | - (void)setupDialogForSavingWithDefaultFileName:(NSString *)filename; 41 | 42 | - (NSString *)filenameFromSaveTextField; 43 | - (NSArray *)selectedItems; 44 | - (FPRepresentedSource *)selectedRepresentedSource; 45 | 46 | @end 47 | -------------------------------------------------------------------------------- /FPPicker/Platforms/Mac/FPFileDownloadController.h: -------------------------------------------------------------------------------- 1 | // 2 | // FPFileDownloadController.h 3 | // FPPicker 4 | // 5 | // Created by Ruben Nine on 16/10/14. 6 | // Copyright (c) 2014 Filepicker.io. All rights reserved. 7 | // 8 | 9 | #import "FPFileTransferController.h" 10 | 11 | @class FPRepresentedSource; 12 | 13 | @interface FPFileDownloadController : FPFileTransferController 14 | 15 | - (instancetype)initWithItems:(NSArray *)items 16 | andRepresentedSource:(FPRepresentedSource *)representedSource; 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /FPPicker/Platforms/Mac/FPFileTransferController.h: -------------------------------------------------------------------------------- 1 | // 2 | // FPFileTransferWindowController.h 3 | // FPPicker 4 | // 5 | // Created by Ruben on 10/10/14. 6 | // Copyright (c) 2014 Filepicker.io. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class FPFileTransferController; 12 | 13 | @protocol FPFileTransferControllerDelegate 14 | 15 | - (void)FPFileTransferControllerDidFinish:(FPFileTransferController *)transferController info:(id)info; 16 | - (void)FPFileTransferControllerDidCancel:(FPFileTransferController *)transferController; 17 | - (void)FPFileTransferControllerDidFail:(FPFileTransferController *)transferController error:(NSError *)error; 18 | 19 | @end 20 | 21 | @interface FPFileTransferController : NSWindowController 22 | 23 | @property (nonatomic, strong, readonly) NSOperationQueue *operationQueue; 24 | @property (nonatomic, strong) IBOutlet NSTextField *descriptionTextField; 25 | @property (nonatomic, strong) IBOutlet NSProgressIndicator *progressIndicator; 26 | @property (nonatomic, weak) id delegate; 27 | 28 | - (void)process; 29 | - (IBAction)cancel:(id)sender; 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /FPPicker/Platforms/Mac/FPFileUploadController.h: -------------------------------------------------------------------------------- 1 | // 2 | // FPFileUploadController.h 3 | // FPPicker 4 | // 5 | // Created by Ruben Nine on 16/10/14. 6 | // Copyright (c) 2014 Filepicker.io. All rights reserved. 7 | // 8 | 9 | #import "FPFileTransferController.h" 10 | 11 | @interface FPFileUploadController : FPFileTransferController 12 | 13 | - (instancetype)initWithData:(NSData *)data 14 | filename:(NSString *)filename 15 | targetPath:(NSString *)path 16 | andMimetype:(NSString *)mimetype; 17 | 18 | - (instancetype)initWithDataURL:(NSURL *)dataURL 19 | filename:(NSString *)filename 20 | targetPath:(NSString *)path 21 | andMimetype:(NSString *)mimetype; 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /FPPicker/Platforms/Mac/FPImageBrowserCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // FPImageBrowserCell.h 3 | // FPPicker 4 | // 5 | // Created by Ruben Nine on 15/10/14. 6 | // Copyright (c) 2014 Filepicker.io. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface FPImageBrowserCell : IKImageBrowserCell 12 | 13 | @property (nonatomic, assign) BOOL isDimmed; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /FPPicker/Platforms/Mac/FPImageBrowserCell.m: -------------------------------------------------------------------------------- 1 | // 2 | // FPImageBrowserCell.m 3 | // FPPicker 4 | // 5 | // Created by Ruben Nine on 15/10/14. 6 | // Copyright (c) 2014 Filepicker.io. All rights reserved. 7 | // 8 | 9 | #import "FPImageBrowserCell.h" 10 | 11 | @implementation FPImageBrowserCell 12 | 13 | - (CGFloat)opacity 14 | { 15 | return self.isDimmed ? 0.5 : 1.0; 16 | } 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /FPPicker/Platforms/Mac/FPImageBrowserView.h: -------------------------------------------------------------------------------- 1 | // 2 | // FPImageBrowserView.h 3 | // FPPicker 4 | // 5 | // Created by Ruben on 9/18/14. 6 | // Copyright (c) 2014 Filepicker.io. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class FPImageBrowserView; 12 | 13 | @interface NSObject (FPImageBrowserDelegate) 14 | 15 | - (BOOL) imageBrowser:(FPImageBrowserView *)aBrowser 16 | shouldForwardKeyboardEvent:(NSEvent *)event; 17 | 18 | @end 19 | 20 | 21 | @interface FPImageBrowserView : IKImageBrowserView 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /FPPicker/Platforms/Mac/FPImageBrowserView.m: -------------------------------------------------------------------------------- 1 | // 2 | // FPImageBrowserView.m 3 | // FPPicker 4 | // 5 | // Created by Ruben on 9/18/14. 6 | // Copyright (c) 2014 Filepicker.io. All rights reserved. 7 | // 8 | 9 | #import "FPImageBrowserView.h" 10 | #import "FPImageBrowserCell.h" 11 | 12 | @implementation FPImageBrowserView 13 | 14 | - (void)mouseDown:(NSEvent *)theEvent 15 | { 16 | NSInteger idx = [self indexOfItemAtLocationInWindow:theEvent.locationInWindow]; 17 | 18 | [self dimCellAtIndexIfRequired:idx 19 | state:NO]; 20 | 21 | [super mouseDown:theEvent]; 22 | } 23 | 24 | - (void)mouseUp:(NSEvent *)theEvent 25 | { 26 | NSInteger idx = [self indexOfItemAtLocationInWindow:theEvent.locationInWindow]; 27 | 28 | [self dimCellAtIndexIfRequired:idx 29 | state:YES]; 30 | 31 | [super mouseUp:theEvent]; 32 | } 33 | 34 | - (void)keyDown:(NSEvent *)event 35 | { 36 | if (self.delegate && 37 | [self.delegate respondsToSelector:@selector(imageBrowser:shouldForwardKeyboardEvent:)]) 38 | { 39 | if (![self.delegate imageBrowser:self 40 | shouldForwardKeyboardEvent:event]) 41 | { 42 | return; 43 | } 44 | } 45 | 46 | [super keyDown:event]; 47 | } 48 | 49 | - (IKImageBrowserCell *)newCellForRepresentedItem:(id /* */)anItem 50 | { 51 | FPImageBrowserCell *cell = [FPImageBrowserCell new]; 52 | 53 | if ([anItem respondsToSelector:@selector(isDimmed)]) 54 | { 55 | cell.isDimmed = [anItem isDimmed]; 56 | } 57 | 58 | return cell; 59 | } 60 | 61 | #pragma mark - Private Methods 62 | 63 | - (void)dimCellAtIndexIfRequired:(NSUInteger)index 64 | state:(BOOL)state 65 | { 66 | if (index != NSNotFound) 67 | { 68 | FPImageBrowserCell *cell = (FPImageBrowserCell *)[self cellForItemAtIndex:index]; 69 | 70 | if ([cell.representedItem respondsToSelector:@selector(isDimmed)] && 71 | [cell.representedItem isDimmed]) 72 | { 73 | cell.isDimmed = state; 74 | 75 | [self setNeedsDisplayInRect:cell.frame]; 76 | } 77 | } 78 | } 79 | 80 | - (NSUInteger)indexOfItemAtLocationInWindow:(NSPoint)locationInWindow 81 | { 82 | NSPoint point = [self convertPoint:locationInWindow 83 | fromView:nil]; 84 | 85 | return [self indexOfItemAtPoint:point]; 86 | } 87 | 88 | @end 89 | -------------------------------------------------------------------------------- /FPPicker/Platforms/Mac/FPImageSearchSourceController.h: -------------------------------------------------------------------------------- 1 | // 2 | // FPImageSearchSourceController.h 3 | // FPPicker 4 | // 5 | // Created by Ruben on 9/25/14. 6 | // Copyright (c) 2014 Filepicker.io. All rights reserved. 7 | // 8 | 9 | #import "FPRemoteSourceController.h" 10 | 11 | @interface FPImageSearchSourceController : FPRemoteSourceController 12 | 13 | @property (nonatomic, strong) NSString *searchString; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /FPPicker/Platforms/Mac/FPImageSearchSourceController.m: -------------------------------------------------------------------------------- 1 | // 2 | // FPImageSearchSourceController.m 3 | // FPPicker 4 | // 5 | // Created by Ruben on 9/25/14. 6 | // Copyright (c) 2014 Filepicker.io. All rights reserved. 7 | // 8 | 9 | #import "FPImageSearchSourceController.h" 10 | #import "FPInternalHeaders.h" 11 | 12 | @interface FPImageSearchSourceController () 13 | 14 | @property (nonatomic, strong) FPRepresentedSource *representedSource; 15 | 16 | @end 17 | 18 | @implementation FPImageSearchSourceController 19 | 20 | #pragma mark - Accessors 21 | 22 | - (void)setSearchString:(NSString *)searchString 23 | { 24 | _searchString = searchString; 25 | 26 | self.representedSource.currentPath = [NSString stringWithFormat:@"%@/%@", 27 | self.representedSource.source.rootPath, 28 | [FPUtils urlEncodeString:searchString]]; 29 | } 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /FPPicker/Platforms/Mac/FPInternalHeaders.h: -------------------------------------------------------------------------------- 1 | // 2 | // FPInternalHeaders.h 3 | // FPPicker Mac 4 | // 5 | // Created by Ruben Nine on 14/08/14. 6 | // Copyright (c) 2014 Filepicker.io. All rights reserved. 7 | // 8 | 9 | #import "FPSharedInternalHeaders.h" 10 | 11 | #import "FPUtils+Mac.h" 12 | #import "FPConstants.h" 13 | #import "FPPrivateConfig.h" 14 | #import "FPRepresentedSource.h" 15 | -------------------------------------------------------------------------------- /FPPicker/Platforms/Mac/FPNavigationController.h: -------------------------------------------------------------------------------- 1 | // 2 | // FPNavigationController.h 3 | // FPPicker 4 | // 5 | // Created by Ruben Nine on 22/08/14. 6 | // Copyright (c) 2014 Filepicker.io. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class FPNavigationController; 12 | @class FPSourcePath; 13 | 14 | @protocol FPNavigationControllerDelegate 15 | 16 | @optional 17 | 18 | - (void)navigationController:(FPNavigationController *)navigationController selectedSourcePath:(FPSourcePath *)sourcePath; 19 | 20 | @end 21 | 22 | @interface FPNavigationController : NSViewController 23 | 24 | @property (nonatomic, weak) IBOutlet id delegate; 25 | 26 | @property (nonatomic, strong) FPSourcePath *sourcePath; 27 | 28 | - (void)refreshDirectoriesPopup; 29 | - (void)clearNavigation; 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /FPPicker/Platforms/Mac/FPNavigationHistory.h: -------------------------------------------------------------------------------- 1 | // 2 | // FPNavigationHistory.h 3 | // FPPicker 4 | // 5 | // Created by Ruben Nine on 22/10/14. 6 | // Copyright (c) 2014 Filepicker.io. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface FPNavigationHistory : NSObject 12 | 13 | - (void)addItem:(id)item; 14 | - (void)clear; 15 | - (id)currentItem; 16 | - (BOOL)canNavigateBack; 17 | - (BOOL)canNavigateForward; 18 | - (BOOL)navigateBack; 19 | - (BOOL)navigateForward; 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /FPPicker/Platforms/Mac/FPNavigationHistory.m: -------------------------------------------------------------------------------- 1 | // 2 | // FPNavigationHistory.m 3 | // FPPicker 4 | // 5 | // Created by Ruben Nine on 22/10/14. 6 | // Copyright (c) 2014 Filepicker.io. All rights reserved. 7 | // 8 | 9 | #import "FPNavigationHistory.h" 10 | 11 | @interface FPNavigationHistory () 12 | 13 | @property (nonatomic, strong) NSMutableOrderedSet *items; 14 | @property (nonatomic, assign) NSInteger currentItemIndex; 15 | 16 | @end 17 | 18 | @implementation FPNavigationHistory 19 | 20 | #pragma mark - Accessors 21 | 22 | - (NSMutableOrderedSet *)items 23 | { 24 | if (!_items) 25 | { 26 | _items = [NSMutableOrderedSet orderedSet]; 27 | } 28 | 29 | return _items; 30 | } 31 | 32 | #pragma mark - Public Methods 33 | 34 | - (instancetype)init 35 | { 36 | self = [super init]; 37 | 38 | if (self) 39 | { 40 | self.currentItemIndex = -1; 41 | } 42 | 43 | return self; 44 | } 45 | 46 | - (BOOL)canNavigateBack 47 | { 48 | if (self.currentItemIndex > 0) 49 | { 50 | return YES; 51 | } 52 | 53 | return NO; 54 | } 55 | 56 | - (BOOL)canNavigateForward 57 | { 58 | if (self.currentItemIndex < self.items.count - 1) 59 | { 60 | return YES; 61 | } 62 | 63 | return NO; 64 | } 65 | 66 | - (BOOL)navigateBack 67 | { 68 | if ([self canNavigateBack]) 69 | { 70 | self.currentItemIndex--; 71 | 72 | return YES; 73 | } 74 | 75 | return NO; 76 | } 77 | 78 | - (BOOL)navigateForward 79 | { 80 | if ([self canNavigateForward]) 81 | { 82 | self.currentItemIndex++; 83 | 84 | return YES; 85 | } 86 | 87 | return NO; 88 | } 89 | 90 | - (void)addItem:(id)item 91 | { 92 | @synchronized(self.items) 93 | { 94 | self.currentItemIndex++; 95 | 96 | if (self.items.count > self.currentItemIndex) 97 | { 98 | NSRange deleteRange = NSMakeRange(self.currentItemIndex, 99 | self.items.count - self.currentItemIndex); 100 | 101 | NSIndexSet *indexset = [NSIndexSet indexSetWithIndexesInRange:deleteRange]; 102 | 103 | [self.items removeObjectsAtIndexes:indexset]; 104 | } 105 | 106 | [self.items addObject:item]; 107 | } 108 | } 109 | 110 | - (void)clear 111 | { 112 | @synchronized(self.items) 113 | { 114 | self.currentItemIndex = -1; 115 | [self.items removeAllObjects]; 116 | } 117 | } 118 | 119 | - (id)currentItem 120 | { 121 | if (self.currentItemIndex >= 0 && 122 | self.currentItemIndex < self.items.count) 123 | { 124 | return self.items[self.currentItemIndex]; 125 | } 126 | else 127 | { 128 | return nil; 129 | } 130 | } 131 | 132 | #pragma mark - Private Methods 133 | 134 | - (NSString *)description 135 | { 136 | return [NSString stringWithFormat:@"%@ {\n\titems: %@\n\tcurrent Index: %ld", 137 | super.description, 138 | self.items, 139 | (unsigned long)self.currentItemIndex]; 140 | } 141 | 142 | @end 143 | -------------------------------------------------------------------------------- /FPPicker/Platforms/Mac/FPPickerController.h: -------------------------------------------------------------------------------- 1 | // 2 | // FPPickerController.h 3 | // FPPicker 4 | // 5 | // Created by Ruben Nine on 18/08/14. 6 | // Copyright (c) 2014 Filepicker.io. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "FPExternalHeaders.h" 11 | 12 | @interface FPPickerController : NSObject 13 | 14 | @property (nonatomic, weak) id delegate; 15 | 16 | @property (nonatomic, strong) NSArray *sourceNames; 17 | @property (nonatomic, strong) NSArray *dataTypes; 18 | @property (nonatomic, assign) NSInteger maxFiles; 19 | 20 | - (void)open; 21 | 22 | @end 23 | -------------------------------------------------------------------------------- /FPPicker/Platforms/Mac/FPPickerMac.h: -------------------------------------------------------------------------------- 1 | // 2 | // FPPickerMac.h 3 | // FPPicker 4 | // 5 | // Created by Ruben Nine on 13/08/14. 6 | // Copyright (c) 2014 Filepicker.io. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | //! Project version number for FPPicker. 12 | FOUNDATION_EXPORT double FPPickerMacVersionNumber; 13 | 14 | //! Project version string for FPPicker. 15 | FOUNDATION_EXPORT const unsigned char FPPickerMacVersionString[]; 16 | 17 | // In this header, you should import all the public headers of your framework using statements like #import 18 | 19 | #import "FPConfig.h" 20 | #import "FPConstants.h" 21 | #import "FPMediaInfo.h" 22 | #import "FPPickerController.h" 23 | #import "FPSaveController.h" 24 | #import "FPSimpleAPI.h" 25 | #import "FPSource+SupportedSources.h" 26 | #import "FPAuthController.h" 27 | -------------------------------------------------------------------------------- /FPPicker/Platforms/Mac/FPRemoteSourceController.h: -------------------------------------------------------------------------------- 1 | // 2 | // FPRemoteSourceController.h 3 | // FPPicker Mac 4 | // 5 | // Created by Ruben Nine on 07/08/14. 6 | // Copyright (c) 2014 Filepicker.io. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "FPBaseSourceController.h" 11 | 12 | @class FPRemoteSourceController; 13 | 14 | @protocol FPRemoteSourceControllerDelegate 15 | 16 | - (void)remoteSourceRequiresAuthentication:(FPRemoteSourceController *)sender; 17 | 18 | @end 19 | 20 | 21 | @interface FPRemoteSourceController : FPBaseSourceController 22 | 23 | @property (nonatomic, weak) iddelegate; 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /FPPicker/Platforms/Mac/FPRepresentedSource.h: -------------------------------------------------------------------------------- 1 | // 2 | // FPRepresentedSource.h 3 | // FPPicker 4 | // 5 | // Created by Ruben Nine on 17/10/14. 6 | // Copyright (c) 2014 Filepicker.io. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "FPSource.h" 11 | #import "FPSourcePath.h" 12 | 13 | @interface FPRepresentedSource : NSObject 14 | 15 | /*! 16 | Parallel operation queue. 17 | This operation queue supports unlimited simultaneous operations. 18 | */ 19 | @property (readonly, nonatomic, strong) NSOperationQueue *parallelOperationQueue; 20 | 21 | /*! 22 | Serial operation queue. 23 | This operation queue is limited to 1 simultaneous operation. 24 | */ 25 | @property (readonly, nonatomic, strong) NSOperationQueue *serialOperationQueue; 26 | 27 | /*! 28 | The FPSource being represented. 29 | */ 30 | @property (readonly, nonatomic, strong) FPSource *source; 31 | 32 | /*! 33 | The FPSourcePath being represented. 34 | */ 35 | @property (readonly, nonatomic, strong) FPSourcePath *sourcePath; 36 | 37 | /*! 38 | Represents the current path. 39 | */ 40 | @property (nonatomic, strong) NSString *currentPath; 41 | 42 | /*! 43 | Is the represented source logged in? 44 | @note This will always be NO if source does not require authentication. 45 | */ 46 | @property (nonatomic, assign) BOOL isLoggedIn; 47 | 48 | /** 49 | Please use the designated initializer instead. 50 | */ 51 | - (id)init __unavailable; 52 | 53 | - (id)initWithSource:(FPSource *)source NS_DESIGNATED_INITIALIZER; 54 | - (void)cancelAllOperations; 55 | - (NSString *)rootPath; 56 | - (NSString *)parentPath; 57 | 58 | @end 59 | -------------------------------------------------------------------------------- /FPPicker/Platforms/Mac/FPRepresentedSource.m: -------------------------------------------------------------------------------- 1 | // 2 | // FPRepresentedSource.m 3 | // FPPicker 4 | // 5 | // Created by Ruben Nine on 17/10/14. 6 | // Copyright (c) 2014 Filepicker.io. All rights reserved. 7 | // 8 | 9 | #import "FPRepresentedSource.h" 10 | 11 | @interface FPRepresentedSource () 12 | 13 | @property (readwrite) NSOperationQueue *parallelOperationQueue; 14 | @property (readwrite) NSOperationQueue *serialOperationQueue; 15 | @property (readwrite) FPSource *source; 16 | @property (readwrite) FPSourcePath *sourcePath; 17 | 18 | @end 19 | 20 | @implementation FPRepresentedSource 21 | 22 | #pragma mark - Accessors 23 | 24 | - (NSOperationQueue *)parallelOperationQueue 25 | { 26 | if (!_parallelOperationQueue) 27 | { 28 | _parallelOperationQueue = [NSOperationQueue new]; 29 | } 30 | 31 | return _parallelOperationQueue; 32 | } 33 | 34 | - (NSOperationQueue *)serialOperationQueue 35 | { 36 | if (!_serialOperationQueue) 37 | { 38 | _serialOperationQueue = [NSOperationQueue new]; 39 | _serialOperationQueue.maxConcurrentOperationCount = 1; 40 | } 41 | 42 | return _serialOperationQueue; 43 | } 44 | 45 | - (void)cancelAllOperations 46 | { 47 | if (self.serialOperationQueue.operationCount > 0 || 48 | self.parallelOperationQueue.operationCount > 0) 49 | { 50 | FPLogInfo(@"Cancelling all operations on %@", self); 51 | 52 | [self.serialOperationQueue cancelAllOperations]; 53 | [self.parallelOperationQueue cancelAllOperations]; 54 | } 55 | } 56 | 57 | - (void)setCurrentPath:(NSString *)currentPath 58 | { 59 | _currentPath = currentPath; 60 | 61 | self.sourcePath = [[FPSourcePath alloc] initWithSource:self.source 62 | andPath:self.currentPath]; 63 | } 64 | 65 | #pragma mark - Public Methods 66 | 67 | - (instancetype)initWithSource:(FPSource *)source 68 | { 69 | self = [super init]; 70 | 71 | if (self) 72 | { 73 | self.source = source; 74 | self.isLoggedIn = NO; 75 | self.currentPath = [NSString stringWithFormat:@"%@/", source.rootPath]; 76 | } 77 | 78 | return self; 79 | } 80 | 81 | - (NSString *)rootPath 82 | { 83 | return self.sourcePath.rootPath; 84 | } 85 | 86 | - (NSString *)parentPath 87 | { 88 | return self.sourcePath.parentPath; 89 | } 90 | 91 | - (NSString *)description 92 | { 93 | return [NSString stringWithFormat:@"%@ {\n\tcurrentPath = %@\n\tisLoggedIn = %@\n\tpending operations = {s: %ld p: %ld}\n\tsource = %@\n}", 94 | super.description, 95 | self.currentPath, 96 | self.isLoggedIn ? @"YES" :@"NO", 97 | (unsigned long)self.serialOperationQueue.operationCount, 98 | (unsigned long)self.parallelOperationQueue.operationCount, 99 | self.source.identifier]; 100 | } 101 | 102 | @end 103 | -------------------------------------------------------------------------------- /FPPicker/Platforms/Mac/FPSaveController.h: -------------------------------------------------------------------------------- 1 | // 2 | // FPSaveController.h 3 | // FPPicker 4 | // 5 | // Created by Ruben Nine on 15/10/14. 6 | // Copyright (c) 2014 Filepicker.io. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "FPExternalHeaders.h" 11 | 12 | @interface FPSaveController : NSObject 13 | 14 | @property (nonatomic, weak) id delegate; 15 | 16 | @property (nonatomic, strong) NSArray *sourceNames; 17 | @property (nonatomic, strong) NSData *data; 18 | @property (nonatomic, strong) NSURL *dataURL; 19 | @property (nonatomic, strong) NSString *dataType; 20 | @property (nonatomic, strong) NSString *proposedFilename; 21 | 22 | - (void)open; 23 | 24 | @end 25 | -------------------------------------------------------------------------------- /FPPicker/Platforms/Mac/FPSourceListController.h: -------------------------------------------------------------------------------- 1 | // 2 | // FPSourceListController.h 3 | // FPPicker 4 | // 5 | // Created by Ruben Nine on 20/08/14. 6 | // Copyright (c) 2014 Filepicker.io. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class FPRepresentedSource; 12 | @class FPSourceListController; 13 | @class FPSource; 14 | 15 | @protocol FPSourceListControllerDelegate 16 | 17 | - (void)sourceListController:(FPSourceListController *)sourceListController 18 | didSelectSource:(FPRepresentedSource *)representedSource; 19 | 20 | - (void)sourceListController:(FPSourceListController *)sourceListController 21 | didLogoutFromSource:(FPRepresentedSource *)representedSource; 22 | 23 | @end 24 | 25 | @interface FPSourceListController : NSViewController 27 | 28 | @property (nonatomic, weak) IBOutlet NSOutlineView *outlineView; 29 | @property (nonatomic, weak) IBOutlet id delegate; 30 | 31 | @property (nonatomic, strong) NSArray *sourceNames; 32 | @property (nonatomic, strong) NSArray *dataTypes; 33 | 34 | - (void)loadAndExpandSourceList; 35 | - (void)refreshOutline; 36 | - (void)cancelAllOperations; 37 | - (void)selectSource:(FPSource *)source; 38 | - (FPSource *)selectedSource; 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /FPPicker/Platforms/Mac/FPSourcePath.h: -------------------------------------------------------------------------------- 1 | // 2 | // FPSourcePath.h 3 | // FPPicker 4 | // 5 | // Created by Ruben Nine on 20/10/14. 6 | // Copyright (c) 2014 Filepicker.io. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class FPSource; 12 | 13 | @interface FPSourcePath : NSObject 14 | 15 | /** 16 | Please use the designated initializer instead. 17 | */ 18 | - (id)init __unavailable; 19 | 20 | - (instancetype)initWithSource:(FPSource *)source 21 | andPath:(NSString *)path NS_DESIGNATED_INITIALIZER; 22 | 23 | @property (nonatomic, strong) FPSource *source; 24 | @property (nonatomic, strong) NSString *path; 25 | 26 | - (NSString *)rootPath; 27 | - (NSString *)parentPath; 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /FPPicker/Platforms/Mac/FPSourcePath.m: -------------------------------------------------------------------------------- 1 | // 2 | // FPSourcePath.m 3 | // FPPicker 4 | // 5 | // Created by Ruben Nine on 20/10/14. 6 | // Copyright (c) 2014 Filepicker.io. All rights reserved. 7 | // 8 | 9 | #import "FPSourcePath.h" 10 | #import "FPSource.h" 11 | 12 | @interface FPSourcePath () 13 | 14 | @end 15 | 16 | @implementation FPSourcePath 17 | 18 | - (instancetype)initWithSource:(FPSource *)source 19 | andPath:(NSString *)path 20 | { 21 | self = [super init]; 22 | 23 | if (self) 24 | { 25 | self.source = source; 26 | self.path = path; 27 | } 28 | 29 | return self; 30 | } 31 | 32 | - (NSString *)rootPath 33 | { 34 | if (!self.source) 35 | { 36 | [NSException raise:NSInternalInconsistencyException 37 | format:@"source must be present."]; 38 | } 39 | 40 | return [self.source.rootPath stringByAppendingString:@"/"]; 41 | } 42 | 43 | - (NSString *)parentPath 44 | { 45 | if (!self.path) 46 | { 47 | [NSException raise:NSInternalInconsistencyException 48 | format:@"path must be present."]; 49 | } 50 | 51 | if ([self.rootPath isEqualToString:self.path]) 52 | { 53 | // We are already at root level 54 | 55 | return self.path; 56 | } 57 | else 58 | { 59 | NSString *parentPath = [self.path.stringByDeletingLastPathComponent stringByAppendingString:@"/"]; 60 | 61 | // Special Github URL handling 62 | // /Github/someuser/ -> /Github/ 63 | 64 | if ([parentPath.stringByDeletingLastPathComponent isEqualToString:@"/Github"]) 65 | { 66 | parentPath = @"/Github/"; 67 | } 68 | 69 | return parentPath; 70 | } 71 | } 72 | 73 | - (NSString *)description 74 | { 75 | return [NSString stringWithFormat:@"%@ {\n\tsource = %@\n\tpath = %@\n}", 76 | super.description, 77 | self.source, 78 | self.path]; 79 | } 80 | 81 | #pragma mark - NSObject Comparison Methods 82 | 83 | - (NSUInteger)hash 84 | { 85 | return self.source.hash ^ self.path.hash; 86 | } 87 | 88 | - (BOOL)isEqual:(id)object 89 | { 90 | return [self hash] == [object hash]; 91 | } 92 | 93 | #pragma mark - NSCopying Methods 94 | 95 | - (id)copyWithZone:(NSZone *)zone 96 | { 97 | typeof(self) obj = [[self.class allocWithZone:zone] init]; 98 | 99 | obj.source = self.source; 100 | obj.path = self.path; 101 | 102 | return obj; 103 | } 104 | 105 | @end 106 | -------------------------------------------------------------------------------- /FPPicker/Platforms/Mac/FPSourceResultsController.h: -------------------------------------------------------------------------------- 1 | // 2 | // FPSourceResultsController.h 3 | // FPPicker 4 | // 5 | // Created by Ruben Nine on 01/09/14. 6 | // Copyright (c) 2014 Filepicker.io. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | #import "FPImageBrowserView.h" 12 | 13 | @class FPSourceResultsController; 14 | 15 | @protocol FPSourceResultsControllerDelegate 16 | 17 | - (void)sourceResults:(FPSourceResultsController *)sourceResultsController selectionDidChange:(NSArray *)selectedItems; 18 | - (void)sourceResults:(FPSourceResultsController *)sourceResultsController didMomentarilySelectItem:(NSDictionary *)item; 19 | 20 | @optional 21 | 22 | - (void)sourceResults:(FPSourceResultsController *)sourceResultsController doubleClickedOnItems:(NSArray *)items; 23 | - (void)sourceResults:(FPSourceResultsController *)sourceResultsController wantsToEnterDirectoryAtPath:(NSString *)path; 24 | - (void)sourceResultsWantsToGoUpOneDirectory:(FPSourceResultsController *)sourceResultsController; 25 | 26 | @end 27 | 28 | @interface FPSourceResultsController : NSObject 29 | 30 | @property (nonatomic, weak) IBOutlet id delegate; 31 | 32 | @property (nonatomic, strong) NSArray *items; 33 | @property (readonly, strong) NSArray *selectedItems; 34 | @property (nonatomic, assign) BOOL allowsFileSelection; 35 | @property (nonatomic, assign) BOOL allowsMultipleSelection; 36 | 37 | - (void)reloadData; 38 | - (void)appendItems:(NSArray *)items; 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /FPPicker/Platforms/Mac/FPSourceViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // FPSourceViewController.h 3 | // FPPicker 4 | // 5 | // Created by Ruben on 9/25/14. 6 | // Copyright (c) 2014 Filepicker.io. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class FPSourceResultsController; 12 | @class FPAuthController; 13 | @class FPBaseSourceController; 14 | @class FPSourceViewController; 15 | @class FPRepresentedSource; 16 | @class FPSourcePath; 17 | 18 | @protocol FPSourceViewControllerDelegate 19 | 20 | @optional 21 | 22 | - (void)sourceViewController:(FPSourceViewController *)sourceViewController representedSourceLoginStatusChanged:(FPRepresentedSource *)representedSource; 23 | 24 | - (void)sourceViewController:(FPSourceViewController *)sourceViewController didMomentarilySelectFilename:(NSString *)filename; 25 | 26 | - (void)sourceViewController:(FPSourceViewController *)sourceViewController sourcePathChanged:(FPSourcePath *)sourcePath; 27 | 28 | - (void)sourceViewController:(FPSourceViewController *)sourceViewController doubleClickedOnItems:(NSArray *)items; 29 | 30 | @end 31 | 32 | @interface FPSourceViewController : NSViewController 33 | 34 | @property (nonatomic, weak) IBOutlet FPSourceResultsController *sourceResultsController; 35 | @property (nonatomic, weak) IBOutlet NSProgressIndicator *progressIndicator; 36 | @property (nonatomic, weak) IBOutlet NSTextField *currentSelectionTextField; 37 | @property (nonatomic, weak) IBOutlet NSButton *loginButton; 38 | @property (nonatomic, weak) IBOutlet NSTabView *tabView; 39 | @property (nonatomic, weak) IBOutlet id delegate; 40 | 41 | @property (nonatomic, strong) FPRepresentedSource *representedSource; 42 | @property (nonatomic, strong, readonly) FPBaseSourceController *sourceController; 43 | @property (nonatomic, assign) BOOL allowsFileSelection; 44 | @property (nonatomic, assign) BOOL allowsMultipleSelection; 45 | 46 | - (NSString *)currentPath; 47 | - (NSArray *)selectedItems; 48 | 49 | - (void)loadPath:(NSString *)path; 50 | 51 | @end 52 | -------------------------------------------------------------------------------- /FPPicker/Platforms/Mac/FPTableCellView.h: -------------------------------------------------------------------------------- 1 | // 2 | // FPTableCellView.h 3 | // FPPicker 4 | // 5 | // Created by Ruben Nine on 17/10/14. 6 | // Copyright (c) 2014 Filepicker.io. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface FPTableCellView : NSTableCellView 12 | 13 | @property (nonatomic, strong) IBOutlet NSButton *button; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /FPPicker/Platforms/Mac/FPTableCellView.m: -------------------------------------------------------------------------------- 1 | // 2 | // FPTableCellView.m 3 | // FPPicker 4 | // 5 | // Created by Ruben Nine on 17/10/14. 6 | // Copyright (c) 2014 Filepicker.io. All rights reserved. 7 | // 8 | 9 | #import "FPTableCellView.h" 10 | 11 | @implementation FPTableCellView 12 | 13 | - (void)awakeFromNib 14 | { 15 | [super awakeFromNib]; 16 | 17 | // We want it to appear "inline" 18 | 19 | [[self.button cell] setBezelStyle:NSInlineBezelStyle]; 20 | } 21 | 22 | // The standard rowSizeStyle does some specific layout for us. To customize layout for our button, we first call super and then modify things 23 | 24 | - (void)viewWillDraw 25 | { 26 | [super viewWillDraw]; 27 | 28 | if (![self.button isHidden]) 29 | { 30 | [self.button sizeToFit]; 31 | 32 | NSRect textFrame = self.textField.frame; 33 | NSRect buttonFrame = self.button.frame; 34 | buttonFrame.origin.x = NSWidth(self.frame) - NSWidth(buttonFrame); 35 | self.button.frame = buttonFrame; 36 | textFrame.size.width = NSMinX(buttonFrame) - NSMinX(textFrame); 37 | self.textField.frame = textFrame; 38 | } 39 | } 40 | 41 | @end 42 | -------------------------------------------------------------------------------- /FPPicker/Platforms/Mac/FPTableView.h: -------------------------------------------------------------------------------- 1 | // 2 | // FPTableView.h 3 | // FPPicker 4 | // 5 | // Created by Ruben Nine on 21/10/14. 6 | // Copyright (c) 2014 Filepicker.io. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class FPTableView; 12 | 13 | @protocol FPTableViewDelegate 14 | 15 | - (BOOL) tableView:(FPTableView *)tableView 16 | shouldForwardKeyboardEvent:(NSEvent *)event; 17 | 18 | @end 19 | 20 | @interface FPTableView : NSTableView 21 | 22 | @end 23 | -------------------------------------------------------------------------------- /FPPicker/Platforms/Mac/FPTableView.m: -------------------------------------------------------------------------------- 1 | // 2 | // FPTableView.m 3 | // FPPicker 4 | // 5 | // Created by Ruben Nine on 21/10/14. 6 | // Copyright (c) 2014 Filepicker.io. All rights reserved. 7 | // 8 | 9 | #import "FPTableView.h" 10 | 11 | @implementation FPTableView 12 | 13 | - (void)keyDown:(NSEvent *)event 14 | { 15 | id theDelegate = (id)self.delegate; 16 | 17 | if (theDelegate && 18 | [theDelegate respondsToSelector:@selector(tableView:shouldForwardKeyboardEvent:)]) 19 | { 20 | if (![theDelegate tableView:self 21 | shouldForwardKeyboardEvent:event]) 22 | { 23 | return; 24 | } 25 | } 26 | 27 | [super keyDown:event]; 28 | } 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /FPPicker/Platforms/Mac/FPThumbnail.h: -------------------------------------------------------------------------------- 1 | // 2 | // FPThumbnail.h 3 | // FPPicker 4 | // 5 | // Created by Ruben Nine on 30/08/14. 6 | // Copyright (c) 2014 Filepicker.io. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface FPThumbnail : NSObject 12 | 13 | @property (nonatomic, strong) NSImage *icon; 14 | @property (nonatomic, strong) NSString *title; 15 | @property (nonatomic, strong) NSString *UID; 16 | @property (nonatomic, assign) BOOL isDimmed; 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /FPPicker/Platforms/Mac/FPThumbnail.m: -------------------------------------------------------------------------------- 1 | // 2 | // FPThumbnail.m 3 | // FPPicker 4 | // 5 | // Created by Ruben Nine on 30/08/14. 6 | // Copyright (c) 2014 Filepicker.io. All rights reserved. 7 | // 8 | 9 | #import "FPThumbnail.h" 10 | #import 11 | 12 | @implementation FPThumbnail 13 | 14 | - (NSString *)imageUID 15 | { 16 | return self.UID; 17 | } 18 | 19 | - (NSString *)imageTitle 20 | { 21 | return self.title; 22 | } 23 | 24 | - (NSString *)imageRepresentationType 25 | { 26 | return IKImageBrowserNSImageRepresentationType; 27 | } 28 | 29 | - (id)imageRepresentation 30 | { 31 | return self.icon; 32 | } 33 | 34 | - (NSString *)description 35 | { 36 | return [NSString stringWithFormat:@"%@ {icon=%@, isDimmed=%@}", 37 | self.title, 38 | self.icon, 39 | self.isDimmed ? @"YES" :@"NO"]; 40 | } 41 | 42 | - (NSString *)debugDescription 43 | { 44 | return [NSString stringWithFormat:@"%@ {icon=%@, isDimmed=%@}", 45 | self.title, 46 | self.icon, 47 | self.isDimmed ? @"YES" :@"NO"]; 48 | } 49 | 50 | @end 51 | -------------------------------------------------------------------------------- /FPPicker/Platforms/Mac/FPUtils+Mac.h: -------------------------------------------------------------------------------- 1 | // 2 | // FPUtils+Mac.h 3 | // FPPicker 4 | // 5 | // Created by Ruben Nine on 16/10/14. 6 | // Copyright (c) 2014 Filepicker.io. All rights reserved. 7 | // 8 | 9 | #import "FPUtils.h" 10 | 11 | @interface FPUtils (Mac) 12 | 13 | + (void)presentError:(NSError *)error 14 | withMessageText:(NSString *)messageText; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /FPPicker/Platforms/Mac/FPUtils+Mac.m: -------------------------------------------------------------------------------- 1 | // 2 | // FPUtils+Mac.m 3 | // FPPicker 4 | // 5 | // Created by Ruben Nine on 16/10/14. 6 | // Copyright (c) 2014 Filepicker.io. All rights reserved. 7 | // 8 | 9 | #import "FPUtils+Mac.h" 10 | 11 | @implementation FPUtils (Mac) 12 | 13 | + (void)presentError:(NSError *)error 14 | withMessageText:(NSString *)messageText 15 | { 16 | NSAlert *alert = [NSAlert new]; 17 | 18 | alert.messageText = messageText; 19 | alert.informativeText = error.localizedDescription; 20 | 21 | [alert runModal]; 22 | } 23 | 24 | @end 25 | -------------------------------------------------------------------------------- /FPPicker/Platforms/Mac/FPView.h: -------------------------------------------------------------------------------- 1 | // 2 | // FPView.h 3 | // FPPicker 4 | // 5 | // Created by Ruben Nine on 21/08/14. 6 | // Copyright (c) 2014 Filepicker.io. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | IB_DESIGNABLE 12 | @interface FPView : NSView 13 | 14 | @property (nonatomic, strong) IBInspectable NSColor *backgroundColor; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /FPPicker/Platforms/Mac/FPView.m: -------------------------------------------------------------------------------- 1 | // 2 | // FPView.m 3 | // FPPicker 4 | // 5 | // Created by Ruben Nine on 21/08/14. 6 | // Copyright (c) 2014 Filepicker.io. All rights reserved. 7 | // 8 | 9 | #import "FPView.h" 10 | 11 | @implementation FPView 12 | 13 | #pragma mark - Accessors 14 | 15 | - (NSColor *)backgroundColor 16 | { 17 | if (!_backgroundColor) 18 | { 19 | _backgroundColor = [NSColor controlColor]; 20 | } 21 | 22 | return _backgroundColor; 23 | } 24 | 25 | #pragma mark - Public Methods 26 | 27 | - (void)drawRect:(NSRect)dirtyRect 28 | { 29 | [super drawRect:dirtyRect]; 30 | 31 | // Drawing code here. 32 | 33 | [self.backgroundColor setFill]; 34 | 35 | NSBezierPath *bezierPath = [NSBezierPath bezierPathWithRect:self.bounds]; 36 | 37 | [bezierPath fill]; 38 | } 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /FPPicker/Platforms/Mac/FPWindow.h: -------------------------------------------------------------------------------- 1 | // 2 | // FPWindow.h 3 | // FPPicker 4 | // 5 | // Created by Ruben Nine on 28/07/15. 6 | // Copyright (c) 2015 Filepicker.io. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface FPWindow : NSWindow 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /FPPicker/Platforms/Mac/FPWindow.m: -------------------------------------------------------------------------------- 1 | // 2 | // FPWindow.m 3 | // FPPicker 4 | // 5 | // Created by Ruben Nine on 28/07/15. 6 | // Copyright (c) 2015 Filepicker.io. All rights reserved. 7 | // 8 | 9 | #import "FPWindow.h" 10 | 11 | @interface FPWindow () 12 | 13 | @end 14 | 15 | @implementation FPWindow 16 | 17 | - (BOOL)canBecomeKeyWindow 18 | { 19 | return YES; 20 | } 21 | 22 | @end 23 | -------------------------------------------------------------------------------- /FPPicker/Platforms/iOS/FPAuthController.h: -------------------------------------------------------------------------------- 1 | // 2 | // FPAuthController.h 3 | // FPPicker 4 | // 5 | // Created by Liyan David Chang on 6/20/12. 6 | // Copyright (c) 2012 Filepicker.io. All rights reserved. 7 | // 8 | 9 | #import 10 | @class FPSource; 11 | 12 | @interface FPAuthController : UIViewController 13 | 14 | @property (nonatomic, strong) UIWebView *webView; 15 | @property (nonatomic, strong) NSString *service; 16 | @property (nonatomic) BOOL alreadyReload; 17 | 18 | - (instancetype)initWithSource:(FPSource *)source NS_DESIGNATED_INITIALIZER; 19 | - (instancetype)initWithCoder:(NSCoder *)aDecoder NS_UNAVAILABLE; 20 | - (instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil NS_UNAVAILABLE; 21 | 22 | @end 23 | -------------------------------------------------------------------------------- /FPPicker/Platforms/iOS/FPBarButtonItem.h: -------------------------------------------------------------------------------- 1 | // 2 | // FPBarButtonItem.h 3 | // FPPicker 4 | // 5 | // Created by Ruben Nine on 10/08/15. 6 | // Copyright (c) 2015 Filepicker.io. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface FPBarButtonItem : UIView 12 | 13 | @property (nonatomic, copy) UIColor *happyTextColor UI_APPEARANCE_SELECTOR; 14 | @property (nonatomic, copy) UIColor *angryTextColor UI_APPEARANCE_SELECTOR; 15 | @property (nonatomic, copy) UIColor *backgroundColor UI_APPEARANCE_SELECTOR; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /FPPicker/Platforms/iOS/FPBarButtonItem.m: -------------------------------------------------------------------------------- 1 | // 2 | // FPBarButtonItem.m 3 | // FPPicker 4 | // 5 | // Created by Ruben Nine on 10/08/15. 6 | // Copyright (c) 2015 Filepicker.io. All rights reserved. 7 | // 8 | 9 | #import "FPBarButtonItem.h" 10 | 11 | @implementation FPBarButtonItem 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /FPPicker/Platforms/iOS/FPImagePickerController.h: -------------------------------------------------------------------------------- 1 | // 2 | // FPImagePickerController.h 3 | // FPPicker 4 | // 5 | // Created by Ruben on 9/18/14. 6 | // Copyright (c) 2014 Filepicker.io (Couldtop Inc.). All rights reserved. 7 | // 8 | 9 | #import 10 | #import "FPSource.h" 11 | 12 | @interface FPImagePickerController : UIImagePickerController 13 | 14 | @property (nonatomic, strong) FPSource *source; 15 | 16 | /*! 17 | Disables the front camera live preview mirroring (experimental) 18 | Side-effect: overrides the existing `cameraViewTransform`. 19 | */ 20 | @property (nonatomic, assign) BOOL disableFrontCameraLivePreviewMirroring; 21 | 22 | @end 23 | -------------------------------------------------------------------------------- /FPPicker/Platforms/iOS/FPInfoViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // FPInfoViewController.h 3 | // FPPicker 4 | // 5 | // Created by Liyan David Chang on 1/7/13. 6 | // Copyright (c) 2013 Filepicker.io. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "FPInternalHeaders.h" 11 | 12 | @interface FPInfoViewController : UIViewController 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /FPPicker/Platforms/iOS/FPInternalHeaders.h: -------------------------------------------------------------------------------- 1 | // 2 | // FPInternalHeaders.h 3 | // FPPicker 4 | // 5 | // Created by Ruben Nine on 14/08/14. 6 | // Copyright (c) 2014 Filepicker.io. All rights reserved. 7 | // 8 | 9 | #import "FPSharedInternalHeaders.h" 10 | 11 | #import "FPAuthController.h" 12 | #import "FPUtils+iOS.h" 13 | #import "FPLibrary+iOS.h" 14 | #import "FPPickerController.h" 15 | #import "FPSaveController.h" 16 | #import "FPSourceListController.h" 17 | #import "FPTableWithUploadButtonViewController.h" 18 | #import "MBProgressHUD.h" 19 | 20 | @class FPSourceController; 21 | @class FPMediaInfo; 22 | 23 | @protocol FPSourceControllerDelegate 24 | 25 | - (void)sourceController:(FPSourceController *)sourceController didPickMediaWithInfo:(FPMediaInfo *)info; 26 | - (void)sourceController:(FPSourceController *)sourceController didFinishPickingMediaWithInfo:(FPMediaInfo *)info; 27 | - (void)sourceController:(FPSourceController *)sourceController didFinishPickingMultipleMediaWithResults:(NSArray *)results; 28 | - (void)sourceControllerDidCancel:(FPSourceController *)sourceController; 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /FPPicker/Platforms/iOS/FPLibrary+iOS.h: -------------------------------------------------------------------------------- 1 | // 2 | // FPLibrary+iOS.h 3 | // FPPicker 4 | // 5 | // Created by Ruben Nine on 16/10/14. 6 | // Copyright (c) 2014 Filepicker.io. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "FPLibrary.h" 11 | 12 | @class PHAsset; 13 | 14 | @interface FPLibrary (iOS) 15 | 16 | // For the camera 17 | 18 | + (void) uploadImage:(UIImage *)image 19 | ofMimetype:(NSString *)mimetype 20 | usingOperationQueue:(NSOperationQueue *)operationQueue 21 | success:(FPUploadAssetSuccessWithLocalURLBlock)success 22 | failure:(FPUploadAssetFailureWithLocalURLBlock)failure 23 | progress:(FPUploadAssetProgressBlock)progress; 24 | 25 | + (void) uploadVideoURL:(NSURL *)url 26 | usingOperationQueue:(NSOperationQueue *)operationQueue 27 | success:(FPUploadAssetSuccessWithLocalURLBlock)success 28 | failure:(FPUploadAssetFailureWithLocalURLBlock)failure 29 | progress:(FPUploadAssetProgressBlock)progress; 30 | 31 | // For uploading local images on open (Camera roll) 32 | 33 | + (void) uploadAsset:(PHAsset *)asset 34 | usingOperationQueue:(NSOperationQueue *)operationQueue 35 | success:(FPUploadAssetSuccessWithLocalURLBlock)success 36 | failure:(FPUploadAssetFailureWithLocalURLBlock)failure 37 | progress:(FPUploadAssetProgressBlock)progress; 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /FPPicker/Platforms/iOS/FPLocalAlbumController.h: -------------------------------------------------------------------------------- 1 | // 2 | // FPLocalAlbumController.h 3 | // FPPicker 4 | // 5 | // Created by Liyan David Chang on 4/17/13. 6 | // Copyright (c) 2013 Filepicker.io. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "FPInternalHeaders.h" 11 | 12 | @class PHAssetCollection; 13 | 14 | @interface FPLocalAlbumController : UIViewController 15 | 16 | @property (nonatomic, strong) NSArray *albums; 17 | @property (nonatomic, weak) id fpdelegate; 18 | @property (nonatomic, strong) FPSource *source; 19 | @property (nonatomic, strong) UITableView *tableView; 20 | @property (nonatomic) BOOL selectMultiple; 21 | @property (nonatomic) NSInteger maxFiles; 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /FPPicker/Platforms/iOS/FPLocalController.h: -------------------------------------------------------------------------------- 1 | // 2 | // FPLocalController.h 3 | // FPPicker 4 | // 5 | // Created by Liyan David Chang on 6/20/12. 6 | // Copyright (c) 2012 Filepicker.io. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "FPInternalHeaders.h" 11 | 12 | @class PHAssetCollection; 13 | 14 | @interface FPLocalController : FPTableWithUploadButtonViewController 15 | 16 | @property (nonatomic, strong) NSArray *photos; 17 | @property (nonatomic, strong) FPSource *source; 18 | @property (nonatomic, weak) id fpdelegate; 19 | @property (nonatomic, retain) PHAssetCollection *assetCollection; 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /FPPicker/Platforms/iOS/FPPicker.h: -------------------------------------------------------------------------------- 1 | // 2 | // FPPicker.h 3 | // FPPicker 4 | // 5 | // Created by Ruben Nine on 13/10/14. 6 | // Copyright (c) 2014 Filepicker.io. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | //! Project version number for FPPicker. 12 | FOUNDATION_EXPORT double FPPickerVersionNumber; 13 | 14 | //! Project version string for FPPicker. 15 | FOUNDATION_EXPORT const unsigned char FPPickerVersionString[]; 16 | 17 | // In this header, you should import all the public headers of your framework using statements like #import 18 | 19 | #import "FPConfig.h" 20 | #import "FPConstants.h" 21 | #import "FPExternalHeaders.h" 22 | #import "FPAuthController.h" 23 | #import "FPPickerController.h" 24 | #import "FPSource+SupportedSources.h" 25 | #import "FPSaveController.h" 26 | #import "FPMediaInfo.h" 27 | #import "FPSimpleAPI.h" 28 | #import "FPTheme.h" 29 | -------------------------------------------------------------------------------- /FPPicker/Platforms/iOS/FPPickerController.h: -------------------------------------------------------------------------------- 1 | // 2 | // NavigationController.h 3 | // FPPicker 4 | // 5 | // Created by Liyan David Chang on 6/20/12. 6 | // Copyright (c) 2012 Filepicker.io. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "FPExternalHeaders.h" 11 | 12 | @class FPTheme; 13 | 14 | @interface FPPickerController : UINavigationController 15 | 16 | @property (nonatomic, weak) id fpdelegate; 17 | @property (nonatomic, strong) NSArray *sourceNames; 18 | @property (nonatomic, strong) NSArray *dataTypes; 19 | @property (nonatomic, strong) FPTheme *theme; 20 | 21 | // imagepicker properties 22 | 23 | @property (nonatomic, assign) BOOL allowsEditing; 24 | @property (nonatomic, assign) BOOL selectMultiple; 25 | @property (nonatomic, assign) NSInteger maxFiles; 26 | 27 | @property (nonatomic, assign) UIImagePickerControllerQualityType videoQuality; 28 | @property (nonatomic, assign) NSTimeInterval videoMaximumDuration; 29 | @property (nonatomic, assign) BOOL showsCameraControls; 30 | @property (nonatomic, strong) UIView *cameraOverlayView; 31 | @property (nonatomic, assign) CGAffineTransform cameraViewTransform; 32 | @property (nonatomic, assign) UIImagePickerControllerCameraDevice cameraDevice; 33 | @property (nonatomic, assign) UIImagePickerControllerCameraFlashMode cameraFlashMode; 34 | 35 | /*! 36 | Disables the front camera live preview mirroring (experimental) 37 | Side-effect: overrides the existing `cameraViewTransform`. 38 | */ 39 | @property (nonatomic, assign) BOOL disableFrontCameraLivePreviewMirroring; 40 | 41 | @end 42 | -------------------------------------------------------------------------------- /FPPicker/Platforms/iOS/FPSaveController.h: -------------------------------------------------------------------------------- 1 | // 2 | // FPSaveController.h 3 | // FPPicker 4 | // 5 | // Created by Liyan David Chang on 7/7/12. 6 | // Copyright (c) 2012 Filepicker.io. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "FPExternalHeaders.h" 11 | 12 | @class FPTheme; 13 | 14 | @interface FPSaveController : UINavigationController 15 | 16 | @property (nonatomic, weak) id fpdelegate; 17 | @property (nonatomic, strong) NSArray *sourceNames; 18 | @property (nonatomic, strong) FPTheme *theme; 19 | 20 | @property (nonatomic, strong) NSData *data; 21 | @property (nonatomic, strong) NSURL *dataurl; 22 | 23 | @property (nonatomic, strong) NSString *dataType; 24 | @property (nonatomic, strong) NSString *dataExtension; 25 | 26 | @property (nonatomic, strong) NSString *proposedFilename; 27 | 28 | - (void)saveFileName:(NSString *)filename To:(NSString *)path; 29 | - (void)saveFileLocally; 30 | 31 | - (NSString *)getExtensionString; 32 | 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /FPPicker/Platforms/iOS/FPSaveSourceController.h: -------------------------------------------------------------------------------- 1 | // 2 | // FPSaveSourceController.h 3 | // FPPicker 4 | // 5 | // Created by Liyan David Chang on 7/8/12. 6 | // Copyright (c) 2012 Filepicker.io. All rights reserved. 7 | // 8 | 9 | #import "FPSourceController.h" 10 | 11 | @interface FPSaveSourceController : FPSourceController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /FPPicker/Platforms/iOS/FPSearchController.h: -------------------------------------------------------------------------------- 1 | // 2 | // FPSearchController.h 3 | // FPPicker 4 | // 5 | // Created by Liyan David Chang on 6/20/12. 6 | // Copyright (c) 2012 Filepicker.io. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "FPSourceController.h" 11 | #import "FPInternalHeaders.h" 12 | 13 | @interface FPSearchController : FPSourceController 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /FPPicker/Platforms/iOS/FPSourceController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ServiceController.h 3 | // FPPicker 4 | // 5 | // Created by Liyan David Chang on 6/20/12. 6 | // Copyright (c) 2012 Filepicker.io. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "FPInternalHeaders.h" 11 | 12 | @interface FPSourceController : FPTableWithUploadButtonViewController 13 | 14 | @property (nonatomic, strong) NSMutableArray *contents; 15 | @property (nonatomic, strong) NSString *path; 16 | @property (nonatomic, strong) FPSource *source; 17 | @property (nonatomic, strong) NSString *viewType; 18 | @property (nonatomic, strong) NSString *nextPage; 19 | @property (nonatomic, strong) UIActivityIndicatorView *nextPageSpinner; 20 | @property (nonatomic, weak) id fpdelegate; 21 | 22 | 23 | - (void)fpLoadContents:(NSString *)loadpath; 24 | 25 | - (void)afterReload; 26 | 27 | - (void)fileSelectedAtIndex:(NSInteger)index 28 | forView:(UIView*)view 29 | withThumbnail:(UIImage *)thumbnail; 30 | 31 | - (void)pushDirectoryControllerForPath:(NSString*)path; 32 | @end 33 | -------------------------------------------------------------------------------- /FPPicker/Platforms/iOS/FPSourceListController.h: -------------------------------------------------------------------------------- 1 | // 2 | // FPSourceListController.h 3 | // FPPicker 4 | // 5 | // Created by Liyan David Chang on 6/20/12. 6 | // Copyright (c) 2012 Filepicker.io. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "FPExternalHeaders.h" 11 | 12 | @protocol FPSourceControllerDelegate; 13 | 14 | @interface FPSourceListController : UITableViewController 17 | 18 | @property (nonatomic, strong) NSArray *sourceNames; 19 | @property (nonatomic, strong) NSDictionary *sources; 20 | 21 | @property (nonatomic, weak) id fpdelegate; 22 | @property (nonatomic, weak) id imageDelegate; 23 | 24 | @property (nonatomic, strong) NSArray *dataTypes; 25 | @property (nonatomic) BOOL selectMultiple; 26 | @property (nonatomic) NSInteger maxFiles; 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /FPPicker/Platforms/iOS/FPTableViewCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // FPTableViewCell.h 3 | // FPPicker 4 | // 5 | // Created by Ruben Nine on 07/08/15. 6 | // Copyright (c) 2015 Filepicker.io. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface FPTableViewCell : UITableViewCell 12 | 13 | @property (nonatomic, copy) UIColor *selectedBackgroundColor UI_APPEARANCE_SELECTOR; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /FPPicker/Platforms/iOS/FPTableViewCell.m: -------------------------------------------------------------------------------- 1 | // 2 | // FPTableViewCell.m 3 | // FPPicker 4 | // 5 | // Created by Ruben Nine on 07/08/15. 6 | // Copyright (c) 2015 Filepicker.io. All rights reserved. 7 | // 8 | 9 | #import "FPTableViewCell.h" 10 | 11 | @implementation FPTableViewCell 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /FPPicker/Platforms/iOS/FPTableWithUploadButtonViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // FPTableWithUploadButtonViewController.h 3 | // FPPicker 4 | // 5 | // Created by Brett van Zuiden on 12/3/13. 6 | // Copyright (c) 2013 Filepicker.io. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface FPTableWithUploadButtonViewController : UITableViewController 12 | 13 | @property (nonatomic) BOOL selectMultiple; 14 | @property (nonatomic) NSInteger maxFiles; 15 | 16 | - (void)updateUploadButton:(NSInteger)count; 17 | - (IBAction)uploadButtonTapped:(id)sender; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /FPPicker/Platforms/iOS/FPTheme.h: -------------------------------------------------------------------------------- 1 | // 2 | // FPTheme.h 3 | // FPPicker 4 | // 5 | // Created by Ruben Nine on 06/08/15. 6 | // Copyright (c) 2015 Filepicker.io. All rights reserved. 7 | // 8 | 9 | @import UIKit; 10 | 11 | @interface FPTheme : NSObject 12 | 13 | /*! 14 | The navigation bar style that specifies its appearance (i.e., UIBarStyleDefault or UIBarStyleBlack) 15 | */ 16 | @property (nonatomic, assign) UIBarStyle navigationBarStyle; 17 | 18 | /*! 19 | The background color to apply to the navigation bar. 20 | 21 | Please notice that this color will also be applied to the popover 22 | presentation controller's background for aesthetic purposes. 23 | */ 24 | @property (nonatomic, strong) UIColor *navigationBarBackgroundColor; 25 | 26 | /*! 27 | The tint color to apply to the navigation items and bar button items. 28 | */ 29 | @property (nonatomic, strong) UIColor *navigationBarTintColor; 30 | 31 | /*! 32 | The tint (background) color to apply to the table view headers and footers. 33 | */ 34 | @property (nonatomic, strong) UIColor *headerFooterViewTintColor; 35 | 36 | /*! 37 | The text color to apply to the table view headers and footers. 38 | */ 39 | @property (nonatomic, strong) UIColor *headerFooterViewTextColor; 40 | 41 | /*! 42 | The background color to apply to the table view. 43 | */ 44 | @property (nonatomic, strong) UIColor *tableViewBackgroundColor; 45 | 46 | /*! 47 | The color to apply to the table view separators. 48 | */ 49 | @property (nonatomic, strong) UIColor *tableViewSeparatorColor; 50 | 51 | /*! 52 | The background color to apply to the table view cells. 53 | */ 54 | @property (nonatomic, strong) UIColor *tableViewCellBackgroundColor; 55 | 56 | /*! 57 | The text color to apply to the table view cells. 58 | */ 59 | @property (nonatomic, strong) UIColor *tableViewCellTextColor; 60 | 61 | /*! 62 | The tint color to apply to the table view cells (i.e. buttons and images) 63 | */ 64 | @property (nonatomic, strong) UIColor *tableViewCellTintColor; 65 | 66 | /*! 67 | The background color to apply to the table view cell when selected. 68 | */ 69 | @property (nonatomic, strong) UIColor *tableViewCellSelectedBackgroundColor; 70 | 71 | /*! 72 | The text color to apply to the table view cell when selected. 73 | */ 74 | @property (nonatomic, strong) UIColor *tableViewCellSelectedTextColor; 75 | 76 | /*! 77 | The text color to apply to the upload button given input is valid. 78 | */ 79 | @property (nonatomic, strong) UIColor *uploadButtonHappyTextColor; 80 | 81 | /*! 82 | The text color to apply to the upload button given input is invalid. 83 | */ 84 | @property (nonatomic, strong) UIColor *uploadButtonAngryTextColor; 85 | 86 | /*! 87 | The background color to apply to the upload button. 88 | */ 89 | @property (nonatomic, strong) UIColor *uploadButtonBackgroundColor; 90 | 91 | @end 92 | -------------------------------------------------------------------------------- /FPPicker/Platforms/iOS/FPTheme.m: -------------------------------------------------------------------------------- 1 | // 2 | // FPTheme.m 3 | // FPPicker 4 | // 5 | // Created by Ruben Nine on 06/08/15. 6 | // Copyright (c) 2015 Filepicker.io. All rights reserved. 7 | // 8 | 9 | #import "FPTheme.h" 10 | 11 | @implementation FPTheme 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /FPPicker/Platforms/iOS/FPThemeApplier.h: -------------------------------------------------------------------------------- 1 | // 2 | // FPThemeApplier.h 3 | // FPPicker 4 | // 5 | // Created by Ruben Nine on 07/08/15. 6 | // Copyright (c) 2015 Filepicker.io. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "FPTheme.h" 11 | 12 | @interface FPThemeApplier : NSObject 13 | 14 | @property (nonatomic, strong, readonly) FPTheme *theme; 15 | 16 | - (instancetype)initWithTheme:(FPTheme *)theme NS_DESIGNATED_INITIALIZER; 17 | - (instancetype)init NS_UNAVAILABLE; 18 | 19 | - (void)applyToController:(id)controller; 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /FPPicker/Platforms/iOS/FPThumbCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // FPThumbCell.h 3 | // FPPicker 4 | // 5 | // Created by Liyan David Chang on 7/9/12. 6 | // Copyright (c) 2012 Filepicker.io. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "FPTableViewCell.h" 11 | 12 | @interface FPThumbCell : FPTableViewCell 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /FPPicker/Platforms/iOS/FPThumbCell.m: -------------------------------------------------------------------------------- 1 | // 2 | // FPThumbCell.m 3 | // FPPicker 4 | // 5 | // Created by Liyan David Chang on 7/9/12. 6 | // Copyright (c) 2012 Filepicker.io. All rights reserved. 7 | // 8 | 9 | #import "FPThumbCell.h" 10 | 11 | @implementation FPThumbCell 12 | 13 | - (void)layoutSubviews 14 | { 15 | [super layoutSubviews]; 16 | 17 | self.imageView.frame = CGRectMake(5, 5, 34, 34); 18 | self.imageView.clipsToBounds = YES; 19 | 20 | CGFloat limgW = self.imageView.image.size.width; 21 | 22 | if (limgW > 0) 23 | { 24 | CGRect textLabelFrame = self.textLabel.frame; 25 | CGRect detailTextLabelFrame = self.detailTextLabel.frame; 26 | 27 | textLabelFrame.origin.x = 50; 28 | detailTextLabelFrame.origin.x = 50; 29 | 30 | self.textLabel.frame = textLabelFrame; 31 | self.detailTextLabel.frame = detailTextLabelFrame; 32 | } 33 | } 34 | 35 | @end 36 | -------------------------------------------------------------------------------- /FPPicker/Platforms/iOS/FPUtils+iOS.h: -------------------------------------------------------------------------------- 1 | // 2 | // FPUtils+iOS.h 3 | // FPPicker 4 | // 5 | // Created by Ruben Nine on 13/08/14. 6 | // Copyright (c) 2014 Filepicker.io. All rights reserved. 7 | // 8 | 9 | #import "FPUtils.h" 10 | #import 11 | 12 | @class PHAsset; 13 | @class PHImageManager; 14 | 15 | typedef void (^FPFetchPHAssetImageBlock)(UIImage *image); 16 | 17 | @interface FPUtils (iOS) 18 | 19 | /*! 20 | Returns an image with corrected rotation. 21 | 22 | @returns An UIImage 23 | */ 24 | + (UIImage *)fixImageRotationIfNecessary:(UIImage *)image; 25 | 26 | /*! 27 | Returns a JPEG compressed image with the desired compression factor. 28 | 29 | @returns An UIImage 30 | */ 31 | + (UIImage *)compressImage:(UIImage *)image 32 | withCompressionFactor:(CGFloat)compressionFactor 33 | andOrientation:(UIImageOrientation)orientation; 34 | 35 | /*! 36 | Asynchronously fetches the thumbnail UIImage representing the given asset. 37 | Note: the completionBlock might be called multiple times, see documentation for 38 | -[PHImageManager requestImageForAsset:targetSize:contentMode:options:resultHandler:] 39 | 40 | @returns void 41 | */ 42 | + (void)asyncFetchAssetThumbnailFromPHAsset:(PHAsset *)asset 43 | completion:(FPFetchPHAssetImageBlock)completionBlock; 44 | 45 | 46 | /*! 47 | Asynchronously fetches the thumbnail UIImage representing the given asset. 48 | The completion block is guaranted to be called only once 49 | 50 | @returns void 51 | */ 52 | + (void)asyncFetchAssetThumbnailFromPHAsset:(PHAsset *)asset 53 | ensureCompletionIsCalledOnce:(BOOL)ensureOnce 54 | completion:(FPFetchPHAssetImageBlock)completionBlock; 55 | 56 | /*! 57 | Returns whether the current running app is an app extension. 58 | 59 | @returns YES or NO 60 | */ 61 | + (BOOL)currentAppIsAppExtension; 62 | 63 | @end 64 | -------------------------------------------------------------------------------- /FPPicker/Platforms/iOS/FPiOSMacros.h: -------------------------------------------------------------------------------- 1 | // 2 | // FPiOSMacros.h 3 | // FPPicker 4 | // 5 | // Created by Ruben Nine on 13/08/14. 6 | // Copyright (c) 2014 Filepicker.io. All rights reserved. 7 | // 8 | 9 | #define DONT_BLOCK_UI() \ 10 | NSAssert(![NSThread isMainThread], @"Don't block the UI thread please!") 11 | 12 | #define BLOCK_UI() \ 13 | NSAssert([NSThread isMainThread], @"You aren't running in the UI thread!") 14 | 15 | #define SYSTEM_VERSION_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedSame) 16 | 17 | #define SYSTEM_VERSION_GREATER_THAN(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedDescending) 18 | 19 | #define SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending) 20 | 21 | #define SYSTEM_VERSION_LESS_THAN(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedAscending) 22 | 23 | #define SYSTEM_VERSION_LESS_THAN_OR_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedDescending) 24 | -------------------------------------------------------------------------------- /FPPicker/Platforms/iOS/UILabel+Appearance.h: -------------------------------------------------------------------------------- 1 | // 2 | // UILabel+Appearance.h 3 | // FPPicker 4 | // 5 | // Created by Ruben Nine on 07/08/15. 6 | // Copyright (c) 2015 Filepicker.io. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface UILabel (Appearance) 12 | 13 | - (void)setAppearanceTextColor:(UIColor *)color UI_APPEARANCE_SELECTOR; 14 | - (void)setAppearanceHighlightedTextColor:(UIColor *)color UI_APPEARANCE_SELECTOR; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /FPPicker/Platforms/iOS/UILabel+Appearance.m: -------------------------------------------------------------------------------- 1 | // 2 | // UILabel+Appearance.m 3 | // FPPicker 4 | // 5 | // Created by Ruben Nine on 07/08/15. 6 | // Copyright (c) 2015 Filepicker.io. All rights reserved. 7 | // 8 | 9 | #import "UILabel+Appearance.h" 10 | 11 | @implementation UILabel (Appearance) 12 | 13 | - (void)setAppearanceTextColor:(UIColor *)color 14 | { 15 | self.textColor = color; 16 | } 17 | 18 | - (void)setAppearanceHighlightedTextColor:(UIColor *)color 19 | { 20 | self.highlightedTextColor = color; 21 | } 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /FPPicker/Shared/FPAPIClient.h: -------------------------------------------------------------------------------- 1 | // 2 | // FPAPIClient.h 3 | // FPPicker 4 | // 5 | // Created by Ruben Nine on 18/06/14. 6 | // Copyright (c) 2014 Filepicker.io. All rights reserved. 7 | // 8 | 9 | #import "AFHTTPRequestOperationManager.h" 10 | 11 | @interface FPAPIClient : AFHTTPRequestOperationManager 12 | 13 | + (instancetype)sharedClient; 14 | 15 | - (AFHTTPRequestOperation *)POST:(NSString *)URLString 16 | parameters:(id)parameters 17 | usingOperationQueue:(NSOperationQueue *)operationQueue 18 | success:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success 19 | failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failure; 20 | 21 | - (AFHTTPRequestOperation *)POST:(NSString *)URLString 22 | parameters:(id)parameters 23 | constructingBodyWithBlock:(void (^)(id formData))block 24 | usingOperationQueue:(NSOperationQueue *)operationQueue 25 | success:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success 26 | failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failure; 27 | @end 28 | -------------------------------------------------------------------------------- /FPPicker/Shared/FPConfig.h: -------------------------------------------------------------------------------- 1 | // 2 | // FPConfig.h 3 | // FPPicker 4 | // 5 | // Created by Ruben Nine on 12/06/14. 6 | // Copyright (c) 2014 Filepicker.io. All rights reserved. 7 | // 8 | 9 | @import Foundation; 10 | 11 | typedef NS_ENUM(NSUInteger, FPLogLevel) { 12 | FPInfoLogLevel, 13 | FPErrorLogLevel, 14 | }; 15 | 16 | typedef void (^FPVideoUploadPreprocessorBlock)(NSURL *localURL); 17 | typedef void (^FPImageUploadPreprocessorBlock)(NSURL *localURL, NSString *mimetype); 18 | typedef void (^FPLoggingBlock)(NSString *message, FPLogLevel logLevel); 19 | 20 | @interface FPConfig : NSObject 21 | 22 | /*! 23 | Filepicker.io base URL (read-only.) 24 | */ 25 | @property (nonatomic, readonly, strong) NSURL *baseURL; 26 | 27 | /*! 28 | Filepicker.io API key (required.) 29 | */ 30 | @property (nonatomic, strong) NSString *APIKey; 31 | 32 | /*! 33 | Filepicker.io App secret key (required if security is enabled in Developer Portal) 34 | */ 35 | @property (nonatomic, strong) NSString *appSecretKey; 36 | 37 | /*! 38 | Indicates that the file should be stored in a way that allows public access 39 | going directly to the underlying file store. 40 | 41 | Defaults to 'private'. 42 | */ 43 | @property (nonatomic, strong) NSString *storeAccess; 44 | 45 | /*! 46 | Where to store the file. 47 | 48 | Defaults to 'S3'. 49 | 50 | Other options are 'azure', 'dropbox' and 'rackspace'. 51 | */ 52 | @property (nonatomic, strong) NSString *storeLocation; 53 | 54 | /*! 55 | The path to store the file at within the specified file store. 56 | For S3, this is the key where the file will be stored at. 57 | For S3, please remember adding a trailing slash (i.e. my-custom-path/) 58 | */ 59 | @property (nonatomic, strong) NSString *storePath; 60 | 61 | /*! 62 | The bucket or container in the specified file store where the file should end up. 63 | */ 64 | @property (nonatomic, strong) NSString *storeContainer; 65 | 66 | /*! 67 | User-definable video upload preprocessor block. 68 | */ 69 | @property (nonatomic, copy) FPVideoUploadPreprocessorBlock videoUploadPreprocessorBlock; 70 | 71 | /*! 72 | User-definable image upload preprocessor block. 73 | */ 74 | @property (nonatomic, copy) FPImageUploadPreprocessorBlock imageUploadPreprocessorBlock; 75 | 76 | /*! 77 | User-definable block so the host application can be aware of errors within the FP library. 78 | The library will log to the console if loggingBlock is nil. 79 | */ 80 | @property (nonatomic, copy) FPLoggingBlock loggingBlock; 81 | 82 | /*! 83 | Returns a singleton FPConfig instance. 84 | */ 85 | + (instancetype)sharedInstance; 86 | 87 | /*! 88 | Emit a log message to the console or invoke the logging block. 89 | */ 90 | + (void)logMessage:(NSString *)message logLevel:(FPLogLevel)logLevel; 91 | 92 | @end 93 | -------------------------------------------------------------------------------- /FPPicker/Shared/FPConstants.h: -------------------------------------------------------------------------------- 1 | // 2 | // FPConstants.h 3 | // FPPicker 4 | // 5 | // Created by Liyan David Chang on 6/20/12. 6 | // Copyright (c) 2012 Filepicker.io. All rights reserved. 7 | // 8 | 9 | @import Foundation; 10 | 11 | FOUNDATION_EXPORT NSString *const FPSourceFilesystem; 12 | FOUNDATION_EXPORT NSString *const FPSourceBox; 13 | FOUNDATION_EXPORT NSString *const FPSourceCameraRoll; 14 | FOUNDATION_EXPORT NSString *const FPSourceDropbox; 15 | FOUNDATION_EXPORT NSString *const FPSourceFacebook; 16 | FOUNDATION_EXPORT NSString *const FPSourceGithub; 17 | FOUNDATION_EXPORT NSString *const FPSourceGmail; 18 | FOUNDATION_EXPORT NSString *const FPSourceImagesearch; 19 | //FOUNDATION_EXPORT NSString *const FPSourceURL; 20 | FOUNDATION_EXPORT NSString *const FPSourceCamera; 21 | FOUNDATION_EXPORT NSString *const FPSourceGoogleDrive; 22 | FOUNDATION_EXPORT NSString *const FPSourceInstagram; 23 | FOUNDATION_EXPORT NSString *const FPSourceFlickr; 24 | FOUNDATION_EXPORT NSString *const FPSourcePicasa; 25 | FOUNDATION_EXPORT NSString *const FPSourceSkydrive; 26 | FOUNDATION_EXPORT NSString *const FPSourceEvernote; 27 | FOUNDATION_EXPORT NSString *const FPSourceCloudDrive; 28 | 29 | // Notifications 30 | FOUNDATION_EXPORT NSString *const FPPickerDidAuthenticateAgainstSourceNotification; 31 | -------------------------------------------------------------------------------- /FPPicker/Shared/FPConstants.m: -------------------------------------------------------------------------------- 1 | // 2 | // FPConstants.m 3 | // FPPicker 4 | // 5 | // Created by Liyan David Chang on 6/20/12. 6 | // Copyright (c) 2012 Filepicker.io. All rights reserved. 7 | // 8 | 9 | #import "FPConstants.h" 10 | 11 | NSString *const FPSourceFilesystem = @"filesystem"; 12 | NSString *const FPSourceBox = @"box"; 13 | NSString *const FPSourceCameraRoll = @"cameraroll"; 14 | NSString *const FPSourceDropbox = @"dropbox"; 15 | NSString *const FPSourceFacebook = @"facebook"; 16 | NSString *const FPSourceGithub = @"github"; 17 | NSString *const FPSourceGmail = @"gmail"; 18 | NSString *const FPSourceImagesearch = @"imagesearch"; 19 | //NSString *const FPSourceURL = @"url"; 20 | NSString *const FPSourceCamera = @"camera"; 21 | NSString *const FPSourceGoogleDrive = @"googledrive"; 22 | NSString *const FPSourceInstagram = @"instagram"; 23 | NSString *const FPSourceFlickr = @"flickr"; 24 | NSString *const FPSourcePicasa = @"picasa"; 25 | NSString *const FPSourceSkydrive = @"skydrive"; 26 | NSString *const FPSourceEvernote = @"evernote"; 27 | NSString *const FPSourceCloudDrive = @"clouddrive"; 28 | 29 | // Notifications 30 | NSString *const FPPickerDidAuthenticateAgainstSourceNotification = @"FPPickerDidAuthenticateAgainstSourceNotification"; 31 | -------------------------------------------------------------------------------- /FPPicker/Shared/FPExternalHeaders.h: -------------------------------------------------------------------------------- 1 | // 2 | // FPExternalHeaders.h 3 | // FPPicker 4 | // 5 | // Created by Liyan David Chang on 7/8/12. 6 | // Copyright (c) 2012 Filepicker.io. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class FPPickerController; 12 | @class FPSaveController; 13 | @class FPMediaInfo; 14 | 15 | @protocol FPPickerControllerDelegate 16 | 17 | @optional 18 | 19 | /*! 20 | Called after Filepicker picked a media. 21 | */ 22 | - (void)fpPickerController:(FPPickerController *)pickerController didPickMediaWithInfo:(FPMediaInfo *)info; 23 | 24 | #if TARGET_OS_IPHONE 25 | 26 | /*! 27 | Called after Filepicker finished picking a media. 28 | At this point the associated media file should be present at info.mediaURL. 29 | @note: iOS only. 30 | */ 31 | - (void)fpPickerController:(FPPickerController *)pickerController didFinishPickingMediaWithInfo:(FPMediaInfo *)info; 32 | 33 | #endif 34 | 35 | /*! 36 | Called after Filepicker finished picking multiple media. 37 | At this point the associated media file for each item should be present at info.mediaURL. 38 | */ 39 | - (void)fpPickerController:(FPPickerController *)pickerController didFinishPickingMultipleMediaWithResults:(NSArray *)results; 40 | 41 | /*! 42 | Typically called when the picking process is cancelled or a file can't be handled. 43 | */ 44 | - (void)fpPickerControllerDidCancel:(FPPickerController *)pickerController; 45 | 46 | @end 47 | 48 | @protocol FPSaveControllerDelegate 49 | 50 | @optional 51 | 52 | /*! 53 | Called after Filepicker finished saving a media. 54 | */ 55 | - (void)fpSaveController:(FPSaveController *)saveController didFinishSavingMediaWithInfo:(FPMediaInfo *)info; 56 | 57 | /*! 58 | Called when Filepicker failed saving a media. 59 | */ 60 | - (void)fpSaveController:(FPSaveController *)saveController didError:(NSError *)error; 61 | 62 | /*! 63 | Typically called when the save process is cancelled or a file can't be handled. 64 | */ 65 | - (void)fpSaveControllerDidCancel:(FPSaveController *)saveController; 66 | 67 | @end 68 | -------------------------------------------------------------------------------- /FPPicker/Shared/FPLibrary.h: -------------------------------------------------------------------------------- 1 | // 2 | // FPLibrary.h 3 | // FPPicker 4 | // 5 | // Created by Liyan David Chang on 6/20/12. 6 | // Copyright (c) 2012 Filepicker.io. All rights reserved. 7 | // 8 | 9 | #import "FPTypedefs.h" 10 | 11 | @class FPSource; 12 | 13 | @interface FPLibrary : NSObject 14 | 15 | + (void)requestObjectMediaInfo:(NSDictionary *)obj 16 | withSource:(FPSource *)source 17 | usingOperationQueue:(NSOperationQueue *)operationQueue 18 | success:(FPFetchObjectSuccessBlock)success 19 | failure:(FPFetchObjectFailureBlock)failure 20 | progress:(FPFetchObjectProgressBlock)progress; 21 | 22 | + (void) uploadData:(NSData *)filedata 23 | named:(NSString *)filename 24 | toPath:(NSString *)path 25 | ofMimetype:(NSString *)mimetype 26 | usingOperationQueue:(NSOperationQueue *)operationQueue 27 | success:(FPUploadAssetSuccessBlock)success 28 | failure:(FPUploadAssetFailureBlock)failure 29 | progress:(FPUploadAssetProgressBlock)progress; 30 | 31 | + (void) uploadDataURL:(NSURL *)localURL 32 | named:(NSString *)filename 33 | toPath:(NSString *)path 34 | ofMimetype:(NSString *)mimetype 35 | usingOperationQueue:(NSOperationQueue *)operationQueue 36 | success:(FPUploadAssetSuccessBlock)success 37 | failure:(FPUploadAssetFailureBlock)failure 38 | progress:(FPUploadAssetProgressBlock)progress; 39 | 40 | + (NSURLRequest *)requestForLoadPath:(NSString *)loadpath 41 | withFormat:(NSString *)type 42 | queryString:(NSString *)queryString 43 | andMimetypes:(NSArray *)mimetypes 44 | cachePolicy:(NSURLRequestCachePolicy)policy; 45 | 46 | #ifdef FPLibrary_protected 47 | 48 | + (void)uploadLocalURLToFilepicker:(NSURL *)localURL 49 | named:(NSString *)filename 50 | ofMimetype:(NSString *)mimetype 51 | usingOperationQueue:(NSOperationQueue *)operationQueue 52 | success:(FPUploadAssetSuccessBlock)success 53 | failure:(FPUploadAssetFailureBlock)failure 54 | progress:(FPUploadAssetProgressBlock)progress; 55 | 56 | #endif 57 | 58 | @end 59 | -------------------------------------------------------------------------------- /FPPicker/Shared/FPMacros.h: -------------------------------------------------------------------------------- 1 | // 2 | // FPMacros.h 3 | // FPPicker 4 | // 5 | // Created by Ruben Nine on 12/06/14. 6 | // Copyright (c) 2014 Filepicker.io. All rights reserved. 7 | // 8 | 9 | #import "FPConfig.h" 10 | 11 | #define FPCLAMP(x, minimum, maximum) \ 12 | MIN((maximum), MAX((minimum), (x))) 13 | 14 | #define FPLog(level, fmt, ...) \ 15 | [FPConfig logMessage:[NSString stringWithFormat:(@"[FPPicker Framework] %s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ## __VA_ARGS__] logLevel:level]; 16 | 17 | #define FPLogError(fmt, ...) FPLog(FPErrorLogLevel, fmt, ## __VA_ARGS__) 18 | #define FPLogInfo(fmt, ...) FPLog(FPInfoLogLevel, fmt, ## __VA_ARGS__) 19 | 20 | -------------------------------------------------------------------------------- /FPPicker/Shared/FPMediaInfo.h: -------------------------------------------------------------------------------- 1 | // 2 | // FPMediaInfo.h 3 | // FPPicker 4 | // 5 | // Created by Ruben Nine on 14/08/14. 6 | // Copyright (c) 2014 Filepicker.io. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class PHAsset; 12 | @class FPSource; 13 | 14 | @interface FPMediaInfo : NSObject 15 | 16 | @property (nonatomic, strong) NSString *mediaType; 17 | @property (nonatomic, strong) NSURL *mediaURL; 18 | @property (nonatomic, strong) NSURL *remoteURL; 19 | @property (nonatomic, strong) NSString *filename; 20 | @property (nonatomic, strong) NSNumber *filesize; 21 | @property (nonatomic, strong) NSString *key; 22 | @property (nonatomic, strong) FPSource *source; 23 | @property (nonatomic, strong) PHAsset *originalAsset; 24 | @property (nonatomic, strong) id thumbnailImage; 25 | 26 | - (BOOL)containsImageAtMediaURL; 27 | - (BOOL)containsMovieAtMediaURL; 28 | - (NSString *)MIMEtype; 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /FPPicker/Shared/FPMediaInfo.m: -------------------------------------------------------------------------------- 1 | // 2 | // FPMediaInfo.m 3 | // FPPicker 4 | // 5 | // Created by Ruben Nine on 14/08/14. 6 | // Copyright (c) 2014 Filepicker.io. All rights reserved. 7 | // 8 | 9 | #import "FPMediaInfo.h" 10 | #import "FPUtils.h" 11 | #import "FPSource.h" 12 | 13 | @implementation FPMediaInfo 14 | 15 | - (NSString *)MIMEtype 16 | { 17 | return [FPUtils mimetypeForUTI:self.mediaType]; 18 | } 19 | 20 | - (BOOL)containsImageAtMediaURL 21 | { 22 | if (self.mediaURL && 23 | self.mediaType && 24 | [FPUtils UTI:self.mediaType conformsToUTI:@"public.image"]) 25 | { 26 | return YES; 27 | } 28 | 29 | return NO; 30 | } 31 | 32 | - (BOOL)containsMovieAtMediaURL 33 | { 34 | if (self.mediaURL && 35 | self.mediaType && 36 | [FPUtils UTI:self.mediaType conformsToUTI:@"public.movie"]) 37 | { 38 | return YES; 39 | } 40 | 41 | return NO; 42 | } 43 | 44 | - (NSString *)description 45 | { 46 | return [NSString stringWithFormat:@"%@ {\n\tmediaType = %@\n\tmediaURL = %@\n\tremoteURL = %@\n\tfilename = %@\n\tfilesize = %@\n\tkey = %@\n\tsource = %@\n\toriginalAsset = %@\n\tthumbnailImage = %@\n\tcontainsImageAtMediaURL = %@\n\tcontainsMovieAtMediaURL = %@\n}", 47 | super.description, 48 | self.mediaType, 49 | self.mediaURL, 50 | self.remoteURL, 51 | self.filename, 52 | self.filesize, 53 | self.key, 54 | self.source.identifier, 55 | self.originalAsset, 56 | self.thumbnailImage, 57 | self.containsImageAtMediaURL ? @"YES" : @"NO", 58 | self.containsMovieAtMediaURL ? @"YES" : @"NO"]; 59 | } 60 | 61 | @end 62 | -------------------------------------------------------------------------------- /FPPicker/Shared/FPMultipartUploader.h: -------------------------------------------------------------------------------- 1 | // 2 | // FPMultipartUpload.h 3 | // FPPicker 4 | // 5 | // Created by Ruben Nine on 25/06/14. 6 | // Copyright (c) 2014 Filepicker.io. All rights reserved. 7 | // 8 | 9 | #import "FPUploader.h" 10 | 11 | @interface FPMultipartUploader : FPUploader 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /FPPicker/Shared/FPPrivateConfig.h: -------------------------------------------------------------------------------- 1 | // 2 | // FPPrivateConfig.h 3 | // FPPicker 4 | // 5 | // Created by Ruben Nine on 25/07/14. 6 | // Copyright (c) 2014 Filepicker.io. All rights reserved. 7 | // 8 | 9 | #import "FPConfig.h" 10 | 11 | #ifdef DEBUG 12 | #define fpBASE_URL @"https://dialog.filepicker.io" 13 | #else 14 | //Make sure release builds are always on prod. 15 | #define fpBASE_URL @"https://dialog.filepicker.io" 16 | #endif 17 | 18 | #define fpCOOKIES [[FPConfig sharedInstance] cookies] 19 | #define fpAPIKEY [[FPConfig sharedInstance] APIKey] 20 | #define fpAPPSECRETKEY [[FPConfig sharedInstance] appSecretKey] 21 | 22 | #define fpWindowSize CGSizeMake(320, 480) 23 | #define fpCellIdentifier @"Filepicker_Cell" 24 | 25 | #define fpLocalThumbSize 75 26 | #define fpRemoteThumbSize 95 27 | 28 | #define fpMaxChunkSize 262144 //.25mb 29 | #define fpNumRetries 10 30 | 31 | #define fpMaxLocalChunkCopySize 2097152 //2.0mb 32 | 33 | @interface FPConfig (PrivateMethods) 34 | 35 | /*! 36 | Returns all the cookies associated to baseURL. 37 | */ 38 | - (NSArray *)cookies; 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /FPPicker/Shared/FPProgressTracker.h: -------------------------------------------------------------------------------- 1 | // 2 | // FPProgressTracker.h 3 | // FPPicker 4 | // 5 | // Created by Brett van Zuiden on 12/9/13. 6 | // Copyright (c) 2013 Filepicker.io. All rights reserved. 7 | // 8 | 9 | @import Foundation; 10 | 11 | @interface FPProgressTracker : NSObject 12 | 13 | - (id)initWithObjectCount:(NSInteger)objectCount; 14 | 15 | /** 16 | Updates the progress map for the given key and returns the current total progress 17 | 18 | @returns A float with the current total progress 19 | */ 20 | - (float)setProgress:(float)progress forKey:(id)key; 21 | 22 | - (float)calculateProgress; 23 | 24 | @end 25 | -------------------------------------------------------------------------------- /FPPicker/Shared/FPProgressTracker.m: -------------------------------------------------------------------------------- 1 | // 2 | // FPProgressTracker.m 3 | // FPPicker 4 | // 5 | // Created by Brett van Zuiden on 12/9/13. 6 | // Copyright (c) 2013 Filepicker.io. All rights reserved. 7 | // 8 | 9 | #import "FPProgressTracker.h" 10 | 11 | @interface FPProgressTracker () 12 | 13 | @property (nonatomic, strong) NSMutableDictionary *progressMap; 14 | @property (atomic) NSInteger count; 15 | 16 | @end 17 | 18 | @implementation FPProgressTracker 19 | 20 | - (id)initWithObjectCount:(NSInteger)objectCount 21 | { 22 | self = [self init]; 23 | 24 | if (self) 25 | { 26 | self.progressMap = [NSMutableDictionary dictionary]; 27 | self.count = objectCount; 28 | } 29 | 30 | return self; 31 | } 32 | 33 | - (float)setProgress:(float)progress forKey:(id)key 34 | { 35 | float clampedProgress = FPCLAMP(progress, 0.0f, 1.0f); 36 | 37 | if(key == nil){ 38 | FPLogError(@"Invalid progress key"); 39 | return 0; 40 | } 41 | 42 | if (progress != clampedProgress) 43 | { 44 | FPLogError(@"Invalid progress: %f, bounding", progress); 45 | } 46 | 47 | self.progressMap[key] = @(clampedProgress); 48 | 49 | return [self calculateProgress]; 50 | } 51 | 52 | - (float)calculateProgress 53 | { 54 | float totalProgress = 0; 55 | 56 | for (id key in self.progressMap) 57 | { 58 | NSNumber *val = self.progressMap[key]; 59 | 60 | if (val) 61 | { 62 | totalProgress += val.floatValue; 63 | } 64 | } 65 | 66 | return FPCLAMP(totalProgress / self.count, 0.0f, 1.0f); 67 | } 68 | 69 | @end 70 | -------------------------------------------------------------------------------- /FPPicker/Shared/FPSession+ConvenienceMethods.h: -------------------------------------------------------------------------------- 1 | // 2 | // FPSession+ConvenienceMethods.h 3 | // FPPicker 4 | // 5 | // Created by Ruben Nine on 15/07/14. 6 | // Copyright (c) 2014 Filepicker.io. All rights reserved. 7 | // 8 | 9 | #import "FPSession.h" 10 | 11 | @interface FPSession (ConvenienceMethods) 12 | 13 | /** 14 | Returns a session object suited for file uploads 15 | with API key and security options already initialized. 16 | */ 17 | + (instancetype)sessionForFileUploads; 18 | 19 | /** 20 | Populates the FPSession object security properties with values 21 | obtained from FPConfig. 22 | */ 23 | - (void)populateSecurityPropertiesFromConfig; 24 | 25 | /** 26 | Populates the FPSession object store properties with values 27 | obtained from FPConfig. 28 | */ 29 | - (void)populateStorePropertiesFromConfig; 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /FPPicker/Shared/FPSession+ConvenienceMethods.m: -------------------------------------------------------------------------------- 1 | // 2 | // FPSession+ConvenienceMethods.m 3 | // FPPicker 4 | // 5 | // Created by Ruben Nine on 15/07/14. 6 | // Copyright (c) 2014 Filepicker.io. All rights reserved. 7 | // 8 | 9 | #import "FPSession+ConvenienceMethods.h" 10 | #import "FPUtils.h" 11 | #import "FPPrivateConfig.h" 12 | 13 | @implementation FPSession (ConvenienceMethods) 14 | 15 | + (instancetype)sessionForFileUploads 16 | { 17 | FPSession *fpSession = [FPSession new]; 18 | 19 | fpSession.APIKey = fpAPIKEY; 20 | 21 | [fpSession populateSecurityPropertiesFromConfig]; 22 | [fpSession populateStorePropertiesFromConfig]; 23 | 24 | return fpSession; 25 | } 26 | 27 | - (void)populateSecurityPropertiesFromConfig 28 | { 29 | if (fpAPPSECRETKEY) 30 | { 31 | NSString *securityPolicy = [FPUtils policyForHandle:nil 32 | expiryInterval:3600.0 33 | andCallOptions:nil]; 34 | 35 | NSString *securitySignature = [FPUtils signPolicy:securityPolicy 36 | usingKey:fpAPPSECRETKEY]; 37 | 38 | self.securityPolicy = securityPolicy; 39 | self.securitySignature = securitySignature; 40 | } 41 | } 42 | 43 | - (void)populateStorePropertiesFromConfig 44 | { 45 | self.storeAccess = [FPConfig sharedInstance].storeAccess; 46 | self.storeContainer = [FPConfig sharedInstance].storeContainer; 47 | self.storeLocation = [FPConfig sharedInstance].storeLocation; 48 | self.storePath = [FPConfig sharedInstance].storePath; 49 | } 50 | 51 | @end 52 | -------------------------------------------------------------------------------- /FPPicker/Shared/FPSession.h: -------------------------------------------------------------------------------- 1 | // 2 | // FPSession.h 3 | // FPPicker 4 | // 5 | // Created by Ruben Nine on 14/07/14. 6 | // Copyright (c) 2014 Filepicker.io. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface FPSession : NSObject 12 | 13 | /** 14 | Returns a JSON representation of the session as a NSString 15 | @return A NSString 16 | */ 17 | - (NSString *)JSONSessionString; 18 | 19 | /** 20 | Filepicker.io API key. 21 | */ 22 | @property (nonatomic, strong) NSString *APIKey; 23 | 24 | /** 25 | Supported mimetype or array of mimetypes. 26 | */ 27 | @property (nonatomic, strong) id mimetypes; 28 | 29 | /** 30 | Indicates that the file should be stored in a way that allows public access 31 | going directly to the underlying file store. 32 | 33 | Defaults to 'private'. 34 | */ 35 | @property (nonatomic, strong) NSString *storeAccess; 36 | 37 | /** 38 | Where to store the file. 39 | 40 | Defaults to 'S3'. 41 | 42 | Other options are 'azure', 'dropbox' and 'rackspace'. 43 | */ 44 | @property (nonatomic, strong) NSString *storeLocation; 45 | 46 | /** 47 | The path to store the file at within the specified file store. 48 | For S3, this is the key where the file will be stored at. 49 | For S3, please remember adding a trailing slash (i.e. my-custom-path/) 50 | */ 51 | @property (nonatomic, strong) NSString *storePath; 52 | 53 | /** 54 | The bucket or container in the specified file store where the file should end up. 55 | */ 56 | @property (nonatomic, strong) NSString *storeContainer; 57 | 58 | /** 59 | Filepicker.io security policy. 60 | @note Required when security is enabled. 61 | */ 62 | @property (nonatomic, strong) NSString *securityPolicy; 63 | 64 | /** 65 | Filepicker.io security signature. 66 | @note Required when security is enabled. 67 | */ 68 | @property (nonatomic, strong) NSString *securitySignature; 69 | 70 | @end 71 | -------------------------------------------------------------------------------- /FPPicker/Shared/FPSession.m: -------------------------------------------------------------------------------- 1 | // 2 | // FPSession.m 3 | // FPPicker 4 | // 5 | // Created by Ruben Nine on 14/07/14. 6 | // Copyright (c) 2014 Filepicker.io. All rights reserved. 7 | // 8 | 9 | #import "FPSession.h" 10 | #import "FPUtils.h" 11 | 12 | @implementation FPSession 13 | 14 | - (NSString *)JSONSessionString 15 | { 16 | NSError *error; 17 | 18 | NSMutableDictionary *sessionObject = [@{@"app":[@{} mutableCopy]} mutableCopy]; 19 | 20 | if (self.APIKey) 21 | { 22 | sessionObject[@"app"][@"apikey"] = self.APIKey; 23 | } 24 | 25 | if (self.mimetypes) 26 | { 27 | sessionObject[@"mimetypes"] = self.mimetypes; 28 | } 29 | 30 | if (self.storeAccess) 31 | { 32 | sessionObject[@"storeAccess"] = self.storeAccess; 33 | } 34 | 35 | if (self.storeLocation) 36 | { 37 | sessionObject[@"storeLocation"] = self.storeLocation; 38 | } 39 | 40 | if (self.storePath) 41 | { 42 | sessionObject[@"storePath"] = self.storePath; 43 | } 44 | 45 | if (self.storeContainer) 46 | { 47 | sessionObject[@"storeContainer"] = self.storeContainer; 48 | } 49 | 50 | if (self.securityPolicy) 51 | { 52 | sessionObject[@"policy"] = self.securityPolicy; 53 | } 54 | 55 | if (self.securitySignature) 56 | { 57 | sessionObject[@"signature"] = self.securitySignature; 58 | } 59 | 60 | // Add "version" key-value required by FileStack API to upload files from external storage 61 | // to provided storeLocation, storePath and storeContainer. 62 | sessionObject[@"version"] = @"v1"; 63 | 64 | return [FPUtils JSONEncodeObject:sessionObject 65 | error:&error]; 66 | } 67 | 68 | @end 69 | -------------------------------------------------------------------------------- /FPPicker/Shared/FPSharedInternalHeaders.h: -------------------------------------------------------------------------------- 1 | // 2 | // FPSharedInternalHeaders.h 3 | // FPPicker 4 | // 5 | // Created by Ruben Nine on 14/08/14. 6 | // Copyright (c) 2014 Filepicker.io. All rights reserved. 7 | // 8 | 9 | #import "FPAPIClient.h" 10 | #import "FPConstants.h" 11 | #import "FPMediaInfo.h" 12 | #import "FPPrivateConfig.h" 13 | #import "FPProgressTracker.h" 14 | #import "FPSession+ConvenienceMethods.h" 15 | #import "FPSource.h" 16 | #import "FPTypedefs.h" 17 | -------------------------------------------------------------------------------- /FPPicker/Shared/FPSinglepartUploader.h: -------------------------------------------------------------------------------- 1 | // 2 | // FPSinglepartUploader.h 3 | // FPPicker 4 | // 5 | // Created by Ruben Nine on 16/07/14. 6 | // Copyright (c) 2014 Filepicker.io. All rights reserved. 7 | // 8 | 9 | #import "FPUploader.h" 10 | 11 | @interface FPSinglepartUploader : FPUploader 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /FPPicker/Shared/FPSinglepartUploader.m: -------------------------------------------------------------------------------- 1 | // 2 | // FPSinglepartUploader.m 3 | // FPPicker 4 | // 5 | // Created by Ruben Nine on 16/07/14. 6 | // Copyright (c) 2014 Filepicker.io. All rights reserved. 7 | // 8 | 9 | #define FPUploader_protected 10 | 11 | #import "FPSinglepartUploader.h" 12 | #import "FPSession+ConvenienceMethods.h" 13 | 14 | @implementation FPSinglepartUploader 15 | 16 | - (void)doUpload 17 | { 18 | AFConstructingBodyBlock constructingBodyBlock = ^(id formData) { 19 | NSData *filedata = [NSData dataWithContentsOfURL:self.localURL]; 20 | 21 | [formData appendPartWithFileData:filedata 22 | name:@"fileUpload" 23 | fileName:self.filename 24 | mimeType:self.mimetype]; 25 | }; 26 | 27 | AFRequestOperationSuccessBlock successOperationBlock = ^(AFHTTPRequestOperation *operation, 28 | id responseObject) { 29 | if ([@"ok" isEqualToString:responseObject[@"result"]]) 30 | { 31 | self.successBlock(responseObject); 32 | self.hasFinished = YES; 33 | } 34 | else 35 | { 36 | self.failureBlock([[NSError alloc] initWithDomain:@"FPPicker" 37 | code:0 38 | userInfo:nil], responseObject); 39 | } 40 | }; 41 | 42 | AFRequestOperationFailureBlock failureOperationBlock = ^(AFHTTPRequestOperation *operation, 43 | NSError *error) { 44 | self.failureBlock(error, nil); 45 | }; 46 | 47 | NSDictionary *params = @{ 48 | @"js_session":self.js_sessionString 49 | }; 50 | 51 | AFHTTPRequestOperation *operation = [[FPAPIClient sharedClient] POST:@"/api/upload/" 52 | parameters:params 53 | constructingBodyWithBlock:constructingBodyBlock 54 | usingOperationQueue:self.operationQueue 55 | success:successOperationBlock 56 | failure:failureOperationBlock]; 57 | 58 | [operation setUploadProgressBlock: ^(NSUInteger bytesWritten, 59 | long long totalBytesWritten, 60 | long long totalBytesExpectedToWrite) { 61 | if (self.progressBlock && 62 | totalBytesExpectedToWrite > 0) 63 | { 64 | self.progressBlock(1.0f * totalBytesWritten / totalBytesExpectedToWrite); 65 | } 66 | }]; 67 | } 68 | 69 | @end 70 | -------------------------------------------------------------------------------- /FPPicker/Shared/FPSource+SupportedSources.h: -------------------------------------------------------------------------------- 1 | // 2 | // FPSource+SupportedSources.h 3 | // FPPicker 4 | // 5 | // Created by Ruben Nine on 20/08/14. 6 | // Copyright (c) 2014 Filepicker.io. All rights reserved. 7 | // 8 | 9 | #import "FPSource.h" 10 | 11 | @interface FPSource (SupportedSources) 12 | 13 | + (NSArray *)allSources; 14 | + (NSArray *)allMobileSources; 15 | + (NSArray *)allDesktopSources; 16 | 17 | + (NSArray *)localMobileSources; 18 | + (NSArray *)localDesktopSources; 19 | + (NSArray *)remoteSources; 20 | 21 | - (instancetype)initWithSourceIdentifier:(NSString *)identifier; 22 | + (FPSource *)sourceWithIdentifier:(NSString *)identifier; 23 | 24 | @end 25 | -------------------------------------------------------------------------------- /FPPicker/Shared/FPSource.h: -------------------------------------------------------------------------------- 1 | // 2 | // FPSource.h 3 | // FPPicker 4 | // 5 | // Created by Liyan David Chang on 7/7/12. 6 | // Copyright (c) 2012 Filepicker.io. All rights reserved. 7 | // 8 | 9 | @import Foundation; 10 | 11 | @interface FPSource : NSObject 12 | 13 | @property (nonatomic, strong) NSString *name; 14 | @property (nonatomic, strong) NSString *identifier; 15 | @property (nonatomic, strong) NSString *icon; 16 | @property (nonatomic, strong) NSString *rootPath; 17 | @property (nonatomic, strong) NSArray *openMimetypes; 18 | @property (nonatomic, strong) NSArray *saveMimetypes; 19 | @property (nonatomic, strong) NSArray *mimetypes; 20 | @property (nonatomic, strong) NSArray *externalDomains; 21 | @property (nonatomic, assign) BOOL overwritePossible; 22 | @property (nonatomic, assign) BOOL requiresAuth; 23 | 24 | - (NSString *)fullSourcePathForRelativePath:(NSString *)relativePath; 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /FPPicker/Shared/FPSource.m: -------------------------------------------------------------------------------- 1 | // 2 | // FPSource.m 3 | // FPPicker 4 | // 5 | // Created by Liyan David Chang on 7/7/12. 6 | // Copyright (c) 2012 Filepicker.io. All rights reserved. 7 | // 8 | 9 | #import "FPSource.h" 10 | #import "FPUtils.h" 11 | 12 | @implementation FPSource 13 | 14 | - (NSString *)fullSourcePathForRelativePath:(NSString *)relativePath 15 | { 16 | NSString *tmpPath = [relativePath copy]; 17 | 18 | if ([tmpPath characterAtIndex:0] == 47) // remove trailing slash, if present 19 | { 20 | tmpPath = [tmpPath substringFromIndex:1]; 21 | } 22 | 23 | if (tmpPath.length > 0 && 24 | [tmpPath characterAtIndex:tmpPath.length - 1] == 47) // remove leading slash, if present 25 | { 26 | tmpPath = [tmpPath substringToIndex:tmpPath.length - 1]; 27 | } 28 | 29 | NSString *sanitizedRelativePath = [FPUtils urlEncodeString:tmpPath]; 30 | NSString *fullPath = [NSString stringWithFormat:@"%@/%@/", self.rootPath, sanitizedRelativePath]; 31 | 32 | return fullPath; 33 | } 34 | 35 | - (NSString *)description 36 | { 37 | return [NSString stringWithFormat:@"%@ {\n\tname = %@\n\tidentifier = %@\n\ticon = %@\n\trootUrl = %@\n\topen_mimetypes = %@\n\tsave_mimetypes = %@\n\tmimetypes = %@\n\texternalDomains = %@\n\toverwritePossible = %@\n\trequiresAuth = %@\n}", 38 | super.description, 39 | self.name, 40 | self.identifier, 41 | self.icon, 42 | self.rootPath, 43 | self.openMimetypes, 44 | self.saveMimetypes, 45 | self.mimetypes, 46 | self.externalDomains, 47 | self.overwritePossible ? @"YES" : @"NO", 48 | self.requiresAuth ? @"YES" : @"NO"]; 49 | } 50 | 51 | #pragma mark - NSObject Comparison Methods 52 | 53 | - (NSUInteger)hash 54 | { 55 | return self.identifier.hash; 56 | } 57 | 58 | - (BOOL)isEqual:(id)object 59 | { 60 | return [self hash] == [object hash]; 61 | } 62 | 63 | @end 64 | -------------------------------------------------------------------------------- /FPPicker/Shared/FPTypedefs.h: -------------------------------------------------------------------------------- 1 | // 2 | // FPTypedefs.h 3 | // FPPicker 4 | // 5 | // Created by Ruben Nine on 14/08/14. 6 | // Copyright (c) 2014 Filepicker.io. All rights reserved. 7 | // 8 | 9 | @class AFHTTPRequestOperation; 10 | @protocol AFMultipartFormData; 11 | 12 | @class FPMediaInfo; 13 | 14 | typedef void (^FPUploadAssetSuccessBlock)(id JSON); 15 | 16 | typedef void (^FPUploadAssetFailureBlock)(NSError *error, 17 | id JSON); 18 | 19 | typedef void (^FPUploadAssetProgressBlock)(float progress); 20 | 21 | typedef void (^FPUploadAssetSuccessWithLocalURLBlock)(id JSON, 22 | NSURL *localURL); 23 | 24 | typedef void (^FPUploadAssetFailureWithLocalURLBlock)(NSError *error, 25 | id JSON, 26 | NSURL *localURL); 27 | 28 | typedef void (^FPFetchObjectSuccessBlock)(FPMediaInfo *mediaInfo); 29 | 30 | typedef void (^FPFetchObjectFailureBlock)(NSError *error); 31 | 32 | typedef void (^FPFetchObjectProgressBlock)(float progress); 33 | 34 | 35 | // AFNetworking block typedefs. 36 | 37 | typedef void (^AFRequestOperationSuccessBlock)(AFHTTPRequestOperation *operation, 38 | id responseObject); 39 | 40 | typedef void (^AFRequestOperationFailureBlock)(AFHTTPRequestOperation *operation, 41 | NSError *error); 42 | 43 | typedef void (^AFConstructingBodyBlock)(id formData); 44 | -------------------------------------------------------------------------------- /FPPicker/Shared/FPUploader.h: -------------------------------------------------------------------------------- 1 | // 2 | // FPUploader.h 3 | // FPPicker 4 | // 5 | // Created by Ruben Nine on 16/07/14. 6 | // Copyright (c) 2014 Filepicker.io. All rights reserved. 7 | // 8 | 9 | #import "FPInternalHeaders.h" 10 | 11 | @interface FPUploader : NSObject 12 | 13 | /** 14 | Please use the designated initializer instead. 15 | */ 16 | - (id)init __unavailable; 17 | 18 | /** 19 | Designated initializer. 20 | 21 | Expects a local URL representing the file to upload, a filename and a mimetype. 22 | */ 23 | - (instancetype)initWithLocalURL:(NSURL *)localURL 24 | filename:(NSString *)filename 25 | mimetype:(NSString *)mimetype 26 | andOperationQueue:(NSOperationQueue *)operationQueue NS_DESIGNATED_INITIALIZER; 27 | 28 | /** 29 | Initiates the file upload. 30 | 31 | @note Once the upload has completed, calling this method again will result in a no-op. 32 | */ 33 | - (void)upload; 34 | 35 | /** 36 | Block to call after an upload succeeds without errors. 37 | 38 | This block returns a JSON response object. 39 | 40 | @note If no block is provided, a default implementation is used 41 | which simply logs the JSON response to the console. 42 | */ 43 | @property (nonatomic, copy) FPUploadAssetSuccessBlock successBlock; 44 | 45 | /** 46 | Block to call after an upload fails. 47 | 48 | This block returns an NSError and a JSON response object (when available) 49 | 50 | @note If no block is provided, a default implementation is used 51 | failing with an assert displaying the NSError description on the console. 52 | */ 53 | @property (nonatomic, copy) FPUploadAssetFailureBlock failureBlock; 54 | 55 | /** 56 | Block to call everytime the upload progress is updated. 57 | 58 | This block returns a float with the progress (range: 0.0 to 1.0) 59 | 60 | @note Optional. 61 | */ 62 | @property (nonatomic, copy) FPUploadAssetProgressBlock progressBlock; 63 | 64 | /** 65 | The operation queue to use to perform uploads. 66 | 67 | @note Optional. 68 | */ 69 | @property (nonatomic, strong, readonly) NSOperationQueue *operationQueue; 70 | 71 | #ifdef FPUploader_protected 72 | 73 | - (void)setup; 74 | - (void)doUpload; 75 | 76 | @property (nonatomic, assign) BOOL hasFinished; 77 | @property (nonatomic, strong) NSURL *localURL; 78 | @property (nonatomic, strong) NSString *filename; 79 | @property (nonatomic, strong) NSString *mimetype; 80 | @property (nonatomic, strong) NSString *js_sessionString; 81 | 82 | #endif 83 | 84 | @end 85 | -------------------------------------------------------------------------------- /FPPicker/Shared/FPUploader.m: -------------------------------------------------------------------------------- 1 | // 2 | // FPUploader.m 3 | // FPPicker 4 | // 5 | // Created by Ruben Nine on 16/07/14. 6 | // Copyright (c) 2014 Filepicker.io. All rights reserved. 7 | // 8 | 9 | #define FPUploader_protected 10 | 11 | #import "FPUploader.h" 12 | #import "FPSession+ConvenienceMethods.h" 13 | 14 | @interface FPUploader () 15 | 16 | @property (readwrite) NSOperationQueue *operationQueue; 17 | 18 | @end 19 | 20 | @implementation FPUploader 21 | 22 | - (instancetype)initWithLocalURL:(NSURL *)localURL 23 | filename:(NSString *)filename 24 | mimetype:(NSString *)mimetype 25 | andOperationQueue:(NSOperationQueue *)operationQueue 26 | { 27 | self = [super init]; 28 | 29 | if (self) 30 | { 31 | NSAssert(localURL, @"LocalURL must be provided"); 32 | NSAssert(mimetype, @"Mimetype must be provided"); 33 | 34 | self.operationQueue = operationQueue; 35 | self.localURL = localURL; 36 | self.filename = filename; 37 | self.mimetype = mimetype; 38 | 39 | if (!self.filename) 40 | { 41 | self.filename = @"filename"; 42 | } 43 | 44 | [self setup]; 45 | } 46 | 47 | return self; 48 | } 49 | 50 | - (void)upload 51 | { 52 | if (!self.hasFinished) 53 | { 54 | [self doUpload]; 55 | } 56 | else 57 | { 58 | FPLogError(@"%@ already finished uploading.", self.filename); 59 | } 60 | } 61 | 62 | #pragma mark - Protected 63 | 64 | - (void)setup 65 | { 66 | FPSession *fpSession = [FPSession sessionForFileUploads]; 67 | 68 | self.js_sessionString = [fpSession JSONSessionString]; 69 | self.hasFinished = NO; 70 | } 71 | 72 | - (void)doUpload 73 | { 74 | NSAssert(NO, @"This method must be implemented by subclasses."); 75 | } 76 | 77 | #pragma mark - Accessors 78 | 79 | - (FPUploadAssetSuccessBlock)successBlock 80 | { 81 | if (!_successBlock) 82 | { 83 | _successBlock = ^(id JSON) { 84 | FPLogInfo(@"Upload succeeded with response: %@", JSON); 85 | }; 86 | } 87 | 88 | return _successBlock; 89 | } 90 | 91 | - (FPUploadAssetFailureBlock)failureBlock 92 | { 93 | if (!_failureBlock) 94 | { 95 | _failureBlock = ^(NSError *error, id JSON) { 96 | FPLogError(@"FAILURE %@ %@", error, JSON); 97 | 98 | assert(false); 99 | }; 100 | } 101 | 102 | return _failureBlock; 103 | } 104 | 105 | @end 106 | -------------------------------------------------------------------------------- /FPPicker/Shared/FPUtils+ResourceHelpers.h: -------------------------------------------------------------------------------- 1 | // 2 | // FPUtils+ResourceHelpers.h 3 | // FPPicker 4 | // 5 | // Created by Ruben Nine on 18/08/14. 6 | // Copyright (c) 2014 Filepicker.io. All rights reserved. 7 | // 8 | 9 | #import "FPUtils.h" 10 | 11 | @interface FPUtils (ResourceHelpers) 12 | 13 | + (NSArray *)allowedURLPrefixList; 14 | + (NSArray *)disallowedURLPrefixList; 15 | + (NSDictionary *)settings; 16 | + (NSString *)xuiJSString; 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /FPPicker/Shared/FPUtils+ResourceHelpers.m: -------------------------------------------------------------------------------- 1 | // 2 | // FPUtils+ResourceHelpers.m 3 | // FPPicker 4 | // 5 | // Created by Ruben Nine on 18/08/14. 6 | // Copyright (c) 2014 Filepicker.io. All rights reserved. 7 | // 8 | 9 | #import "FPUtils+ResourceHelpers.h" 10 | 11 | @implementation FPUtils (ResourceHelpers) 12 | 13 | + (NSArray *)allowedURLPrefixList 14 | { 15 | NSURL *path = [[FPUtils frameworkBundle] URLForResource:@"allowedUrlPrefix" 16 | withExtension:@"plist"]; 17 | 18 | return [NSArray arrayWithContentsOfURL:path]; 19 | } 20 | 21 | + (NSArray *)disallowedURLPrefixList 22 | { 23 | NSURL *path = [[FPUtils frameworkBundle] URLForResource:@"disallowedUrlPrefix" 24 | withExtension:@"plist"]; 25 | 26 | return [NSArray arrayWithContentsOfURL:path]; 27 | } 28 | 29 | + (NSDictionary *)settings 30 | { 31 | NSURL *FPSettingsFilePath = [[FPUtils frameworkBundle] URLForResource:@"FilepickerSettings" 32 | withExtension:@"plist"]; 33 | 34 | return [NSDictionary dictionaryWithContentsOfURL:FPSettingsFilePath]; 35 | } 36 | 37 | + (NSString *)xuiJSString 38 | { 39 | NSURL *xuiURL = [[FPUtils frameworkBundle] URLForResource:@"xui-2.3.2.min" 40 | withExtension:@"js"]; 41 | 42 | NSError *error; 43 | 44 | NSString *xui = [NSString stringWithContentsOfURL:xuiURL 45 | encoding:NSUTF8StringEncoding 46 | error:&error]; 47 | 48 | if (error) 49 | { 50 | FPLogError(@"Error loading XUI javascript contents: %@", error); 51 | 52 | return nil; 53 | } 54 | 55 | return xui; 56 | } 57 | 58 | @end 59 | -------------------------------------------------------------------------------- /FPPicker/Shared/NSData+FPHexString.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSData+FPHexString.h 3 | // FPPicker 4 | // 5 | // Created by Ruben Nine on 14/07/14. 6 | // Copyright (c) 2014 Filepicker.io. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface NSData (FPHexString) 12 | 13 | - (NSString *)FPHexString; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /FPPicker/Shared/NSData+FPHexString.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSData+FPHexString.m 3 | // FPPicker 4 | // 5 | // Created by Ruben Nine on 14/07/14. 6 | // Copyright (c) 2014 Filepicker.io. All rights reserved. 7 | // 8 | 9 | #import "NSData+FPHexString.h" 10 | 11 | @implementation NSData (FPHexString) 12 | 13 | - (NSString *)FPHexString 14 | { 15 | NSMutableString *string = [NSMutableString stringWithCapacity:self.length * 2]; 16 | const unsigned char *dataBytes = self.bytes; 17 | 18 | for (size_t idx = 0; idx < self.length; ++idx) 19 | { 20 | [string appendFormat:@"%02x", dataBytes[idx]]; 21 | } 22 | 23 | return [string copy]; 24 | } 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013 Ink (Cloudtop Inc.) 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 4 | 5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 8 | 9 | (MIT License) 10 | -------------------------------------------------------------------------------- /Podfile: -------------------------------------------------------------------------------- 1 | source 'https://github.com/CocoaPods/Specs.git' 2 | workspace 'FPPicker.xcworkspace' 3 | xcodeproj 'FPPicker.xcodeproj' 4 | platform :ios, '7.1' 5 | 6 | # iOS Targets 7 | 8 | target :'FPPicker' do 9 | pod 'MBProgressHUD', '~> 0.9' 10 | pod 'AFNetworking', '~> 2.6.0' 11 | end 12 | 13 | target :'FPPicker Functional Tests' do 14 | pod 'OCMock', '~> 3.0.2' 15 | pod 'OHHTTPStubs', '~> 3.1.2' 16 | end 17 | 18 | 19 | # Mac Targets 20 | 21 | target :'FPPickerMac' do 22 | platform :osx, '10.9' 23 | pod 'AFNetworking', '~> 2.6.0' 24 | pod 'PureLayout', '~> 2.0.6' 25 | end 26 | -------------------------------------------------------------------------------- /Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - AFNetworking (2.6.0): 3 | - AFNetworking/NSURLConnection (= 2.6.0) 4 | - AFNetworking/NSURLSession (= 2.6.0) 5 | - AFNetworking/Reachability (= 2.6.0) 6 | - AFNetworking/Security (= 2.6.0) 7 | - AFNetworking/Serialization (= 2.6.0) 8 | - AFNetworking/UIKit (= 2.6.0) 9 | - AFNetworking/NSURLConnection (2.6.0): 10 | - AFNetworking/Reachability 11 | - AFNetworking/Security 12 | - AFNetworking/Serialization 13 | - AFNetworking/NSURLSession (2.6.0): 14 | - AFNetworking/Reachability 15 | - AFNetworking/Security 16 | - AFNetworking/Serialization 17 | - AFNetworking/Reachability (2.6.0) 18 | - AFNetworking/Security (2.6.0) 19 | - AFNetworking/Serialization (2.6.0) 20 | - AFNetworking/UIKit (2.6.0): 21 | - AFNetworking/NSURLConnection 22 | - AFNetworking/NSURLSession 23 | - MBProgressHUD (0.9.1) 24 | - OCMock (3.0.2) 25 | - OHHTTPStubs (3.1.12): 26 | - OHHTTPStubs/Core (= 3.1.12) 27 | - OHHTTPStubs/Core (3.1.12) 28 | - PureLayout (2.0.6) 29 | 30 | DEPENDENCIES: 31 | - AFNetworking (~> 2.6.0) 32 | - MBProgressHUD (~> 0.9) 33 | - OCMock (~> 3.0.2) 34 | - OHHTTPStubs (~> 3.1.2) 35 | - PureLayout (~> 2.0.6) 36 | 37 | SPEC CHECKSUMS: 38 | AFNetworking: 79f7eb1a0fcfa7beb409332b2ca49afe9ce53b05 39 | MBProgressHUD: c47f2c166c126cf2ce36498d80f33e754d4e93ad 40 | OCMock: 1f0871af0f397183f33e7552cca088bd2b485c25 41 | OHHTTPStubs: 8cf0cfe6f34f13fc88fdf5b2a1b2c2536e8c0261 42 | PureLayout: f25f0bb904d5ccfe6e31da3cb869185259f02e0d 43 | 44 | COCOAPODS: 0.39.0 45 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | This project is DEPRECATED. 2 | 3 | Please use new version that is available here: [https://github.com/filestack/FSPicker](https://github.com/filestack/FSPicker) 4 | -------------------------------------------------------------------------------- /Resources-Mac/FPPicker Mac-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | FMWK 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1 25 | NSHumanReadableCopyright 26 | Copyright © 2014 Filepicker.io. All rights reserved. 27 | NSPrincipalClass 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /Resources-Mac/FPPicker-Mac-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header 3 | // 4 | // The contents of this file are implicitly included at the beginning of every source file. 5 | // 6 | 7 | #ifdef __OBJC__ 8 | #import 9 | #import "FPMacros.h" 10 | #endif 11 | -------------------------------------------------------------------------------- /Resources-Mac/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /Resources-Shared/CloudDrive.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ink/ios-picker/00a17e82e7bb6858d354d89483020156ed0184f9/Resources-Shared/CloudDrive.png -------------------------------------------------------------------------------- /Resources-Shared/CloudDrive@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ink/ios-picker/00a17e82e7bb6858d354d89483020156ed0184f9/Resources-Shared/CloudDrive@2x.png -------------------------------------------------------------------------------- /Resources-Shared/FPPicker_Resources-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | BNDL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1 25 | CFPlugInDynamicRegisterFunction 26 | 27 | CFPlugInDynamicRegistration 28 | NO 29 | CFPlugInFactories 30 | 31 | 00000000-0000-0000-0000-000000000000 32 | MyFactoryFunction 33 | 34 | CFPlugInTypes 35 | 36 | 00000000-0000-0000-0000-000000000000 37 | 38 | 00000000-0000-0000-0000-000000000000 39 | 40 | 41 | CFPlugInUnloadFunction 42 | 43 | NSHumanReadableCopyright 44 | Copyright © 2012 __MyCompanyName__. All rights reserved. 45 | 46 | 47 | -------------------------------------------------------------------------------- /Resources-Shared/FilepickerSettings.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | OnlyResolveAllowedLinks 6 | 7 | HideAllLinks 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Resources-Shared/GoogleDrive.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ink/ios-picker/00a17e82e7bb6858d354d89483020156ed0184f9/Resources-Shared/GoogleDrive.png -------------------------------------------------------------------------------- /Resources-Shared/GoogleDrive@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ink/ios-picker/00a17e82e7bb6858d354d89483020156ed0184f9/Resources-Shared/GoogleDrive@2x.png -------------------------------------------------------------------------------- /Resources-Shared/Instagram.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ink/ios-picker/00a17e82e7bb6858d354d89483020156ed0184f9/Resources-Shared/Instagram.png -------------------------------------------------------------------------------- /Resources-Shared/Instagram@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ink/ios-picker/00a17e82e7bb6858d354d89483020156ed0184f9/Resources-Shared/Instagram@2x.png -------------------------------------------------------------------------------- /Resources-Shared/SelectOverlayiOS7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ink/ios-picker/00a17e82e7bb6858d354d89483020156ed0184f9/Resources-Shared/SelectOverlayiOS7.png -------------------------------------------------------------------------------- /Resources-Shared/SelectOverlayiOS7@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ink/ios-picker/00a17e82e7bb6858d354d89483020156ed0184f9/Resources-Shared/SelectOverlayiOS7@2x.png -------------------------------------------------------------------------------- /Resources-Shared/disallowedUrlPrefix.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Resources-Shared/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /Resources-Shared/glyphicons_008_film.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ink/ios-picker/00a17e82e7bb6858d354d89483020156ed0184f9/Resources-Shared/glyphicons_008_film.png -------------------------------------------------------------------------------- /Resources-Shared/glyphicons_008_film@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ink/ios-picker/00a17e82e7bb6858d354d89483020156ed0184f9/Resources-Shared/glyphicons_008_film@2x.png -------------------------------------------------------------------------------- /Resources-Shared/glyphicons_011_camera.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ink/ios-picker/00a17e82e7bb6858d354d89483020156ed0184f9/Resources-Shared/glyphicons_011_camera.png -------------------------------------------------------------------------------- /Resources-Shared/glyphicons_011_camera@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ink/ios-picker/00a17e82e7bb6858d354d89483020156ed0184f9/Resources-Shared/glyphicons_011_camera@2x.png -------------------------------------------------------------------------------- /Resources-Shared/glyphicons_020_home.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ink/ios-picker/00a17e82e7bb6858d354d89483020156ed0184f9/Resources-Shared/glyphicons_020_home.png -------------------------------------------------------------------------------- /Resources-Shared/glyphicons_020_home@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ink/ios-picker/00a17e82e7bb6858d354d89483020156ed0184f9/Resources-Shared/glyphicons_020_home@2x.png -------------------------------------------------------------------------------- /Resources-Shared/glyphicons_027_search.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ink/ios-picker/00a17e82e7bb6858d354d89483020156ed0184f9/Resources-Shared/glyphicons_027_search.png -------------------------------------------------------------------------------- /Resources-Shared/glyphicons_027_search@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ink/ios-picker/00a17e82e7bb6858d354d89483020156ed0184f9/Resources-Shared/glyphicons_027_search@2x.png -------------------------------------------------------------------------------- /Resources-Shared/glyphicons_036_file.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ink/ios-picker/00a17e82e7bb6858d354d89483020156ed0184f9/Resources-Shared/glyphicons_036_file.png -------------------------------------------------------------------------------- /Resources-Shared/glyphicons_036_file@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ink/ios-picker/00a17e82e7bb6858d354d89483020156ed0184f9/Resources-Shared/glyphicons_036_file@2x.png -------------------------------------------------------------------------------- /Resources-Shared/glyphicons_144_folder_open.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ink/ios-picker/00a17e82e7bb6858d354d89483020156ed0184f9/Resources-Shared/glyphicons_144_folder_open.png -------------------------------------------------------------------------------- /Resources-Shared/glyphicons_144_folder_open@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ink/ios-picker/00a17e82e7bb6858d354d89483020156ed0184f9/Resources-Shared/glyphicons_144_folder_open@2x.png -------------------------------------------------------------------------------- /Resources-Shared/glyphicons_154_show_big_thumbnails.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ink/ios-picker/00a17e82e7bb6858d354d89483020156ed0184f9/Resources-Shared/glyphicons_154_show_big_thumbnails.png -------------------------------------------------------------------------------- /Resources-Shared/glyphicons_154_show_big_thumbnails@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ink/ios-picker/00a17e82e7bb6858d354d89483020156ed0184f9/Resources-Shared/glyphicons_154_show_big_thumbnails@2x.png -------------------------------------------------------------------------------- /Resources-Shared/glyphicons_180_facetime_video.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ink/ios-picker/00a17e82e7bb6858d354d89483020156ed0184f9/Resources-Shared/glyphicons_180_facetime_video.png -------------------------------------------------------------------------------- /Resources-Shared/glyphicons_180_facetime_video@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ink/ios-picker/00a17e82e7bb6858d354d89483020156ed0184f9/Resources-Shared/glyphicons_180_facetime_video@2x.png -------------------------------------------------------------------------------- /Resources-Shared/glyphicons_300_microphone.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ink/ios-picker/00a17e82e7bb6858d354d89483020156ed0184f9/Resources-Shared/glyphicons_300_microphone.png -------------------------------------------------------------------------------- /Resources-Shared/glyphicons_300_microphone@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ink/ios-picker/00a17e82e7bb6858d354d89483020156ed0184f9/Resources-Shared/glyphicons_300_microphone@2x.png -------------------------------------------------------------------------------- /Resources-Shared/glyphicons_361_dropbox.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ink/ios-picker/00a17e82e7bb6858d354d89483020156ed0184f9/Resources-Shared/glyphicons_361_dropbox.png -------------------------------------------------------------------------------- /Resources-Shared/glyphicons_361_dropbox@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ink/ios-picker/00a17e82e7bb6858d354d89483020156ed0184f9/Resources-Shared/glyphicons_361_dropbox@2x.png -------------------------------------------------------------------------------- /Resources-Shared/glyphicons_366_picasa.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ink/ios-picker/00a17e82e7bb6858d354d89483020156ed0184f9/Resources-Shared/glyphicons_366_picasa.png -------------------------------------------------------------------------------- /Resources-Shared/glyphicons_366_picasa@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ink/ios-picker/00a17e82e7bb6858d354d89483020156ed0184f9/Resources-Shared/glyphicons_366_picasa@2x.png -------------------------------------------------------------------------------- /Resources-Shared/glyphicons_371_evernote.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ink/ios-picker/00a17e82e7bb6858d354d89483020156ed0184f9/Resources-Shared/glyphicons_371_evernote.png -------------------------------------------------------------------------------- /Resources-Shared/glyphicons_371_evernote@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ink/ios-picker/00a17e82e7bb6858d354d89483020156ed0184f9/Resources-Shared/glyphicons_371_evernote@2x.png -------------------------------------------------------------------------------- /Resources-Shared/glyphicons_381_github.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ink/ios-picker/00a17e82e7bb6858d354d89483020156ed0184f9/Resources-Shared/glyphicons_381_github.png -------------------------------------------------------------------------------- /Resources-Shared/glyphicons_381_github@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ink/ios-picker/00a17e82e7bb6858d354d89483020156ed0184f9/Resources-Shared/glyphicons_381_github@2x.png -------------------------------------------------------------------------------- /Resources-Shared/glyphicons_390_facebook.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ink/ios-picker/00a17e82e7bb6858d354d89483020156ed0184f9/Resources-Shared/glyphicons_390_facebook.png -------------------------------------------------------------------------------- /Resources-Shared/glyphicons_390_facebook@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ink/ios-picker/00a17e82e7bb6858d354d89483020156ed0184f9/Resources-Shared/glyphicons_390_facebook@2x.png -------------------------------------------------------------------------------- /Resources-Shared/glyphicons_395_flickr.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ink/ios-picker/00a17e82e7bb6858d354d89483020156ed0184f9/Resources-Shared/glyphicons_395_flickr.png -------------------------------------------------------------------------------- /Resources-Shared/glyphicons_395_flickr@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ink/ios-picker/00a17e82e7bb6858d354d89483020156ed0184f9/Resources-Shared/glyphicons_395_flickr@2x.png -------------------------------------------------------------------------------- /Resources-Shared/glyphicons_399_e-mail.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ink/ios-picker/00a17e82e7bb6858d354d89483020156ed0184f9/Resources-Shared/glyphicons_399_e-mail.png -------------------------------------------------------------------------------- /Resources-Shared/glyphicons_399_e-mail@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ink/ios-picker/00a17e82e7bb6858d354d89483020156ed0184f9/Resources-Shared/glyphicons_399_e-mail@2x.png -------------------------------------------------------------------------------- /Resources-Shared/glyphicons_sb1_gmail.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ink/ios-picker/00a17e82e7bb6858d354d89483020156ed0184f9/Resources-Shared/glyphicons_sb1_gmail.png -------------------------------------------------------------------------------- /Resources-Shared/glyphicons_sb1_gmail@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ink/ios-picker/00a17e82e7bb6858d354d89483020156ed0184f9/Resources-Shared/glyphicons_sb1_gmail@2x.png -------------------------------------------------------------------------------- /Resources-Shared/glyphicons_sb2_box.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ink/ios-picker/00a17e82e7bb6858d354d89483020156ed0184f9/Resources-Shared/glyphicons_sb2_box.png -------------------------------------------------------------------------------- /Resources-Shared/glyphicons_sb2_box@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ink/ios-picker/00a17e82e7bb6858d354d89483020156ed0184f9/Resources-Shared/glyphicons_sb2_box@2x.png -------------------------------------------------------------------------------- /Resources-Shared/glyphicons_sb3_skydrive.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ink/ios-picker/00a17e82e7bb6858d354d89483020156ed0184f9/Resources-Shared/glyphicons_sb3_skydrive.png -------------------------------------------------------------------------------- /Resources-Shared/glyphicons_sb3_skydrive@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ink/ios-picker/00a17e82e7bb6858d354d89483020156ed0184f9/Resources-Shared/glyphicons_sb3_skydrive@2x.png -------------------------------------------------------------------------------- /Resources-Shared/logo_small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ink/ios-picker/00a17e82e7bb6858d354d89483020156ed0184f9/Resources-Shared/logo_small.png -------------------------------------------------------------------------------- /Resources-Shared/logo_small@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ink/ios-picker/00a17e82e7bb6858d354d89483020156ed0184f9/Resources-Shared/logo_small@2x.png -------------------------------------------------------------------------------- /Resources-Shared/placeholder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ink/ios-picker/00a17e82e7bb6858d354d89483020156ed0184f9/Resources-Shared/placeholder.png -------------------------------------------------------------------------------- /Resources-Shared/select.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ink/ios-picker/00a17e82e7bb6858d354d89483020156ed0184f9/Resources-Shared/select.png -------------------------------------------------------------------------------- /Resources-Shared/select@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ink/ios-picker/00a17e82e7bb6858d354d89483020156ed0184f9/Resources-Shared/select@2x.png -------------------------------------------------------------------------------- /Resources-iOS/FPPicker-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | $(CURRENT_PROJECT_VERSION) 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Resources-iOS/FPPicker-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'FPPicker' target in the 'FPPicker' project 3 | // 4 | 5 | #ifdef __OBJC__ 6 | #import 7 | #import "FPMacros.h" 8 | #import "FPiOSMacros.h" 9 | #endif 10 | --------------------------------------------------------------------------------