diff --git a/XBMC Remote/DetailViewController.m b/XBMC Remote/DetailViewController.m index 21e32b089..5f22b8d03 100644 --- a/XBMC Remote/DetailViewController.m +++ b/XBMC Remote/DetailViewController.m @@ -1612,6 +1612,9 @@ - (void)didSelectItemAtIndexPath:(NSIndexPath*)indexPath item:(NSDictionary*)ite [Utilities showMessage:message color:[Utilities getSystemRed:0.95]]; } } + else if ([item[@"family"] isEqualToString:@"profile"]) { + [self loadProfile:item]; + } else if (methods[@"method"] != nil && ![parameters[@"forceActionSheet"] boolValue] && !stackscrollFullscreen) { // There is a child and we want to show it (only when not in fullscreen) [self viewChild:indexPath item:item displayPoint:point]; @@ -4503,6 +4506,26 @@ - (void)SimpleAction:(NSString*)action params:(NSDictionary*)parameters success: }]; } +- (void)loadProfile:(NSDictionary*)item { + NSString *profileName = item[@"label"]; + if ([profileName isEqualToString:AppDelegate.instance.currentProfile]) { + return; + } + // Load user profile + [[Utilities getJsonRPC] + callMethod:@"Profiles.LoadProfile" + withParameters:@{ + @"profile": profileName, + @"prompt": @YES, + } + onCompletion:^(NSString *methodName, NSInteger callId, id methodResult, DSJSONRPCError *methodError, NSError *error) { + if (!error && !methodError) { + AppDelegate.instance.currentProfile = profileName; + [dataList reloadData]; + } + }]; +} + - (void)displayInfoView:(NSDictionary*)item { if (IS_IPHONE) { ShowInfoViewController *showInfoViewController = [[ShowInfoViewController alloc] initWithNibName:@"ShowInfoViewController" bundle:nil];