|
@@ -188,28 +188,30 @@ class CCNotification: UITableViewController, OCNetworkingDelegate {
|
|
|
|
|
|
// MARK: - Networking delegate
|
|
|
|
|
|
- func setNotificationServerFailure(_ metadataNet: CCMetadataNet!, message: String!, errorCode: Int) {
|
|
|
-
|
|
|
- appDelegate.messageNotification("_error_", description: message, visible: true, delay: TimeInterval(k_dismissAfterSecond), type: TWMessageBarMessageType.error, errorCode: errorCode)
|
|
|
- }
|
|
|
-
|
|
|
- func setNotificationServerSuccess(_ metadataNet: CCMetadataNet!) {
|
|
|
+ func setNotificationServerSuccessFailure(_ metadataNet: CCMetadataNet!, message: String!, errorCode: Int) {
|
|
|
|
|
|
// Check Active Account
|
|
|
if (metadataNet.account != appDelegate.activeAccount) {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
- let listOfNotifications = appDelegate.listOfNotifications as NSArray as! [OCNotifications]
|
|
|
-
|
|
|
- if let index = listOfNotifications.index(where: {$0.idNotification == Int(metadataNet.assetLocalIdentifier)}) {
|
|
|
- appDelegate.listOfNotifications.removeObject(at: index)
|
|
|
- }
|
|
|
-
|
|
|
- self.tableView.reloadData()
|
|
|
-
|
|
|
- if appDelegate.listOfNotifications.count == 0 {
|
|
|
- viewClose()
|
|
|
+ if (errorCode == 0) {
|
|
|
+
|
|
|
+ let listOfNotifications = appDelegate.listOfNotifications as NSArray as! [OCNotifications]
|
|
|
+
|
|
|
+ if let index = listOfNotifications.index(where: {$0.idNotification == Int(metadataNet.assetLocalIdentifier)}) {
|
|
|
+ appDelegate.listOfNotifications.removeObject(at: index)
|
|
|
+ }
|
|
|
+
|
|
|
+ self.tableView.reloadData()
|
|
|
+
|
|
|
+ if appDelegate.listOfNotifications.count == 0 {
|
|
|
+ viewClose()
|
|
|
+ }
|
|
|
+
|
|
|
+ } else {
|
|
|
+
|
|
|
+ appDelegate.messageNotification("_error_", description: message, visible: true, delay: TimeInterval(k_dismissAfterSecond), type: TWMessageBarMessageType.error, errorCode: errorCode)
|
|
|
}
|
|
|
}
|
|
|
|