Skip to content

Commit 21d784c

Browse files
author
Arief Nur Putranto
committed
fix completion retry send message when get expired token
1 parent f322dda commit 21d784c

File tree

2 files changed

+24
-16
lines changed

2 files changed

+24
-16
lines changed

QiscusCore.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = "QiscusCore"
3-
s.version = "1.14.8"
3+
s.version = "1.14.9"
44
s.summary = "Qiscus Core SDK for iOS"
55
s.description = <<-DESC
66
Qiscus SDK for iOS contains Qiscus public Model.

Source/QiscusCore/QiscusCore.swift

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import Foundation
1010
import UIKit
1111

1212
public class QiscusCore: NSObject {
13-
public static let qiscusCoreVersionNumber:String = "1.14.8"
13+
public static let qiscusCoreVersionNumber:String = "1.14.9"
1414
class var bundle:Bundle{
1515
get{
1616
let podBundle = Bundle(for: QiscusCore.self)
@@ -1496,21 +1496,29 @@ public class QiscusCore: NSObject {
14961496
}
14971497

14981498
private func sendPendingMessage(onNext: @escaping (Bool) -> Void){
1499-
guard let comments = QiscusCore.database.comment.find(status: .pending) else { return }
1500-
1501-
comments.forEach { (c) in
1502-
// validation comment prevent id
1503-
if c.uniqId.isEmpty { QiscusCore.database.comment.evaluate(); return }
1504-
QiscusCore.shared.sendMessage(message: c, onSuccess: { (response) in
1505-
QiscusLogger.debugPrint("success send pending message \(response.uniqId)")
1506-
ConfigManager.shared.lastCommentId = response.id
1507-
1508-
onNext(true)
1509-
}, onError: { (error) in
1510-
QiscusLogger.errorPrint("failed send pending message \(c.uniqId)")
1511-
onNext(false)
1512-
})
1499+
guard let comments = QiscusCore.database.comment.find(status: .pending) else {
1500+
onNext(true)
1501+
return
1502+
}
1503+
1504+
if comments.count == 0 {
1505+
onNext(true)
1506+
}else{
1507+
comments.forEach { (c) in
1508+
// validation comment prevent id
1509+
if c.uniqId.isEmpty { QiscusCore.database.comment.evaluate(); return }
1510+
QiscusCore.shared.sendMessage(message: c, onSuccess: { (response) in
1511+
QiscusLogger.debugPrint("success send pending message \(response.uniqId)")
1512+
ConfigManager.shared.lastCommentId = response.id
1513+
1514+
onNext(true)
1515+
}, onError: { (error) in
1516+
QiscusLogger.errorPrint("failed send pending message \(c.uniqId)")
1517+
onNext(false)
1518+
})
1519+
}
15131520
}
1521+
15141522
}
15151523

15161524
private func syncEvent() {

0 commit comments

Comments
 (0)