Deduplicate card history entries
This commit is contained in:
@ -39,6 +39,7 @@ public class MandiriEmoneyApi : UnifiedNfcApi {
|
||||
debugLog(response.getData().hexEncodedString())
|
||||
let balance = response.getData().hexEncodedString().subString(from: 0, to: 8)
|
||||
self.emoney.setBalance(self.getRealBalance(reverseHexa: balance))
|
||||
self.resetHistoryState()
|
||||
// self.updateScreen()
|
||||
if (self.cardType! == 131){
|
||||
self.getLogStep01(index: self.start)
|
||||
@ -64,7 +65,7 @@ public class MandiriEmoneyApi : UnifiedNfcApi {
|
||||
} else {
|
||||
self.parseNewLog()
|
||||
self.start = 0
|
||||
self.riwayatList = self.riwayatList.sorted(by: { $0.getTransationTime()?.compare($1.getTransationTime()!) == .orderedDescending })
|
||||
self.finalizeHistory()
|
||||
self.emoney.setRiwayatList(self.riwayatList)
|
||||
self.emoney.setTampilRiwayat(true)
|
||||
self.updateScreen()
|
||||
@ -74,7 +75,7 @@ public class MandiriEmoneyApi : UnifiedNfcApi {
|
||||
} else {
|
||||
self.parseNewLog()
|
||||
self.start = 0
|
||||
self.riwayatList = self.riwayatList.sorted(by: { $0.getTransationTime()?.compare($1.getTransationTime()!) == .orderedDescending })
|
||||
self.finalizeHistory()
|
||||
self.emoney.setRiwayatList(self.riwayatList)
|
||||
self.emoney.setTampilRiwayat(true)
|
||||
self.updateScreen()
|
||||
@ -125,7 +126,7 @@ public class MandiriEmoneyApi : UnifiedNfcApi {
|
||||
} else {
|
||||
self.parseOldLog()
|
||||
self.start = 0
|
||||
self.riwayatList = self.riwayatList.sorted(by: { $0.getTransationTime()?.compare($1.getTransationTime()!) == .orderedDescending })
|
||||
self.finalizeHistory()
|
||||
self.emoney.setRiwayatList(self.riwayatList)
|
||||
self.emoney.setTampilRiwayat(true)
|
||||
self.updateScreen()
|
||||
@ -135,7 +136,7 @@ public class MandiriEmoneyApi : UnifiedNfcApi {
|
||||
} else {
|
||||
self.parseOldLog()
|
||||
self.start = 0
|
||||
self.riwayatList = self.riwayatList.sorted(by: { $0.getTransationTime()?.compare($1.getTransationTime()!) == .orderedDescending })
|
||||
self.finalizeHistory()
|
||||
self.emoney.setRiwayatList(self.riwayatList)
|
||||
self.emoney.setTampilRiwayat(true)
|
||||
self.updateScreen()
|
||||
@ -198,6 +199,16 @@ public class MandiriEmoneyApi : UnifiedNfcApi {
|
||||
self.apduRunner.callback?.complete(emoney: self.emoney)
|
||||
}
|
||||
}
|
||||
|
||||
private func resetHistoryState() {
|
||||
riwayatList.removeAll()
|
||||
mapv1 = ""
|
||||
start = 0
|
||||
}
|
||||
|
||||
private func finalizeHistory() {
|
||||
riwayatList = riwayatList.sorted(by: { $0.getTransationTime()?.compare($1.getTransationTime()!) == .orderedDescending })
|
||||
}
|
||||
|
||||
func riwayatCard(_ bArr: [UInt8]) -> RiwayatCard? {
|
||||
var str: String
|
||||
|
||||
Reference in New Issue
Block a user