@@ -10,7 +10,7 @@ import Foundation
1010import UIKit
1111
1212public 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