diff --git a/src/App_delegate.m b/src/App_delegate.m index f6818c9..6e77176 100644 --- a/src/App_delegate.m +++ b/src/App_delegate.m @@ -4,6 +4,7 @@ #import "controllers/Tab_controller.h" #import "db/DB.h" #import "macro.h" +#import "Record_my_position-Swift.h" #import "EHReachability.h" @@ -64,6 +65,8 @@ - (BOOL)application:(UIApplication *)application { DLOG(@"Lunching application with %@", launch_options); + [[SGPS get] start]; + [[UIDevice currentDevice] setBatteryMonitoringEnabled:YES]; _set_globals(); [DB preserve_old_db]; diff --git a/src/SGPS.swift b/src/SGPS.swift index 839bbfc..7f1d04b 100644 --- a/src/SGPS.swift +++ b/src/SGPS.swift @@ -1,20 +1,36 @@ import Foundation -class SGPS +public class Test { - static let cInstance: SGPS = SGPS() + init(a: String) { + println("Hello \(a)") + } +} + +@objc public class SGPS +{ + private let _GPS_IS_ON_KEY = "gps_is_on" + private let _KEY_SAVE_SINGLE_POSITION = "save_single_positions" + + static private let cInstance: SGPS = SGPS(); + static private var cSaveAllPositions: Bool = false - get { return cInstance; } - init() + static func get() -> SGPS { + return cInstance + } + + public init() { - let defaults = NSUserDefaults.standardUserDefaults - let gpsIsOn = defaults.boolForKey(_GPS_IS_ON_KEY); + let defaults = NSUserDefaults.standardUserDefaults() + if defaults.boolForKey(_GPS_IS_ON_KEY) { + start(); + } + SGPS.cSaveAllPositions = defaults.boolForKey(_KEY_SAVE_SINGLE_POSITION); + } + + public func start() + { + println("Starting!"); } } -// const BOOL gps_is_on = [defaults boolForKey:_GPS_IS_ON_KEY]; -// if (gps_is_on) -// [g_ start]; -// -// g_->save_all_positions_ = -// ![defaults boolForKey:_KEY_SAVE_SINGLE_POSITION]; \ No newline at end of file