mirror of
https://github.com/tappollo/WWDC.git
synced 2026-01-12 17:12:18 +08:00
Improved thumbnails for special events and get-togethers
This commit is contained in:
Binary file not shown.
12
WWDC/Assets.xcassets/get-together.imageset/Contents.json
vendored
Normal file
12
WWDC/Assets.xcassets/get-together.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "get-together.pdf"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
||||
BIN
WWDC/Assets.xcassets/get-together.imageset/get-together.pdf
vendored
Normal file
BIN
WWDC/Assets.xcassets/get-together.imageset/get-together.pdf
vendored
Normal file
Binary file not shown.
12
WWDC/Assets.xcassets/special.imageset/Contents.json
vendored
Normal file
12
WWDC/Assets.xcassets/special.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "special.pdf"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
||||
BIN
WWDC/Assets.xcassets/special.imageset/special.pdf
vendored
Normal file
BIN
WWDC/Assets.xcassets/special.imageset/special.pdf
vendored
Normal file
Binary file not shown.
@@ -100,6 +100,17 @@ final class SessionTableCellView: NSTableCellView {
|
||||
self?.contextColorView.progress = 0
|
||||
}
|
||||
}).addDisposableTo(self.disposeBag)
|
||||
|
||||
viewModel.rxSessionType.distinctUntilChanged().subscribe(onNext: { [weak self] type in
|
||||
guard type != .session && type != .lab else { return }
|
||||
|
||||
switch type {
|
||||
case .getTogether:
|
||||
self?.thumbnailImageView.image = #imageLiteral(resourceName: "get-together")
|
||||
default:
|
||||
self?.thumbnailImageView.image = #imageLiteral(resourceName: "special")
|
||||
}
|
||||
}).addDisposableTo(self.disposeBag)
|
||||
}
|
||||
|
||||
private lazy var titleLabel: NSTextField = {
|
||||
|
||||
@@ -61,6 +61,10 @@ final class SessionViewModel: NSObject {
|
||||
return Observable.from(object: self.session).map({ SessionViewModel.footer(for: $0, at: $0.event.first) })
|
||||
}()
|
||||
|
||||
lazy var rxSessionType: Observable<SessionInstanceType> = {
|
||||
return Observable.from(object: self.session).map({ $0.instances.first?.type }).ignoreNil()
|
||||
}()
|
||||
|
||||
lazy var rxColor: Observable<NSColor> = {
|
||||
return Observable.from(object: self.session).map({ SessionViewModel.trackColor(for: $0) }).ignoreNil()
|
||||
}()
|
||||
@@ -222,6 +226,10 @@ final class SessionViewModel: NSObject {
|
||||
}
|
||||
|
||||
static func imageUrl(for session: Session) -> URL? {
|
||||
guard session.instances.first?.type == .session || session.instances.first?.type == .lab else {
|
||||
return nil
|
||||
}
|
||||
|
||||
let imageAsset = session.asset(of: .image)
|
||||
|
||||
guard let thumbnail = imageAsset?.remoteURL, let thumbnailUrl = URL(string: thumbnail) else { return nil }
|
||||
|
||||
Reference in New Issue
Block a user