Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 15 additions & 11 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,19 @@ let package = Package(
.package(url: "https://github.com/Giphy/giphy-ios-sdk", .upToNextMajor(from: "2.1.3"))
],
targets: [
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
// Targets can depend on other targets in this package, and on products in packages this package depends on.
.target(
name: "ChatUI",
dependencies: [
.product(name: "GiphyUISDK", package: "giphy-ios-sdk")
]),
.testTarget(
name: "ChatUITests",
dependencies: ["ChatUI"]),
]
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
// Targets can depend on other targets in this package, and on products in packages this package depends on.
.target(
name: "ChatUI",
dependencies: [
.product(name: "GiphyUISDK", package: "giphy-ios-sdk")
],
resources: [
.process("Resources")
]
),
.testTarget(
name: "ChatUITests",
dependencies: ["ChatUI"]),
]
Comment on lines +21 to +35
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
// Targets can depend on other targets in this package, and on products in packages this package depends on.
.target(
name: "ChatUI",
dependencies: [
.product(name: "GiphyUISDK", package: "giphy-ios-sdk")
],
resources: [
.process("Resources")
]
),
.testTarget(
name: "ChatUITests",
dependencies: ["ChatUI"]),
]
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
// Targets can depend on other targets in this package, and on products in packages this package depends on.
.target(
name: "ChatUI",
dependencies: [
.product(name: "GiphyUISDK", package: "giphy-ios-sdk")
],
resources: [
.process("Resources")
]
),
.testTarget(
name: "ChatUITests",
dependencies: ["ChatUI"]),
]

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Convention: Indent -> 4 space

)
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import SwiftUI

class CustomTabBarController: UITabBarController {
var tabBarHeight: CGFloat {
tabBar.frame.size.height
}
}

struct GiphyAttributionMarkView: View {

private let PADDING_ABOVE_TAB = 2.5
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
private let PADDING_ABOVE_TAB = 2.5
private let paddingAboveTab = 2.5

please modify snake case to lower camel case :)


@Environment(\.colorScheme) private var colorScheme

var body: some View {
VStack {
Spacer()
HStack {
Spacer()
Image(getImageName() , bundle: .module)
.padding(.bottom, CustomTabBarController().tabBarHeight + PADDING_ABOVE_TAB)
}
}
}

private func getImageName() -> String {
colorScheme == .dark
? "Poweredby_100px-Black_VertText"
: "Poweredby_100px-White_VertText"
}
}

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add GiphyAttributionMarkView.Previews to Previews/ChatInChannel path:

struct GiphyAttributionMarkView_Preview: PreviewProvider {
    static var previews: some View {
        GiphyAttributionMarkView()
            .preferredColorScheme(.dark)
    }
}

24 changes: 15 additions & 9 deletions Sources/ChatUI/ChatInChannel/MessageField/MessageField.swift
Original file line number Diff line number Diff line change
Expand Up @@ -183,15 +183,21 @@ public struct MessageField: View {
}
.sheet(isPresented: $isGIFPickerPresented) {
if let giphyKey = configuration.giphyKey {
GiphyPicker(
giphyKey: giphyKey,
giphyConfig: configuration.giphyConfig
)
.ignoresSafeArea()
.presentationDetents(
[.fraction(configuration.giphyConfig.presentationDetents)]
)
.presentationDragIndicator(.hidden)
ZStack {
GiphyPicker(
giphyKey: giphyKey,
giphyConfig: configuration.giphyConfig
)
.ignoresSafeArea()
.presentationDetents(
[.fraction(configuration.giphyConfig.presentationDetents)]
)
.presentationDragIndicator(.hidden)

if (configuration.giphyConfig.showsAttributionMark) {
GiphyAttributionMarkView()
}
}
} else {
Text("No Giphy Key")
}
Expand Down
10 changes: 8 additions & 2 deletions Sources/ChatUI/Essentials/GiphyConfiguration.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,24 @@ public struct GiphyConfiguration {
public let shouldLocalizeSearch: Bool
public let mediaTypeConfig: [GiphyUISDK.GPHContentType]
public let presentationDetents: CGFloat

/// When moving from beta key to production key 'Giphy' asks to clearly display "Powered By GIPHY" attribution marks where the API is utilized.
/// setting this value to true will show the attribution mark on the giphy select display.
public let showsAttributionMark: Bool

public init(
dimBackground: Bool = false,
showConfirmationScreen: Bool = false,
shouldLocalizeSearch: Bool = false,
mediaTypeConfig: [GiphyUISDK.GPHContentType] = [.gifs, .stickers, .recents],
presentationDetents: CGFloat = 0.9
presentationDetents: CGFloat = 0.9,
showsAttributionMark: Bool = false
) {
self.dimBackground = dimBackground
self.showConfirmationScreen = showConfirmationScreen
self.shouldLocalizeSearch = shouldLocalizeSearch
self.mediaTypeConfig = mediaTypeConfig
self.presentationDetents = presentationDetents
self.showsAttributionMark = showsAttributionMark
}
}
}
6 changes: 6 additions & 0 deletions Sources/ChatUI/Resources/Media.xcassets/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"images" : [

],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"images" : [

],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.