Skip to content
This repository has been archived by the owner on Jan 10, 2024. It is now read-only.

Commit

Permalink
cleaned up code
Browse files Browse the repository at this point in the history
  • Loading branch information
tgymnich committed Jul 8, 2020
1 parent 4f3c081 commit 6b82b31
Show file tree
Hide file tree
Showing 12 changed files with 17 additions and 26 deletions.
5 changes: 3 additions & 2 deletions TUM Campus App/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,7 @@
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" cocoaTouchSystemColor="groupTableViewBackgroundColor"/>
<view key="tableFooterView" contentMode="scaleToFill" id="T0A-pD-y4X">
<rect key="frame" x="0.0" y="832.5" width="375" height="54"/>
<rect key="frame" x="0.0" y="832" width="375" height="54"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews>
<label opaque="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Version 1.0.0" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontForContentSizeCategory="YES" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="6cx-bG-yLI">
Expand Down Expand Up @@ -1402,7 +1402,7 @@
</connections>
</collectionView>
<navigationItem key="navigationItem" id="9cA-Sd-cdH">
<barButtonItem key="rightBarButtonItem" systemItem="add" id="fuM-zA-e19">
<barButtonItem key="rightBarButtonItem" title="Item" image="person.crop.circle.badge.plus" catalog="system" id="fuM-zA-e19">
<connections>
<action selector="addContactToAddressBook" destination="gsl-L3-Jsp" id="tcm-Yf-w8X"/>
</connections>
Expand Down Expand Up @@ -2439,6 +2439,7 @@
<image name="pencil.circle" catalog="system" width="128" height="121"/>
<image name="person.circle" catalog="system" width="128" height="121"/>
<image name="person.crop.circle" catalog="system" width="128" height="121"/>
<image name="person.crop.circle.badge.plus" catalog="system" width="128" height="101"/>
<image name="person.crop.circle.fill" catalog="system" width="128" height="121"/>
<image name="studentdesk" catalog="system" width="124" height="128"/>
<namedColor name="tumBlue">
Expand Down
1 change: 0 additions & 1 deletion TUM Campus App/Calendar/CalendarEventViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -83,5 +83,4 @@ final class CalendarEventViewModel: EventDescriptor {
textColor = .white
}


}
1 change: 0 additions & 1 deletion TUM Campus App/Lecture Detail/LectureDetail.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import Foundation

