Skip to content

Commit

Permalink
Fix a minor issue regarding HealthKit
Browse files Browse the repository at this point in the history
  • Loading branch information
Yuuki Nishiyama committed Dec 10, 2019
1 parent eb540bc commit c2a3ebf
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion AWAREFramework.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

Pod::Spec.new do |s|
s.name = 'AWAREFramework'
s.version = '1.8'
s.version = '1.8.1'
s.summary = 'AWARE: An Open-source Context Instrumentation Framework'

# This description is used to generate tags and improve search results.
Expand Down
3 changes: 2 additions & 1 deletion AWAREFramework/Classes/Core/Sensor/AWARESensorManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,8 @@ - (void) stopAndRemoveAllSensors {
// message = [NSString stringWithFormat:@"[%@] Stop %@ sensor",[sensor getSensorName], [sensor getSensorName]];
// NSLog(@"%@", message);
bool state = [sensor stopSensor];
[sensor.storage cancelSyncStorage];
// [sensor.storage cancelSyncStorage];
[sensor stopSyncDB];
[AWAREEventLogger.shared logEvent:@{@"class":@"AWARESensorManager",
@"event":@"stop and remove sensor",
@"sensor":sensor.getSensorName,
Expand Down
6 changes: 3 additions & 3 deletions AWAREFramework/Classes/Core/Storage/AWAREStorage.m
Original file line number Diff line number Diff line change
Expand Up @@ -272,16 +272,16 @@ - (void)createDBTableOnServerWithQuery:(NSString *)query tableName:(NSString *)t
//////////////////////////////////////////

- (void)startSyncStorage {
NSLog(@"Please orverwrite -startSyncStorage");
NSLog(@"[%@] Please orverwrite -startSyncStorage", sensorName);
}

- (void)startSyncStorageWithCallBack:(SyncProcessCallBack)callback{
syncProcessCallBack = callback;
NSLog(@"Please orverwrite -startSyncStorageWithCallBack");
NSLog(@"[%@] Please orverwrite -startSyncStorageWithCallBack", sensorName);
}

- (void)cancelSyncStorage {
NSLog(@"Please overwirte -cancelSyncStorage");
NSLog(@"[%@] Please overwirte -cancelSyncStorage", sensorName);
}

- (BOOL)saveDataWithArray:(NSArray * _Nullable)dataArray buffer:(BOOL)isRequiredBuffer saveInMainThread:(BOOL)saveInMainThread {
Expand Down
4 changes: 2 additions & 2 deletions AWAREFramework/Classes/Core/Storage/CSV/CSVStorage.m
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,8 @@ - (void)startSyncStorage {
}
}

- (void)cancelSyncStorage {
NSLog(@"Please overwirte -cancelSyncStorage");
- (void) cancelSyncStorage {
if (self.isDebug) NSLog(@"Please overwirte -cancelSyncStorage");
}


Expand Down
2 changes: 1 addition & 1 deletion AWAREFramework/Classes/Core/Storage/JSON/JSONStorage.m
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ - (void) dataSyncIsFinishedCorrectly {
}

- (void)cancelSyncStorage {
NSLog(@"Please overwirte -cancelSyncStorage");
if (self.isDebug) NSLog(@"Please overwirte -cancelSyncStorage");
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -436,9 +436,9 @@ - (void) deleteSyncedData {
[self->_mainQueueManagedObjectContext performBlock:^{
NSError * error = nil;
if([self->_mainQueueManagedObjectContext save:&error]){
NSLog(@"[%@] merged all changes on the temp-DB into the main DB", self.sensorName);
if (self.isDebug) NSLog(@"[%@] merged all changes on the temp-DB into the main DB", self.sensorName);
}else{
NSLog(@"[%@] %@", self.sensorName, error.debugDescription);
if (self.isDebug) NSLog(@"[%@] %@", self.sensorName, error.debugDescription);
}
}];
}];
Expand Down
11 changes: 5 additions & 6 deletions AWAREFramework/Classes/Plugins/HealthKit/AWAREHealthKit.m
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ @implementation AWAREHealthKit{
}

- (instancetype)initWithAwareStudy:(AWAREStudy *)study dbType:(AwareDBType)dbType{
AWAREStorage * storage = [[AWAREStorage alloc] initWithStudy:study sensorName:SENSOR_HEALTH_KIT];
JSONStorage * storage = [[JSONStorage alloc] initWithStudy:study sensorName:SENSOR_HEALTH_KIT];
self = [super initWithAwareStudy:study sensorName:SENSOR_HEALTH_KIT storage:storage];
if( self != nil ){
healthStore = [[HKHealthStore alloc] init];
Expand Down Expand Up @@ -144,21 +144,20 @@ - (void)startSyncDB{
[_awareHKWorkout startSyncDB];
[_awareHKCategory startSyncDB];
[_awareHKQuantity startSyncDB];

[_awareHKHeartRate.storage setSyncProcessCallBack:self.storage.syncProcessCallBack];
[_awareHKHeartRate startSyncDB];
[_awareHKSleep startSyncDB];
// [super startSyncDB];
[super startSyncDB];
}

- (void)stopSyncDB{
[_awareHKWorkout stopSyncDB];
[_awareHKCategory stopSyncDB];
[_awareHKQuantity stopSyncDB];

[_awareHKHeartRate startSyncDB];
[_awareHKSleep startSyncDB];
// [super stopSyncDB];
[_awareHKHeartRate stopSyncDB];
[_awareHKSleep stopSyncDB];
[super stopSyncDB];
}

- (NSDate * _Nullable) getLastRecordTimeWithHKDataType:(NSString * _Nonnull)type{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,13 +145,13 @@ - (BOOL)stopSensor{
- (void) startSyncDB{
[_visitLocationSensor startSyncDB];
[_locationSensor startSyncDB];
[super startSyncDB];
// [super startSyncDB];
}

- (void)stopSyncDB{
[_visitLocationSensor stopSyncDB];
[_locationSensor stopSyncDB];
[super stopSyncDB];
// [super stopSyncDB];
}

- (void) getGpsData: (NSTimer *) theTimer {
Expand Down

0 comments on commit c2a3ebf

Please sign in to comment.