Merge branch '5-make-it-possible-to-save-photos-captured-using-camera-in-app' into 'master'
Resolve "Make it possible to save photos captured using camera in app" Closes #5 See merge request !3
This commit is contained in:
commit
35ea02227e
|
@ -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;
|
||||
|
|
6
dcav-uploader/Assets.xcassets/Contents.json
Normal file
6
dcav-uploader/Assets.xcassets/Contents.json
Normal file
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
21
dcav-uploader/Assets.xcassets/savedImage.imageset/Contents.json
vendored
Normal file
21
dcav-uploader/Assets.xcassets/savedImage.imageset/Contents.json
vendored
Normal file
|
@ -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"
|
||||
}
|
||||
}
|
BIN
dcav-uploader/Assets.xcassets/savedImage.imageset/saved_image.png
vendored
Normal file
BIN
dcav-uploader/Assets.xcassets/savedImage.imageset/saved_image.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 17 KiB |
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="12121" systemVersion="16F73" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="8xC-Gn-SAo">
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="12121" systemVersion="16F2073" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="8xC-Gn-SAo">
|
||||
<device id="retina4_7" orientation="portrait">
|
||||
<adaptation id="fullscreen"/>
|
||||
</device>
|
||||
|
@ -21,8 +21,8 @@
|
|||
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="Hej" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Wr7-lK-wSY">
|
||||
<rect key="frame" x="290" y="529" width="26" height="21"/>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="temp" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Wr7-lK-wSY">
|
||||
<rect key="frame" x="16" y="581" width="150" height="21"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<nil key="textColor"/>
|
||||
|
@ -33,38 +33,51 @@
|
|||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
</imageView>
|
||||
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="4gf-ZL-vBk">
|
||||
<rect key="frame" x="141" y="398" width="93" height="32"/>
|
||||
<rect key="frame" x="141" y="448" width="93" height="32"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<state key="normal" title="Take Photo"/>
|
||||
<state key="normal" title="Take Photo">
|
||||
<color key="titleColor" cocoaTouchSystemColor="darkTextColor"/>
|
||||
</state>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="number" keyPath="layer.borderWidth">
|
||||
<integer key="value" value="1"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
</userDefinedRuntimeAttributes>
|
||||
<connections>
|
||||
<action selector="onPhotoButton:" destination="BYZ-38-t0r" eventType="touchUpInside" id="Hsa-47-H63"/>
|
||||
</connections>
|
||||
</button>
|
||||
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="hD6-Iz-ohL">
|
||||
<rect key="frame" x="141" y="438" width="93" height="30"/>
|
||||
<rect key="frame" x="190" y="410" width="93" height="30"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<state key="normal" title="Save Photo"/>
|
||||
<accessibility key="accessibilityConfiguration" identifier="SaveButton" label="SaveButton"/>
|
||||
<state key="normal" title="Save Photo">
|
||||
<color key="titleColor" cocoaTouchSystemColor="darkTextColor"/>
|
||||
</state>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="number" keyPath="layer.borderWidth">
|
||||
<integer key="value" value="1"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
</userDefinedRuntimeAttributes>
|
||||
<connections>
|
||||
<action selector="onSaveButton:" destination="BYZ-38-t0r" eventType="touchUpInside" id="e6I-Yy-Y5q"/>
|
||||
</connections>
|
||||
</button>
|
||||
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="AIU-y1-LLs">
|
||||
<rect key="frame" x="39" y="536" width="92" height="30"/>
|
||||
<rect key="frame" x="141" y="488" width="93" height="30"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<state key="normal" title="Photo Library"/>
|
||||
<state key="normal" title="Library">
|
||||
<color key="titleColor" cocoaTouchSystemColor="darkTextColor"/>
|
||||
</state>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="number" keyPath="layer.borderWidth">
|
||||
<integer key="value" value="1"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
</userDefinedRuntimeAttributes>
|
||||
<connections>
|
||||
<action selector="onLibraryButton:" destination="BYZ-38-t0r" eventType="touchUpInside" id="538-4H-pMy"/>
|
||||
</connections>
|
||||
</button>
|
||||
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="pq9-PY-U2H">
|
||||
<rect key="frame" x="162" y="552" width="50" height="30"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<state key="normal" title="Upload"/>
|
||||
<connections>
|
||||
<action selector="onSaveButton:" destination="BYZ-38-t0r" eventType="touchUpInside" id="msf-I0-aFP"/>
|
||||
<action selector="onUploadButton:" destination="BYZ-38-t0r" eventType="touchUpInside" id="rdn-nl-j6f"/>
|
||||
</connections>
|
||||
</button>
|
||||
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="9YY-rV-nVu">
|
||||
<rect key="frame" x="39" y="72" width="298" height="30"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
|
@ -76,6 +89,25 @@
|
|||
<rect key="frame" x="16" y="383" width="343" height="2"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
</progressView>
|
||||
<imageView hidden="YES" userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" image="savedImage" translatesAutoresizingMaskIntoConstraints="NO" id="ehT-4D-jVX">
|
||||
<rect key="frame" x="64" y="168" width="247" height="152"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
</imageView>
|
||||
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="pq9-PY-U2H">
|
||||
<rect key="frame" x="89" y="410" width="93" height="30"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<state key="normal" title="Upload">
|
||||
<color key="titleColor" cocoaTouchSystemColor="darkTextColor"/>
|
||||
</state>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="number" keyPath="layer.borderWidth">
|
||||
<integer key="value" value="1"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
</userDefinedRuntimeAttributes>
|
||||
<connections>
|
||||
<action selector="onUploadButton:" destination="BYZ-38-t0r" eventType="touchUpInside" id="rdn-nl-j6f"/>
|
||||
</connections>
|
||||
</button>
|
||||
</subviews>
|
||||
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
</view>
|
||||
|
@ -88,6 +120,7 @@
|
|||
<outlet property="dcavTextField" destination="9YY-rV-nVu" id="RPZ-ov-oMp"/>
|
||||
<outlet property="imageView" destination="3Cc-7Y-DVl" id="CcV-Us-W0x"/>
|
||||
<outlet property="labell" destination="Wr7-lK-wSY" id="u97-bt-PHA"/>
|
||||
<outlet property="savedPhotoImageView" destination="ehT-4D-jVX" id="80l-aT-65F"/>
|
||||
<outlet property="uploadProgressBar" destination="JEW-rQ-Kb1" id="zuQ-8e-GvG"/>
|
||||
</connections>
|
||||
</viewController>
|
||||
|
@ -118,4 +151,7 @@
|
|||
<point key="canvasLocation" x="-266" y="38"/>
|
||||
</scene>
|
||||
</scenes>
|
||||
<resources>
|
||||
<image name="savedImage" width="320" height="240"/>
|
||||
</resources>
|
||||
</document>
|
||||
|
|
|
@ -20,6 +20,10 @@
|
|||
<string>1</string>
|
||||
<key>LSRequiresIPhoneOS</key>
|
||||
<true/>
|
||||
<key>NSCameraUsageDescription</key>
|
||||
<string>Need to access camera lol</string>
|
||||
<key>NSPhotoLibraryUsageDescription</key>
|
||||
<string>Plz give access</string>
|
||||
<key>UILaunchStoryboardName</key>
|
||||
<string>LaunchScreen</string>
|
||||
<key>UIMainStoryboardFile</key>
|
||||
|
@ -39,9 +43,5 @@
|
|||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||
</array>
|
||||
<key>NSPhotoLibraryUsageDescription</key>
|
||||
<string>Plz give access</string>
|
||||
<key>NSCameraUsageDescription</key>
|
||||
<string>Need to access camera lol</string>
|
||||
</dict>
|
||||
</plist>
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue
Block a user