Skip to content

Commit 7575ee1

Browse files
committed
Minor fixes
1 parent 24d67a0 commit 7575ee1

File tree

5 files changed

+67
-76
lines changed

5 files changed

+67
-76
lines changed

iTorrent/Base.lproj/Main.storyboard

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
<rect key="frame" x="0.0" y="0.0" width="375" height="812"/>
1818
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
1919
<subviews>
20-
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="KYM-MO-AoK" customClass="ThemedUITableView" customModule="iTorrent" customModuleProvider="target">
20+
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" keyboardDismissMode="onDrag" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="KYM-MO-AoK" customClass="ThemedUITableView" customModule="iTorrent" customModuleProvider="target">
2121
<rect key="frame" x="0.0" y="0.0" width="375" height="812"/>
2222
<color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
2323
<prototypes>
@@ -84,7 +84,7 @@
8484
</prototypes>
8585
</tableView>
8686
<view hidden="YES" userInteractionEnabled="NO" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="E7j-3O-T4A">
87-
<rect key="frame" x="57.666666666666657" y="365.33333333333331" width="260" height="130.66666666666669"/>
87+
<rect key="frame" x="57.666666666666657" y="351.33333333333331" width="260" height="130.66666666666669"/>
8888
<subviews>
8989
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" alignment="center" spacing="8" translatesAutoresizingMaskIntoConstraints="NO" id="tMU-dN-W3p">
9090
<rect key="frame" x="0.0" y="0.0" width="260" height="130.66666666666666"/>
@@ -98,7 +98,7 @@
9898
<constraint firstAttribute="width" constant="82" id="qv9-LC-Xb7"/>
9999
</constraints>
100100
</imageView>
101-
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="List is empty, go and download something!" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="KnE-OU-dJk" customClass="ThemedUILabel" customModule="iTorrent" customModuleProvider="target">
101+
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="List is empty, go and download something!" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" minimumScaleFactor="0.29999999999999999" translatesAutoresizingMaskIntoConstraints="NO" id="KnE-OU-dJk" customClass="ThemedUILabel" customModule="iTorrent" customModuleProvider="target">
102102
<rect key="frame" x="0.0" y="90" width="260" height="40.666666666666657"/>
103103
<constraints>
104104
<constraint firstAttribute="width" constant="260" id="H4L-GH-hXj"/>
@@ -143,11 +143,12 @@
143143
<constraint firstItem="6Tk-OE-BBY" firstAttribute="bottom" secondItem="nxi-gq-Num" secondAttribute="bottom" id="9yD-lu-xvj"/>
144144
<constraint firstItem="BKM-Z7-QMV" firstAttribute="centerY" secondItem="8bC-Xf-vdC" secondAttribute="centerY" constant="2.5" id="IOs-1r-zKT"/>
145145
<constraint firstItem="nxi-gq-Num" firstAttribute="leading" secondItem="6Tk-OE-BBY" secondAttribute="leading" id="M23-SY-liw"/>
146+
<constraint firstItem="nxi-gq-Num" firstAttribute="top" relation="greaterThanOrEqual" secondItem="E7j-3O-T4A" secondAttribute="bottom" id="Mvn-oc-kG2"/>
146147
<constraint firstItem="E7j-3O-T4A" firstAttribute="centerX" secondItem="8bC-Xf-vdC" secondAttribute="centerX" id="R2A-HJ-SSf"/>
147148
<constraint firstItem="KYM-MO-AoK" firstAttribute="leading" secondItem="8bC-Xf-vdC" secondAttribute="leading" id="SWS-Ke-a9L"/>
148149
<constraint firstItem="BKM-Z7-QMV" firstAttribute="centerX" secondItem="8bC-Xf-vdC" secondAttribute="centerX" id="Tf6-pG-lDm"/>
149150
<constraint firstItem="KYM-MO-AoK" firstAttribute="top" secondItem="8bC-Xf-vdC" secondAttribute="top" id="Za2-qq-lXh"/>
150-
<constraint firstItem="E7j-3O-T4A" firstAttribute="centerY" secondItem="6Tk-OE-BBY" secondAttribute="centerY" constant="22" id="aPx-jZ-Piy"/>
151+
<constraint firstItem="E7j-3O-T4A" firstAttribute="centerY" secondItem="6Tk-OE-BBY" secondAttribute="centerY" constant="8" id="aPx-jZ-Piy"/>
151152
<constraint firstAttribute="bottom" secondItem="KYM-MO-AoK" secondAttribute="bottom" id="mVJ-2H-IOE"/>
152153
<constraint firstItem="KYM-MO-AoK" firstAttribute="trailing" secondItem="8bC-Xf-vdC" secondAttribute="trailing" id="q0D-OC-eGZ"/>
153154
<constraint firstAttribute="trailing" secondItem="nxi-gq-Num" secondAttribute="trailing" id="usz-dZ-670"/>
@@ -1536,8 +1537,6 @@ Thanks for all your support!</string>
15361537
<constraints>
15371538
<constraint firstAttribute="bottom" secondItem="7oo-qb-XiQ" secondAttribute="bottom" constant="16" id="O4n-M7-kc8"/>
15381539
<constraint firstItem="7oo-qb-XiQ" firstAttribute="top" secondItem="rr6-WS-LyB" secondAttribute="top" constant="16" id="bvH-nN-BwY"/>
1539-
<constraint firstAttribute="trailing" secondItem="7oo-qb-XiQ" secondAttribute="trailing" constant="16" id="dSn-oM-uqL"/>
1540-
<constraint firstItem="7oo-qb-XiQ" firstAttribute="leading" secondItem="rr6-WS-LyB" secondAttribute="leading" constant="16" id="iJT-mB-klr"/>
15411540
</constraints>
15421541
</view>
15431542
</subviews>
@@ -1554,7 +1553,9 @@ Thanks for all your support!</string>
15541553
</subviews>
15551554
<color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
15561555
<constraints>
1556+
<constraint firstItem="7oo-qb-XiQ" firstAttribute="leading" secondItem="2go-8C-vqG" secondAttribute="leading" constant="16" id="Ee1-Tw-9RW"/>
15571557
<constraint firstItem="fim-SI-BRV" firstAttribute="trailing" secondItem="GTC-Uy-e9M" secondAttribute="trailing" id="Iw2-Pm-Crs"/>
1558+
<constraint firstItem="2go-8C-vqG" firstAttribute="trailing" secondItem="7oo-qb-XiQ" secondAttribute="trailing" constant="16" id="Jwe-gs-1gy"/>
15581559
<constraint firstAttribute="bottom" secondItem="fim-SI-BRV" secondAttribute="bottom" id="SGL-Ia-24J"/>
15591560
<constraint firstItem="fim-SI-BRV" firstAttribute="top" secondItem="GTC-Uy-e9M" secondAttribute="top" constant="20" symbolic="YES" id="Yne-T3-zD9"/>
15601561
<constraint firstItem="fim-SI-BRV" firstAttribute="leading" secondItem="GTC-Uy-e9M" secondAttribute="leading" id="igF-Kz-lse"/>
@@ -2018,7 +2019,7 @@ Thanks for all your support!</string>
20182019
<color key="tintColor" red="1" green="0.29803921568627451" blue="0.16862745098039217" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
20192020
<resources>
20202021
<image name="ChatPin" width="30.666666030883789" height="12.666666984558105"/>
2021-
<image name="EmptyBox" width="170.66667175292969" height="170.66667175292969"/>
2022+
<image name="EmptyBox" width="82" height="82"/>
20222023
<image name="Folder" width="170.66667175292969" height="170.66667175292969"/>
20232024
<image name="GreenCheckMarker" width="35" height="35"/>
20242025
<image name="More2" width="25" height="25"/>
Lines changed: 41 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="16096" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
3-
<device id="retina6_1" orientation="portrait" appearance="light"/>
3+
<device id="retina5_5" orientation="portrait" appearance="light"/>
44
<dependencies>
55
<deployment identifier="iOS"/>
66
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="16087"/>
@@ -10,56 +10,50 @@
1010
<objects>
1111
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="TabBarView" customModule="iTorrent" customModuleProvider="target"/>
1212
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
13-
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" id="KGk-i7-Jjw" customClass="TabBarView" customModule="iTorrent" customModuleProvider="target">
14-
<rect key="frame" x="0.0" y="0.0" width="425" height="44"/>
13+
<view contentMode="scaleToFill" id="Ict-dT-htk" customClass="TabBarView" customModule="iTorrent" customModuleProvider="target">
14+
<rect key="frame" x="0.0" y="0.0" width="414" height="44"/>
1515
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
16-
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="KGk-i7-Jjw" id="H2p-sc-9uM">
17-
<rect key="frame" x="0.0" y="0.0" width="425" height="44"/>
18-
<autoresizingMask key="autoresizingMask"/>
19-
<subviews>
20-
<visualEffectView opaque="NO" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Bqq-40-XdF">
21-
<rect key="frame" x="0.0" y="0.0" width="425" height="44"/>
22-
<view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" insetsLayoutMarginsFromSafeArea="NO" id="dCc-TU-XNP">
23-
<rect key="frame" x="0.0" y="0.0" width="425" height="44"/>
24-
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
25-
</view>
26-
<blurEffect style="regular"/>
27-
</visualEffectView>
28-
<collectionView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" showsHorizontalScrollIndicator="NO" showsVerticalScrollIndicator="NO" dataMode="none" translatesAutoresizingMaskIntoConstraints="NO" id="Psc-nG-iJr">
29-
<rect key="frame" x="0.0" y="0.0" width="425" height="44"/>
30-
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
31-
<constraints>
32-
<constraint firstAttribute="height" constant="44" id="eDX-7S-YNB"/>
33-
</constraints>
34-
<collectionViewFlowLayout key="collectionViewLayout" scrollDirection="horizontal" automaticEstimatedItemSize="YES" minimumLineSpacing="10" minimumInteritemSpacing="10" id="foI-np-7FH">
35-
<size key="itemSize" width="128" height="44"/>
36-
<size key="headerReferenceSize" width="0.0" height="0.0"/>
37-
<size key="footerReferenceSize" width="0.0" height="0.0"/>
38-
<inset key="sectionInset" minX="14" minY="0.0" maxX="14" maxY="0.0"/>
39-
</collectionViewFlowLayout>
40-
</collectionView>
41-
</subviews>
42-
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
43-
<constraints>
44-
<constraint firstItem="Psc-nG-iJr" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="top" id="5wA-3m-wYD"/>
45-
<constraint firstAttribute="trailing" secondItem="Bqq-40-XdF" secondAttribute="trailing" id="WId-Tg-WxK"/>
46-
<constraint firstAttribute="bottom" secondItem="Psc-nG-iJr" secondAttribute="bottom" id="mgX-NC-F9I"/>
47-
<constraint firstAttribute="bottom" secondItem="Bqq-40-XdF" secondAttribute="bottom" id="s3s-Vi-7uu"/>
48-
<constraint firstItem="Bqq-40-XdF" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="top" id="suI-Fw-gkW"/>
49-
<constraint firstItem="Bqq-40-XdF" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" id="yr2-Ee-wUE"/>
50-
</constraints>
51-
</tableViewCellContentView>
52-
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
16+
<subviews>
17+
<visualEffectView opaque="NO" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Bqq-40-XdF">
18+
<rect key="frame" x="0.0" y="0.0" width="414" height="44"/>
19+
<view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" insetsLayoutMarginsFromSafeArea="NO" id="dCc-TU-XNP">
20+
<rect key="frame" x="0.0" y="0.0" width="414" height="44"/>
21+
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
22+
</view>
23+
<blurEffect style="regular"/>
24+
</visualEffectView>
25+
<collectionView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" showsHorizontalScrollIndicator="NO" showsVerticalScrollIndicator="NO" dataMode="none" translatesAutoresizingMaskIntoConstraints="NO" id="Psc-nG-iJr">
26+
<rect key="frame" x="0.0" y="0.0" width="414" height="44"/>
27+
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
28+
<constraints>
29+
<constraint firstAttribute="height" constant="44" id="eDX-7S-YNB"/>
30+
</constraints>
31+
<collectionViewFlowLayout key="collectionViewLayout" scrollDirection="horizontal" automaticEstimatedItemSize="YES" minimumLineSpacing="10" minimumInteritemSpacing="10" id="foI-np-7FH">
32+
<size key="itemSize" width="128" height="44"/>
33+
<size key="headerReferenceSize" width="0.0" height="0.0"/>
34+
<size key="footerReferenceSize" width="0.0" height="0.0"/>
35+
<inset key="sectionInset" minX="14" minY="0.0" maxX="14" maxY="0.0"/>
36+
</collectionViewFlowLayout>
37+
</collectionView>
38+
</subviews>
39+
<color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
5340
<constraints>
54-
<constraint firstItem="Psc-nG-iJr" firstAttribute="leading" secondItem="njF-e1-oar" secondAttribute="leading" id="mfa-LB-L5A"/>
55-
<constraint firstItem="njF-e1-oar" firstAttribute="trailing" secondItem="Psc-nG-iJr" secondAttribute="trailing" id="qBA-Qi-ggs"/>
41+
<constraint firstAttribute="bottom" secondItem="Psc-nG-iJr" secondAttribute="bottom" id="2to-wb-vmu"/>
42+
<constraint firstItem="Bqq-40-XdF" firstAttribute="top" secondItem="Ict-dT-htk" secondAttribute="top" id="DXg-cb-JXc"/>
43+
<constraint firstItem="Bqq-40-XdF" firstAttribute="leading" secondItem="Ict-dT-htk" secondAttribute="leading" id="Goi-Bf-iUo"/>
44+
<constraint firstItem="Psc-nG-iJr" firstAttribute="top" secondItem="Ict-dT-htk" secondAttribute="top" id="VgQ-xf-gOr"/>
45+
<constraint firstAttribute="trailing" secondItem="Psc-nG-iJr" secondAttribute="trailing" id="WjZ-K9-znb"/>
46+
<constraint firstAttribute="bottom" secondItem="Bqq-40-XdF" secondAttribute="bottom" id="bMi-jd-K5c"/>
47+
<constraint firstItem="Psc-nG-iJr" firstAttribute="leading" secondItem="Ict-dT-htk" secondAttribute="leading" id="dBG-Xs-fZX"/>
48+
<constraint firstAttribute="trailing" secondItem="Bqq-40-XdF" secondAttribute="trailing" id="n3f-gd-oNs"/>
5649
</constraints>
57-
<viewLayoutGuide key="safeArea" id="njF-e1-oar"/>
50+
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
51+
<viewLayoutGuide key="safeArea" id="rh2-oE-IZH"/>
5852
<connections>
59-
<outlet property="collectionView" destination="Psc-nG-iJr" id="GDX-qQ-myG"/>
60-
<outlet property="fxView" destination="Bqq-40-XdF" id="fco-L0-00w"/>
53+
<outlet property="collectionView" destination="Psc-nG-iJr" id="QC8-4Q-qeB"/>
54+
<outlet property="fxView" destination="Bqq-40-XdF" id="9Vy-iB-bQD"/>
6155
</connections>
62-
<point key="canvasLocation" x="213.768115942029" y="120.53571428571428"/>
63-
</tableViewCell>
56+
<point key="canvasLocation" x="598.55072463768124" y="218.47826086956525"/>
57+
</view>
6458
</objects>
6559
</document>

