mirror of
https://github.com/AU-COVIDSafe/mobile-ios.git
synced 2025-04-19 21:15:21 +00:00
COVIDSafe code from version 1.4 (#3)
This commit is contained in:
parent
56c93f2079
commit
b2e0c5b34c
33 changed files with 6865 additions and 481 deletions
|
@ -19,12 +19,13 @@ final class ContactViewController: UIViewController {
|
|||
}
|
||||
|
||||
func fetchContacts() {
|
||||
guard let appDelegate = UIApplication.shared.delegate as? AppDelegate else {
|
||||
return
|
||||
guard let persistentContainer =
|
||||
EncounterDB.shared.persistentContainer else {
|
||||
return
|
||||
}
|
||||
let managedContext = appDelegate.persistentContainer.viewContext
|
||||
let managedContext = persistentContainer.viewContext
|
||||
let fetchRequest = Encounter.fetchRequestForRecords()
|
||||
let sortByContactId = NSSortDescriptor(key: "msg", ascending: false)
|
||||
let sortByContactId = NSSortDescriptor(key: "timestamp", ascending: false)
|
||||
fetchRequest.sortDescriptors = [sortByContactId]
|
||||
fetchedResultsController = NSFetchedResultsController<Encounter>(fetchRequest: fetchRequest, managedObjectContext: managedContext, sectionNameKeyPath: nil, cacheName: nil)
|
||||
fetchedResultsController?.delegate = self
|
||||
|
@ -44,11 +45,11 @@ final class ContactViewController: UIViewController {
|
|||
}
|
||||
var contactCounts: [String: Int] = [:]
|
||||
for encounter in encounters {
|
||||
if encounter.msg != nil {
|
||||
if contactCounts[encounter.msg!] == nil {
|
||||
contactCounts[encounter.msg!] = 0
|
||||
if encounter.remoteBlob != nil {
|
||||
if contactCounts[encounter.remoteBlob!] == nil {
|
||||
contactCounts[encounter.remoteBlob!] = 0
|
||||
}
|
||||
contactCounts[encounter.msg!]! += 1
|
||||
contactCounts[encounter.remoteBlob!]! += 1
|
||||
}
|
||||
}
|
||||
var contactTuples = contactCounts.map { ($0.key, $0.value) }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue