Browse Source

Update Compose view controller

master
Dwayne Harris 6 years ago
parent
commit
76db54bee8
  1. 21
      elpha-ios/AbstractStatusTableViewController.swift
  2. 1
      elpha-ios/AttachmentManager.swift
  3. 137
      elpha-ios/Base.lproj/Main.storyboard
  4. 44
      elpha-ios/ComposeViewController.swift
  5. 2
      elpha-ios/FLAnimatedImageView+LoadImageURL.swift
  6. 4
      elpha-ios/MastodonAPI.swift
  7. 9
      elpha-ios/StatusView.xib
  8. 20
      elpha-ios/TimelineTableViewController.swift

21
elpha-ios/AbstractStatusTableViewController.swift

@ -26,19 +26,19 @@ class AbstractStatusTableViewController: UITableViewController, StatusViewDelega
}
}
func storyboard() -> UIStoryboard {
return UIStoryboard(name: "Main", bundle: nil)
}
func accountTapped(account: AccountMO) {
let storyboard = UIStoryboard(name: "Main", bundle: nil)
if let controller = storyboard.instantiateViewController(withIdentifier: "AccountTableViewController") as? AccountTableViewController {
if let controller = storyboard().instantiateViewController(withIdentifier: "AccountTableViewController") as? AccountTableViewController {
controller.account = account
self.navigationController?.pushViewController(controller, animated: true)
}
}
func statusTapped(status: StatusMO) {
let storyboard = UIStoryboard(name: "Main", bundle: nil)
if let controller = storyboard.instantiateViewController(withIdentifier: "StatusTableViewController") as? StatusTableViewController {
if let controller = storyboard().instantiateViewController(withIdentifier: "StatusTableViewController") as? StatusTableViewController {
controller.status = status
self.navigationController?.pushViewController(controller, animated: true)
}
@ -49,13 +49,14 @@ class AbstractStatusTableViewController: UITableViewController, StatusViewDelega
}
func replyTapped(status: StatusMO) {
performSegue(withIdentifier: "ComposeSegue", sender: self)
if let controller = storyboard().instantiateViewController(withIdentifier: "ComposeViewController") as? ComposeViewController {
controller.replyToStatus = status
present(controller, animated: true)
}
}
func attachmentTapped(status: StatusMO, index: Int) {
let storyboard = UIStoryboard(name: "Main", bundle: nil)
if let controller = storyboard.instantiateViewController(withIdentifier: "AttachmentPageViewController") as? AttachmentPageViewController {
if let controller = storyboard().instantiateViewController(withIdentifier: "AttachmentPageViewController") as? AttachmentPageViewController {
controller.status = status
controller.attachmentIndex = index

1
elpha-ios/AttachmentManager.swift

@ -40,6 +40,7 @@ class AttachmentManager: NSObject {
case 1:
let attachment = attachments.firstObject as! AttachmentMO
let imageView = FLAnimatedImageView()
imageView.contentMode = UIImageView.ContentMode.scaleAspectFill
let tapGestureRecognizer = UITapGestureRecognizer(target: self, action: #selector(attachmentTapped))
tapGestureRecognizer.delegate = self

137
elpha-ios/Base.lproj/Main.storyboard

@ -1062,78 +1062,56 @@
<!--Compose View Controller-->
<scene sceneID="K94-uj-No4">
<objects>
<viewController storyboardIdentifier="ComposeViewController" definesPresentationContext="YES" providesPresentationContextTransitionStyle="YES" modalPresentationStyle="overCurrentContext" id="MNp-Rq-Swn" customClass="ComposeViewController" customModule="elpha_ios" customModuleProvider="target" sceneMemberID="viewController">
<viewController storyboardIdentifier="ComposeViewController" definesPresentationContext="YES" providesPresentationContextTransitionStyle="YES" modalPresentationStyle="overFullScreen" id="MNp-Rq-Swn" customClass="ComposeViewController" customModule="elpha_ios" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="NDm-1a-rKP">
<rect key="frame" x="0.0" y="0.0" width="375" height="812"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<visualEffectView opaque="NO" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="bv7-e3-oWD">
<rect key="frame" x="0.0" y="0.0" width="375" height="729"/>
<rect key="frame" x="0.0" y="0.0" width="375" height="778"/>
<view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" insetsLayoutMarginsFromSafeArea="NO" id="s1W-PY-h1k">
<rect key="frame" x="0.0" y="0.0" width="375" height="729"/>
<rect key="frame" x="0.0" y="0.0" width="375" height="778"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<scrollView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="TaE-kM-jSH">
<rect key="frame" x="0.0" y="0.0" width="375" height="729"/>
<rect key="frame" x="0.0" y="80" width="375" height="698"/>
<subviews>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" translatesAutoresizingMaskIntoConstraints="NO" id="yeC-3y-hAG">
<rect key="frame" x="0.0" y="50" width="375" height="729"/>
<rect key="frame" x="0.0" y="0.0" width="375" height="698"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="OUa-cb-0gQ">
<rect key="frame" x="0.0" y="0.0" width="375" height="30"/>
<subviews>
<imageView contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="Close" translatesAutoresizingMaskIntoConstraints="NO" id="7bB-Lp-9yL">
<rect key="frame" x="20" y="6" width="18" height="18"/>
<gestureRecognizers/>
<constraints>
<constraint firstAttribute="height" constant="18" id="aZg-Zz-VMv"/>
<constraint firstAttribute="width" constant="18" id="bRZ-Sb-1Sk"/>
</constraints>
<connections>
<outletCollection property="gestureRecognizers" destination="0V9-Ll-no6" appends="YES" id="Ojt-oP-apL"/>
</connections>
</imageView>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstAttribute="height" constant="30" id="2zB-SW-8LS"/>
<constraint firstItem="7bB-Lp-9yL" firstAttribute="centerY" secondItem="OUa-cb-0gQ" secondAttribute="centerY" id="i8p-kO-8p4"/>
<constraint firstItem="7bB-Lp-9yL" firstAttribute="leading" secondItem="OUa-cb-0gQ" secondAttribute="leading" constant="20" id="yNQ-qM-Bnd"/>
</constraints>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="w3S-pT-NYF">
<rect key="frame" x="0.0" y="30" width="375" height="250"/>
<rect key="frame" x="0.0" y="0.0" width="375" height="180"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Replying To" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="co5-cA-nTI">
<rect key="frame" x="20" y="8" width="335" height="50"/>
<rect key="frame" x="20" y="8" width="335" height="30"/>
<constraints>
<constraint firstAttribute="height" constant="50" id="YlZ-hK-ikz"/>
<constraint firstAttribute="height" constant="30" id="YlZ-hK-ikz"/>
</constraints>
<fontDescription key="fontDescription" type="boldSystem" pointSize="17"/>
<color key="textColor" name="Primary"/>
<nil key="highlightedColor"/>
</label>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="DBM-gJ-bmW" customClass="FLAnimatedImageView">
<rect key="frame" x="20" y="73" width="55" height="55"/>
<rect key="frame" x="20" y="53" width="45" height="45"/>
<constraints>
<constraint firstAttribute="height" constant="55" id="Odb-PW-C0m"/>
<constraint firstAttribute="width" constant="55" id="eJR-OK-tSg"/>
<constraint firstAttribute="height" constant="45" id="Odb-PW-C0m"/>
<constraint firstAttribute="width" constant="45" id="eJR-OK-tSg"/>
</constraints>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Display Name" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="htY-mN-l6s">
<rect key="frame" x="83" y="73" width="272" height="23"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="19"/>
<rect key="frame" x="73" y="53" width="282" height="20.333333333333329"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="17"/>
<color key="textColor" name="Text"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Username" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="P5v-hq-2Ee">
<rect key="frame" x="83" y="98" width="272" height="19.333333333333329"/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<rect key="frame" x="73" y="75.333333333333343" width="282" height="18"/>
<fontDescription key="fontDescription" type="system" pointSize="15"/>
<color key="textColor" name="Primary"/>
<nil key="highlightedColor"/>
</label>
<textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" scrollEnabled="NO" editable="NO" text="Content" textAlignment="natural" translatesAutoresizingMaskIntoConstraints="NO" id="wi5-07-ou8" customClass="UITextViewFixed" customModule="elpha_ios" customModuleProvider="target">
<rect key="frame" x="20" y="143" width="335" height="87"/>
<rect key="frame" x="20" y="113" width="335" height="59"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<color key="tintColor" name="Primary"/>
<color key="textColor" name="Text"/>
@ -1149,7 +1127,7 @@
<constraint firstItem="co5-cA-nTI" firstAttribute="leading" secondItem="w3S-pT-NYF" secondAttribute="leading" constant="20" id="AcU-cS-MkN"/>
<constraint firstItem="htY-mN-l6s" firstAttribute="leading" secondItem="DBM-gJ-bmW" secondAttribute="trailing" constant="8" id="BoK-Jc-mUZ"/>
<constraint firstAttribute="trailing" secondItem="wi5-07-ou8" secondAttribute="trailing" constant="20" id="LH6-kW-CnZ"/>
<constraint firstAttribute="bottom" secondItem="wi5-07-ou8" secondAttribute="bottom" constant="20" id="V6M-9G-xOh"/>
<constraint firstAttribute="bottom" secondItem="wi5-07-ou8" secondAttribute="bottom" constant="8" id="V6M-9G-xOh"/>
<constraint firstAttribute="trailing" secondItem="P5v-hq-2Ee" secondAttribute="trailing" constant="20" id="W4Q-IT-0Oe"/>
<constraint firstItem="wi5-07-ou8" firstAttribute="top" secondItem="DBM-gJ-bmW" secondAttribute="bottom" constant="15" id="Wad-bN-IVn"/>
<constraint firstItem="wi5-07-ou8" firstAttribute="leading" secondItem="w3S-pT-NYF" secondAttribute="leading" constant="20" id="YlR-MT-7L7"/>
@ -1159,47 +1137,38 @@
<constraint firstAttribute="trailing" secondItem="htY-mN-l6s" secondAttribute="trailing" constant="20" id="s3Z-Vx-dco"/>
<constraint firstAttribute="trailing" secondItem="co5-cA-nTI" secondAttribute="trailing" constant="20" id="sCf-x8-mNG"/>
<constraint firstItem="DBM-gJ-bmW" firstAttribute="leading" secondItem="w3S-pT-NYF" secondAttribute="leading" constant="20" id="tFt-Ki-sef"/>
<constraint firstAttribute="height" constant="250" id="zVv-ls-E8L"/>
<constraint firstAttribute="height" constant="180" id="zVv-ls-E8L"/>
</constraints>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="LeJ-qN-f3j">
<rect key="frame" x="0.0" y="280" width="375" height="449"/>
<rect key="frame" x="0.0" y="180" width="375" height="518"/>
<subviews>
<textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="top" borderStyle="roundedRect" placeholder="Type something..." textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="FWE-IU-mUe">
<rect key="frame" x="20" y="8" width="335" height="253"/>
<color key="textColor" name="Text"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<textInputTraits key="textInputTraits"/>
<connections>
<action selector="statusTextFieldEdited:" destination="MNp-Rq-Swn" eventType="editingDidEnd" id="9L6-su-P47"/>
</connections>
</textField>
<textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="Content Warning" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="D8y-nm-aIL">
<rect key="frame" x="20" y="363" width="335" height="40"/>
<rect key="frame" x="20" y="409.33333333333337" width="335" height="35"/>
<constraints>
<constraint firstAttribute="height" constant="40" id="Pja-qP-5Hb"/>
<constraint firstAttribute="height" constant="35" id="Pja-qP-5Hb"/>
</constraints>
<color key="textColor" name="Text"/>
<fontDescription key="fontDescription" type="system" pointSize="15"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits"/>
</textField>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="kek-uj-Dhl">
<rect key="frame" x="20" y="295" width="335" height="60"/>
<rect key="frame" x="20" y="361.33333333333337" width="335" height="40"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="ClN-BL-Y5Y">
<rect key="frame" x="0.0" y="15" width="80" height="30"/>
<rect key="frame" x="0.0" y="5" width="80" height="30"/>
<state key="normal" title="Attachment">
<color key="titleColor" name="Primary"/>
</state>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="uTI-IW-IxV">
<rect key="frame" x="95" y="15" width="45" height="30"/>
<rect key="frame" x="95" y="5" width="45" height="30"/>
<state key="normal" title="GIPHY">
<color key="titleColor" name="Primary"/>
</state>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="60a-gb-CaD">
<rect key="frame" x="289" y="12" width="46" height="36"/>
<rect key="frame" x="289" y="2" width="46" height="36"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="20"/>
<state key="normal" title=" Toot">
<color key="titleColor" name="Primary"/>
@ -1210,42 +1179,50 @@
<constraint firstItem="ClN-BL-Y5Y" firstAttribute="leading" secondItem="kek-uj-Dhl" secondAttribute="leading" id="2qT-cZ-WPa"/>
<constraint firstAttribute="trailing" secondItem="60a-gb-CaD" secondAttribute="trailing" id="F21-ZR-wIR"/>
<constraint firstItem="uTI-IW-IxV" firstAttribute="centerY" secondItem="kek-uj-Dhl" secondAttribute="centerY" id="OI6-mv-RDN"/>
<constraint firstAttribute="height" constant="60" id="kO5-xQ-oya"/>
<constraint firstAttribute="height" constant="40" id="kO5-xQ-oya"/>
<constraint firstItem="60a-gb-CaD" firstAttribute="centerY" secondItem="kek-uj-Dhl" secondAttribute="centerY" id="l6J-J9-XEH"/>
<constraint firstItem="uTI-IW-IxV" firstAttribute="leading" secondItem="ClN-BL-Y5Y" secondAttribute="trailing" constant="15" id="mGi-mX-tDA"/>
<constraint firstItem="ClN-BL-Y5Y" firstAttribute="centerY" secondItem="kek-uj-Dhl" secondAttribute="centerY" id="wm3-uo-Dp9"/>
</constraints>
</view>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="500" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="lj5-34-gkN">
<rect key="frame" x="20" y="269" width="335" height="18"/>
<fontDescription key="fontDescription" type="system" pointSize="15"/>
<rect key="frame" x="20" y="336.33333333333337" width="335" height="17"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<color key="textColor" name="Primary"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Description of content warnings." lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="L6c-Q0-xOK">
<rect key="frame" x="20" y="411" width="335" height="18"/>
<fontDescription key="fontDescription" type="system" pointSize="15"/>
<rect key="frame" x="20" y="452.33333333333337" width="335" height="15.666666666666686"/>
<fontDescription key="fontDescription" type="system" pointSize="13"/>
<color key="textColor" cocoaTouchSystemColor="scrollViewTexturedBackgroundColor"/>
<nil key="highlightedColor"/>
</label>
<textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" textAlignment="natural" translatesAutoresizingMaskIntoConstraints="NO" id="9BJ-55-1nh">
<rect key="frame" x="20" y="8" width="335" height="320.33333333333331"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<color key="tintColor" name="Primary"/>
<color key="textColor" name="Text"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits" autocapitalizationType="sentences" keyboardType="twitter" returnKeyType="send"/>
</textView>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstAttribute="trailing" secondItem="lj5-34-gkN" secondAttribute="trailing" constant="20" id="1Ww-Jb-slE"/>
<constraint firstItem="lj5-34-gkN" firstAttribute="top" secondItem="FWE-IU-mUe" secondAttribute="bottom" constant="8" id="4Vf-VW-dZw"/>
<constraint firstItem="9BJ-55-1nh" firstAttribute="top" secondItem="LeJ-qN-f3j" secondAttribute="top" constant="8" id="5mM-GI-M7m"/>
<constraint firstItem="9BJ-55-1nh" firstAttribute="leading" secondItem="LeJ-qN-f3j" secondAttribute="leading" constant="20" id="ASu-H6-J5i"/>
<constraint firstItem="lj5-34-gkN" firstAttribute="top" secondItem="9BJ-55-1nh" secondAttribute="bottom" constant="8" id="DQR-jf-Bxi"/>
<constraint firstAttribute="trailing" secondItem="D8y-nm-aIL" secondAttribute="trailing" constant="20" id="Ghs-6F-hzK"/>
<constraint firstItem="D8y-nm-aIL" firstAttribute="top" secondItem="kek-uj-Dhl" secondAttribute="bottom" constant="8" id="Hg7-Bi-qm9"/>
<constraint firstItem="L6c-Q0-xOK" firstAttribute="top" secondItem="D8y-nm-aIL" secondAttribute="bottom" constant="8" id="IIM-Kg-fbe"/>
<constraint firstAttribute="trailing" secondItem="kek-uj-Dhl" secondAttribute="trailing" constant="20" id="MAi-pv-PLM"/>
<constraint firstItem="D8y-nm-aIL" firstAttribute="leading" secondItem="LeJ-qN-f3j" secondAttribute="leading" constant="20" id="Tdy-Mo-HPS"/>
<constraint firstAttribute="bottom" secondItem="L6c-Q0-xOK" secondAttribute="bottom" constant="20" id="XkQ-Ab-eUM"/>
<constraint firstAttribute="bottom" secondItem="L6c-Q0-xOK" secondAttribute="bottom" constant="50" id="XkQ-Ab-eUM"/>
<constraint firstItem="lj5-34-gkN" firstAttribute="leading" secondItem="LeJ-qN-f3j" secondAttribute="leading" constant="20" id="bAc-FO-r0d"/>
<constraint firstItem="kek-uj-Dhl" firstAttribute="top" secondItem="lj5-34-gkN" secondAttribute="bottom" constant="8" id="bgR-6t-h4g"/>
<constraint firstItem="FWE-IU-mUe" firstAttribute="leading" secondItem="LeJ-qN-f3j" secondAttribute="leading" constant="20" id="ha4-jU-BVV"/>
<constraint firstAttribute="trailing" secondItem="FWE-IU-mUe" secondAttribute="trailing" constant="20" id="of8-Dh-4P0"/>
<constraint firstAttribute="trailing" secondItem="9BJ-55-1nh" secondAttribute="trailing" constant="20" id="fuN-h0-TiZ"/>
<constraint firstItem="L6c-Q0-xOK" firstAttribute="leading" secondItem="LeJ-qN-f3j" secondAttribute="leading" constant="20" id="pwG-Io-phi"/>
<constraint firstItem="kek-uj-Dhl" firstAttribute="leading" secondItem="LeJ-qN-f3j" secondAttribute="leading" constant="20" id="qKf-dD-i3Z"/>
<constraint firstItem="FWE-IU-mUe" firstAttribute="top" secondItem="LeJ-qN-f3j" secondAttribute="top" constant="8" id="uDV-vG-DPW"/>
<constraint firstAttribute="trailing" secondItem="L6c-Q0-xOK" secondAttribute="trailing" constant="20" id="z6e-Op-san"/>
</constraints>
</view>
@ -1255,7 +1232,7 @@
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstItem="yeC-3y-hAG" firstAttribute="top" secondItem="TaE-kM-jSH" secondAttribute="top" constant="50" id="0rg-i7-uGd"/>
<constraint firstItem="yeC-3y-hAG" firstAttribute="top" secondItem="TaE-kM-jSH" secondAttribute="top" id="0rg-i7-uGd"/>
<constraint firstItem="yeC-3y-hAG" firstAttribute="width" secondItem="TaE-kM-jSH" secondAttribute="width" id="HD2-Z9-XVR"/>
<constraint firstItem="yeC-3y-hAG" firstAttribute="leading" secondItem="TaE-kM-jSH" secondAttribute="leading" id="haA-5q-EG2"/>
<constraint firstAttribute="bottom" secondItem="yeC-3y-hAG" secondAttribute="bottom" id="iTf-Cg-o06"/>
@ -1263,13 +1240,26 @@
<constraint firstAttribute="trailing" secondItem="yeC-3y-hAG" secondAttribute="trailing" id="rh3-9A-KfJ"/>
</constraints>
</scrollView>
<imageView contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="Close" translatesAutoresizingMaskIntoConstraints="NO" id="7bB-Lp-9yL">
<rect key="frame" x="20" y="54" width="18" height="18"/>
<gestureRecognizers/>
<constraints>
<constraint firstAttribute="height" constant="18" id="aZg-Zz-VMv"/>
<constraint firstAttribute="width" constant="18" id="bRZ-Sb-1Sk"/>
</constraints>
<connections>
<outletCollection property="gestureRecognizers" destination="0V9-Ll-no6" appends="YES" id="Ojt-oP-apL"/>
</connections>
</imageView>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstItem="TaE-kM-jSH" firstAttribute="leading" secondItem="s1W-PY-h1k" secondAttribute="leading" id="E9Q-ZS-xWL"/>
<constraint firstItem="TaE-kM-jSH" firstAttribute="top" secondItem="s1W-PY-h1k" secondAttribute="top" id="Xyy-bK-L6U"/>
<constraint firstItem="7bB-Lp-9yL" firstAttribute="leading" secondItem="s1W-PY-h1k" secondAttribute="leading" constant="20" id="Ouq-rl-JgK"/>
<constraint firstItem="TaE-kM-jSH" firstAttribute="top" secondItem="s1W-PY-h1k" secondAttribute="top" constant="80" id="Xyy-bK-L6U"/>
<constraint firstAttribute="trailing" secondItem="TaE-kM-jSH" secondAttribute="trailing" id="u7p-wI-aDf"/>
<constraint firstAttribute="bottom" secondItem="TaE-kM-jSH" secondAttribute="bottom" id="uV9-Tt-dTp"/>
<constraint firstItem="TaE-kM-jSH" firstAttribute="top" secondItem="7bB-Lp-9yL" secondAttribute="bottom" constant="8" id="v75-Uk-r4i"/>
</constraints>
</view>
<blurEffect style="light"/>
@ -1285,6 +1275,7 @@
<viewLayoutGuide key="safeArea" id="17A-fV-wOt"/>
</view>
<connections>
<outlet property="bottomConstraint" destination="XkQ-Ab-eUM" id="KCl-nW-sRm"/>
<outlet property="contentWarningTextField" destination="D8y-nm-aIL" id="ZA5-ic-drj"/>
<outlet property="replyToAvatarImageView" destination="DBM-gJ-bmW" id="JYd-Nq-rlx"/>
<outlet property="replyToContentTextView" destination="wi5-07-ou8" id="FPX-mU-jq8"/>
@ -1292,7 +1283,7 @@
<outlet property="replyToUsernameLabel" destination="P5v-hq-2Ee" id="0IE-QS-d0j"/>
<outlet property="replyToView" destination="w3S-pT-NYF" id="sYr-Cy-B8b"/>
<outlet property="statusCharacterCountLabel" destination="lj5-34-gkN" id="LcE-IU-4um"/>
<outlet property="statusTextField" destination="FWE-IU-mUe" id="t2A-3P-h4d"/>
<outlet property="statusTextView" destination="9BJ-55-1nh" id="UZH-gU-M11"/>
<outlet property="tootButton" destination="60a-gb-CaD" id="I50-Ix-Kuw"/>
</connections>
</viewController>
@ -1303,7 +1294,7 @@
</connections>
</tapGestureRecognizer>
</objects>
<point key="canvasLocation" x="2701.5999999999999" y="-735.22167487684737"/>
<point key="canvasLocation" x="2702" y="-828"/>
</scene>
<!--Timeline-->
<scene sceneID="jGL-v8-K0I">
@ -1351,7 +1342,6 @@
</refreshControl>
<connections>
<segue destination="TVm-XQ-DKr" kind="presentation" identifier="TimelinesSegue" modalPresentationStyle="overCurrentContext" modalTransitionStyle="crossDissolve" id="Z24-89-f5Z"/>
<segue destination="MNp-Rq-Swn" kind="presentation" identifier="ComposeSegue" modalPresentationStyle="overCurrentContext" id="S80-S9-Doy"/>
</connections>
</tableViewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="KTy-Tn-EdD" userLabel="First Responder" sceneMemberID="firstResponder"/>
@ -1724,7 +1714,7 @@
<textInputTraits key="textInputTraits" autocorrectionType="no" spellCheckingType="no" smartDashesType="no" smartInsertDeleteType="no" smartQuotesType="no"/>
<dataDetectorType key="dataDetectorTypes" link="YES"/>
</textView>
<imageView contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="Close" translatesAutoresizingMaskIntoConstraints="NO" id="WAn-22-dqH">
<imageView contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="Close White" translatesAutoresizingMaskIntoConstraints="NO" id="WAn-22-dqH">
<rect key="frame" x="15" y="50" width="18" height="18"/>
<gestureRecognizers/>
<constraints>
@ -1851,6 +1841,7 @@
<image name="Boost Regular" width="20" height="24"/>
<image name="Clock" width="22" height="22"/>
<image name="Close" width="20" height="20"/>
<image name="Close White" width="20" height="20"/>
<image name="Globe" width="22" height="22"/>
<image name="Instance Placeholder" width="135" height="135"/>
<image name="Logo" width="180" height="180"/>

44
elpha-ios/ComposeViewController.swift

@ -15,16 +15,27 @@ class ComposeViewController: UIViewController {
@IBOutlet var replyToDisplayNameLabel: UILabel!
@IBOutlet var replyToUsernameLabel: UILabel!
@IBOutlet var replyToContentTextView: UITextViewFixed!
@IBOutlet var statusTextField: UITextField!
@IBOutlet var statusTextView: UITextView!
@IBOutlet var statusCharacterCountLabel: UILabel!
@IBOutlet var contentWarningTextField: UITextField!
@IBOutlet var tootButton: UIButton!
@IBOutlet var bottomConstraint: NSLayoutConstraint!
var replyToStatus: StatusMO? = nil
override func viewDidLoad() {
super.viewDidLoad()
replyToAvatarImageView.layer.cornerRadius = 10
replyToAvatarImageView.layer.masksToBounds = true
statusTextView.layer.cornerRadius = 10
statusTextView.layer.masksToBounds = true
statusTextView.delegate = self
NotificationCenter.default.addObserver(self, selector: #selector(keyboardNotification(notification:)), name: UIResponder.keyboardWillChangeFrameNotification, object: nil)
if let replyToStatus = replyToStatus {
replyToView.isHidden = false
@ -38,9 +49,13 @@ class ComposeViewController: UIViewController {
}
}
deinit {
NotificationCenter.default.removeObserver(self)
}
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
statusTextField.becomeFirstResponder()
statusTextView.becomeFirstResponder()
}
func setupReplyTo(status: StatusMO) {
@ -50,15 +65,30 @@ class ComposeViewController: UIViewController {
replyToUsernameLabel.text = "@\(account.acct!)"
}
replyToContentTextView.attributedText = status.content?.htmlAttributed(size: 15.0)
replyToContentTextView.attributedText = status.content?.htmlAttributed(size: 13.0)
}
@IBAction func statusTextFieldEdited(_ sender: Any) {
let characters = statusTextField.text!.count
statusCharacterCountLabel.text = String(500 - characters)
@objc func keyboardNotification(notification: NSNotification) {
if let userInfo = notification.userInfo {
let endFrame = (userInfo[UIResponder.keyboardFrameEndUserInfoKey] as? NSValue)?.cgRectValue
let endFrameY = endFrame?.origin.y ?? 0
if endFrameY >= UIScreen.main.bounds.size.height {
bottomConstraint.constant = 50.0
} else {
bottomConstraint.constant = endFrame?.size.height ?? 0.0
}
}
}
@IBAction func dismissTapped(_ sender: Any) {
dismiss(animated: true)
}
}
extension ComposeViewController: UITextViewDelegate {
func textViewDidChange(_ textView: UITextView) {
let characters = statusTextView.text!.count
statusCharacterCountLabel.text = String(500 - characters)
}
}

2
elpha-ios/FLAnimatedImageView+LoadImageURL.swift

@ -63,7 +63,7 @@ extension FLAnimatedImageView {
if let data = response.data {
DispatchQueue.main.async {
ImageCache.set(url: url, data: data)
self.contentMode = .scaleAspectFit
self.contentMode = .scaleAspectFill
if url.absoluteString.hasSuffix(".gif") {
self.animatedImage = FLAnimatedImage(animatedGIFData: data)

4
elpha-ios/MastodonAPI.swift

@ -66,7 +66,7 @@ class MastodonAPI {
return []
}
let regex = try! NSRegularExpression(pattern: "<[\\S]+(?:max_id|since_id)=([0-9]+)[\\S]*>; rel=\"(next|prev)\"", options: .caseInsensitive)
let regex = try! NSRegularExpression(pattern: "<[\\S]+(?:max_id|since_id|min_id)=([0-9]+)[\\S]*>; rel=\"(next|prev)\"", options: .caseInsensitive)
let matches = regex.matches(in: link, options: [], range: NSRange(location: 0, length: link.count))
return matches.map { match in
let statusRange = match.range(at: 1)
@ -103,7 +103,7 @@ class MastodonAPI {
if let pagination = pagination {
switch pagination.direction {
case .prev:
parameters["since_id"] = pagination.statusID
parameters["min_id"] = pagination.statusID
case .next:
parameters["max_id"] = pagination.statusID
}

9
elpha-ios/StatusView.xib

@ -271,10 +271,14 @@
<rect key="frame" x="8" y="86" width="359" height="22"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<color key="tintColor" name="Primary"/>
<gestureRecognizers/>
<color key="textColor" name="Text"/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<textInputTraits key="textInputTraits" autocorrectionType="no" spellCheckingType="no" smartDashesType="no" smartInsertDeleteType="no" smartQuotesType="no"/>
<dataDetectorType key="dataDetectorTypes" phoneNumber="YES" link="YES" address="YES" calendarEvent="YES" shipmentTrackingNumber="YES" flightNumber="YES" lookupSuggestion="YES"/>
<connections>
<outletCollection property="gestureRecognizers" destination="NIR-5D-8DX" appends="YES" id="mbF-iG-qgu"/>
</connections>
</textView>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
@ -565,6 +569,11 @@
<action selector="replyTapped:" destination="-1" id="fO5-jo-Y2d"/>
</connections>
</tapGestureRecognizer>
<tapGestureRecognizer id="NIR-5D-8DX">
<connections>
<action selector="mainViewTapped:" destination="-1" id="xeS-QA-LEZ"/>
</connections>
</tapGestureRecognizer>
</objects>
<resources>
<image name="Alert" width="22" height="22"/>

20
elpha-ios/TimelineTableViewController.swift

@ -16,8 +16,6 @@ class TimelineTableViewController: AbstractStatusTableViewController {
var feedbackGenerator: UINotificationFeedbackGenerator? = nil
var fetchedResultsController: NSFetchedResultsController<StatusMO>? = nil
var replyToStatus: StatusMO? = nil
override var currentPaginationContext: String {
get {
guard let timeline = AuthenticationManager.session?.timeline, let categoryString = timeline.category else {
@ -101,11 +99,6 @@ class TimelineTableViewController: AbstractStatusTableViewController {
}
}
override func replyTapped(status: StatusMO) {
replyToStatus = status
performSegue(withIdentifier: "ComposeSegue", sender: self)
}
@objc func openSettings() {
let storyboard = UIStoryboard(name: "Main", bundle: nil)
@ -119,8 +112,11 @@ class TimelineTableViewController: AbstractStatusTableViewController {
}
@objc func compose() {
replyToStatus = nil
performSegue(withIdentifier: "ComposeSegue", sender: self)
let storyboard = UIStoryboard(name: "Main", bundle: nil)
if let controller = storyboard.instantiateViewController(withIdentifier: "ComposeViewController") as? ComposeViewController {
present(controller, animated: true)
}
}
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
@ -129,12 +125,6 @@ class TimelineTableViewController: AbstractStatusTableViewController {
destination.delegate = self
}
}
if segue.identifier == "ComposeSegue" {
if let destination = segue.destination as? ComposeViewController {
destination.replyToStatus = replyToStatus
}
}
}
func createDefaultTimelines(account: AccountMO) {

Loading…
Cancel
Save