Browse Source

Add more button to status

pixelfed
Shadowfacts 3 years ago
parent
commit
e75b03f28d
Signed by: shadowfacts GPG Key ID: 94A5AB95422746E5
  1. 84
      Artwork/Icons/More.svg
  2. 1
      Tusker/Assets.xcassets/More.imageset/Contents.json
  3. BIN
      Tusker/Assets.xcassets/More.imageset/More.pdf
  4. 15
      Tusker/Extensions/UIViewController+Delegates.swift
  5. 10
      Tusker/Views/Profile Header/ProfileHeaderTableViewCell.xib
  6. 4
      Tusker/Views/Status/ConversationMainStatusTableViewCell.swift
  7. 20
      Tusker/Views/Status/ConversationMainStatusTableViewCell.xib
  8. 6
      Tusker/Views/Status/StatusTableViewCell.swift
  9. 20
      Tusker/Views/Status/StatusTableViewCell.xib

84
Artwork/Icons/More.svg

@ -0,0 +1,84 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="80"
height="40"
viewBox="0 0 21.166666 10.583334"
version="1.1"
id="svg1623"
inkscape:version="0.92.2 5c3e80d, 2017-08-06"
sodipodi:docname="More.svg">
<defs
id="defs1617" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="5.6"
inkscape:cx="83.737701"
inkscape:cy="47.564201"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="false"
inkscape:window-width="2560"
inkscape:window-height="1395"
inkscape:window-x="1920"
inkscape:window-y="1"
inkscape:window-maximized="1"
units="px" />
<metadata
id="metadata1620">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(0,-286.41665)">
<rect
style="fill:#000000;fill-opacity:0;stroke:none;stroke-width:2.73260474;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:stroke markers fill"
id="rect2326"
width="21.166668"
height="10.583334"
x="6.9388939e-18"
y="286.41666" />
<circle
style="fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.15993595;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:stroke markers fill"
id="path2187"
cx="2.6458333"
cy="291.70831"
r="2.6458333" />
<circle
cy="291.70831"
cx="-10.583333"
id="circle2189"
style="fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.15993595;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:stroke markers fill"
transform="scale(-1,1)"
r="2.6458333" />
<circle
style="fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.15993595;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:stroke markers fill"
id="circle2191"
cx="18.520834"
cy="291.70831"
r="2.6458333" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.9 KiB

1
Tusker/Assets.xcassets/More.imageset/Contents.json

@ -19,6 +19,7 @@
"author" : "xcode"
},
"properties" : {
"template-rendering-intent" : "template",
"preserves-vector-representation" : true
}
}

BIN
Tusker/Assets.xcassets/More.imageset/More.pdf

Binary file not shown.

15
Tusker/Extensions/UIViewController+Delegates.swift

@ -77,7 +77,20 @@ extension StatusTableViewCellDelegate where Self: UIViewController {
present(vc, animated: true)
}
func updatedStatus(for cell: StatusTableViewCell, status: Status) {
func showMoreOptions(status: Status) {
let alert = UIAlertController(title: nil, message: nil, preferredStyle: .actionSheet)
if let url = status.url {
alert.addAction(UIAlertAction(title: "Open in Safari...", style: .default, handler: { _ in
let vc = SFSafariViewController(url: url)
self.present(vc, animated: true)
}))
alert.addAction(UIAlertAction(title: "Share...", style: .default, handler: { _ in
let vc = UIActivityViewController(activityItems: [url], applicationActivities: nil)
self.present(vc, animated: true)
}))
}
alert.addAction(UIAlertAction(title: "Cancel", style: .cancel, handler: nil))
present(alert, animated: true)
}
}

10
Tusker/Views/Profile Header/ProfileHeaderTableViewCell.xib

