From e9c3a80070c1851e1b1c99292204a1d8aacfcd7b Mon Sep 17 00:00:00 2001 From: Enes Karaosman Date: Mon, 16 Nov 2020 13:43:27 +0300 Subject: [PATCH] [ADD] pictureInPicturePlayingMessage parameter added to VideoItem protocol. --- README.md | 2 +- .../SwiftyChat/MessageCells/VideoPlaceholderCell.swift | 2 +- Sources/SwiftyChat/Mock/MockMessages.swift | 8 ++++---- Sources/SwiftyChat/Protocols/VideoItem.swift | 3 +++ 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 4b8aae78..0d5b7482 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/Sources/SwiftyChat/MessageCells/VideoPlaceholderCell.swift b/Sources/SwiftyChat/MessageCells/VideoPlaceholderCell.swift index b7093496..57433f52 100644 --- a/Sources/SwiftyChat/MessageCells/VideoPlaceholderCell.swift +++ b/Sources/SwiftyChat/MessageCells/VideoPlaceholderCell.swift @@ -81,7 +81,7 @@ internal struct VideoPlaceholderCell: 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) diff --git a/Sources/SwiftyChat/Mock/MockMessages.swift b/Sources/SwiftyChat/Mock/MockMessages.swift index cdacbf59..888a9aab 100644 --- a/Sources/SwiftyChat/Mock/MockMessages.swift +++ b/Sources/SwiftyChat/Mock/MockMessages.swift @@ -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: "")) } } } @@ -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 @@ -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, diff --git a/Sources/SwiftyChat/Protocols/VideoItem.swift b/Sources/SwiftyChat/Protocols/VideoItem.swift index 5fc159e5..fc80b573 100644 --- a/Sources/SwiftyChat/Protocols/VideoItem.swift +++ b/Sources/SwiftyChat/Protocols/VideoItem.swift @@ -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 } }