Skip to content

Commit

Permalink
Merge pull request #67 from pyconjp/release/v1.0.0
Browse files Browse the repository at this point in the history
release v1.0.0 into master
  • Loading branch information
yutailang0119 authored Sep 24, 2016
2 parents ef73f21 + 4597b90 commit f562ee7
Show file tree
Hide file tree
Showing 69 changed files with 1,906 additions and 326 deletions.
3 changes: 2 additions & 1 deletion Cartfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# PyCon JP use Library
github "Alamofire/Alamofire" ~> 3.4
github "Alamofire/Alamofire" ~> 3.5
github "Alamofire/AlamofireImage" ~> 2.5
github "realm/realm-cocoa" ~> 1.0
163 changes: 147 additions & 16 deletions PyConJP2016.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

10 changes: 9 additions & 1 deletion PyConJP2016/Application/PCJConfig.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,16 @@ import UIKit

enum PCJConfig {

static let baseURL = "https://pycon.jp/2016/" + NSLocale.currentLanguageLocaleIdentifier() + "/"
static let hostURL = NSProcessInfo.processInfo().environment["APIBaseURL"] ?? "https://pycon.jp"

static let baseURL = PCJConfig.hostURL + "/2016/" + NSLocale.currentLanguageLocaleIdentifier + "/"

static let apiURL = PCJConfig.baseURL + "api/"

static let authUser = NSProcessInfo.processInfo().environment["APIAuthUser"] ?? ""

static let authPassword = NSProcessInfo.processInfo().environment["APIAuthPassword"] ?? ""

static let mailAddress = "symposion@pycon.jp"

}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
65 changes: 65 additions & 0 deletions PyConJP2016/DataSource/More/StaffListDataSource.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
//
// StaffListDataSource.swift
// PyConJP2016
//
// Created by Yutaro Muta on 9/10/16.
// Copyright © 2016 PyCon JP. All rights reserved.
//

import UIKit

class StaffListDataSource: NSObject, UITableViewDataSource, StaffListAPIType {

let reuseIdentifier = "StaffTableViewCell"

var teams: [Team] = []

let facebookAction: ((url: String) -> (() -> Void))
let twitterAction: ((url: String) -> (() -> Void))

init(facebookAction: ((url: String) -> (() -> Void)), twitterAction: ((url: String) -> (() -> Void))) {
self.facebookAction = facebookAction
self.twitterAction = twitterAction
}

func refreshData(completionHandler: (Result<Void, NSError> -> Void)) -> Void {
getStaffs { [weak self](result) in
guard let weakSelf = self else { return }
switch result {
case .Success(let staffs):
weakSelf.teams.removeAll()
let teamNames = staffs.map({ $0.team }).unique()
for tuple in teamNames.enumerate() {
weakSelf.teams.append(Team(name: teamNames[tuple.index], staffs: staffs.filter({ $0.team == teamNames[tuple.index] })))
}
completionHandler(.Success())
case .Failure(let error):
completionHandler(.Failure(error))
}
}
}

// MARK: - Table View Controller Data Source

func numberOfSectionsInTableView(tableView: UITableView) -> Int {
return teams.count
}

func tableView(tableView: UITableView, titleForHeaderInSection section: Int) -> String? {
return teams[section].name
}

func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return teams[section].staffs.count
}

func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
guard let cell = tableView.dequeueReusableCellWithIdentifier(reuseIdentifier, forIndexPath: indexPath) as? StaffTableViewCell else {
fatalError("Could not create StaffTableViewCell")
}
cell.fill(teams[indexPath.section].staffs[indexPath.row],
onFacebookButton: facebookAction(url: teams[indexPath.section].staffs[indexPath.row].facebook),
onTwitterButton: twitterAction(url: teams[indexPath.section].staffs[indexPath.row].twitter))
return cell
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
//
// SpeakersCollectionViewDataSource.swift
// PyConJP2016
//
// Created by Yutaro Muta on 9/8/16.
// Copyright © 2016 PyCon JP. All rights reserved.
//

import UIKit