@ -60,13 +60,13 @@
</constraints>
</view>
<button opaque="NO" alpha="0.59999999999999998" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="qiv-gB-kiX">
<rect key="frame" x="306" y="127" width="53" height="15"/>
<rect key="frame" x="309" y="117" width="50" height="25"/>
<constraints>
<constraint firstAttribute="height" constant="15" id="9Ch-uS-uEA"/>
<constraint firstAttribute="width" constant="53" id="9yR-dQ-Zfr"/>
<constraint firstAttribute="width" secondItem="qiv-gB-kiX" secondAttribute="height" multiplier="2:1" id="5iw-fx-9ax"/>
<constraint firstAttribute="height" constant="25" id="9Ch-uS-uEA"/>
</constraints>
<color key="tintColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<state key="normal" title="Button" image="More"/>
<state key="normal" image="More"/>
<connections>
<action selector="morePressed:" destination="iN0-l3-epB" eventType="touchUpInside" id="0go-4p-qDa"/>
</connections>
@ -106,6 +106,6 @@
</view>
</objects>
<resources>
<image name="More" width="263" height="75"/>
<image name="More" width="60" height="30"/>
</resources>
</document>

4
Tusker/Views/Status/ConversationMainStatusTableViewCell.swift

@ -200,6 +200,10 @@ class ConversationMainStatusTableViewCell: UITableViewCell, PreferencesAdaptive
}
}
@IBAction func morePressed(_ sender: Any) {
delegate?.showMoreOptions(status: status)
}
}
extension ConversationMainStatusTableViewCell: HTMLContentLabelDelegate {

20
Tusker/Views/Status/ConversationMainStatusTableViewCell.xib

@ -79,8 +79,8 @@
<constraint firstAttribute="height" priority="999" constant="200" id="UMv-Bk-ZyY"/>
</constraints>
</view>
<stackView opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" spacing="20" translatesAutoresizingMaskIntoConstraints="NO" id="3Bg-XP-d13">
<rect key="frame" x="0.0" y="164" width="121.5" height="20"/>
<stackView opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" distribution="equalSpacing" spacing="20" translatesAutoresizingMaskIntoConstraints="NO" id="3Bg-XP-d13">
<rect key="frame" x="0.0" y="164" width="343" height="20"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="leading" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="2cc-lE-AdG">
<rect key="frame" x="0.0" y="0.0" width="27" height="20"/>
@ -93,7 +93,7 @@
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="DhN-rJ-jdA">
<rect key="frame" x="47" y="0.0" width="21" height="20"/>
<rect key="frame" x="101" y="0.0" width="21" height="20"/>
<constraints>
<constraint firstAttribute="width" secondItem="DhN-rJ-jdA" secondAttribute="height" multiplier="137:131" id="POd-P3-n6S"/>
</constraints>
@ -103,7 +103,7 @@
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="GUG-f7-Hdy">
<rect key="frame" x="88" y="0.0" width="33.5" height="20"/>
<rect key="frame" x="196" y="0.0" width="33" height="20"/>
<constraints>
<constraint firstAttribute="width" secondItem="GUG-f7-Hdy" secondAttribute="height" multiplier="927:558" id="V8H-aT-eIJ"/>
</constraints>
@ -112,6 +112,16 @@
<action selector="reblogPressed:" destination="iN0-l3-epB" eventType="touchUpInside" id="SAf-RN-q8N"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Ujo-Ap-dmK">
<rect key="frame" x="303" y="0.0" width="40" height="20"/>
<constraints>
<constraint firstAttribute="width" secondItem="Ujo-Ap-dmK" secondAttribute="height" multiplier="2:1" id="9DR-cM-JaD"/>
</constraints>
<state key="normal" image="More"/>
<connections>
<action selector="morePressed:" destination="iN0-l3-epB" eventType="touchUpInside" id="dWb-67-CoL"/>
</connections>
</button>
</subviews>
<constraints>
<constraint firstAttribute="height" constant="20" id="bqe-m8-5Lo"/>
@ -121,6 +131,7 @@
<constraints>
<constraint firstItem="Cnd-Fj-B7l" firstAttribute="width" secondItem="GuG-Qd-B8I" secondAttribute="width" id="2hS-RG-81T"/>
<constraint firstItem="IF9-9U-Gk0" firstAttribute="width" secondItem="GuG-Qd-B8I" secondAttribute="width" id="8A8-wi-7sg"/>
<constraint firstItem="3Bg-XP-d13" firstAttribute="width" secondItem="GuG-Qd-B8I" secondAttribute="width" id="iIq-gh-90O"/>
</constraints>
</stackView>
</subviews>
@ -148,6 +159,7 @@
</objects>
<resources>
<image name="Favorite" width="390" height="371"/>
<image name="More" width="60" height="30"/>
<image name="Reblog" width="679" height="406"/>
<image name="Reply" width="155" height="114"/>
</resources>

6
Tusker/Views/Status/StatusTableViewCell.swift

@ -25,7 +25,7 @@ protocol StatusTableViewCellDelegate {
func showLargeImage(_ image: UIImage, description: String?, animatingFrom originView: UIView)
func updatedStatus(for cell: StatusTableViewCell, status: Status)
func showMoreOptions(status: Status)
}
@ -248,6 +248,10 @@ class StatusTableViewCell: UITableViewCell, PreferencesAdaptive {
}
}
@IBAction func morePressed(_ sender: Any) {
delegate?.showMoreOptions(status: status)
}
}
extension StatusTableViewCell: HTMLContentLabelDelegate {

20
Tusker/Views/Status/StatusTableViewCell.xib

@ -86,8 +86,8 @@
<constraint firstAttribute="height" priority="999" constant="200" id="J42-49-2MU"/>
</constraints>
</view>
<stackView opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" spacing="15" translatesAutoresizingMaskIntoConstraints="NO" id="Zlb-yt-NTw">
<rect key="frame" x="0.0" y="119" width="91" height="15"/>
<stackView opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" distribution="equalSpacing" spacing="15" translatesAutoresizingMaskIntoConstraints="NO" id="Zlb-yt-NTw">
<rect key="frame" x="0.0" y="119" width="343" height="15"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" contentHorizontalAlignment="leading" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="rKF-yF-KIa">
<rect key="frame" x="0.0" y="0.0" width="20.5" height="15"/>
@ -100,7 +100,7 @@
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="x0t-TR-jJ4">
<rect key="frame" x="35.5" y="0.0" width="15.5" height="15"/>
<rect key="frame" x="104.5" y="0.0" width="15.5" height="15"/>
<constraints>
<constraint firstAttribute="width" secondItem="x0t-TR-jJ4" secondAttribute="height" multiplier="137:131" id="MRT-Ae-MgD"/>
</constraints>
@ -110,7 +110,7 @@
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="6tW-z8-Qh9">
<rect key="frame" x="66" y="0.0" width="25" height="15"/>
<rect key="frame" x="204" y="0.0" width="25" height="15"/>
<constraints>
<constraint firstAttribute="width" secondItem="6tW-z8-Qh9" secondAttribute="height" multiplier="927:558" id="lV9-JI-Q4e"/>
</constraints>
@ -119,6 +119,16 @@
<action selector="reblogPressed:" destination="iN0-l3-epB" eventType="touchUpInside" id="JQI-VT-wTt"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="982-J4-NGl">
<rect key="frame" x="313" y="0.0" width="30" height="15"/>
<constraints>
<constraint firstAttribute="width" secondItem="982-J4-NGl" secondAttribute="height" multiplier="2:1" id="v0d-ft-gmZ"/>
</constraints>
<state key="normal" image="More"/>
<connections>
<action selector="morePressed:" destination="iN0-l3-epB" eventType="touchUpInside" id="dcV-Ez-EIe"/>
</connections>
</button>
</subviews>
<constraints>
<constraint firstAttribute="height" constant="15" id="TKC-Uc-C4K"/>
@ -127,6 +137,7 @@
</subviews>
<constraints>
<constraint firstItem="nbq-yr-2mA" firstAttribute="width" secondItem="yNh-ac-v6c" secondAttribute="width" id="3Ag-HE-h4m"/>
<constraint firstItem="Zlb-yt-NTw" firstAttribute="width" secondItem="yNh-ac-v6c" secondAttribute="width" id="wxD-pe-Udd"/>
<constraint firstItem="ve3-Y1-NQH" firstAttribute="width" secondItem="yNh-ac-v6c" secondAttribute="width" id="xN6-cs-Tnn"/>
</constraints>
</stackView>
@ -156,6 +167,7 @@
</objects>
<resources>
<image name="Favorite" width="390" height="371"/>
<image name="More" width="60" height="30"/>
<image name="Reblog" width="679" height="406"/>
<image name="Reply" width="155" height="114"/>
</resources>

Loading…
Cancel
Save