Skip to content

Commit a657efd

Browse files
authored
Merge pull request #1914 from MixinNetwork/bugfix/sticker
Fix add sticker
2 parents ae709fd + d10a322 commit a657efd

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

Mixin/UserInterface/Controllers/Chat/StickerAddViewController.swift

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -188,8 +188,8 @@ extension StickerAddViewController {
188188
showMalformedAlert()
189189
return
190190
}
191-
let base64 = data.base64EncodedString()
192-
StickerAPI.addSticker(stickerBase64: base64, completion: { [weak self] (result) in
191+
let image = data.base64RawURLEncodedString()
192+
StickerAPI.addSticker(base64EncodedImage: image) { [weak self] (result) in
193193
switch result {
194194
case let .success(sticker):
195195
SDImageCache.persistentSticker.storeImageData(toDisk: data, forKey: sticker.assetUrl)
@@ -204,8 +204,7 @@ extension StickerAddViewController {
204204
self?.rightBarButton?.isBusy = false
205205
showAutoHiddenHud(style: .error, text: error.localizedDescription)
206206
}
207-
})
207+
}
208208
}
209209

210210
}
211-

MixinServices/MixinServices/Services/API/StickerAPI.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ public final class StickerAPI : MixinAPI {
3838
request(method: .get, path: Path.albums(id: albumId))
3939
}
4040

41-
public static func addSticker(stickerBase64: String, completion: @escaping (MixinAPI.Result<StickerResponse>) -> Void) {
42-
request(method: .post, path: Path.add, parameters: ["data_base64": stickerBase64], completion: completion)
41+
public static func addSticker(base64EncodedImage data: String, completion: @escaping (MixinAPI.Result<StickerResponse>) -> Void) {
42+
request(method: .post, path: Path.add, parameters: ["data_base64": data], completion: completion)
4343
}
4444

4545
public static func addSticker(stickerId: String, completion: @escaping (MixinAPI.Result<StickerResponse>) -> Void) {

0 commit comments

Comments
 (0)