Skip to content

Commit 90bd1e2

Browse files
committed
* Improved stability
* Added `shouldUseImageCompression` flag in `SBUGlobals`
1 parent 3e079fc commit 90bd1e2

File tree

59 files changed

+1926
-1668
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+1926
-1668
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Change Log
22

3+
### v2.0.1 (Jan 14, 2021)
4+
* Improved stability
5+
* Added `shouldUseImageCompression` flag in `SBUGlobals`
6+
37
### v2.0.0 (Dec 24, 2020)
48
* Added OpenChannel features.
59
* `SBUOpenChannelViewController`

SendBirdUIKit.framework.dSYM/Contents/Info.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<key>CFBundleSignature</key>
1414
<string>????</string>
1515
<key>CFBundleShortVersionString</key>
16-
<string>2.0.0</string>
16+
<string>2.0.1</string>
1717
<key>CFBundleVersion</key>
1818
<string>1</string>
1919
</dict>
510 KB
Binary file not shown.

SendBirdUIKit.framework/Assets.car

0 Bytes
Binary file not shown.

SendBirdUIKit.framework/Headers/SBUActionSheet.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public class SBUActionSheetItem: SBUCommonItem {
3232
image: UIImage? = nil,
3333
font: UIFont? = nil,
3434
textAlignment: NSTextAlignment = .left,
35-
completionHandler: SBUActionSheetHandler? = nil) {
35+
completionHandler: SBUActionSheetHandler?) {
3636
super.init(
3737
title: title,
3838
color: color,

SendBirdUIKit.framework/Headers/SBUChannelSettingsViewController.swift

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -435,16 +435,19 @@ open class SBUChannelSettingsViewController: UIViewController, UINavigationContr
435435
let changeNameItem = SBUActionSheetItem(
436436
title: SBUStringSet.ChannelSettings_Change_Name,
437437
color: theme.itemTextColor,
438-
image: nil
438+
image: nil,
439+
completionHandler: nil
439440
)
440441
let changeImageItem = SBUActionSheetItem(
441442
title: SBUStringSet.ChannelSettings_Change_Image,
442443
color: theme.itemTextColor,
443-
image: nil
444+
image: nil,
445+
completionHandler: nil
444446
)
445447
let cancelItem = SBUActionSheetItem(
446448
title: SBUStringSet.Cancel,
447-
color: theme.itemColor
449+
color: theme.itemColor,
450+
completionHandler: nil
448451
)
449452
SBUActionSheet.show(
450453
items: [changeNameItem, changeImageItem],
@@ -460,15 +463,18 @@ open class SBUChannelSettingsViewController: UIViewController, UINavigationContr
460463
public func selectChannelImage() {
461464
let cameraItem = SBUActionSheetItem(
462465
title: SBUStringSet.Camera,
463-
image: SBUIconSet.iconCamera.sbu_with(tintColor: theme.itemColor)
466+
image: SBUIconSet.iconCamera.sbu_with(tintColor: theme.itemColor),
467+
completionHandler: nil
464468
)
465469
let libraryItem = SBUActionSheetItem(
466470
title: SBUStringSet.PhotoVideoLibrary,
467-
image: SBUIconSet.iconPhoto.sbu_with(tintColor: theme.itemColor)
471+
image: SBUIconSet.iconPhoto.sbu_with(tintColor: theme.itemColor),
472+
completionHandler: nil
468473
)
469474
let cancelItem = SBUActionSheetItem(
470475
title: SBUStringSet.Cancel,
471-
color: theme.itemColor
476+
color: theme.itemColor,
477+
completionHandler: nil
472478
)
473479
SBUActionSheet.show(
474480
items: [cameraItem, libraryItem],

SendBirdUIKit.framework/Headers/SBUChannelViewController.swift

Lines changed: 28 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -726,7 +726,8 @@ open class SBUChannelViewController: SBUBaseChannelViewController, UINavigationC
726726
/// - fileName: file name. Used when displayed in channel list.
727727
/// - mimeType: file's mime type.
728728
/// - Since: 1.0.9
729-
public func sendFileMessage(fileData: Data, fileName: String, mimeType: String) {
729+
public func sendFileMessage(fileData: Data?, fileName: String, mimeType: String) {
730+
guard let fileData = fileData else { return }
730731
let messageParams = SBDFileMessageParams(file: fileData)!
731732
messageParams.fileName = fileName
732733
messageParams.mimeType = mimeType
@@ -1259,10 +1260,15 @@ open class SBUChannelViewController: SBUBaseChannelViewController, UINavigationC
12591260
guard let imageUrl = _imageUrl else {
12601261
let originalImage = info[.originalImage] as? UIImage
12611262
// for Camera capture
1262-
guard let imageData = originalImage?
1263+
guard let image = originalImage?
12631264
.fixedOrientation()
1264-
.resize(with: SBUGlobals.imageResizingSize)
1265-
.jpegData(compressionQuality: SBUGlobals.imageCompressionRate) else { return }
1265+
.resize(with: SBUGlobals.imageResizingSize) else { return }
1266+
1267+
var imageData: Data?
1268+
if SBUGlobals.shouldUseImageCompression {
1269+
imageData = image
1270+
.jpegData(compressionQuality: SBUGlobals.imageCompressionRate)
1271+
}
12661272

12671273
self.sendFileMessage(
12681274
fileData: imageData,
@@ -1303,11 +1309,16 @@ open class SBUChannelViewController: SBUBaseChannelViewController, UINavigationC
13031309
}
13041310

13051311
default:
1306-
guard let originalImage = info[.originalImage] as? UIImage else { return }
1307-
guard let imageData = originalImage
1312+
let originalImage = info[.originalImage] as? UIImage
1313+
guard let image = originalImage?
13081314
.fixedOrientation()
1309-
.resize(with: SBUGlobals.imageResizingSize)
1310-
.jpegData(compressionQuality: SBUGlobals.imageCompressionRate) else { return }
1315+
.resize(with: SBUGlobals.imageResizingSize) else { return }
1316+
1317+
var imageData: Data?
1318+
if SBUGlobals.shouldUseImageCompression {
1319+
imageData = image
1320+
.jpegData(compressionQuality: SBUGlobals.imageCompressionRate)
1321+
}
13111322

13121323
self.sendFileMessage(
13131324
fileData: imageData,
@@ -1556,7 +1567,8 @@ open class SBUChannelViewController: SBUBaseChannelViewController, UINavigationC
15561567
}
15571568
let cancelItem = SBUActionSheetItem(
15581569
title: SBUStringSet.Cancel,
1559-
color: self.theme.cancelItemColor
1570+
color: self.theme.cancelItemColor,
1571+
completionHandler: nil
15601572
)
15611573

15621574
SBUActionSheet.show(
@@ -1593,7 +1605,8 @@ open class SBUChannelViewController: SBUBaseChannelViewController, UINavigationC
15931605
}
15941606
let cancelItem = SBUActionSheetItem(
15951607
title: SBUStringSet.Cancel,
1596-
color: self.theme.cancelItemColor
1608+
color: self.theme.cancelItemColor,
1609+
completionHandler: nil
15971610
)
15981611

15991612
SBUActionSheet.show(
@@ -2221,6 +2234,7 @@ extension SBUChannelViewController: UITableViewDelegate, UITableViewDataSource {
22212234
}
22222235

22232236
let isSameDay = self.checkSameDayAsNextMessage(currentIndex: indexPath.row)
2237+
let receiptState = SBUUtils.getReceiptState(channel: channel, message: message)
22242238
switch (message, messageCell) {
22252239

22262240
// Amdin Message
@@ -2235,7 +2249,7 @@ extension SBUChannelViewController: UITableViewDelegate, UITableViewDataSource {
22352249
unknownMessage,
22362250
hideDateView: isSameDay,
22372251
groupPosition: self.getMessageGroupingPosition(currentIndex: indexPath.row),
2238-
receiptState: SBUUtils.getReceiptState(channel: channel, message: unknownMessage)
2252+
receiptState: receiptState
22392253
)
22402254
self.setUnkownMessageCellGestures(
22412255
unknownMessageCell,
@@ -2249,7 +2263,7 @@ extension SBUChannelViewController: UITableViewDelegate, UITableViewDataSource {
22492263
userMessage,
22502264
hideDateView: isSameDay,
22512265
groupPosition: self.getMessageGroupingPosition(currentIndex: indexPath.row),
2252-
receiptState: SBUUtils.getReceiptState(channel: channel, message: message)
2266+
receiptState: receiptState
22532267
)
22542268
self.setUserMessageCellGestures(
22552269
userMessageCell,
@@ -2263,7 +2277,7 @@ extension SBUChannelViewController: UITableViewDelegate, UITableViewDataSource {
22632277
fileMessage,
22642278
hideDateView: isSameDay,
22652279
groupPosition: self.getMessageGroupingPosition(currentIndex: indexPath.row),
2266-
receiptState: SBUUtils.getReceiptState(channel: channel, message: message)
2280+
receiptState: receiptState
22672281
)
22682282

22692283
self.setFileMessageCellGestures(
@@ -2279,7 +2293,7 @@ extension SBUChannelViewController: UITableViewDelegate, UITableViewDataSource {
22792293
message: message,
22802294
position: .center,
22812295
hideDateView: isSameDay,
2282-
receiptState: SBUUtils.getReceiptState(channel: channel, message: message)
2296+
receiptState: receiptState
22832297
)
22842298
}
22852299

SendBirdUIKit.framework/Headers/SBUEmptyView.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,9 @@ open class SBUEmptyView: UIView {
8484

8585
self.statusLabel.font = theme.emptyViewStatusFont
8686
self.statusLabel.textColor = theme.emptyViewStatusTintColor
87-
self.statusImageView.image = self.statusImageView.image?.sbu_with(tintColor: theme.emptyViewStatusTintColor)
87+
//NOTE: this will cause unexpected image when tint with not desirable
88+
//image
89+
//self.statusImageView.image = self.statusImageView.image?.sbu_with(tintColor: theme.emptyViewStatusTintColor)
8890

8991
self.retryButton.setTitleColor(theme.emptyViewRetryButtonTintColor, for: .normal)
9092
self.retryButton.titleLabel?.font = theme.emptyViewRetryButtonFont

SendBirdUIKit.framework/Headers/SBUGlobals.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ public class SBUGlobals: NSObject {
3737
/// - Since: 2.0.0
3838
public static var UsingUserProfileInOpenChannel: Bool = false
3939

40+
/// if this value is enabled, image compression and resizing will be applied when sending a file message
41+
/// - Since: 2.0.1
42+
public static var shouldUseImageCompression: Bool = false
43+
4044
/// Image compression rate value that will be used when sending image. Default value is 0.85.
4145
/// Typically this value will be used in `jpegData(compressionQuality:)`
4246
/// - Since: 2.0.0

SendBirdUIKit.framework/Headers/SBUMemberListViewController.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -787,7 +787,8 @@ open class SBUMemberListViewController: UIViewController {
787787
let userNameItem = SBUActionSheetItem(
788788
title: member.nickname ?? member.userId,
789789
color: self.componentTheme.actionSheetSubTextColor,
790-
textAlignment: .center
790+
textAlignment: .center,
791+
completionHandler: nil
791792
)
792793

793794
let operatorItem = SBUActionSheetItem(
@@ -839,7 +840,8 @@ open class SBUMemberListViewController: UIViewController {
839840

840841
let cancelItem = SBUActionSheetItem(
841842
title: SBUStringSet.Cancel,
842-
color: self.componentTheme.actionSheetItemColor)
843+
color: self.componentTheme.actionSheetItemColor,
844+
completionHandler: nil)
843845

844846
var items: [SBUActionSheetItem] = [userNameItem]
845847

0 commit comments

Comments
 (0)