Added app icons, launch screen; changed colours in ViewControllers to colour literals

This commit is contained in:
Deniz Duezgoeren
2019-07-17 21:54:38 +02:00
parent 92e3fed7e6
commit 3a03c1be30
33 changed files with 211 additions and 168 deletions
@@ -1,93 +1,111 @@
{
"images" : [
{
"idiom" : "iphone",
"size" : "20x20",
"idiom" : "iphone",
"filename" : "avh20x2-1.png",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "20x20",
"idiom" : "iphone",
"filename" : "avh20x3.png",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "29x29",
"idiom" : "iphone",
"filename" : "avh29x2.png",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "29x29",
"idiom" : "iphone",
"filename" : "avh29x3.png",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "40x40",
"idiom" : "iphone",
"filename" : "avh40x2-1.png",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "40x40",
"idiom" : "iphone",
"filename" : "avh40x3.png",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "60x60",
"idiom" : "iphone",
"filename" : "avh60x2.png",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "60x60",
"idiom" : "iphone",
"filename" : "avh60x3.png",
"scale" : "3x"
},
{
"idiom" : "ipad",
"size" : "20x20",
"idiom" : "ipad",
"filename" : "avh20x1.png",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "20x20",
"idiom" : "ipad",
"filename" : "avh20x2.png",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "29x29",
"idiom" : "ipad",
"filename" : "avh29x1.png",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "29x29",
"idiom" : "ipad",
"filename" : "avh29x2-1.png",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "40x40",
"idiom" : "ipad",
"filename" : "avh40x1.png",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "40x40",
"idiom" : "ipad",
"filename" : "avh40x2.png",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "76x76",
"idiom" : "ipad",
"filename" : "avh76x1.png",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "76x76",
"idiom" : "ipad",
"filename" : "avh76x2.png",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "83.5x83.5",
"idiom" : "ipad",
"filename" : "avh83,5x2.png",
"scale" : "2x"
},
{
"idiom" : "ios-marketing",
"size" : "1024x1024",
"idiom" : "ios-marketing",
"filename" : "app_icon_ios.png",
"scale" : "1x"
}
],
Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 437 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 812 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 812 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 647 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 812 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

+33 -5
View File
@@ -1,7 +1,11 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13122.16" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14490.70" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
<device id="retina6_1" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13104.12"/>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14490.49"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
@@ -11,15 +15,39 @@
<objects>
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<tabBar contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" translatesAutoresizingMaskIntoConstraints="NO" id="QLu-GC-NzK">
<rect key="frame" x="0.0" y="813" width="414" height="83"/>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
<viewLayoutGuide key="safeArea" id="h2U-4g-7Ak"/>
<items>
<tabBarItem title="" image="ic_writing" selectedImage="ic_writing" id="keQ-St-8hM"/>
<tabBarItem title="" image="ic_idea" selectedImage="ic_idea" id="spn-vi-J6I"/>
<tabBarItem title="" image="ic_information" selectedImage="ic_information" id="OBW-rE-k7z"/>
<tabBarItem title="" image="ic_tomato" selectedImage="ic_tomato" id="zev-fl-fMd"/>
</items>
</tabBar>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="bottom" secondItem="QLu-GC-NzK" secondAttribute="bottom" id="QQT-h6-ci0"/>
<constraint firstItem="QLu-GC-NzK" firstAttribute="leading" secondItem="Ze5-6b-2t3" secondAttribute="leading" id="RJl-XD-nho"/>
<constraint firstAttribute="trailing" secondItem="QLu-GC-NzK" secondAttribute="trailing" id="SEZ-En-0Xe"/>
</constraints>
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="53" y="375"/>
<point key="canvasLocation" x="52.173913043478265" y="375"/>
</scene>
</scenes>
<resources>
<image name="ic_idea" width="16.5" height="25"/>
<image name="ic_information" width="25" height="25"/>
<image name="ic_tomato" width="25" height="25"/>
<image name="ic_writing" width="25" height="25"/>
</resources>
</document>
+11 -12
View File
@@ -15,10 +15,10 @@
<objects>
<viewController title="AvH Plan" id="9pv-A4-QxB" customClass="GeneralViewController" customModule="AvH_Plan" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="tsR-hK-woN">
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
<rect key="frame" x="0.0" y="0.0" width="414" height="813"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<navigationBar contentMode="scaleToFill" layoutMarginsFollowReadableWidth="YES" translatesAutoresizingMaskIntoConstraints="NO" id="F8V-CQ-shR">
<navigationBar contentMode="scaleToFill" layoutMarginsFollowReadableWidth="YES" translucent="NO" translatesAutoresizingMaskIntoConstraints="NO" id="F8V-CQ-shR">
<rect key="frame" x="0.0" y="44" width="414" height="44"/>
<viewLayoutGuide key="safeArea" id="b9C-lJ-bz8"/>
<items>
@@ -48,15 +48,15 @@
<objects>
<viewController id="8rJ-Kc-sve" customClass="PersonalPlanViewController" customModule="AvH_Plan" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="QS5-Rx-YEW">
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
<rect key="frame" x="0.0" y="0.0" width="414" height="813"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<navigationBar contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" layoutMarginsFollowReadableWidth="YES" translatesAutoresizingMaskIntoConstraints="NO" id="zYA-MY-Azp">
<navigationBar contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" layoutMarginsFollowReadableWidth="YES" translucent="NO" translatesAutoresizingMaskIntoConstraints="NO" id="zYA-MY-Azp">
<rect key="frame" x="0.0" y="44" width="414" height="44"/>
<viewLayoutGuide key="safeArea" id="Or0-Ph-ylC"/>
<items>
<navigationItem title="Personal Plan" id="8j4-CR-EDO">
<barButtonItem key="rightBarButtonItem" title="Customise" id="iH8-LX-SKF">
<barButtonItem key="rightBarButtonItem" title="Customize" id="iH8-LX-SKF">
<connections>
<action selector="toolbarButtonCustomise:" destination="8rJ-Kc-sve" id="XTh-6F-m3e"/>
</connections>
@@ -87,10 +87,10 @@
<objects>
<viewController id="Ve9-lV-ekU" customClass="InfoViewController" customModule="AvH_Plan" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="eFO-Bf-72I">
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
<rect key="frame" x="0.0" y="0.0" width="414" height="813"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<navigationBar contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" layoutMarginsFollowReadableWidth="YES" translatesAutoresizingMaskIntoConstraints="NO" id="n9O-m5-UQM">
<navigationBar contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" layoutMarginsFollowReadableWidth="YES" translucent="NO" translatesAutoresizingMaskIntoConstraints="NO" id="n9O-m5-UQM">
<rect key="frame" x="0.0" y="44" width="414" height="44"/>
<viewLayoutGuide key="safeArea" id="YA8-Ln-bdM"/>
<items>
@@ -104,7 +104,7 @@
<rect key="frame" x="0.0" y="0.0" width="414" height="52.333333333333336"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="wordWrap" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="6H8-lj-boN">
<rect key="frame" x="24" y="16" width="366" height="20.333333333333329"/>
<rect key="frame" x="24" y="15.999999999999998" width="366" height="20.333333333333329"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
@@ -155,10 +155,10 @@
<objects>
<viewController id="bBH-of-tdd" customClass="MenuViewController" customModule="AvH_Plan" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="nOs-f2-7qu">
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
<rect key="frame" x="0.0" y="0.0" width="414" height="813"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<navigationBar contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" layoutMarginsFollowReadableWidth="YES" translatesAutoresizingMaskIntoConstraints="NO" id="R10-r1-giF">
<navigationBar contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" layoutMarginsFollowReadableWidth="YES" translucent="NO" translatesAutoresizingMaskIntoConstraints="NO" id="R10-r1-giF">
<rect key="frame" x="0.0" y="44" width="414" height="44"/>
<viewLayoutGuide key="safeArea" id="zEW-od-JDN"/>
<items>
@@ -187,10 +187,9 @@
<scene sceneID="yl2-sM-qoP">
<objects>
<tabBarController title="AvH Plan" id="49e-Tb-3d3" sceneMemberID="viewController">
<tabBar key="tabBar" contentMode="scaleToFill" id="W28-zg-YXA">
<tabBar key="tabBar" contentMode="scaleToFill" translucent="NO" id="W28-zg-YXA">
<rect key="frame" x="0.0" y="975" width="768" height="49"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
</tabBar>
<connections>
<segue destination="9pv-A4-QxB" kind="relationship" relationship="viewControllers" id="u7Y-xg-7CH"/>
+57 -79
View File
@@ -32,37 +32,35 @@ class DataFetcher {
func doAsync(do task: String, completionHandler: @escaping (_ substitutions: Array<Any>) -> ()) {
DispatchQueue(label: "work-queue").async {
var url = ""
switch task {
case "menu": url = "https://djd4rkn355.github.io/food_test.html"
default: url = "https://djd4rkn355.github.io/subst_test.html"
}
let foodUrl = "https://djd4rkn355.github.io/food_test.html"
let url = "https://djd4rkn355.github.io/subst_test.html"
Alamofire.request(url).responseString { response in
if let html = response.result.value {
switch task {
case "plan": completionHandler(self.parseHTML(html: html, isPersonal: false))
case "personal": completionHandler(self.parseHTML(html: html, isPersonal: true))
case "info": completionHandler(self.parseInformation(html: html))
default: completionHandler(self.parseMenu(html: html))
Alamofire.request(foodUrl).responseString { response in
if let foodHtml = response.result.value {
completionHandler(self.parseHTML(html: html, food: foodHtml, type: task))
}
}
}
}
}
}
func parseHTML(html: String, isPersonal: Bool) -> Array<SubstModel> {
func parseHTML(html: String, food: String, type: String) -> Array<Any> {
var subst = Array<SubstModel>()
var personalSubst = Array<SubstModel>()
var info = ""
var infoList = [String]()
var menuList = [String]()
do {
let doc: Document = try SwiftSoup.parse(html)
let doc = try SwiftSoup.parse(html)
let rows: Elements = try doc.select("tr")
let courses = prefs.string(forKey: "courses")
let classes = prefs.string(forKey: "classes")
// let courses: String? = "GES7"
// let classes: String? = "17"
let db = try Connection("\(path)/db.sqlite3")
@@ -130,20 +128,53 @@ class DataFetcher {
}
}
}
} catch Exception.Error(let type, let message) {
print(type)
print(message)
} catch {
print("error")
}
if isPersonal {
return personalSubst
} else {
let pi: Elements = try doc.select("p")
for item in pi {
if info.isEmpty {
info = try item.text()
} else {
info += "\n\n\(try item.text())"
}
}
_ = prefs.set(info, forKey: "information")
} catch {}
infoList.append(info)
do {
let foodDoc: Document = try SwiftSoup.parse(food)
let ef: Elements = try foodDoc.select("th")
let db = try Connection("\(path)/db.sqlite3")
try db.run(foodmenu.create(ifNotExists: true) { t in
t.column(id, primaryKey: true)
t.column(text)
})
try db.run(foodmenu.delete())
for i in 0..<ef.size() {
menuList.append(try ef.get(i).text())
let insert = foodmenu.insert(text <- try ef.get(i).text())
_ = try db.run(insert)
}
} catch {}
switch type {
case "plan":
return subst
case "personal":
return personalSubst
case "info":
return infoList
default:
return menuList
}
}
@@ -169,63 +200,10 @@ class DataFetcher {
return substs
}
func parseInformation(html: String) -> [String] {
var info = ""
do {
let doc: Document = try SwiftSoup.parse(html)
let p: Elements = try doc.select("p")
for item in p {
if info.isEmpty {
info = try item.text()
} else {
info += "\n\n\(try item.text())"
}
}
_ = prefs.set(info, forKey: "information")
} catch Exception.Error(let type, let message) {
print(type)
print(message)
} catch {
print("error")
}
var list = [String]()
list.append(info)
return list
}
func readInformation() -> String {
return prefs.string(forKey: "information") ?? ""
}
func parseMenu(html: String) -> [String] {
var items = [String]()
do {
let doc: Document = try SwiftSoup.parse(html)
let e: Elements = try doc.select("th")
let db = try Connection("\(path)/db.sqlite3")
try db.run(foodmenu.create(ifNotExists: true) { t in
t.column(id, primaryKey: true)
t.column(text)
})
try db.run(foodmenu.delete())
for i in 0..<e.size() {
items.append(try e.get(i).text())
let insert = foodmenu.insert(text <- try e.get(i).text())
_ = try db.run(insert)
}
} catch {}
return items
}
func readMenu() -> [String] {
var menu = [String]()
do {
+1 -1
View File
@@ -21,7 +21,7 @@ class GeneralViewController: PlanViewController {
}
override func getRefreshViewString() -> String {
return "Fetching the plan..."
return NSLocalizedString("fetch_plan", comment: "")
}
override func getFromDatabase() -> [SubstModel] {
+3 -7
View File
@@ -24,9 +24,10 @@ class InfoViewController : UIViewController {
scrollView.addSubview(refreshControl)
}
refreshControl.addTarget(self, action: #selector(objDoAsync(_:)), for: .valueChanged)
refreshControl.tintColor = UIColor(red: 0.39, green: 0.71, blue: 0.96, alpha: 1.0)
refreshControl.attributedTitle = NSAttributedString(string: "Fetching some information...")
refreshControl.tintColor = #colorLiteral(red: 0.07843137255, green: 0.5568627451, blue: 1, alpha: 1)
refreshControl.attributedTitle = NSAttributedString(string: NSLocalizedString("fetch_info", comment: ""))
self.scrollView.isDirectionalLockEnabled = true
content.text = df.readInformation()
}
@objc private func objDoAsync(_ sender: Any) {
@@ -35,9 +36,4 @@ class InfoViewController : UIViewController {
self.refreshControl.endRefreshing()
}
}
override func viewDidLoad() {
super.viewDidLoad()
content.text = df.readInformation()
}
}
+8
View File
@@ -25,12 +25,20 @@
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="ve8-vV-g8Y">
<rect key="frame" x="0.0" y="63" width="512" height="1"/>
<color key="backgroundColor" white="0.66666666669999997" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</view>
</subviews>
</view>
<constraints>
<constraint firstAttribute="trailing" secondItem="ve8-vV-g8Y" secondAttribute="trailing" id="0ti-JN-3Z9"/>
<constraint firstItem="LRg-M9-Mh9" firstAttribute="top" secondItem="gTV-IL-0wX" secondAttribute="top" constant="16" id="5zo-M7-gZh"/>
<constraint firstAttribute="bottom" secondItem="ve8-vV-g8Y" secondAttribute="bottom" id="AbT-cH-6Nh"/>
<constraint firstAttribute="trailing" secondItem="LRg-M9-Mh9" secondAttribute="trailing" constant="24" id="Bsa-Fp-zBH"/>
<constraint firstItem="ve8-vV-g8Y" firstAttribute="leading" secondItem="gTV-IL-0wX" secondAttribute="leading" id="WoG-wV-h6c"/>
<constraint firstItem="LRg-M9-Mh9" firstAttribute="leading" secondItem="gTV-IL-0wX" secondAttribute="leading" constant="24" id="bVa-ZP-z1d"/>
<constraint firstItem="ve8-vV-g8Y" firstAttribute="top" secondItem="LRg-M9-Mh9" secondAttribute="bottom" constant="15" id="oLQ-A5-4UE"/>
<constraint firstAttribute="bottom" secondItem="LRg-M9-Mh9" secondAttribute="bottom" constant="16" id="yRL-dW-1Yd"/>
</constraints>
<viewLayoutGuide key="safeArea" id="ZTg-uK-7eu"/>
+7 -11
View File
@@ -38,6 +38,7 @@ class MenuViewController : UIViewController, UICollectionViewDataSource, UIColle
collectionView.register(UINib(nibName: "MenuViewCell", bundle: nil), forCellWithReuseIdentifier: identifier)
collectionView.dataSource = self
collectionView.delegate = self
collectionView.backgroundColor = #colorLiteral(red: 1.0, green: 1.0, blue: 1.0, alpha: 1.0)
if #available(iOS 10.0, *) {
collectionView.refreshControl = refreshControl
@@ -45,8 +46,11 @@ class MenuViewController : UIViewController, UICollectionViewDataSource, UIColle
collectionView.addSubview(refreshControl) // likely unnecessary
}
refreshControl.addTarget(self, action: #selector(objDoAsync(_:)), for: .valueChanged)
refreshControl.tintColor = UIColor(red: 0.39, green: 0.71, blue: 0.96, alpha: 1.0)
refreshControl.attributedTitle = NSAttributedString(string: "Fetching the food menu...")
refreshControl.tintColor = #colorLiteral(red: 0.07843137255, green: 0.5568627451, blue: 1, alpha: 1)
refreshControl.attributedTitle = NSAttributedString(string: NSLocalizedString("fetch_menu", comment: ""))
self.items = self.df.readMenu()
self.collectionView.reloadData()
}
@objc private func objDoAsync(_ sender: Any) {
@@ -57,14 +61,6 @@ class MenuViewController : UIViewController, UICollectionViewDataSource, UIColle
}
}
override func viewDidLoad() {
super.viewDidLoad()
collectionView.backgroundColor = UIColor(red: 0.8, green: 0.8, blue: 0.8, alpha: 1.0)
self.items = self.df.readMenu()
self.collectionView.reloadData()
}
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return self.items.count
}
@@ -108,7 +104,7 @@ class MenuViewController : UIViewController, UICollectionViewDataSource, UIColle
}
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, verticalSpacingForElementsInSectionAtIndex index: Int) -> CGFloat {
return 1
return 0
}
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, insetsForSectionAtIndex index: Int) -> UIEdgeInsets {
+7 -22
View File
@@ -14,18 +14,18 @@ class PersonalPlanViewController: PlanViewController {
let prefs = UserDefaults.standard
@IBAction func toolbarButtonCustomise(_ sender: UIBarButtonItem) {
let alert = UIAlertController(title: "Customise personal page", message: nil, preferredStyle: .alert)
let alert = UIAlertController(title: NSLocalizedString("customize_alert_title", comment: ""), message: nil, preferredStyle: .alert)
alert.addTextField { (name) in
name.text = self.prefs.string(forKey: "username")
name.placeholder = "Name"
name.placeholder = NSLocalizedString("name", comment: "")
}
alert.addTextField { (classes) in
classes.text = self.prefs.string(forKey: "classes")
classes.placeholder = "Classes"
classes.placeholder = NSLocalizedString("classes", comment: "")
}
alert.addTextField { (courses) in
courses.text = self.prefs.string(forKey: "courses")
courses.placeholder = "Courses"
courses.placeholder = NSLocalizedString("courses", comment: "")
}
alert.addAction(UIAlertAction(title: "OK", style: .default, handler: { [weak alert] (action) -> Void in
_ = self.prefs.set(alert!.textFields![0].text, forKey: "username")
@@ -42,24 +42,19 @@ class PersonalPlanViewController: PlanViewController {
let user = self.prefs.string(forKey: "username")
if (user != nil && user != "") {
if (user!.last == "x" || user!.last == "s" || user!.last == "z") {
self.toolbar!.topItem!.title = "\(user!)' Plan"
self.toolbar!.topItem!.title = "\(user!)\(NSLocalizedString("nosplan", comment: ""))"
} else {
self.toolbar!.topItem!.title = "\(user!)'s Plan"
self.toolbar!.topItem!.title = "\(user!)\(NSLocalizedString("splan", comment: ""))"
}
}
}
override func viewDidLoad() {
super.viewDidLoad()
}
override func getViewType() -> String {
return "personal"
}
override func getRefreshViewString() -> String {
return "Fetching your plan..."
return NSLocalizedString("fetch_personal", comment: "")
}
override func getFromDatabase() -> [SubstModel] {
@@ -70,14 +65,4 @@ class PersonalPlanViewController: PlanViewController {
return toolbar.bottomAnchor
}
/*
// MARK: - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
// Get the new view controller using segue.destination.
// Pass the selected object to the new view controller.
}
*/
}
+8
View File
@@ -58,11 +58,16 @@
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="BNy-Bm-Hfo">
<rect key="frame" x="0.0" y="107" width="512" height="1"/>
<color key="backgroundColor" white="0.66666666666666663" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</view>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstItem="z2B-fh-0m1" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="vzu-WZ-FPo" secondAttribute="trailing" constant="8" id="3kU-Ww-Qcw"/>
<constraint firstItem="47e-N3-adl" firstAttribute="top" secondItem="Ay1-0Z-yKh" secondAttribute="top" constant="16" id="5g6-Dx-f58"/>
<constraint firstAttribute="trailing" secondItem="BNy-Bm-Hfo" secondAttribute="trailing" id="6ZJ-3c-6Eu"/>
<constraint firstAttribute="bottom" secondItem="F6T-RY-ZUE" secondAttribute="bottom" constant="16" id="CbT-RS-Wcv"/>
<constraint firstItem="vzu-WZ-FPo" firstAttribute="leading" secondItem="Ay1-0Z-yKh" secondAttribute="leading" constant="24" id="E02-p0-1pW"/>
<constraint firstItem="z2B-fh-0m1" firstAttribute="top" secondItem="kVO-L1-w44" secondAttribute="bottom" constant="8" id="FLB-1o-cei"/>
@@ -74,12 +79,15 @@
<constraint firstAttribute="trailing" secondItem="47e-N3-adl" secondAttribute="trailing" constant="24" id="d5g-l0-tid"/>
<constraint firstAttribute="bottom" secondItem="Jed-sH-OKY" secondAttribute="bottom" constant="16" id="di9-dn-Wfv"/>
<constraint firstItem="vzu-WZ-FPo" firstAttribute="top" secondItem="kVO-L1-w44" secondAttribute="bottom" constant="8" id="fYW-HW-mSP"/>
<constraint firstAttribute="bottom" secondItem="BNy-Bm-Hfo" secondAttribute="bottom" id="gZx-dG-A7M"/>
<constraint firstItem="BNy-Bm-Hfo" firstAttribute="leading" secondItem="Ay1-0Z-yKh" secondAttribute="leading" id="jLw-TQ-vvC"/>
<constraint firstItem="Jed-sH-OKY" firstAttribute="top" secondItem="vzu-WZ-FPo" secondAttribute="bottom" constant="8" id="kKA-h5-ADN"/>
<constraint firstItem="vzu-WZ-FPo" firstAttribute="top" relation="greaterThanOrEqual" secondItem="Ay1-0Z-yKh" secondAttribute="top" constant="44" id="mZr-e4-cwy"/>
<constraint firstItem="47e-N3-adl" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="kVO-L1-w44" secondAttribute="trailing" constant="8" id="pGe-p1-Ger"/>
<constraint firstItem="Jed-sH-OKY" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="F6T-RY-ZUE" secondAttribute="trailing" constant="8" id="ryb-w6-jie"/>
<constraint firstAttribute="trailing" secondItem="Jed-sH-OKY" secondAttribute="trailing" constant="24" id="uJx-Q7-VfS"/>
<constraint firstItem="kVO-L1-w44" firstAttribute="top" secondItem="Ay1-0Z-yKh" secondAttribute="top" constant="16" id="vic-2C-ffY"/>
<constraint firstItem="BNy-Bm-Hfo" firstAttribute="top" secondItem="F6T-RY-ZUE" secondAttribute="bottom" constant="15" id="yXT-rV-p1f"/>
</constraints>
</view>
</subviews>
+8 -12
View File
@@ -13,7 +13,7 @@ class PlanViewController : UIViewController, UICollectionViewDataSource, UIColle
let identifier = "plan_cell"
var substs = [SubstModel]()
private let refreshControl = UIRefreshControl()
let refreshControl = UIRefreshControl()
let df = DataFetcher()
let layout = MagazineLayout()
var collectionView: UICollectionView
@@ -41,6 +41,7 @@ class PlanViewController : UIViewController, UICollectionViewDataSource, UIColle
collectionView.register(UINib(nibName: "PlanViewCell", bundle: nil), forCellWithReuseIdentifier: identifier)
collectionView.dataSource = self
collectionView.delegate = self
collectionView.backgroundColor = #colorLiteral(red: 1.0, green: 1.0, blue: 1.0, alpha: 1.0)
if #available(iOS 10.0, *) {
collectionView.refreshControl = refreshControl
@@ -48,8 +49,11 @@ class PlanViewController : UIViewController, UICollectionViewDataSource, UIColle
collectionView.addSubview(refreshControl)
}
refreshControl.addTarget(self, action: #selector(objDoAsync(_:)), for: .valueChanged)
refreshControl.tintColor = UIColor(red: 0.39, green: 0.71, blue: 0.96, alpha: 1.0)
refreshControl.tintColor = #colorLiteral(red: 0.07843137255, green: 0.5568627451, blue: 1, alpha: 1)
refreshControl.attributedTitle = NSAttributedString(string: getRefreshViewString())
self.substs = getFromDatabase()
self.collectionView.reloadData()
}
func getViewType() -> String {
@@ -61,7 +65,7 @@ class PlanViewController : UIViewController, UICollectionViewDataSource, UIColle
}
func getRefreshViewString() -> String {
return "Fetching the plan..."
return NSLocalizedString("fetch_plan", comment: "")
}
@objc private func objDoAsync(_ sender: Any) {
@@ -71,14 +75,6 @@ class PlanViewController : UIViewController, UICollectionViewDataSource, UIColle
self.refreshControl.endRefreshing()
}
}
override func viewDidLoad() {
super.viewDidLoad()
collectionView.backgroundColor = UIColor(red: 0.8, green: 0.8, blue: 0.8, alpha: 1.0)
self.substs = getFromDatabase()
self.collectionView.reloadData()
}
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return self.substs.count
@@ -141,7 +137,7 @@ class PlanViewController : UIViewController, UICollectionViewDataSource, UIColle
}
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, verticalSpacingForElementsInSectionAtIndex index: Int) -> CGFloat {
return 1
return 0 // change this if needed
}
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, insetsForSectionAtIndex index: Int) -> UIEdgeInsets {
+12
View File
@@ -0,0 +1,12 @@
/* Class = "UITabBarItem"; title = "Information"; ObjectID = "OBW-rE-k7z"; */
"OBW-rE-k7z.title" = "Informationen";
/* Class = "UITabBarItem"; title = "Plan"; ObjectID = "keQ-St-8hM"; */
"keQ-St-8hM.title" = "Plan";
/* Class = "UITabBarItem"; title = "Personal"; ObjectID = "spn-vi-J6I"; */
"spn-vi-J6I.title" = "Persönlich";
/* Class = "UITabBarItem"; title = "Menu"; ObjectID = "zev-fl-fMd"; */
"zev-fl-fMd.title" = "Speiseplan";
+1
View File
@@ -0,0 +1 @@