Skip to content

Commit

Permalink
Merge pull request #148 from sendbird/release/3.29.0
Browse files Browse the repository at this point in the history
Release/3.29.0 -> main
  • Loading branch information
tezpark authored Jan 2, 2025
2 parents 02d5a83 + 974f36d commit d7fb331
Show file tree
Hide file tree
Showing 85 changed files with 4,228 additions and 8,153 deletions.
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,24 @@
# Changelog

### v3.29.0 (Jan 02, 2025)

## MessageTemplate (New)

### 🚀 New Feature

Introduced a powerful module for parsing JSON-based templated syntax and seamlessly converting it into dynamic Views

- Added TemplateParser to parse the template and generate the code
- Added ViewGenerator to generate the view based on the parsed template

### 📦 Modular Design

Designed as a standalone library for easy adoption in diverse projects

### 🛠️ Developer-Friendly

Offers a straightforward API for effortless parsing and rendering, enabling rapid development and reduced boilerplate code

### v3.28.1 (Dec 05, 2024)

## ModuleSet Improvements
Expand Down
Empty file.
4 changes: 2 additions & 2 deletions Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
"repositoryURL": "https://github.com/sendbird/sendbird-chat-sdk-ios",
"state": {
"branch": null,
"revision": "3125065015982175879093cac9c71b5adbe0749e",
"version": "4.19.0"
"revision": "0b1843060748c295b49f60a6f718dc6488e11657",
"version": "4.24.1"
}
}
]
Expand Down
21 changes: 19 additions & 2 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ let package = Package(
name: "SendbirdUIKit",
targets: ["SendbirdUIKitTarget"]
),
.library(
name: "SendbirdUIMessageTemplate",
targets: ["SendbirdUIMessageTemplateTarget"]
),
],
dependencies: [
.package(
Expand All @@ -21,8 +25,13 @@ let package = Package(
targets: [
.binaryTarget(
name: "SendbirdUIKit",
url: "https://github.com/sendbird/sendbird-uikit-ios/releases/download/3.28.1/SendbirdUIKit.xcframework.zip", // SendbirdUIKit_URL
checksum: "505f30d55e1a2d2ab270c7d0ee4542da359fa58c3ad07190c5f631d02e0d3143" // SendbirdUIKit_CHECKSUM
url: "https://github.com/sendbird/sendbird-uikit-ios/releases/download/3.29.0/SendbirdUIKit.xcframework.zip", // SendbirdUIKit_URL
checksum: "556fddaccb892b9b6e1c3ac5734cd493a5f2772f1bab313543a144b542df8944" // SendbirdUIKit_CHECKSUM
),
.binaryTarget(
name: "SendbirdUIMessageTemplate",
url: "https://github.com/sendbird/sendbird-uikit-ios/releases/download/3.29.0/SendbirdUIMessageTemplate.xcframework.zip", // SendbirdUIMessageTemplate_URL
checksum: "d153ea5c96c9ef69589217e416afa060555a0addabcae5f81afddbba9df31cda" // SendbirdUIMessageTemplate_CHECKSUM
),
.target(
name: "SendbirdUIKitTarget",
Expand All @@ -33,5 +42,13 @@ let package = Package(
path: "Framework/Dependency",
exclude: ["../../Sample", "../../Sources"]
),
.target(
name: "SendbirdUIMessageTemplateTarget",
dependencies: [
.product(name: "SendbirdChatSDK", package: "SendbirdChatSDK")
],
path: "Framework/Module/MessageTemplate",
exclude: ["../../Sample", "../../Sources"]
),
]
)
5,035 changes: 2,457 additions & 2,578 deletions Sample/QuickStart.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions SendBirdUIKit.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "SendBirdUIKit"
s.version = "3.28.1"
s.version = "3.29.0"
s.summary = "UIKit based on SendbirdChatSDK"
s.description = "Sendbird UIKit is a framework composed of basic UI components based on SendbirdChatSDK."
s.homepage = "https://sendbird.com"
Expand All @@ -16,10 +16,11 @@ Pod::Spec.new do |s|
"Kai" => "[email protected]"
}
s.platform = :ios, "12.0"
s.source = { :http => "https://github.com/sendbird/sendbird-uikit-ios/releases/download/#{s.version}/SendBirdUIKit.zip", :sha1 => "41192f0e9a4a0131a84aecc9e299afae2cc4eb93" }
s.source = { :http => "https://github.com/sendbird/sendbird-uikit-ios/releases/download/#{s.version}/SendBirdUIKit.zip", :sha1 => "a787030f4a2c477990903b8bcd5cf0a22d2550ea" }
s.ios.vendored_frameworks = 'SendBirdUIKit/SendbirdUIKit.xcframework'
s.ios.frameworks = ["UIKit", "Foundation", "CoreData", "SendbirdChatSDK"]
s.requires_arc = true
s.dependency "SendbirdChatSDK", ">= 4.23.1"
s.dependency "SendbirdUIMessageTemplate", ">= 3.29.0"
s.ios.library = "icucore"
end
24 changes: 24 additions & 0 deletions SendbirdUIMessageTemplate.podspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
Pod::Spec.new do |s|
s.name = "SendbirdUIMessageTemplate"
s.version = "3.29.0"
s.summary = "SendbirdUIMessageTemplate based on SendbirdChatSDK"
s.description = "Sendbird UI MessageTemplate is a framework composed of basic Message Template UI components based on SendbirdChatSDK."
s.homepage = "https://sendbird.com"
s.documentation_url = 'https://sendbird.com/docs/uikit'
s.license = { :type => 'Commercial', :file => 'SendbirdUIMessageTemplate/LICENSE.md' }
s.authors = {
"Tez" => "[email protected]",
"Celine" => "[email protected]",
"Damon" => "[email protected]",
"Jed" => "[email protected]",
"Young" => "[email protected]",
"Kai" => "[email protected]"
}
s.platform = :ios, "12.0"
s.source = { :http => "https://github.com/sendbird/sendbird-uikit-ios/releases/download/#{s.version}/SendbirdUIMessageTemplate.zip", :sha1 => "dcfdcb54416f96c33db9d7507e3fd5dd2d6859e9" }
s.ios.vendored_frameworks = 'SendbirdUIMessageTemplate/SendbirdUIMessageTemplate.xcframework'
s.ios.frameworks = ["UIKit", "Foundation", "CoreData", "SendbirdChatSDK"]
s.requires_arc = true
s.dependency "SendbirdChatSDK", ">= 4.23.1"
s.ios.library = "icucore"
end
9 changes: 0 additions & 9 deletions Sources/Enums/SBUEnums.swift
Original file line number Diff line number Diff line change
Expand Up @@ -286,15 +286,6 @@ public enum NewMessageInfoItemType: Int {
case button
}

@objc
public enum LogType: UInt8 {
case none = 0b00000000
case error = 0b00000001
case warning = 0b00000010
case info = 0b00000100
case all = 0b00000111
}

/// This is an enumeration for notification type.
/// - Since: 3.5.0
enum NotificationType: Int {
Expand Down
6 changes: 0 additions & 6 deletions Sources/Extension/Array+SBUIKit.swift
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,6 @@ public extension NSArray {
}
}

extension Array {
subscript(safe index: Int) -> Element? {
return indices.contains(index) ? self[index] : nil
}
}

extension Array where Element == String {
func toggle(_ value: String) -> [String] {
var copy = self
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,9 @@ import Foundation
extension Collection {
var hasElements: Bool { isEmpty == false }
}

extension Array {
subscript(safe index: Int) -> Element? {
return indices.contains(index) ? self[index] : nil
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,7 @@ public extension UIImage {
}

let data = image.jpegData(
compressionQuality: SBUGlobals.isImageCompressionEnabled
? SBUGlobals.imageCompressionRate
: 1.0
compressionQuality: SBUGlobals.imageCompressionQuality
)

if data == nil {
Expand Down Expand Up @@ -337,19 +335,23 @@ extension UIImage {
// swiftlint:enable identifier_name

extension UIImage {
/// test downloader
static var sbu_imageDownloader = SBUImageDownloader()
}

// 이미지 다운로드 클래스 정의
/// image downloader
class SBUImageDownloader {
/// string to url.
func url(string: String) -> URL? {
URL(string: string)
}

/// url to image.
func image(url: URL) -> UIImage? {
UIImage(url: url)
}

// download image from url.
func downloadImage(
from url: URL,
completion: @escaping (Data?, Error?) -> Void
Expand All @@ -359,3 +361,42 @@ class SBUImageDownloader {
}
}
}

extension UIImage {
// https://stackoverflow.com/a/47884962
// INFO: Edge case - image height is wrap
func resizeTopAlignedToFill(newWidth: CGFloat) -> UIImage? {
// Calculate ratio used for resizing the image
let scale = newWidth / size.width
let newHeight = size.height * scale
let newSize = CGSize(width: newWidth, height: newHeight)

// Array that stores image frames
var images: [UIImage] = []

// If animated GIF image, resize all images in frames and append them to the array
if let animatedImages = self.images {
for animatedImage in animatedImages {
guard let cgImage = animatedImage.cgImage else { continue }
let image = UIImage(cgImage: cgImage)
UIGraphicsBeginImageContextWithOptions(newSize, false, image.scale)
let rect = CGRect(x: 0, y: 0, width: newSize.width, height: newSize.height)
image.draw(in: rect)
let newImage = UIGraphicsGetImageFromCurrentImageContext()
UIGraphicsEndImageContext()
guard let newImage = newImage else { continue }
images.append(newImage)
}
} else {
// If not an animated GIF image, create a new image with resizing
UIGraphicsBeginImageContextWithOptions(newSize, false, UIApplication.shared.currentWindow?.screen.scale ?? 1.0)
draw(in: CGRect(origin: .zero, size: newSize))
let newImage = UIGraphicsGetImageFromCurrentImageContext()
UIGraphicsEndImageContext()
return newImage
}

// Create a new GIF image with modified images
return UIImage.animatedImage(with: images, duration: self.duration)
}
}
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,53 +1,12 @@
//
// SBUMessageTemplate.Renderer+Utils.swift
// UILabel+SBUIKit.swift
// SendbirdUIKit
//
// Created by Tez Park on 2022/10/14.
// Copyright © 2024 Sendbird, Inc. All rights reserved.
// Created by Damon Park on 11/21/24.
//

import UIKit

extension UIImage {
// https://stackoverflow.com/a/47884962
// INFO: Edge case - image height is wrap
func resizeTopAlignedToFill(newWidth: CGFloat) -> UIImage? {
// Calculate ratio used for resizing the image
let scale = newWidth / size.width
let newHeight = size.height * scale
let newSize = CGSize(width: newWidth, height: newHeight)

// Array that stores image frames
var images: [UIImage] = []

// If animated GIF image, resize all images in frames and append them to the array
if let animatedImages = self.images {
for animatedImage in animatedImages {
guard let cgImage = animatedImage.cgImage else { continue }
let image = UIImage(cgImage: cgImage)
UIGraphicsBeginImageContextWithOptions(newSize, false, image.scale)
let rect = CGRect(x: 0, y: 0, width: newSize.width, height: newSize.height)
image.draw(in: rect)
let newImage = UIGraphicsGetImageFromCurrentImageContext()
UIGraphicsEndImageContext()
guard let newImage = newImage else { continue }
images.append(newImage)
}
} else {
// If not an animated GIF image, create a new image with resizing
UIGraphicsBeginImageContextWithOptions(newSize, false, UIApplication.shared.currentWindow?.screen.scale ?? 1.0)
draw(in: CGRect(origin: .zero, size: newSize))
let newImage = UIGraphicsGetImageFromCurrentImageContext()
UIGraphicsEndImageContext()
return newImage
}

// Create a new GIF image with modified images
return UIImage.animatedImage(with: images, duration: self.duration)
}
}

// TODO: will be separated by a file
extension UILabel {
func textWidth() -> CGFloat {
return UILabel.textWidth(font: self.font, text: self.text ?? "")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1385,3 +1385,9 @@ extension UIView {
return view
}
}

extension UIView {
var memoryAddress: String {
String(describing: Unmanaged.passUnretained(self).toOpaque()).uppercased()
}
}
Loading

0 comments on commit d7fb331

Please sign in to comment.