Skip to content

Commit

Permalink
feat: thumbnail
Browse files Browse the repository at this point in the history
  • Loading branch information
nuomi1 committed Jan 24, 2021
1 parent 945187c commit 73f0783
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions NBus/Classes/Handler/WeiboHandler.swift
Original file line number Diff line number Diff line change
Expand Up @@ -94,21 +94,24 @@ extension WeiboHandler: ShareHandlerType {
messageItems["mediaObject"] = webPageItems(
link: message.link,
title: message.title,
description: message.description
description: message.description,
thumbnail: message.thumbnail
)

case let message as VideoMessage:
messageItems["mediaObject"] = webPageItems(
link: message.link,
title: message.title,
description: message.description
description: message.description,
thumbnail: message.thumbnail
)

case let message as WebPageMessage:
messageItems["mediaObject"] = webPageItems(
link: message.link,
title: message.title,
description: message.description
description: message.description,
thumbnail: message.thumbnail
)

default:
Expand Down Expand Up @@ -155,13 +158,15 @@ extension WeiboHandler: ShareHandlerType {
private func webPageItems(
link: URL,
title: String?,
description: String?
description: String?,
thumbnail: Data?
) -> [String: Any] {
var webPageItems: [String: Any] = [:]

webPageItems["__class"] = "WBWebpageObject"
webPageItems["description"] = description
webPageItems["objectID"] = UUID().uuidString
webPageItems["thumbnailData"] = thumbnail
webPageItems["title"] = title
webPageItems["webpageUrl"] = link.absoluteString

Expand Down

0 comments on commit 73f0783

Please sign in to comment.