struct LectureDetail: Decodable {

let id: Int64
let lvNumber: Int64
let title: String
Expand Down
4 changes: 2 additions & 2 deletions TUM Campus App/Lecture Detail/LectureDetailCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import UIKit

final class LectureDetailCell: UICollectionViewCell {
private let seperatorView = UIView()
@IBOutlet weak var keyLabel: UILabel!
@IBOutlet weak var valueLabel: UILabel!
@IBOutlet private weak var keyLabel: UILabel!
@IBOutlet private weak var valueLabel: UILabel!

func configure(viewModel: LectureDetailViewModel.Cell, isLastCell: Bool = false) {
keyLabel.text = viewModel.key
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ final class LectureDetailCollectionViewController: UICollectionViewController {

func setLecture(_ lecture: Lecture) {
viewModel = LectureDetailViewModel(lecture: lecture)
reload(animated: true)
endpoint = TUMOnlineAPI.lectureDetails(lvNr: lecture.lvNumber.description)
fetch(animated: true)
}
Expand All @@ -44,7 +43,7 @@ final class LectureDetailCollectionViewController: UICollectionViewController {
reload(animated: animated)
}

@objc private func fetch(animated: Bool = true) {
private func fetch(animated: Bool = true) {
guard let endpoint = endpoint else { return }
sessionManager.request(endpoint).responseDecodable(of: TUMOnlineAPIResponse<LectureDetail>.self, decoder: XMLDecoder()) { [weak self] response in
guard let value = response.value?.rows?.first else { return }
Expand Down
4 changes: 2 additions & 2 deletions TUM Campus App/Lecture Detail/LectureDetailHeader.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
import UIKit

final class LectureDetailHeader: UICollectionViewCell {
@IBOutlet weak var titleLabel: UILabel!
@IBOutlet weak var subtitleLabel: UILabel!
@IBOutlet private weak var titleLabel: UILabel!
@IBOutlet private weak var subtitleLabel: UILabel!

func configure(viewModel: LectureDetailViewModel.Header) {
titleLabel.text = viewModel.title
Expand Down
2 changes: 1 addition & 1 deletion TUM Campus App/Lecture Detail/LectureDetailLinkCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import UIKit

final class LectureDetailLinkCell: UICollectionViewCell {
private let seperatorView = UIView()
@IBOutlet weak var nameLabel: UILabel!
@IBOutlet private weak var nameLabel: UILabel!

func configure(viewModel: LectureDetailViewModel.LinkCell, isLastCell: Bool = false) {
nameLabel.text = viewModel.name
Expand Down
3 changes: 1 addition & 2 deletions TUM Campus App/Lecture Detail/LectureDetailViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import Foundation

struct LectureDetailViewModel: Hashable {
var sections: [Section]
let sections: [Section]

struct Section: Identifiable, Hashable {
let id = UUID()
Expand Down Expand Up @@ -39,7 +39,6 @@ struct LectureDetailViewModel: Hashable {
let header = Header(title: lecture.title ?? "", subtitle: lecture.eventType ?? "")

var general: [AnyHashable] = []

if let duration = lecture.duration?.description {
general.append(Cell(key: "Duration".localized, value: duration))
}
Expand Down
7 changes: 2 additions & 5 deletions TUM Campus App/Login/TokenConfirmationViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,8 @@

import UIKit

class TokenConfirmationViewController: UIViewController {

@IBOutlet weak var checkAuthorizationButton: ShadowButton!


final class TokenConfirmationViewController: UIViewController {
@IBOutlet private weak var checkAuthorizationButton: ShadowButton!
var loginController: AuthenticationHandler?

override func viewWillAppear(_ animated: Bool) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ final class MovieDetailCollectionViewController: UICollectionViewController {

func setMovie(_ movie: Movie) {
viewModel = MovieDetailViewModel(movie: movie)
reload(animated: true)
}

override func viewDidLoad() {
Expand Down Expand Up @@ -61,7 +60,7 @@ final class MovieDetailCollectionViewController: UICollectionViewController {

if let header = item as? MovieDetailViewModel.Header {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: MovieDetailHeader.reuseIdentifier, for: indexPath) as! MovieDetailHeader
cell.configure(viewModel: header, isLastCell: isLastCell)
cell.configure(viewModel: header)
return cell
} else if let item = item as? MovieDetailViewModel.Cell {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: MovieDetailCell.reuseIdentifier, for: indexPath) as! MovieDetailCell
Expand Down
6 changes: 3 additions & 3 deletions TUM Campus App/Movie Detail/MovieDetailHeader.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ import UIKit
import AlamofireImage

final class MovieDetailHeader: UICollectionViewCell {
@IBOutlet weak var imageView: UIImageView!
@IBOutlet weak var titleLabel: UILabel!
@IBOutlet private weak var imageView: UIImageView!
@IBOutlet private weak var titleLabel: UILabel!

func configure(viewModel: MovieDetailViewModel.Header, isLastCell: Bool = false) {
func configure(viewModel: MovieDetailViewModel.Header) {
if let imageURL = viewModel.imageURL {
imageView.af.setImage(withURL: imageURL, placeholderImage: UIImage(named: "movie"), filter: RoundedCornersFilter(radius: 4), imageTransition: .crossDissolve(0.3))
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,12 @@ final class PersonDetailCollectionViewController: UICollectionViewController, CN

func setPerson(_ person: Person) {
viewModel = PersonDetailViewModel(person: person)
reload(animated: true)
endpoint = TUMOnlineAPI.personDetails(identNumber: person.obfuscatedID)
fetch(animated: true)
}

func setPerson(withProfile profile: Profile) {
viewModel = PersonDetailViewModel(profile: profile)
reload(animated: true)
guard let id = profile.obfuscatedID else { return }
endpoint = TUMOnlineAPI.personDetails(identNumber: id)
fetch(animated: true)
Expand All @@ -54,7 +52,7 @@ final class PersonDetailCollectionViewController: UICollectionViewController, CN
reload(animated: animated)
}

@objc private func fetch(animated: Bool = true) {
private func fetch(animated: Bool = true) {
guard let endpoint = endpoint else { return }
sessionManager.request(endpoint).responseDecodable(of: PersonDetail.self, decoder: XMLDecoder()) { [weak self] response in
guard let value = response.value else { return }
Expand Down

0 comments on commit 6b82b31

Please sign in to comment.