Browse Source

Add input accessory view

master
Dwayne Harris 6 years ago
parent
commit
4e9549e239
  1. 16
      elpha-ios.xcodeproj/project.pbxproj
  2. 6
      elpha-ios/AccountTableViewController.swift
  3. 8
      elpha-ios/AttachmentManager.swift
  4. 2
      elpha-ios/AttachmentViewController.swift
  5. 54
      elpha-ios/Base.lproj/Main.storyboard
  6. 54
      elpha-ios/ComposeAccessoryView.swift
  7. 91
      elpha-ios/ComposeAccessoryView.xib
  8. 39
      elpha-ios/ComposeViewController.swift
  9. 18
      elpha-ios/FLAnimatedImageView+SetImage.swift
  10. 6
      elpha-ios/SettingsTableViewController.swift
  11. 12
      elpha-ios/StatusTableViewController.swift
  12. 8
      elpha-ios/StatusView.swift

16
elpha-ios.xcodeproj/project.pbxproj

@ -15,6 +15,7 @@
15131EF6216DBA820092B252 /* AccountNavigationController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 15131EF5216DBA820092B252 /* AccountNavigationController.swift */; };
151AD4D9216899AD00F07403 /* AlamofireImage.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 1517EA842159D72200DE80D6 /* AlamofireImage.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
151AD4E621689A0F00F07403 /* Alamofire.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 157405C3215890BC00EEAAEB /* Alamofire.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
15222807219D37A500D2E5A6 /* ComposeAccessoryView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 15222806219D37A500D2E5A6 /* ComposeAccessoryView.swift */; };
152734D22186DC74003DB3C8 /* TimelinesViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 152734D12186DC74003DB3C8 /* TimelinesViewController.swift */; };
152FB0F8218ADC1A001D6574 /* AttachmentPageViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 152FB0F7218ADC1A001D6574 /* AttachmentPageViewController.swift */; };
152FB0FA218ADDD0001D6574 /* AttachmentViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 152FB0F9218ADDD0001D6574 /* AttachmentViewController.swift */; };
@ -25,7 +26,7 @@
152FBCF2219818AD0079B3E8 /* FieldTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 152FBCF1219818AD0079B3E8 /* FieldTableViewCell.swift */; };
1539509121894A38009BA6E7 /* AlertManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1539509021894A38009BA6E7 /* AlertManager.swift */; };
156902A0219A7D75002BF61F /* ComposeViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1569029F219A7D75002BF61F /* ComposeViewController.swift */; };
156902B3219A8A1C002BF61F /* FLAnimatedImageView+LoadImageURL.swift in Sources */ = {isa = PBXBuildFile; fileRef = 156902B2219A8A1C002BF61F /* FLAnimatedImageView+LoadImageURL.swift */; };
156902B3219A8A1C002BF61F /* FLAnimatedImageView+SetImage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 156902B2219A8A1C002BF61F /* FLAnimatedImageView+SetImage.swift */; };
156FF015217289380074D9CA /* AccountTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 156FF014217289380074D9CA /* AccountTableViewCell.swift */; };
156FF0312174797E0074D9CA /* StatusTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 156FF0302174797E0074D9CA /* StatusTableViewController.swift */; };
156FF04F2175CDBC0074D9CA /* MainStatusTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 156FF04E2175CDBC0074D9CA /* MainStatusTableViewCell.swift */; };
@ -53,6 +54,7 @@
15960E7E21329FED00C38CE9 /* AuthenticateViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 15960E7D21329FED00C38CE9 /* AuthenticateViewController.swift */; };
15960E822136668500C38CE9 /* TimelinesNavigationController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 15960E812136668500C38CE9 /* TimelinesNavigationController.swift */; };
15960E84213774FC00C38CE9 /* InstancesTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 15960E83213774FC00C38CE9 /* InstancesTableViewController.swift */; };
159B553A219D11E600964AC0 /* ComposeAccessoryView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 159B5539219D11E600964AC0 /* ComposeAccessoryView.xib */; };
15A79B2E215C63B6007A326E /* AlamofireImage.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1517EA842159D72200DE80D6 /* AlamofireImage.framework */; };
15A79B43215EB959007A326E /* CoreDataManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 15A79B42215EB959007A326E /* CoreDataManager.swift */; };
15B127922192467F00F4EF1D /* String+HtmlAttributed.swift in Sources */ = {isa = PBXBuildFile; fileRef = 15B127912192467F00F4EF1D /* String+HtmlAttributed.swift */; };
@ -249,6 +251,7 @@
15131EF3216DB8B90092B252 /* AccountTableViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountTableViewController.swift; sourceTree = "<group>"; };
15131EF5216DBA820092B252 /* AccountNavigationController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountNavigationController.swift; sourceTree = "<group>"; };
1517EA6F2159D72200DE80D6 /* AlamofireImage.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = AlamofireImage.xcodeproj; path = Frameworks/AlamofireImage/AlamofireImage.xcodeproj; sourceTree = "<group>"; };
15222806219D37A500D2E5A6 /* ComposeAccessoryView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ComposeAccessoryView.swift; sourceTree = "<group>"; };
1522EC752193EBA10082C3FA /* AlamofireNetworkActivityIndicator.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = AlamofireNetworkActivityIndicator.xcodeproj; path = Frameworks/AlamofireNetworkActivityIndicator/AlamofireNetworkActivityIndicator.xcodeproj; sourceTree = "<group>"; };
152734D12186DC74003DB3C8 /* TimelinesViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TimelinesViewController.swift; sourceTree = "<group>"; };
152FB0F7218ADC1A001D6574 /* AttachmentPageViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AttachmentPageViewController.swift; sourceTree = "<group>"; };
@ -259,7 +262,7 @@
152FBCF1219818AD0079B3E8 /* FieldTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FieldTableViewCell.swift; sourceTree = "<group>"; };
1539509021894A38009BA6E7 /* AlertManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AlertManager.swift; sourceTree = "<group>"; };
1569029F219A7D75002BF61F /* ComposeViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ComposeViewController.swift; sourceTree = "<group>"; };
156902B2219A8A1C002BF61F /* FLAnimatedImageView+LoadImageURL.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "FLAnimatedImageView+LoadImageURL.swift"; sourceTree = "<group>"; };
156902B2219A8A1C002BF61F /* FLAnimatedImageView+SetImage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "FLAnimatedImageView+SetImage.swift"; sourceTree = "<group>"; };
156FF014217289380074D9CA /* AccountTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountTableViewCell.swift; sourceTree = "<group>"; };
156FF0302174797E0074D9CA /* StatusTableViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StatusTableViewController.swift; sourceTree = "<group>"; };
156FF04E2175CDBC0074D9CA /* MainStatusTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainStatusTableViewCell.swift; sourceTree = "<group>"; };
@ -289,6 +292,7 @@
15960E7D21329FED00C38CE9 /* AuthenticateViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AuthenticateViewController.swift; sourceTree = "<group>"; };
15960E812136668500C38CE9 /* TimelinesNavigationController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TimelinesNavigationController.swift; sourceTree = "<group>"; };
15960E83213774FC00C38CE9 /* InstancesTableViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InstancesTableViewController.swift; sourceTree = "<group>"; };
159B5539219D11E600964AC0 /* ComposeAccessoryView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = ComposeAccessoryView.xib; sourceTree = "<group>"; };
15A79B42215EB959007A326E /* CoreDataManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CoreDataManager.swift; sourceTree = "<group>"; };
15B127912192467F00F4EF1D /* String+HtmlAttributed.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "String+HtmlAttributed.swift"; sourceTree = "<group>"; };
15B127A22192486200F4EF1D /* UIColor+HexString.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIColor+HexString.swift"; sourceTree = "<group>"; };
@ -358,6 +362,8 @@
children = (
15C91A03216AB32500D97DC3 /* AlertView.swift */,
15C91A01216AB2D600D97DC3 /* AlertView.xib */,
15222806219D37A500D2E5A6 /* ComposeAccessoryView.swift */,
159B5539219D11E600964AC0 /* ComposeAccessoryView.xib */,
15131EF1216D8D570092B252 /* StatusView.swift */,
15131ED7216D8C680092B252 /* StatusView.xib */,
);
@ -382,7 +388,7 @@
isa = PBXGroup;
children = (
159026CF2163069600D362DD /* Date+TimeAgo.swift */,
156902B2219A8A1C002BF61F /* FLAnimatedImageView+LoadImageURL.swift */,
156902B2219A8A1C002BF61F /* FLAnimatedImageView+SetImage.swift */,
15B127912192467F00F4EF1D /* String+HtmlAttributed.swift */,
15B127A22192486200F4EF1D /* UIColor+HexString.swift */,
);
@ -731,6 +737,7 @@
buildActionMask = 2147483647;
files = (
15960E67213145E200C38CE9 /* LaunchScreen.storyboard in Resources */,
159B553A219D11E600964AC0 /* ComposeAccessoryView.xib in Resources */,
15C91A02216AB2D600D97DC3 /* AlertView.xib in Resources */,
15960E64213145E200C38CE9 /* Assets.xcassets in Resources */,
157405B12151A5DA00EEAAEB /* README.md in Resources */,
@ -759,6 +766,7 @@
15131EF4216DB8B90092B252 /* AccountTableViewController.swift in Sources */,
156902A0219A7D75002BF61F /* ComposeViewController.swift in Sources */,
15F998352162C0E8009E58DA /* MastodonDataManager.swift in Sources */,
15222807219D37A500D2E5A6 /* ComposeAccessoryView.swift in Sources */,
15960E7A2132387A00C38CE9 /* MainTabBarController.swift in Sources */,
15960E7C213272CD00C38CE9 /* AuthenticationManager.swift in Sources */,
15B127922192467F00F4EF1D /* String+HtmlAttributed.swift in Sources */,
@ -780,7 +788,7 @@
159026D02163069600D362DD /* Date+TimeAgo.swift in Sources */,
152FBCD2219682E80079B3E8 /* AbstractStatusTableViewController.swift in Sources */,
15A79B43215EB959007A326E /* CoreDataManager.swift in Sources */,
156902B3219A8A1C002BF61F /* FLAnimatedImageView+LoadImageURL.swift in Sources */,
156902B3219A8A1C002BF61F /* FLAnimatedImageView+SetImage.swift in Sources */,
15BB72AB2171A8D4002F1FA4 /* TimelinesTableViewCell.swift in Sources */,
1574148D2169AD0100C841BD /* AttachmentManager.swift in Sources */,
156FF015217289380074D9CA /* AccountTableViewCell.swift in Sources */,

6
elpha-ios/AccountTableViewController.swift

@ -107,7 +107,7 @@ class AccountTableViewController: AbstractStatusTableViewController {
}
if let avatarURL = account.avatarURL {
avatarImageView.loadImageURL(avatarURL)
avatarImageView.setImage(withURL: avatarURL, withShadow: true)
}
displayNameLabel.text = account.displayName
@ -139,10 +139,6 @@ class AccountTableViewController: AbstractStatusTableViewController {
refreshControl?.addTarget(self, action: #selector(self.fetch), for: .valueChanged)
fieldTableViewController = FieldTableViewController()
avatarImageView.layer.shadowColor = UIColor.black.cgColor
avatarImageView.layer.shadowOpacity = 0.8
avatarImageView.layer.shadowOffset = CGSize.zero
avatarImageView.layer.shadowRadius = 10
avatarImageView.layer.cornerRadius = 10
avatarImageView.layer.masksToBounds = true

8
elpha-ios/AttachmentManager.swift

@ -51,7 +51,7 @@ class AttachmentManager: NSObject {
imageView.addGestureRecognizer(tapGestureRecognizer)
imageView.isUserInteractionEnabled = true
imageView.loadImageURL(attachment.url!)
imageView.setImage(withURL: attachment.url!)
view.addSubview(imageView)
imageView.translatesAutoresizingMaskIntoConstraints = false
@ -80,7 +80,7 @@ class AttachmentManager: NSObject {
imageView.addGestureRecognizer(tapGestureRecognizer)
imageView.isUserInteractionEnabled = true
imageView.loadImageURL((attachments[index] as! AttachmentMO).url!)
imageView.setImage(withURL: (attachments[index] as! AttachmentMO).url!)
view.addSubview(imageView)
imageView.translatesAutoresizingMaskIntoConstraints = false
@ -115,7 +115,7 @@ class AttachmentManager: NSObject {
imageView.addGestureRecognizer(tapGestureRecognizer)
imageView.isUserInteractionEnabled = true
imageView.loadImageURL((attachments[index] as! AttachmentMO).url!)
imageView.setImage(withURL: (attachments[index] as! AttachmentMO).url!)
view.addSubview(imageView)
imageView.translatesAutoresizingMaskIntoConstraints = false
@ -160,7 +160,7 @@ class AttachmentManager: NSObject {
imageView.addGestureRecognizer(tapGestureRecognizer)
imageView.isUserInteractionEnabled = true
imageView.loadImageURL((attachments[index] as! AttachmentMO).url!)
imageView.setImage(withURL: (attachments[index] as! AttachmentMO).url!)
view.addSubview(imageView)
imageView.translatesAutoresizingMaskIntoConstraints = false

2
elpha-ios/AttachmentViewController.swift

@ -34,7 +34,7 @@ class AttachmentViewController: UIViewController {
if let attachment = attachment {
attachmentScrollView.delegate = self
attachmentImageView.loadImageURL(attachment.url!)
attachmentImageView.setImage(withURL: attachment.url!, withShadow: false, withContentMode: .scaleAspectFit)
if let content = attachment.status?.content {
statusTextView.attributedText = content.htmlAttributed(size: 14, centered: true, color: UIColor.white)

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

@ -1144,44 +1144,8 @@
<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="391.33333333333337" width="335" height="40"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="ClN-BL-Y5Y">
<rect key="frame" x="0.0" y="8.6666666666666288" width="22" height="23"/>
<state key="normal" image="Attachment">
<color key="titleColor" name="Primary"/>
</state>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="uTI-IW-IxV">
<rect key="frame" x="37" y="9" width="24" height="22"/>
<state key="normal" image="Visibility">
<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="2" width="46" height="36"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="20"/>
<state key="normal" title=" Toot">
<color key="titleColor" name="Primary"/>
</state>
<connections>
<action selector="tootTapped:" destination="MNp-Rq-Swn" eventType="touchUpInside" id="2p7-22-rrO"/>
</connections>
</button>
</subviews>
<constraints>
<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="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="366.33333333333337" width="335" height="17"/>
<rect key="frame" x="20" y="402.33333333333337" width="335" height="17"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<color key="textColor" name="Primary"/>
<nil key="highlightedColor"/>
@ -1193,7 +1157,7 @@
<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="350.33333333333331"/>
<rect key="frame" x="20" y="8" width="335" height="386.33333333333331"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<color key="tintColor" name="Primary"/>
<color key="textColor" name="Text"/>
@ -1208,16 +1172,13 @@
<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="50" id="XkQ-Ab-eUM"/>
<constraint firstItem="D8y-nm-aIL" firstAttribute="top" secondItem="lj5-34-gkN" secondAttribute="bottom" constant="20" id="ZTP-bY-fRh"/>
<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 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 firstAttribute="trailing" secondItem="L6c-Q0-xOK" secondAttribute="trailing" constant="20" id="z6e-Op-san"/>
</constraints>
</view>
@ -1279,7 +1240,6 @@
<outlet property="replyToView" destination="w3S-pT-NYF" id="sYr-Cy-B8b"/>
<outlet property="statusCharacterCountLabel" destination="lj5-34-gkN" id="LcE-IU-4um"/>
<outlet property="statusTextView" destination="9BJ-55-1nh" id="UZH-gU-M11"/>
<outlet property="tootButton" destination="60a-gb-CaD" id="I50-Ix-Kuw"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="Wh6-Fa-5O1" userLabel="First Responder" sceneMemberID="firstResponder"/>
@ -1523,6 +1483,7 @@
</constraints>
<connections>
<outletCollection property="gestureRecognizers" destination="dVp-l7-qxz" appends="YES" id="37g-LW-Ne9"/>
<outletCollection property="gestureRecognizers" destination="IYd-yl-Al5" appends="YES" id="G65-E0-qae"/>
</connections>
</view>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="15" translatesAutoresizingMaskIntoConstraints="NO" id="hBh-J5-s0Y">
@ -1653,6 +1614,11 @@
<action selector="favoriteTapped:" destination="RAJ-ub-len" id="JNI-Rd-xSW"/>
</connections>
</tapGestureRecognizer>
<tapGestureRecognizer id="IYd-yl-Al5">
<connections>
<action selector="replyTapped:" destination="RAJ-ub-len" id="uWr-ZP-fyf"/>
</connections>
</tapGestureRecognizer>
</objects>
<point key="canvasLocation" x="2701.5999999999999" y="-22.167487684729064"/>
</scene>
@ -1833,7 +1799,6 @@
</scenes>
<resources>
<image name="Account" width="25" height="25"/>
<image name="Attachment" width="22" height="23"/>
<image name="Boost Regular" width="20" height="24"/>
<image name="Clock" width="22" height="22"/>
<image name="Close" width="20" height="20"/>
@ -1845,7 +1810,6 @@
<image name="Share" width="18" height="22"/>
<image name="Star Regular" width="22" height="22"/>
<image name="Timelines" width="20" height="21"/>
<image name="Visibility" width="24" height="18"/>
<namedColor name="Background Primary">
<color red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor>

54
elpha-ios/ComposeAccessoryView.swift

@ -0,0 +1,54 @@
//
// ComposeAccessoryView.swift
// elpha-ios
//
// Created by Dwayne Harris on 11/14/18.
// Copyright © 2018 Elpha. All rights reserved.
//
import UIKit
protocol ComposeAccessoryViewDelegate {
func attachmentTapped()
func visibilityTapped()
func tootTapped()
}
class ComposeAccessoryView: UIView {
@IBOutlet var contentView: UIView!
@IBOutlet var attachmentButton: UIButton!
@IBOutlet var visibilityButton: UIButton!
@IBOutlet var tootButton: UIButton!
var delegate: ComposeAccessoryViewDelegate? = 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("ComposeAccessoryView", owner: self, options: nil)
addSubview(contentView)
contentView.frame = self.bounds
}
@IBAction func attachmentTapped(_ sender: Any) {
print("Attachment tapped 1")
delegate?.attachmentTapped()
}
@IBAction func visibilityTapped(_ sender: Any) {
print("Visibility tapped 1")
delegate?.visibilityTapped()
}
@IBAction func tootTapped(_ sender: Any) {
delegate?.tootTapped()
}
}

91
elpha-ios/ComposeAccessoryView.xib

@ -0,0 +1,91 @@
<?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="ComposeAccessoryView" customModule="elpha_ios" customModuleProvider="target">
<connections>
<outlet property="attachmentButton" destination="p9E-dV-blq" id="PGC-qB-cmp"/>
<outlet property="contentView" destination="iN0-l3-epB" id="RRP-dz-Q9f"/>
<outlet property="tootButton" destination="f6o-l1-yXR" id="9rx-wt-RGB"/>
<outlet property="visibilityButton" destination="ZLh-n0-Jkb" id="rhj-Rh-j8C"/>
</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="55"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="p9E-dV-blq">
<rect key="frame" x="20" y="17" width="22" height="23"/>
<constraints>
<constraint firstAttribute="width" constant="22" id="FYE-si-fNa"/>
<constraint firstAttribute="height" constant="23" id="XFq-lD-Puo"/>
</constraints>
<state key="normal" image="Attachment">
<color key="titleColor" name="Primary"/>
</state>
<connections>
<action selector="attachmentTapped:" destination="-1" eventType="touchUpInside" id="qNg-9t-ZlU"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="f6o-l1-yXR">
<rect key="frame" x="284" y="17" width="71" height="23"/>
<constraints>
<constraint firstAttribute="height" constant="23" id="TKB-N5-qlj"/>
</constraints>
<fontDescription key="fontDescription" type="boldSystem" pointSize="18"/>
<state key="normal" title=" Toot!" image="Compose">
<color key="titleColor" name="Primary"/>
</state>
<connections>
<action selector="tootTapped:" destination="-1" eventType="touchUpInside" id="Pke-RH-QSD"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="ZLh-n0-Jkb">
<rect key="frame" x="57" y="18" width="79" height="22"/>
<constraints>
<constraint firstAttribute="height" constant="22" id="gTK-Rc-C4r"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="13"/>
<state key="normal" title=" Visibility" image="Visibility">
<color key="titleColor" name="Primary"/>
</state>
<connections>
<action selector="visibilityTapped:" destination="-1" eventType="touchUpInside" id="f3p-KD-4Z7"/>
</connections>
</button>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="ZLh-n0-Jkb" firstAttribute="leading" secondItem="p9E-dV-blq" secondAttribute="trailing" constant="15" id="5pc-4Y-ZhS"/>
<constraint firstItem="vUN-kp-3ea" firstAttribute="bottom" secondItem="p9E-dV-blq" secondAttribute="bottom" constant="15" id="HUF-cO-ElL"/>
<constraint firstAttribute="bottom" secondItem="ZLh-n0-Jkb" secondAttribute="bottom" constant="15" id="UkW-u6-WMg"/>
<constraint firstItem="p9E-dV-blq" firstAttribute="leading" secondItem="vUN-kp-3ea" secondAttribute="leading" constant="20" id="jVv-Cj-aR0"/>
<constraint firstItem="vUN-kp-3ea" firstAttribute="bottom" secondItem="f6o-l1-yXR" secondAttribute="bottom" constant="15" id="pJj-50-4rA"/>
<constraint firstItem="vUN-kp-3ea" firstAttribute="trailing" secondItem="f6o-l1-yXR" secondAttribute="trailing" constant="20" id="rjA-c3-AEe"/>
</constraints>
<nil key="simulatedTopBarMetrics"/>
<nil key="simulatedBottomBarMetrics"/>
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
<viewLayoutGuide key="safeArea" id="vUN-kp-3ea"/>
<point key="canvasLocation" x="138.40000000000001" y="427.73613193403304"/>
</view>
</objects>
<resources>
<image name="Attachment" width="22" height="23"/>
<image name="Compose" width="22" height="23"/>
<image name="Visibility" width="24" height="18"/>
<namedColor name="Primary">
<color red="0.32549019607843138" green="0.20392156862745098" blue="0.55686274509803924" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor>
</resources>
</document>

39
elpha-ios/ComposeViewController.swift

@ -18,12 +18,12 @@ class ComposeViewController: UIViewController {
@IBOutlet var statusTextView: UITextView!
@IBOutlet var statusCharacterCountLabel: UILabel!
@IBOutlet var contentWarningTextField: UITextField!
@IBOutlet var tootButton: UIButton!
@IBOutlet var bottomConstraint: NSLayoutConstraint!
let characterLimit = 500
var feedbackGenerator: UINotificationFeedbackGenerator? = nil
var replyToStatus: StatusMO? = nil
var composeAccessoryView: ComposeAccessoryView? = nil
override func viewDidLoad() {
super.viewDidLoad()
@ -36,7 +36,11 @@ class ComposeViewController: UIViewController {
statusTextView.layer.cornerRadius = 10
statusTextView.layer.masksToBounds = true
composeAccessoryView = ComposeAccessoryView()
composeAccessoryView!.delegate = self
statusTextView.delegate = self
statusTextView.inputAccessoryView = composeAccessoryView
NotificationCenter.default.addObserver(self, selector: #selector(keyboardNotification(notification:)), name: UIResponder.keyboardWillChangeFrameNotification, object: nil)
@ -64,7 +68,7 @@ class ComposeViewController: UIViewController {
func setupReplyTo(status: StatusMO) {
if let account = status.account {
replyToAvatarImageView.loadImageURL(account.avatarURL!)
replyToAvatarImageView.setImage(withURL: account.avatarURL!)
replyToDisplayNameLabel.text = account.displayName
replyToUsernameLabel.text = "@\(account.acct!)"
}
@ -80,16 +84,36 @@ class ComposeViewController: UIViewController {
if endFrameY >= UIScreen.main.bounds.size.height {
bottomConstraint.constant = 50.0
} else {
bottomConstraint.constant = endFrame?.size.height ?? 0.0
bottomConstraint.constant = (endFrame?.size.height ?? 0.0) + 15
}
}
}
@IBAction func dismissTapped(_ sender: Any) {
statusTextView.inputAccessoryView = nil
statusTextView.reloadInputViews()
dismiss(animated: true)
}
}
extension ComposeViewController: UITextViewDelegate {
func textViewDidChange(_ textView: UITextView) {
let characters = statusTextView.text!.count
statusCharacterCountLabel.text = String(characterLimit - characters)
}
}
extension ComposeViewController: ComposeAccessoryViewDelegate {
func attachmentTapped() {
print("Attachment tapped")
}
func visibilityTapped() {
print("Visibility tapped")
}
@IBAction func tootTapped(_ sender: Any) {
func tootTapped() {
if let content = statusTextView.text {
if !content.isEmpty && content.count <= characterLimit {
feedbackGenerator?.prepare()
@ -112,10 +136,3 @@ class ComposeViewController: UIViewController {
}
}
}
extension ComposeViewController: UITextViewDelegate {
func textViewDidChange(_ textView: UITextView) {
let characters = statusTextView.text!.count
statusCharacterCountLabel.text = String(characterLimit - characters)
}
}

18
elpha-ios/FLAnimatedImageView+LoadImageURL.swift → elpha-ios/FLAnimatedImageView+SetImage.swift

@ -1,5 +1,5 @@
//
// FLAnimatedImage+LoadImageURL.swift
// FLAnimatedImage+SetImage.swift
// elpha-ios
//
// Created by Dwayne Harris on 11/12/18.
@ -49,8 +49,20 @@ extension FLAnimatedImageView {
self.image = UIImage(named: "Help")
}
func loadImageURL(_ url: URL, contentMode: UIView.ContentMode = .scaleAspectFit) {
func setImage(withURL url: URL, withShadow shadow: Bool = false, withContentMode contentMode: UIView.ContentMode = .scaleAspectFill) {
func setShadow() {
if shadow {
self.layer.shadowColor = UIColor.black.cgColor
self.layer.shadowOpacity = 0.8
self.layer.shadowOffset = CGSize.zero
self.layer.shadowRadius = 10
}
}
if let data = ImageCache.get(url: url) {
self.contentMode = contentMode
setShadow()
if url.absoluteString.hasSuffix(".gif") {
self.animatedImage = FLAnimatedImage(animatedGIFData: data)
} else {
@ -63,7 +75,9 @@ extension FLAnimatedImageView {
if let data = response.data {
DispatchQueue.main.async {
ImageCache.set(url: url, data: data)
self.contentMode = contentMode
setShadow()
if url.absoluteString.hasSuffix(".gif") {
self.animatedImage = FLAnimatedImage(animatedGIFData: data)

6
elpha-ios/SettingsTableViewController.swift

@ -21,16 +21,12 @@ class SettingsTableViewController: UITableViewController {
navigationItem.title = "Settings"
avatarImageView.layer.shadowColor = UIColor.black.cgColor
avatarImageView.layer.shadowOpacity = 0.8
avatarImageView.layer.shadowOffset = CGSize.zero
avatarImageView.layer.shadowRadius = 10
avatarImageView.layer.cornerRadius = 10
avatarImageView.layer.masksToBounds = true
if let account = AuthenticationManager.session?.account {
headerImageView.af_setImage(withURL: account.headerURL!)
avatarImageView.loadImageURL(account.avatarURL!)
avatarImageView.setImage(withURL: account.avatarURL!, withShadow: true)
displayNameLabel.text = account.displayName
usernameLabel.text = "@\(account.acct!)"
}

12
elpha-ios/StatusTableViewController.swift

@ -120,6 +120,10 @@ class StatusTableViewController: AbstractStatusTableViewController, UIGestureRec
}
}
@IBAction func replyTapped(_ sender: Any) {
self.replyTapped(status: status!)
}
func fetchStatuses(completion: @escaping (Error?) -> Void) {
if let status = status {
loading = true
@ -263,17 +267,13 @@ extension StatusTableViewController {
}
cell.contentTextView.delegate = self
cell.avatarImageView.layer.shadowColor = UIColor.black.cgColor
cell.avatarImageView.layer.shadowOpacity = 0.8
cell.avatarImageView.layer.shadowOffset = CGSize.zero
cell.avatarImageView.layer.shadowRadius = 10
cell.avatarImageView.layer.cornerRadius = 10
cell.avatarImageView.layer.masksToBounds = true
func updateAccountView(status: StatusMO) {
if let account = status.account {
cell.avatarImageView.loadImageURL(account.avatarURL!)
cell.avatarImageView.setImage(withURL: account.avatarURL!, withShadow: true)
cell.displayNameLabel.text = account.displayName
cell.usernameLabel.text = "@\(account.acct!)"
}

8
elpha-ios/StatusView.swift

@ -250,7 +250,7 @@ class StatusView: UIView {
func updateStatusContent(_ status: StatusMO) {
if let account = status.account {
avatarImageView.loadImageURL(account.avatarURL!)
avatarImageView.setImage(withURL: account.avatarURL!)
displayNameLabel.text = account.displayName
usernameLabel.text = "@\(account.acct!)"
}
@ -333,7 +333,7 @@ class StatusView: UIView {
boostView.isHidden = false
if let account = status.account {
boostAvatarImageView.loadImageURL(account.avatarURL!)
boostAvatarImageView.setImage(withURL: account.avatarURL!)
boostDisplayNameLabel.text = account.displayName
boostUsernameLabel.text = "@\(account.acct!)"
}
@ -341,7 +341,7 @@ class StatusView: UIView {
updateStatusContent(reblog)
} else {
if let account = status.account {
avatarImageView.loadImageURL(account.avatarURL!)
avatarImageView.setImage(withURL: account.avatarURL!)
displayNameLabel.text = account.displayName
usernameLabel.text = "@\(account.acct!)"
}
@ -352,7 +352,7 @@ class StatusView: UIView {
if let replyAccountID = status.inReplyToAccountID {
if let replyAccount = MastodonDataManager.account(id: replyAccountID) {
replyView.isHidden = false
replyAvatarImageView.loadImageURL(replyAccount.avatarURL!)
replyAvatarImageView.setImage(withURL: replyAccount.avatarURL!)
replyDisplayNameLabel.text = replyAccount.displayName
replyUsernameLabel.text = "@\(replyAccount.acct!)"
}

Loading…
Cancel
Save