mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-26 22:07:12 +00:00
Renamed DataManager into CoreDataManager
This commit is contained in:
1 parent
c6c9e2c589
commit
001ef06861
7 files changed
+35
-35
No files matched your search
@@ -299,7 +299,7 @@
|
||||
7F950A911A35E967003C8C5C /* LeaderBoardViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7F950A901A35E967003C8C5C /* LeaderBoardViewController.swift */; };
|
||||
7F99DE3C1A126554009B3619 /* RegattaViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7F99DE3B1A126554009B3619 /* RegattaViewController.swift */; };
|
||||
7FA2220B1A25E55400FD364B /* CoreLocation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7F83F17519F1574700C53328 /* CoreLocation.framework */; };
|
||||
7FA6551A19F6661900A1B92D /* DataManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7FA6551919F6661900A1B92D /* DataManager.swift */; };
|
||||
7FA6551A19F6661900A1B92D /* CoreDataManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7FA6551919F6661900A1B92D /* CoreDataManager.swift */; };
|
||||
7FAFA7951A126B5700D230F1 /* AboutViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7FAFA7941A126B5700D230F1 /* AboutViewController.swift */; };
|
||||
7FC5232D19F6AEE800BBFDCC /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7FC5232C19F6AEE800BBFDCC /* AVFoundation.framework */; };
|
||||
7FD9D3031A1236080058FEAD /* Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7FD9D3021A1236080058FEAD /* Extensions.swift */; };
|
||||
@@ -687,7 +687,7 @@
|
||||
7F8CC2071A10D47A00C56D7F /* SettingsViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SettingsViewController.swift; sourceTree = "<group>"; };
|
||||
7F950A901A35E967003C8C5C /* LeaderBoardViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LeaderBoardViewController.swift; sourceTree = "<group>"; };
|
||||
7F99DE3B1A126554009B3619 /* RegattaViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RegattaViewController.swift; sourceTree = "<group>"; };
|
||||
7FA6551919F6661900A1B92D /* DataManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = DataManager.swift; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.swift; };
|
||||
7FA6551919F6661900A1B92D /* CoreDataManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = CoreDataManager.swift; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.swift; };
|
||||
7FAFA7941A126B5700D230F1 /* AboutViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AboutViewController.swift; sourceTree = "<group>"; };
|
||||
7FAFB0B51A603C3E0054D457 /* LICENSE.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = LICENSE.txt; sourceTree = "<group>"; };
|
||||
7FC5232C19F6AEE800BBFDCC /* AVFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVFoundation.framework; path = System/Library/Frameworks/AVFoundation.framework; sourceTree = SDKROOT; };
|
||||
@@ -760,9 +760,10 @@
|
||||
name = Frameworks;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
7F06590019F7FE750077FF95 /* Model */ = {
|
||||
7F06590019F7FE750077FF95 /* CoreData */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
7FA6551919F6661900A1B92D /* CoreDataManager.swift */,
|
||||
7F44095919F65B5B0021BF22 /* CoreData.xcdatamodeld */,
|
||||
C8739DA51D2539A900A89F3C /* CheckIn+CoreDataProperties.swift */,
|
||||
C8739DA61D2539A900A89F3C /* CheckIn.swift */,
|
||||
@@ -775,7 +776,7 @@
|
||||
C8739DB91D25409700A89F3C /* Leaderboard+CoreDataProperties.swift */,
|
||||
C8739DBA1D25409700A89F3C /* Leaderboard.swift */,
|
||||
);
|
||||
name = Model;
|
||||
name = CoreData;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
7F06590119F7FE920077FF95 /* ViewController */ = {
|
||||
@@ -1118,7 +1119,7 @@
|
||||
7F72C7401A2DEA3300F48EE8 /* Helpers */,
|
||||
7F06590119F7FE920077FF95 /* ViewController */,
|
||||
7F06590219F7FEA40077FF95 /* DataController */,
|
||||
7F06590019F7FE750077FF95 /* Model */,
|
||||
7F06590019F7FE750077FF95 /* CoreData */,
|
||||
7F83F15319F154F000C53328 /* Supporting Files */,
|
||||
);
|
||||
path = SAPTracker;
|
||||
@@ -1203,7 +1204,6 @@
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
C852BAA11CF5E1EA0093B0C5 /* RequestManager.swift */,
|
||||
7FA6551919F6661900A1B92D /* DataManager.swift */,
|
||||
7F2C605919F160E400C32D93 /* LocationManager.swift */,
|
||||
);
|
||||
name = Managers;
|
||||
@@ -1844,7 +1844,7 @@
|
||||
C8739DB71D2539A900A89F3C /* GPSFix+CoreDataProperties.swift in Sources */,
|
||||
7F1B66F91A0CDCF600904A41 /* BatteryManager.swift in Sources */,
|
||||
7F03FD3E19FA44CD00FA1327 /* APIManager.swift in Sources */,
|
||||
7FA6551A19F6661900A1B92D /* DataManager.swift in Sources */,
|
||||
7FA6551A19F6661900A1B92D /* CoreDataManager.swift in Sources */,
|
||||
C852BAA21CF5E1EA0093B0C5 /* RequestManager.swift in Sources */,
|
||||
C8BBAC791C52649E004CA551 /* LicenseViewController.swift in Sources */,
|
||||
C8739D8E1D23D53C00A89F3C /* SendGPSFixesController.swift in Sources */,
|
||||
|
||||
@@ -23,7 +23,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
|
||||
#endif
|
||||
|
||||
// Initialize core data, migrate database if needed, or delete if migration needed but not possible
|
||||
DataManager.sharedManager
|
||||
CoreDataManager.sharedManager
|
||||
|
||||
// Start timer in case GPS fixes need to be sent
|
||||
// SendGPSFixController.sharedManager.timer()
|
||||
@@ -48,7 +48,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
|
||||
func applicationDidEnterBackground(application: UIApplication) {
|
||||
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
|
||||
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
|
||||
DataManager.sharedManager.saveContext()
|
||||
CoreDataManager.sharedManager.saveContext()
|
||||
}
|
||||
|
||||
func applicationWillEnterForeground(application: UIApplication) {
|
||||
@@ -61,7 +61,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
|
||||
|
||||
func applicationWillTerminate(application: UIApplication) {
|
||||
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
|
||||
DataManager.sharedManager.saveContext()
|
||||
CoreDataManager.sharedManager.saveContext()
|
||||
}
|
||||
|
||||
// MARK: - Setups
|
||||
|
||||
@@ -161,16 +161,16 @@ class CheckInController : NSObject {
|
||||
private func checkInOnServerSucceed() {
|
||||
|
||||
// Check database if check-in already exist
|
||||
if let checkIn = DataManager.sharedManager.fetchCheckIn(checkInData.eventID,
|
||||
leaderboardName: checkInData.leaderboardName,
|
||||
competitorID: checkInData.competitorID) {
|
||||
if let checkIn = CoreDataManager.sharedManager.fetchCheckIn(checkInData.eventID,
|
||||
leaderboardName: checkInData.leaderboardName,
|
||||
competitorID: checkInData.competitorID) {
|
||||
// Delete old check-in
|
||||
DataManager.sharedManager.deleteCheckIn(checkIn)
|
||||
DataManager.sharedManager.saveContext()
|
||||
CoreDataManager.sharedManager.deleteCheckIn(checkIn)
|
||||
CoreDataManager.sharedManager.saveContext()
|
||||
}
|
||||
|
||||
// Create new check-in
|
||||
let checkIn = DataManager.sharedManager.newCheckIn()
|
||||
let checkIn = CoreDataManager.sharedManager.newCheckIn()
|
||||
checkIn.competitorID = checkInData!.competitorID
|
||||
checkIn.eventID = checkInData.eventID
|
||||
checkIn.lastSyncDate = NSDate().timeIntervalSince1970
|
||||
@@ -180,18 +180,18 @@ class CheckInController : NSObject {
|
||||
checkIn.teamImageRetry = false
|
||||
|
||||
// Create new event
|
||||
let event = DataManager.sharedManager.newEvent(checkIn)
|
||||
let event = CoreDataManager.sharedManager.newEvent(checkIn)
|
||||
event.endDate = (eventEndDate() / 1000)
|
||||
event.eventID = eventID()
|
||||
event.name = eventName()
|
||||
event.startDate = (eventStartDate() / 1000)
|
||||
|
||||
// Create new leaderboard
|
||||
let leaderboard = DataManager.sharedManager.newLeaderBoard(checkIn)
|
||||
let leaderboard = CoreDataManager.sharedManager.newLeaderBoard(checkIn)
|
||||
leaderboard.name = leaderboardName()
|
||||
|
||||
// Create new competitor
|
||||
let competitor = DataManager.sharedManager.newCompetitor(checkIn)
|
||||
let competitor = CoreDataManager.sharedManager.newCompetitor(checkIn)
|
||||
competitor.boatClassName = competitorBoatClassName()
|
||||
competitor.competitorID = competitorID()
|
||||
competitor.countryCode = competitorCountryCode()
|
||||
@@ -200,7 +200,7 @@ class CheckInController : NSObject {
|
||||
competitor.sailID = competitorSailID()
|
||||
|
||||
// Save objects
|
||||
DataManager.sharedManager.saveContext()
|
||||
CoreDataManager.sharedManager.saveContext()
|
||||
|
||||
// Check-in completed
|
||||
self.checkInDidEnd(withSuccess: true)
|
||||
|
||||
+4
-4
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// DataManager.swift
|
||||
// CoreDataManager.swift
|
||||
// SAPTracker
|
||||
//
|
||||
// Created by computing on 21/10/14.
|
||||
@@ -9,11 +9,11 @@
|
||||
import Foundation
|
||||
import CoreData
|
||||
|
||||
public class DataManager: NSObject {
|
||||
public class CoreDataManager: NSObject {
|
||||
|
||||
public class var sharedManager: DataManager {
|
||||
public class var sharedManager: CoreDataManager {
|
||||
struct Singleton {
|
||||
static let sharedManager = DataManager()
|
||||
static let sharedManager = CoreDataManager()
|
||||
}
|
||||
return Singleton.sharedManager
|
||||
}
|
||||
@@ -53,7 +53,7 @@ class HomeViewController: UIViewController {
|
||||
}
|
||||
|
||||
private func setupTableViewDataSource() {
|
||||
fetchedResultsController = DataManager.sharedManager.checkInFetchedResultsController()
|
||||
fetchedResultsController = CoreDataManager.sharedManager.checkInFetchedResultsController()
|
||||
fetchedResultsController!.delegate = self
|
||||
do {
|
||||
try fetchedResultsController!.performFetch()
|
||||
|
||||
@@ -117,7 +117,7 @@ class RegattaViewController : UIViewController, UINavigationControllerDelegate {
|
||||
teamImageView.image = image
|
||||
checkIn.teamImageData = UIImageJPEGRepresentation(image, 0.8)
|
||||
checkIn.teamImageRetry = false
|
||||
DataManager.sharedManager.saveContext()
|
||||
CoreDataManager.sharedManager.saveContext()
|
||||
setupTeamImageFinished()
|
||||
}
|
||||
|
||||
@@ -264,8 +264,8 @@ class RegattaViewController : UIViewController, UINavigationControllerDelegate {
|
||||
success: { (operation, responseObject) in },
|
||||
failure: { (operation, error) in
|
||||
})
|
||||
DataManager.sharedManager.deleteCheckIn(self.checkIn!)
|
||||
DataManager.sharedManager.saveContext()
|
||||
CoreDataManager.sharedManager.deleteCheckIn(self.checkIn!)
|
||||
CoreDataManager.sharedManager.saveContext()
|
||||
navigationController!.popViewControllerAnimated(true)
|
||||
}
|
||||
|
||||
@@ -301,7 +301,7 @@ extension RegattaViewController: UIImagePickerControllerDelegate {
|
||||
teamImageEditButton.hidden = false
|
||||
teamImageRetryButton.hidden = true
|
||||
checkIn.teamImageData = UIImageJPEGRepresentation(image, 0.8)
|
||||
DataManager.sharedManager.saveContext()
|
||||
CoreDataManager.sharedManager.saveContext()
|
||||
postTeamImageData(checkIn.teamImageData)
|
||||
}
|
||||
|
||||
@@ -319,7 +319,7 @@ extension RegattaViewController: UIImagePickerControllerDelegate {
|
||||
let teamImageURL = (teamImageDictionary[TeamImageKeys.TeamImageURL]) as! String
|
||||
checkIn.teamImageURL = teamImageURL
|
||||
checkIn.teamImageRetry = false
|
||||
DataManager.sharedManager.saveContext()
|
||||
CoreDataManager.sharedManager.saveContext()
|
||||
|
||||
// Setup team image
|
||||
setupTeamImage()
|
||||
@@ -329,7 +329,7 @@ extension RegattaViewController: UIImagePickerControllerDelegate {
|
||||
|
||||
// Save image upload failure
|
||||
checkIn.teamImageRetry = true
|
||||
DataManager.sharedManager.saveContext()
|
||||
CoreDataManager.sharedManager.saveContext()
|
||||
|
||||
// Show alert
|
||||
let alertTitle = NSLocalizedString("Failed to upload image", comment: "")
|
||||
|
||||
@@ -47,13 +47,13 @@ class SendGPSFixesController: NSObject {
|
||||
dispatch_async(dispatch_get_main_queue(), {
|
||||
if let userInfo = notification.userInfo {
|
||||
if userInfo[LocationManager.UserInfo.IsValid] as? Bool ?? false {
|
||||
let gpsFix = DataManager.sharedManager.newGPSFix(self.checkIn)
|
||||
let gpsFix = CoreDataManager.sharedManager.newGPSFix(self.checkIn)
|
||||
gpsFix.course = userInfo[LocationManager.UserInfo.Course] as! Double
|
||||
gpsFix.latitude = userInfo[LocationManager.UserInfo.Latitude] as! Double
|
||||
gpsFix.longitude = userInfo[LocationManager.UserInfo.Longitude] as! Double
|
||||
gpsFix.speed = userInfo[LocationManager.UserInfo.Speed] as! Double
|
||||
gpsFix.timestamp = round(userInfo[LocationManager.UserInfo.Timestamp] as! Double * 1000)
|
||||
DataManager.sharedManager.saveContext()
|
||||
CoreDataManager.sharedManager.saveContext()
|
||||
}
|
||||
}
|
||||
})
|
||||
@@ -92,8 +92,8 @@ class SendGPSFixesController: NSObject {
|
||||
print(NSThread.isMainThread)
|
||||
dispatch_async(dispatch_get_main_queue(), {
|
||||
self.log("sending \(gpsFixes.count) GPS fixes was successful")
|
||||
DataManager.sharedManager.deleteGPSFixes(gpsFixes)
|
||||
DataManager.sharedManager.saveContext()
|
||||
CoreDataManager.sharedManager.deleteGPSFixes(gpsFixes)
|
||||
CoreDataManager.sharedManager.saveContext()
|
||||
self.sendGPSFixesFinished()
|
||||
})
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user