mirror of
https://github.com/neon443/StickerSlack.git
synced 2026-11-30 12:44:51 +00:00
added clear logos for giphy stickers
This commit is contained in:
8 files changed
+32
-9
No files matched your search
@@ -14,6 +14,7 @@ import UniformTypeIdentifiers
|
||||
struct Emoji: StickerProtocol {
|
||||
var id: String
|
||||
var name: String
|
||||
var typeGlyph: String = "slack.logo"
|
||||
var localImageURLString: String {
|
||||
let urlString = remoteImageURL.absoluteString
|
||||
let split = urlString.split(separator: ".")
|
||||
|
||||
@@ -12,6 +12,8 @@ import UniformTypeIdentifiers
|
||||
struct Gif: StickerProtocol {
|
||||
var id: String
|
||||
var name: String
|
||||
var typeGlyph: String = "giphy.logo"
|
||||
|
||||
var localImageURLString: String {
|
||||
let urlString = remoteImageURL.absoluteString
|
||||
let split = urlString.split(separator: ".")
|
||||
|
||||
@@ -57,7 +57,7 @@ extension StickerProtocol {
|
||||
return
|
||||
}
|
||||
|
||||
func resize(image: UIImage, to targetSize: CGSize) -> UIImage {
|
||||
func resize(image: UIImage, to targetSize: CGSize) -> UIImage {
|
||||
let oldSize = image.size
|
||||
let ratio: (x: CGFloat, y: CGFloat)
|
||||
ratio.x = targetSize.width / oldSize.width
|
||||
|
||||
@@ -12,6 +12,8 @@ protocol StickerProtocol: Codable, Identifiable, Hashable {
|
||||
var id: String { get set }
|
||||
var name: String { get set }
|
||||
|
||||
var typeGlyph: String { get }
|
||||
|
||||
var localImageURL: URL { get }
|
||||
var localImageURLString: String { get }
|
||||
var remoteImageURL: URL { get set }
|
||||
|
||||
@@ -34,14 +34,10 @@ struct StickerRow<T: Hoarder>: View {
|
||||
Button {
|
||||
showTooltip.toggle()
|
||||
} label: {
|
||||
if type(of: sticker) == Emoji.self {
|
||||
Image("slack.logo")
|
||||
.resizable().scaledToFit()
|
||||
.frame(width: 20, height: 20)
|
||||
.foregroundStyle(.gray)
|
||||
} else if type(of: sticker) == Gif.self {
|
||||
Text("G")
|
||||
}
|
||||
Image(sticker.typeGlyph)
|
||||
.resizable().scaledToFit()
|
||||
.frame(maxHeight: 20)
|
||||
.foregroundStyle(.gray)
|
||||
}
|
||||
.buttonStyle(.borderless)
|
||||
.alert("From Slack", isPresented: $showTooltip) {
|
||||
|
||||