Skip to content

Commit

Permalink
Load profile on select
Browse files Browse the repository at this point in the history
Only load non-active profile and request password prompt.
  • Loading branch information
wutschel committed Nov 24, 2024
1 parent bd44b34 commit a0774ca
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions XBMC Remote/DetailViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -1603,6 +1603,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];
Expand Down Expand Up @@ -4506,6 +4509,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];
Expand Down

0 comments on commit a0774ca

Please sign in to comment.