iTorrent/System/Rss/Models/RssModel.swift

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ import Foundation
1111
import SwiftyXMLParser
1212

1313
class RssModel: Hashable, Codable, DiffAware {
14+
enum Error: Swift.Error {
15+
case missingKey
16+
}
17+
1418
var xmlLink: URL
1519
var title: String
1620
var description: String
@@ -30,12 +34,14 @@ class RssModel: Hashable, Codable, DiffAware {
3034
}
3135
return title
3236
}
37+
3338
var displayDescription: String {
3439
if customDescriotion?.isEmpty == false {
3540
return customDescriotion!
3641
}
3742
return description
3843
}
44+
3945
var updatesCount: Int {
4046
items.filter { $0.new }.count
4147
}
@@ -47,10 +53,18 @@ class RssModel: Hashable, Codable, DiffAware {
4753
let contents = try String(contentsOf: xmlLink)
4854
let xml = try XML.parse(contents)
4955

50-
title = xml["rss", "channel", "title"].text!
51-
description = xml["rss", "channel", "description"].text!
52-
self.link = URL(string: xml["rss", "channel", "link"].text!)!
53-
linkImage = URL(string: "https://www.google.com/s2/favicons?domain=" + xml["rss", "channel", "link"].text!)!
56+
guard let title = xml["rss", "channel", "title"].text,
57+
let description = xml["rss", "channel", "description"].text,
58+
let xmlLink = xml["rss", "channel", "link"].text,
59+
let link = URL(string: xmlLink),
60+
let linkImage = URL(string: "https://www.google.com/s2/favicons?domain=" + xmlLink) else {
61+
throw Error.missingKey
62+
}
63+
64+
self.title = title
65+
self.description = description
66+
self.link = link
67+
self.linkImage = linkImage
5468

5569
for xmlItem in xml["rss", "channel", "item"] {
5670
items.append(RssItemModel(xml: xmlItem))

0 commit comments

Comments
 (0)