class SpeakersCollectionViewDataSource: NSObject, UICollectionViewDataSource {

let reuseIdentifier = "SpeakerCollectionViewCell"

var speakers: [Speaker] = []

func collectionView(collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return speakers.count
}

func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCellWithReuseIdentifier(reuseIdentifier, forIndexPath: indexPath) as! SpeakerCollectionViewCell
cell.fill(speakers[indexPath.row])
return cell
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,21 @@ class BookmarkListDataSource: TimelineDataSource, RealmTalksType {
let filterPredicate = NSPredicate(format: "favorited == %@", true)
let sortProperties = [SortDescriptor(property: "date", ascending: true), SortDescriptor(property: "place", ascending: true)]

func refreshData() {
timelines.removeAll()
loadTalkObjects({ result in
func refreshData(completionHandler: (Result<Void, NSError> -> Void)) -> Void {
loadTalkObjects { [weak self](result) in
guard let weakSelf = self else { return }
switch result {
case .Success(let talks):
weakSelf.timelines.removeAll()
let keys = talks.map { $0.day }.unique()
for tuple in keys.enumerate() {
self.timelines.append(Timeline(key: keys[tuple.index], talks: talks.filter { $0.day == keys[tuple.index]}))
weakSelf.timelines.append(Timeline(key: keys[tuple.index], talks: talks.filter { $0.day == keys[tuple.index]}))
}
break
case .Failure: break
completionHandler(.Success())
case .Failure(let error):
completionHandler(.Failure(error))
}
})
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,19 @@ class ConferenceListDataSource: TimelineDataSource, RealmTalksType {
super.init()
}

func refreshData() {
timelines.removeAll()
loadTalkObjects { result in
func refreshData(completionHandler: (Result<Void, NSError> -> Void)) -> Void {
loadTalkObjects { [weak self](result) in
guard let weakSelf = self else { return }
switch result {
case .Success(let talks):
weakSelf.timelines.removeAll()
let keys = talks.map { $0.startTime }.unique()
for tuple in keys.enumerate() {
self.timelines.append(Timeline(time: keys[tuple.index], talks: talks.filter { $0.startTime == keys[tuple.index]}))
weakSelf.timelines.append(Timeline(time: keys[tuple.index], talks: talks.filter { $0.startTime == keys[tuple.index]}))
}
case .Failure: break
completionHandler(.Success())
case .Failure(let error):
completionHandler(.Failure(error))
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion PyConJP2016/DataSource/Timeline/TimelineDataSource.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class TimelineDataSource: NSObject, UITableViewDataSource {
guard let cell = tableView.dequeueReusableCellWithIdentifier(reuseIdentifier, forIndexPath: indexPath) as? TalkTableViewCell else {
fatalError("Could not create TalkTableViewCell")
}
cell.fillWith(timelines[indexPath.section].talks[indexPath.row])
cell.fill(timelines[indexPath.section].talks[indexPath.row])
return cell
}
}
6 changes: 3 additions & 3 deletions PyConJP2016/Extension/NSLocaleExtention.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ import UIKit

extension NSLocale {

static func currentLanguageLocaleIdentifier() -> String {
static var currentLanguageLocaleIdentifier: String {
return NSBundle.mainBundle().preferredLocalizations.first!
}

static func currentLanguageLocale() -> NSLocale {
return NSLocale(localeIdentifier: NSLocale.currentLanguageLocaleIdentifier())
static var currentLanguageLocale: NSLocale {
return NSLocale(localeIdentifier: NSLocale.currentLanguageLocaleIdentifier)
}

}
8 changes: 8 additions & 0 deletions PyConJP2016/Extension/UIColorExtension.swift
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,12 @@ extension UIColor {
return UIColor.hexStr("#C8C8C8", alpha: 1)
}

static func twitterColor() -> UIColor {
return UIColor.hexStr("#55ACEE", alpha: 1)
}

static func facebookColor() -> UIColor {
return UIColor.hexStr("#315096", alpha: 1)
}

}
5 changes: 2 additions & 3 deletions PyConJP2016/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
Expand All @@ -25,6 +23,7 @@
<key>LSApplicationQueriesSchemes</key>
<array>
<string>twitter</string>
<string>mailto</string>
</array>
<key>LSRequiresIPhoneOS</key>
<true/>
Expand All @@ -37,7 +36,7 @@
<string>armv7</string>
</array>
<key>UIStatusBarStyle</key>
<string>UIStatusBarStyleLightContent</string>
<string>UIStatusBarStyleDefault</string>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
Expand Down
2 changes: 1 addition & 1 deletion PyConJP2016/Model/Class/TalkObject.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import UIKit
import RealmSwift

class TalkObject: Object {
class TalkObject: RealmSwift.Object {
dynamic var id = 0
dynamic var title = ""
dynamic var descriptionText = ""
Expand Down
4 changes: 2 additions & 2 deletions PyConJP2016/Model/Enum/Language.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ enum Language: String {

var localized: String {
switch self {
case .En: return NSLocalizedString("english", tableName: "Language", comment: "")
case .Ja: return NSLocalizedString("japanese", tableName: "Language", comment: "")
case .En: return NSLocalizedString("English", tableName: "Language", comment: "")
case .Ja: return NSLocalizedString("Japanese", tableName: "Language", comment: "")

}
}
Expand Down
23 changes: 5 additions & 18 deletions PyConJP2016/Model/Struct/Speaker.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,31 +10,18 @@ import UIKit

struct Speaker {

let id: Int
let name: String
let imageURL: String
let twitterName: String
let githubName: String
let imageURL: String?
let twitterName: String?

}

extension Speaker {

init(dictionary: [String : AnyObject]) {
id = dictionary["id"] as? Int ?? 0
name = dictionary["name"] as? String ?? ""
imageURL = dictionary["image_url"] as? String ?? ""
twitterName = dictionary["twitter"] as? String ?? ""
githubName = dictionary["github"] as? String ?? ""
imageURL = dictionary["image_uri"] as? String
twitterName = dictionary["twitter"] as? String
}

init?(dictionary: [String : AnyObject]?) {
guard let dictionary = dictionary else { return nil }
id = dictionary["id"] as? Int ?? 0
name = dictionary["name"] as? String ?? ""
imageURL = dictionary["image_url"] as? String ?? ""
twitterName = dictionary["twitter"] as? String ?? ""
githubName = dictionary["github"] as? String ?? ""
}


}
31 changes: 31 additions & 0 deletions PyConJP2016/Model/Struct/Staff.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
//
// Staff.swift
// PyConJP2016
//
// Created by Yutaro Muta on 9/10/16.
// Copyright © 2016 PyCon JP. All rights reserved.
//

import UIKit

struct Staff {

let team: String
let name: String
let role: String
let twitter: String
let facebook: String

}

extension Staff {

init(dictionary: Dictionary<String, AnyObject>) {
self.init(team: dictionary["team"] as? String ?? "",
name: dictionary["name"] as? String ?? "",
role: dictionary["title"] as? String ?? "",
twitter: dictionary["twitter"] as? String ?? "",
facebook: dictionary["facebook"] as? String ?? "")
}

}
Loading

0 comments on commit f562ee7

Please sign in to comment.