Skip to content

Commit

Permalink
fixed up workflow when kill switch triggered for garmin
Browse files Browse the repository at this point in the history
  • Loading branch information
roznet committed Oct 4, 2023
1 parent 5c42087 commit fdb372b
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 2 deletions.
2 changes: 2 additions & 0 deletions ConnectStats/src/GCAppConstants.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ extern NSString * const CONFIG_CONNECTSTATS_USE;
extern NSString * const CONFIG_CONNECTSTATS_FILLYEAR;
extern NSString * const CONFIG_CONNECTSTATS_CONFIG;
extern NSString * const CONFIG_GARMIN_ENABLE;
extern NSString * const CONFIG_GARMIN_KILL_SWITCH;
extern NSString * const CONFIG_GARMIN_LOGIN_METHOD;
extern NSString * const CONFIG_GARMIN_LAST_SOURCE;
extern NSString * const CONFIG_GARMIN_USE_MODERN;
Expand All @@ -113,6 +114,7 @@ extern NSString * const CONFIG_CONNECTSTATS_USER_ID;
extern NSString * const CONFIG_GARMIN_FIT_DOWNLOAD;
extern NSString * const CONFIG_GARMIN_FIT_MERGE;


extern NSString * const CONFIG_ENABLE_DEBUG;
extern NSString * const CONFIG_ENABLE_DEBUG_ON;
extern NSString * const CONFIG_ENABLE_DEBUG_OFF;
Expand Down
1 change: 1 addition & 0 deletions ConnectStats/src/GCAppConstants.m
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@
NSString * const CONFIG_CONNECTSTATS_FILLYEAR = @"config_connectstats_fillyear";
NSString * const CONFIG_CONNECTSTATS_CONFIG = @"config_connectstats_config";
NSString * const CONFIG_GARMIN_ENABLE = @"config_garmin_enable";
NSString * const CONFIG_GARMIN_KILL_SWITCH = @"config_garmin_kill_switch";
NSString * const CONFIG_GARMIN_LOGIN_METHOD = @"config_garmin_login_method";
NSString * const CONFIG_GARMIN_LAST_SOURCE = @"config_garmin_last_source";
NSString * const CONFIG_GARMIN_USE_MODERN = @"config_garmin_use_modern_v3";
Expand Down
3 changes: 3 additions & 0 deletions ConnectStats/src/GCAppProfiles.m
Original file line number Diff line number Diff line change
Expand Up @@ -568,6 +568,9 @@ -(BOOL)serviceEnabled:(gcService)service{
switch (service) {
case gcServiceGarmin:
rv = [self configGetBool:CONFIG_GARMIN_ENABLE defaultValue:NO];
if( [[GCAppGlobal profile] configGetBool:CONFIG_GARMIN_KILL_SWITCH defaultValue:true]){
rv = false;
}
break;
case gcServiceStrava:
rv = [self configGetBool:CONFIG_STRAVA_ENABLE defaultValue:NO];
Expand Down
2 changes: 1 addition & 1 deletion ConnectStats/src/GCGarminRequest.m
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
@implementation GCGarminReqBase

+(BOOL)killSwitchTriggered{
return true;
return [[GCAppGlobal profile] configGetBool:CONFIG_GARMIN_KILL_SWITCH defaultValue:true];
}

-(BOOL)checkNoErrors{
Expand Down
5 changes: 5 additions & 0 deletions ConnectStats/src/GCSettingsViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -571,6 +571,11 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N

NSMutableArray * statuses = [NSMutableArray arrayWithCapacity:5];
NSString * status = nil;
status = [[GCService service:gcServiceConnectStats] statusDescription];
if( status.length > 0){
[statuses addObject:status];
}

status = [[GCService service:gcServiceGarmin] statusDescription];
if (status.length>0) {
[statuses addObject:status];
Expand Down
9 changes: 8 additions & 1 deletion ConnectStats/src/GCViewConfig.m
Original file line number Diff line number Diff line change
Expand Up @@ -650,7 +650,11 @@ + (UIImage*)mergeImage:(UIImage*)first withImage:(UIImage*)second

+(gcGarminDownloadSource)garminDownloadSource{
if([[GCAppGlobal profile] configGetBool:CONFIG_GARMIN_ENABLE defaultValue:false] && [[GCAppGlobal profile] configGetBool:CONFIG_CONNECTSTATS_ENABLE defaultValue:false] ){
return gcGarminDownloadSourceBoth;
if( [[GCAppGlobal profile] configGetBool:CONFIG_GARMIN_KILL_SWITCH defaultValue:true]){
return gcGarminDownloadSourceConnectStats;
}else{
return gcGarminDownloadSourceBoth;
}
}else if( [[GCAppGlobal profile] configGetBool:CONFIG_GARMIN_ENABLE defaultValue:false] ){
return gcGarminDownloadSourceGarminWeb;
}else if( [[GCAppGlobal profile] configGetBool:CONFIG_CONNECTSTATS_ENABLE defaultValue:false]){
Expand Down Expand Up @@ -688,6 +692,9 @@ +(void)setGarminDownloadSource:(gcGarminDownloadSource)source{
break;
}
}
if( [[GCAppGlobal profile] configGetBool:CONFIG_GARMIN_KILL_SWITCH defaultValue:true] ){
garminOn = true;
}
[[GCAppGlobal profile] configSet:CONFIG_CONNECTSTATS_ENABLE boolVal:connectStatsOn];
[[GCAppGlobal profile] configSet:CONFIG_GARMIN_ENABLE boolVal:garminOn];
}
Expand Down

0 comments on commit fdb372b

Please sign in to comment.