Skip to content

Commit

Permalink
[ADD] pictureInPicturePlayingMessage parameter added to VideoItem pro…
Browse files Browse the repository at this point in the history
…tocol.
  • Loading branch information
EnesKaraosman committed Nov 16, 2020
1 parent fd3d447 commit e9c3a80
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
![Version](https://img.shields.io/badge/version-1.3.0-blue)
![Version](https://img.shields.io/badge/version-1.3.1-blue)
![Swift 5.3](https://img.shields.io/badge/Swift-5.3-orange.svg)

# SwiftyChat
Expand Down
2 changes: 1 addition & 1 deletion Sources/SwiftyChat/MessageCells/VideoPlaceholderCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ internal struct VideoPlaceholderCell<Message: ChatMessage>: View {
.resizable()
.scaledToFit()
.frame(width: 40)
Text("Bu video resim içinde resim olarak oynuyor.")
Text(media.pictureInPicturePlayingMessage)
.font(.footnote)
.fontWeight(.semibold)
.padding(.horizontal, 60)
Expand Down
8 changes: 4 additions & 4 deletions Sources/SwiftyChat/Mock/MockMessages.swift
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public struct MockMessages {
case .Contact: return .contact(ContactRow(displayName: ""))
case .QuickReply: return .quickReply([])
case .Carousel: return .carousel([CarouselRow(title: "", imageURL: nil, subtitle: "", buttons: [])])
case .Video: return .video(VideoRow(url: URL(string: "")!, placeholderImage: .remote(URL(string: "")!)))
case .Video: return .video(VideoRow(url: URL(string: "")!, placeholderImage: .remote(URL(string: "")!), pictureInPicturePlayingMessage: ""))
}
}
}
Expand Down Expand Up @@ -74,9 +74,8 @@ public struct MockMessages {
// MARK: - Concrete model for Video
private struct VideoRow: VideoItem {
var url: URL
// var image: UIImage?
var placeholderImage: ImageLoadingKind
// var size: CGSize
var pictureInPicturePlayingMessage: String
}

// MARK: - Concrete model for ChatMessage
Expand Down Expand Up @@ -229,7 +228,8 @@ public struct MockMessages {
case .Video:
let videoItem = VideoRow(
url: URL(string: "http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4")!,
placeholderImage: .remote(URL(string: "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/images/BigBuckBunny.jpg")!)
placeholderImage: .remote(URL(string: "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/images/BigBuckBunny.jpg")!),
pictureInPicturePlayingMessage: "This video is playing in picture in picture."
)
return ChatMessageItem(
user: randomUser,
Expand Down
3 changes: 3 additions & 0 deletions Sources/SwiftyChat/Protocols/VideoItem.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,8 @@ public protocol VideoItem {

/// A placeholder image for when the image is obtained asynchronously.
var placeholderImage: ImageLoadingKind { get }

/// The message is shown in thumbnailView when the video is playing.
var pictureInPicturePlayingMessage: String { get }

}

0 comments on commit e9c3a80

Please sign in to comment.