Dwayne Harris
6 years ago
10 changed files with 313 additions and 66 deletions
-
2Frameworks/Kingfisher
-
20elpha-ios.xcodeproj/project.pbxproj
-
30elpha-ios/AttachmentInputView.swift
-
77elpha-ios/AttachmentInputView.xib
-
23elpha-ios/AttachmentManager.swift
-
45elpha-ios/ComposeViewController.swift
-
4elpha-ios/MastodonAPI.swift
-
70elpha-ios/StatusView.swift
-
58elpha-ios/VisibilityInputView.swift
-
50elpha-ios/VisibilityInputView.xib
@ -1 +1 @@ |
|||
Subproject commit fbf8067218a358b470baad99a1ed3836365540f5 |
|||
Subproject commit 696a8762a81af2acffc916c1753a22a5a1381d0f |
@ -0,0 +1,30 @@ |
|||
// |
|||
// AttachmentInputView.swift |
|||
// elpha-ios |
|||
// |
|||
// Created by Dwayne Harris on 11/17/18. |
|||
// Copyright © 2018 Elpha. All rights reserved. |
|||
// |
|||
|
|||
import UIKit |
|||
|
|||
class AttachmentInputView: UIView { |
|||
@IBOutlet var contentView: UIView! |
|||
|
|||
override init(frame: CGRect) { |
|||
super.init(frame: frame) |
|||
setup() |
|||
} |
|||
|
|||
required init?(coder aDecoder: NSCoder) { |
|||
super.init(coder: aDecoder) |
|||
setup() |
|||
} |
|||
|
|||
private func setup() { |
|||
Bundle.main.loadNibNamed("AttachmentInputView", owner: self, options: nil) |
|||
addSubview(contentView) |
|||
contentView.frame = self.bounds |
|||
contentView.autoresizingMask = [.flexibleWidth, .flexibleHeight] |
|||
} |
|||
} |
@ -0,0 +1,77 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="14460.31" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES"> |
|||
<device id="retina4_7" orientation="portrait"> |
|||
<adaptation id="fullscreen"/> |
|||
</device> |
|||
<dependencies> |
|||
<deployment identifier="iOS"/> |
|||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14460.20"/> |
|||
<capability name="Named colors" minToolsVersion="9.0"/> |
|||
<capability name="Safe area layout guides" minToolsVersion="9.0"/> |
|||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> |
|||
</dependencies> |
|||
<objects> |
|||
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="AttachmentInputView" customModule="elpha_ios" customModuleProvider="target"> |
|||
<connections> |
|||
<outlet property="contentView" destination="iN0-l3-epB" id="FW6-Gc-su3"/> |
|||
</connections> |
|||
</placeholder> |
|||
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/> |
|||
<view contentMode="scaleToFill" id="iN0-l3-epB"> |
|||
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/> |
|||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> |
|||
<subviews> |
|||
<collectionView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" dataMode="none" translatesAutoresizingMaskIntoConstraints="NO" id="DgV-de-OI2"> |
|||
<rect key="frame" x="20" y="76" width="335" height="527"/> |
|||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> |
|||
<collectionViewFlowLayout key="collectionViewLayout" minimumLineSpacing="10" minimumInteritemSpacing="10" id="pQk-XB-end"> |
|||
<size key="itemSize" width="50" height="50"/> |
|||
<size key="headerReferenceSize" width="0.0" height="0.0"/> |
|||
<size key="footerReferenceSize" width="0.0" height="0.0"/> |
|||
<inset key="sectionInset" minX="0.0" minY="0.0" maxX="0.0" maxY="0.0"/> |
|||
</collectionViewFlowLayout> |
|||
</collectionView> |
|||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Attachments" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="xhE-rm-MSc"> |
|||
<rect key="frame" x="15" y="35" width="345" height="21"/> |
|||
<fontDescription key="fontDescription" type="boldSystem" pointSize="17"/> |
|||
<color key="textColor" name="Text"/> |
|||
<nil key="highlightedColor"/> |
|||
</label> |
|||
<toolbar opaque="NO" clearsContextBeforeDrawing="NO" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="q7s-jQ-GQc"> |
|||
<rect key="frame" x="0.0" y="623" width="375" height="44"/> |
|||
<items> |
|||
<barButtonItem title="Add Media" id="Bj0-V6-Hhl"> |
|||
<color key="tintColor" name="Text"/> |
|||
</barButtonItem> |
|||
<barButtonItem style="plain" systemItem="flexibleSpace" id="69C-R5-KwC"/> |
|||
<barButtonItem title="Cancel" id="Q8B-VF-ZJe"> |
|||
<color key="tintColor" name="Text"/> |
|||
</barButtonItem> |
|||
</items> |
|||
</toolbar> |
|||
</subviews> |
|||
<color key="backgroundColor" name="Secondary"/> |
|||
<constraints> |
|||
<constraint firstItem="q7s-jQ-GQc" firstAttribute="leading" secondItem="vUN-kp-3ea" secondAttribute="leading" id="APE-kj-6aQ"/> |
|||
<constraint firstItem="DgV-de-OI2" firstAttribute="leading" secondItem="vUN-kp-3ea" secondAttribute="leading" constant="20" id="Hh6-za-VeG"/> |
|||
<constraint firstItem="xhE-rm-MSc" firstAttribute="leading" secondItem="vUN-kp-3ea" secondAttribute="leading" constant="15" id="QfV-u7-lAG"/> |
|||
<constraint firstItem="xhE-rm-MSc" firstAttribute="top" secondItem="vUN-kp-3ea" secondAttribute="top" constant="15" id="ZpL-Ut-mnx"/> |
|||
<constraint firstItem="vUN-kp-3ea" firstAttribute="trailing" secondItem="xhE-rm-MSc" secondAttribute="trailing" constant="15" id="aNb-Y7-owY"/> |
|||
<constraint firstItem="q7s-jQ-GQc" firstAttribute="trailing" secondItem="vUN-kp-3ea" secondAttribute="trailing" id="gMo-9u-tBg"/> |
|||
<constraint firstItem="q7s-jQ-GQc" firstAttribute="bottom" secondItem="vUN-kp-3ea" secondAttribute="bottom" id="jaw-06-e0K"/> |
|||
<constraint firstItem="vUN-kp-3ea" firstAttribute="trailing" secondItem="DgV-de-OI2" secondAttribute="trailing" constant="20" id="kv4-gu-UWt"/> |
|||
<constraint firstItem="q7s-jQ-GQc" firstAttribute="top" secondItem="DgV-de-OI2" secondAttribute="bottom" constant="20" id="qmP-mN-b7z"/> |
|||
<constraint firstItem="DgV-de-OI2" firstAttribute="top" secondItem="xhE-rm-MSc" secondAttribute="bottom" constant="20" id="wVQ-yi-XqO"/> |
|||
</constraints> |
|||
<viewLayoutGuide key="safeArea" id="vUN-kp-3ea"/> |
|||
</view> |
|||
</objects> |
|||
<resources> |
|||
<namedColor name="Secondary"> |
|||
<color red="0.792156862745098" green="0.68627450980392157" blue="0.99215686274509807" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> |
|||
</namedColor> |
|||
<namedColor name="Text"> |
|||
<color red="0.090196078431372548" green="0.047058823529411764" blue="0.28627450980392155" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> |
|||
</namedColor> |
|||
</resources> |
|||
</document> |
@ -0,0 +1,58 @@ |
|||
// |
|||
// VisibilityInputView.swift |
|||
// elpha-ios |
|||
// |
|||
// Created by Dwayne Harris on 11/17/18. |
|||
// Copyright © 2018 Elpha. All rights reserved. |
|||
// |
|||
|
|||
import UIKit |
|||
|
|||
protocol VisibilityInputViewDelegate { |
|||
func visibilitySelected(visibility: StatusVisibility) |
|||
} |
|||
|
|||
class VisibilityInputView: UIView { |
|||
@IBOutlet var contentView: UIView! |
|||
@IBOutlet var visibilityPickerView: UIPickerView! |
|||
|
|||
public var delegate: VisibilityInputViewDelegate? = nil |
|||
|
|||
override init(frame: CGRect) { |
|||
super.init(frame: frame) |
|||
setup() |
|||
} |
|||
|
|||
required init?(coder aDecoder: NSCoder) { |
|||
super.init(coder: aDecoder) |
|||
setup() |
|||
} |
|||
|
|||
private func setup() { |
|||
Bundle.main.loadNibNamed("VisibilityInputView", owner: self, options: nil) |
|||
addSubview(contentView) |
|||
contentView.frame = self.bounds |
|||
contentView.autoresizingMask = [.flexibleWidth, .flexibleHeight] |
|||
|
|||
visibilityPickerView.delegate = self |
|||
visibilityPickerView.dataSource = self |
|||
} |
|||
} |
|||
|
|||
extension VisibilityInputView: UIPickerViewDelegate, UIPickerViewDataSource { |
|||
func numberOfComponents(in pickerView: UIPickerView) -> Int { |
|||
return 1 |
|||
} |
|||
|
|||
func pickerView(_ pickerView: UIPickerView, numberOfRowsInComponent component: Int) -> Int { |
|||
return StatusVisibility.allCases.count |
|||
} |
|||
|
|||
func pickerView(_ pickerView: UIPickerView, titleForRow row: Int, forComponent component: Int) -> String? { |
|||
return StatusVisibility.allCases[row].rawValue.capitalized |
|||
} |
|||
|
|||
func pickerView(_ pickerView: UIPickerView, didSelectRow row: Int, inComponent component: Int) { |
|||
delegate?.visibilitySelected(visibility: StatusVisibility.allCases[row]) |
|||
} |
|||
} |
@ -0,0 +1,50 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="14460.31" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES"> |
|||
<device id="retina4_7" orientation="portrait"> |
|||
<adaptation id="fullscreen"/> |
|||
</device> |
|||
<dependencies> |
|||
<deployment identifier="iOS"/> |
|||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14460.20"/> |
|||
<capability name="Named colors" minToolsVersion="9.0"/> |
|||
<capability name="Safe area layout guides" minToolsVersion="9.0"/> |
|||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> |
|||
</dependencies> |
|||
<objects> |
|||
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="VisibilityInputView" customModule="elpha_ios" customModuleProvider="target"> |
|||
<connections> |
|||
<outlet property="contentView" destination="iN0-l3-epB" id="7pz-hP-ZWx"/> |
|||
<outlet property="visibilityPickerView" destination="eBW-A5-bzo" id="0jd-DN-JX5"/> |
|||
</connections> |
|||
</placeholder> |
|||
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/> |
|||
<view contentMode="scaleToFill" id="iN0-l3-epB"> |
|||
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/> |
|||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> |
|||
<subviews> |
|||
<pickerView contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="eBW-A5-bzo"> |
|||
<rect key="frame" x="0.0" y="258.5" width="375" height="150"/> |
|||
<color key="tintColor" name="Text"/> |
|||
<constraints> |
|||
<constraint firstAttribute="height" constant="150" id="PnD-GD-JgW"/> |
|||
</constraints> |
|||
</pickerView> |
|||
</subviews> |
|||
<color key="backgroundColor" name="Secondary"/> |
|||
<constraints> |
|||
<constraint firstItem="eBW-A5-bzo" firstAttribute="trailing" secondItem="vUN-kp-3ea" secondAttribute="trailing" id="Jvq-QQ-FZw"/> |
|||
<constraint firstItem="eBW-A5-bzo" firstAttribute="leading" secondItem="vUN-kp-3ea" secondAttribute="leading" id="Q0U-OE-d4i"/> |
|||
<constraint firstItem="eBW-A5-bzo" firstAttribute="centerY" secondItem="iN0-l3-epB" secondAttribute="centerY" id="T6B-SN-bx7"/> |
|||
</constraints> |
|||
<viewLayoutGuide key="safeArea" id="vUN-kp-3ea"/> |
|||
</view> |
|||
</objects> |
|||
<resources> |
|||
<namedColor name="Secondary"> |
|||
<color red="0.792156862745098" green="0.68627450980392157" blue="0.99215686274509807" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> |
|||
</namedColor> |
|||
<namedColor name="Text"> |
|||
<color red="0.090196078431372548" green="0.047058823529411764" blue="0.28627450980392155" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> |
|||
</namedColor> |
|||
</resources> |
|||
</document> |
Write
Preview
Loading…
Cancel
Save
Reference in new issue