Skip to content

Instantly share code, notes, and snippets.

@grantmiller
Last active August 29, 2015 14:02
Show Gist options
  • Save grantmiller/505089555f05e747173f to your computer and use it in GitHub Desktop.
Save grantmiller/505089555f05e747173f to your computer and use it in GitHub Desktop.
- (void)lookioManager:(LIOLookIOManager *)manager didChangeEnabled:(bool)enabled forSkill:(NSString *)skill forAccount:(NSString *)account
{
//reports button availability
NSString *accountButtonName = [NSString stringWithFormat:@"%@-mobile-button", account];
if (enabled) {
[[LIOLookIOManager sharedLookIOManager] setInvitationShown];
[[LIOLookIOManager sharedLookIOManager] reportEvent:accountButtonName withData:@"1"];
} else {
[[LIOLookIOManager sharedLookIOManager] setInvitationNotShown];
[[LIOLookIOManager sharedLookIOManager] reportEvent:accountButtonName withData:@"0"];
};
ESFAppManager *appManager = [ESFAppManager sharedManager];
NSPredicate *accountSkillPredicate = [NSPredicate predicateWithFormat:@"account = %@ AND skill = %@", account, skill];
NSArray *accountSkillArray = [appManager.accountSkills filteredArrayUsingPredicate:accountSkillPredicate];
if (accountSkillArray.count > 0)
{
ESFAccountSkillPair *pair = [accountSkillArray objectAtIndex:0];
pair.isEnabled = enabled;
}
else
{
ESFAccountSkillPair *pair = [[ESFAccountSkillPair alloc] init];
pair.account = account;
pair.skill = skill;
pair.isEnabled = enabled;
[appManager.accountSkills addObject:pair];
}
[[NSNotificationCenter defaultCenter] postNotificationName:kESFNotificationIARWasChanged object:nil userInfo:nil];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment