mirror of
https://github.com/wahyd4/Yep.git
synced 2026-08-09 04:46:35 +10:00
OpenGraphInfoType
This commit is contained in:
@@ -264,7 +264,7 @@
|
||||
50CDBE491ACBAD3200459CE0 /* ChatLeftImageCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50CDBE471ACBAD3200459CE0 /* ChatLeftImageCell.swift */; };
|
||||
50D45FC31C44D2300044C95A /* OpenGraphService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50D45FC21C44D2300044C95A /* OpenGraphService.swift */; };
|
||||
50D4D0DB1AFA825B005AEB6F /* MediaControlView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50D4D0DA1AFA825B005AEB6F /* MediaControlView.swift */; };
|
||||
50DBDEF11C48C2240044E21B /* FeedURLInfoType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50DBDEF01C48C2240044E21B /* FeedURLInfoType.swift */; };
|
||||
50DBDEF11C48C2240044E21B /* OpenGraphInfoType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50DBDEF01C48C2240044E21B /* OpenGraphInfoType.swift */; };
|
||||
50DBDEFD1C4CCB030044E21B /* ChatLeftTextURLCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50DBDEFB1C4CCB030044E21B /* ChatLeftTextURLCell.swift */; };
|
||||
50DBDF011C4CE75E0044E21B /* ChatRightTextURLCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50DBDEFF1C4CE75E0044E21B /* ChatRightTextURLCell.swift */; };
|
||||
50DBDF051C4DD9530044E21B /* CGSize+Yep.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50DBDF041C4DD9530044E21B /* CGSize+Yep.swift */; };
|
||||
@@ -637,7 +637,7 @@
|
||||
50CDBE471ACBAD3200459CE0 /* ChatLeftImageCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = ChatLeftImageCell.swift; path = Views/Cells/ChatLeftImage/ChatLeftImageCell.swift; sourceTree = "<group>"; };
|
||||
50D45FC21C44D2300044C95A /* OpenGraphService.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = OpenGraphService.swift; path = Services/OpenGraphService.swift; sourceTree = "<group>"; };
|
||||
50D4D0DA1AFA825B005AEB6F /* MediaControlView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = MediaControlView.swift; path = Views/Media/MediaControlView.swift; sourceTree = "<group>"; };
|
||||
50DBDEF01C48C2240044E21B /* FeedURLInfoType.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = FeedURLInfoType.swift; path = Protocols/FeedURLInfoType.swift; sourceTree = "<group>"; };
|
||||
50DBDEF01C48C2240044E21B /* OpenGraphInfoType.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = OpenGraphInfoType.swift; path = Protocols/OpenGraphInfoType.swift; sourceTree = "<group>"; };
|
||||
50DBDEFB1C4CCB030044E21B /* ChatLeftTextURLCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = ChatLeftTextURLCell.swift; path = Views/Cells/ChatLeftTextURL/ChatLeftTextURLCell.swift; sourceTree = "<group>"; };
|
||||
50DBDEFF1C4CE75E0044E21B /* ChatRightTextURLCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = ChatRightTextURLCell.swift; path = Views/Cells/ChatRightTextURL/ChatRightTextURLCell.swift; sourceTree = "<group>"; };
|
||||
50DBDF041C4DD9530044E21B /* CGSize+Yep.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = "CGSize+Yep.swift"; path = "Extensions/CGSize+Yep.swift"; sourceTree = "<group>"; };
|
||||
@@ -2071,7 +2071,7 @@
|
||||
50DBDEF21C48C2290044E21B /* Protocols */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
50DBDEF01C48C2240044E21B /* FeedURLInfoType.swift */,
|
||||
50DBDEF01C48C2240044E21B /* OpenGraphInfoType.swift */,
|
||||
);
|
||||
name = Protocols;
|
||||
sourceTree = "<group>";
|
||||
@@ -2872,7 +2872,7 @@
|
||||
0A90187E1B01152800AE4B7F /* ProfileSocialAccountCell.swift in Sources */,
|
||||
50F5AF831BBA67060033C9BC /* NewFeedViewController.swift in Sources */,
|
||||
50FE29CD1C4786AE0067CA03 /* FeedURLCell.swift in Sources */,
|
||||
50DBDEF11C48C2240044E21B /* FeedURLInfoType.swift in Sources */,
|
||||
50DBDEF11C48C2240044E21B /* OpenGraphInfoType.swift in Sources */,
|
||||
50894CF51AEA4A01000981AF /* SettingsUserCell.swift in Sources */,
|
||||
84385C441B8592120071130D /* ShowStepGeniusViewController.swift in Sources */,
|
||||
6A5632931BC911CB00397B53 /* DiscoverNormalUserCell.swift in Sources */,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// FeedURLInfoType.swift
|
||||
// OpenGraphInfoType.swift
|
||||
// Yep
|
||||
//
|
||||
// Created by nixzhu on 16/1/15.
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
protocol FeedURLInfoType {
|
||||
protocol OpenGraphInfoType {
|
||||
|
||||
var URL: NSURL { get }
|
||||
|
||||
@@ -864,7 +864,7 @@ class OpenGraphInfo: Object {
|
||||
}
|
||||
}
|
||||
|
||||
extension OpenGraphInfo: FeedURLInfoType {
|
||||
extension OpenGraphInfo: OpenGraphInfoType {
|
||||
|
||||
var URL: NSURL {
|
||||
return NSURL(string: URLString)!
|
||||
|
||||
@@ -2959,7 +2959,7 @@ struct DiscoveredFeed: Hashable {
|
||||
}
|
||||
}
|
||||
|
||||
struct URLInfo: FeedURLInfoType {
|
||||
struct URLInfo: OpenGraphInfoType {
|
||||
|
||||
let URL: NSURL
|
||||
|
||||
|
||||
@@ -259,18 +259,18 @@ enum ConversationFeed {
|
||||
return nil
|
||||
}
|
||||
|
||||
var URLInfo: FeedURLInfoType? {
|
||||
var openGraphInfo: OpenGraphInfoType? {
|
||||
|
||||
switch self {
|
||||
case .DiscoveredFeedType(let discoveredFeed):
|
||||
if let attachment = discoveredFeed.attachment {
|
||||
if case let .URL(URLInfo) = attachment {
|
||||
return URLInfo
|
||||
if case let .URL(openGraphInfo) = attachment {
|
||||
return openGraphInfo
|
||||
}
|
||||
}
|
||||
case .FeedType(let feed):
|
||||
if let URLInfo = feed.openGraphInfo {
|
||||
return URLInfo
|
||||
if let openGraphInfo = feed.openGraphInfo {
|
||||
return openGraphInfo
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ class ChatLeftTextURLCell: ChatLeftTextCell {
|
||||
feedURLContainerView.frame = feedURLContainerViewFrame
|
||||
|
||||
if let openGraphInfo = message.openGraphInfo {
|
||||
feedURLContainerView.configureWithFeedURLInfoType(openGraphInfo)
|
||||
feedURLContainerView.configureWithOpenGraphInfoType(openGraphInfo)
|
||||
openGraphURL = openGraphInfo.URL
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ class ChatRightTextURLCell: ChatRightTextCell {
|
||||
feedURLContainerView.frame = feedURLContainerViewFrame
|
||||
|
||||
if let openGraphInfo = message.openGraphInfo {
|
||||
feedURLContainerView.configureWithFeedURLInfoType(openGraphInfo)
|
||||
feedURLContainerView.configureWithOpenGraphInfoType(openGraphInfo)
|
||||
openGraphURL = openGraphInfo.URL
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ class FeedURLCell: FeedBasicCell {
|
||||
if let attachment = feed.attachment {
|
||||
if case let .URL(URLInfo) = attachment {
|
||||
|
||||
feedURLContainerView.configureWithFeedURLInfoType(URLInfo)
|
||||
feedURLContainerView.configureWithOpenGraphInfoType(URLInfo)
|
||||
|
||||
feedURLContainerView.tapAction = { [weak self] in
|
||||
self?.tapURLInfoAction?(URL: URLInfo.URL)
|
||||
|
||||
@@ -146,13 +146,13 @@ class FeedURLContainerView: UIView {
|
||||
tapAction?()
|
||||
}
|
||||
|
||||
func configureWithFeedURLInfoType(URLInfo: FeedURLInfoType) {
|
||||
func configureWithOpenGraphInfoType(openGraphInfo: OpenGraphInfoType) {
|
||||
|
||||
siteNameLabel.text = URLInfo.siteName
|
||||
titleLabel.text = URLInfo.title
|
||||
descriptionLabel.text = URLInfo.infoDescription
|
||||
siteNameLabel.text = openGraphInfo.siteName
|
||||
titleLabel.text = openGraphInfo.title
|
||||
descriptionLabel.text = openGraphInfo.infoDescription
|
||||
|
||||
if let thumbnailImageURL = NSURL(string: URLInfo.thumbnailImageURLString) {
|
||||
if let thumbnailImageURL = NSURL(string: openGraphInfo.thumbnailImageURLString) {
|
||||
thumbnailImageView.kf_setImageWithURL(thumbnailImageURL, placeholderImage: nil)
|
||||
} else {
|
||||
thumbnailImageView.image = nil
|
||||
|
||||
@@ -360,8 +360,8 @@ class FeedView: UIView {
|
||||
|
||||
socialWorkContainerViewHeightConstraint.constant = 80
|
||||
|
||||
if let URLInfo = feed.URLInfo {
|
||||
feedURLContainerView.configureWithFeedURLInfoType(URLInfo)
|
||||
if let openGraphInfo = feed.openGraphInfo {
|
||||
feedURLContainerView.configureWithOpenGraphInfoType(openGraphInfo)
|
||||
}
|
||||
|
||||
case .Image:
|
||||
@@ -512,7 +512,7 @@ class FeedView: UIView {
|
||||
}
|
||||
|
||||
func tapURLInfo(sender: UITapGestureRecognizer) {
|
||||
guard let URL = feed?.URLInfo?.URL else {
|
||||
guard let URL = feed?.openGraphInfo?.URL else {
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user