diff --git a/dcav-uploader.xcodeproj/project.pbxproj b/dcav-uploader.xcodeproj/project.pbxproj index a1be6b7..c430cbe 100644 --- a/dcav-uploader.xcodeproj/project.pbxproj +++ b/dcav-uploader.xcodeproj/project.pbxproj @@ -149,6 +149,7 @@ TargetAttributes = { ACAAF0011F2F93C600271C26 = { CreatedOnToolsVersion = 8.3.3; + DevelopmentTeam = HU6WPE737K; ProvisioningStyle = Automatic; }; ACAAF0151F2F93C600271C26 = { @@ -345,11 +346,14 @@ isa = XCBuildConfiguration; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + DEVELOPMENT_TEAM = HU6WPE737K; INFOPLIST_FILE = "dcav-uploader/Info.plist"; IPHONEOS_DEPLOYMENT_TARGET = 10.3; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = "space.guava.dcav-uploader"; + PRODUCT_BUNDLE_IDENTIFIER = "space.guava-"; PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE_SPECIFIER = ""; SWIFT_VERSION = 3.0; }; name = Debug; @@ -358,11 +362,14 @@ isa = XCBuildConfiguration; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + DEVELOPMENT_TEAM = HU6WPE737K; INFOPLIST_FILE = "dcav-uploader/Info.plist"; IPHONEOS_DEPLOYMENT_TARGET = 10.3; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = "space.guava.dcav-uploader"; + PRODUCT_BUNDLE_IDENTIFIER = "space.guava-"; PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE_SPECIFIER = ""; SWIFT_VERSION = 3.0; }; name = Release; diff --git a/dcav-uploader/Assets.xcassets/Contents.json b/dcav-uploader/Assets.xcassets/Contents.json new file mode 100644 index 0000000..da4a164 --- /dev/null +++ b/dcav-uploader/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/dcav-uploader/Assets.xcassets/savedImage.imageset/Contents.json b/dcav-uploader/Assets.xcassets/savedImage.imageset/Contents.json new file mode 100644 index 0000000..acb6c00 --- /dev/null +++ b/dcav-uploader/Assets.xcassets/savedImage.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "saved_image.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/dcav-uploader/Assets.xcassets/savedImage.imageset/saved_image.png b/dcav-uploader/Assets.xcassets/savedImage.imageset/saved_image.png new file mode 100644 index 0000000..d291a83 Binary files /dev/null and b/dcav-uploader/Assets.xcassets/savedImage.imageset/saved_image.png differ diff --git a/dcav-uploader/Base.lproj/Main.storyboard b/dcav-uploader/Base.lproj/Main.storyboard index 8584ddf..a002128 100644 --- a/dcav-uploader/Base.lproj/Main.storyboard +++ b/dcav-uploader/Base.lproj/Main.storyboard @@ -1,5 +1,5 @@ - + @@ -21,8 +21,8 @@ - @@ -88,6 +120,7 @@ + @@ -118,4 +151,7 @@ + + + diff --git a/dcav-uploader/Info.plist b/dcav-uploader/Info.plist index 4102788..4ab9e43 100644 --- a/dcav-uploader/Info.plist +++ b/dcav-uploader/Info.plist @@ -20,6 +20,10 @@ 1 LSRequiresIPhoneOS + NSCameraUsageDescription + Need to access camera lol + NSPhotoLibraryUsageDescription + Plz give access UILaunchStoryboardName LaunchScreen UIMainStoryboardFile @@ -39,9 +43,5 @@ UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight - NSPhotoLibraryUsageDescription - Plz give access - NSCameraUsageDescription - Need to access camera lol diff --git a/dcav-uploader/ViewController.swift b/dcav-uploader/ViewController.swift index d241865..a26db80 100644 --- a/dcav-uploader/ViewController.swift +++ b/dcav-uploader/ViewController.swift @@ -16,6 +16,8 @@ class ViewController: UIViewController, UINavigationControllerDelegate, UIImageP @IBOutlet weak var dcavTextField: UITextField! var responseString : String! @IBOutlet weak var uploadProgressBar: UIProgressView! + @IBOutlet weak var savedPhotoImageView: UIImageView! + let pasteBoard = UIPasteboard.general override func viewDidLoad() { super.viewDidLoad() @@ -45,15 +47,13 @@ class ViewController: UIViewController, UINavigationControllerDelegate, UIImageP func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any]) { imagePickerController.dismiss(animated: true, completion: nil) + imageView.contentMode = .scaleAspectFit imageView.image = info[UIImagePickerControllerOriginalImage] as? UIImage } func setTextInField(path: String) { dcavTextField.text = path } - - @IBAction func onSaveButton(_ sender: Any) { - } @IBAction func onUploadButton(_ sender: Any) { guard let username : String = UserDefaults.standard.string(forKey: "username_preference") else { @@ -84,10 +84,10 @@ class ViewController: UIViewController, UINavigationControllerDelegate, UIImageP self.responseString = String(data: data, encoding: .utf8)! print("responseString = \(String(describing: self.responseString))") DispatchQueue.main.async() { - self.setTextInField(path: "https://dcav.pw/\(String(describing: self.labell.text![(self.labell.text!.startIndex)]))\(String(describing: self.responseString!))") + self.setTextInField(path: "https://dcav.pw/\(String(describing: self.labell.text![(self.labell.text!.startIndex)]))\(String(describing: self.responseString!))") + self.pasteBoard.string = self.dcavTextField.text! } } - task.resume() } @@ -130,6 +130,27 @@ class ViewController: UIViewController, UINavigationControllerDelegate, UIImageP return request } + @IBAction func onSaveButton(_ sender: UIButton) { + + UIImageWriteToSavedPhotosAlbum(imageView.image!, nil, nil, nil); + + self.savedPhotoImageView.alpha = 0 + self.savedPhotoImageView.isHidden = false + + UIView.animate(withDuration: 0.3, delay:0.0, options:UIViewAnimationOptions.transitionCrossDissolve, animations: { + + self.savedPhotoImageView.alpha = 1 + + }, completion: { finished in + UIView.animate(withDuration: 0.3, delay:1, options:UIViewAnimationOptions.transitionCrossDissolve, animations: { + self.savedPhotoImageView.alpha = 0 + + }, completion: { finished in + self.savedPhotoImageView.isHidden = true + }) + }) + } + //MARK:Update progress bar func urlSession(_ session: URLSession, task: URLSessionTask, didSendBodyData bytesSent: Int64, totalBytesSent: Int64, totalBytesExpectedToSend: Int64) { uploadProgressBar.progress = Float(totalBytesSent) / Float(totalBytesExpectedToSend)