You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There's a method in src/Commands/OrientationCommand.m:
(NSDictionary *)getOrientationRepresentationViaStatusBar{
switch([[UIApplication sharedApplication] statusBarOrientation]){
case UIInterfaceOrientationLandscapeLeft:
return [self representOrientation:@"landscape" withDetailedOrientation:@"landscape_left"];
case UIInterfaceOrientationLandscapeRight:
return [self representOrientation:@"landscape" withDetailedOrientation:@"landscape_right"];
case UIInterfaceOrientationPortrait:
return [self representOrientation:@"portrait" withDetailedOrientation:@"portrait"];
case UIInterfaceOrientationPortraitUpsideDown:
return [self representOrientation:@"portrait" withDetailedOrientation:@"portrait_upside_down"];
default:
NSLog(@"Device orientation via status bar is unknown");
return nil;
}
}
but it is never called. The handleGet method seems to have a bug where if getOrientationRepresentationViaDevice returns nil then it calls the same method, getOrientationRepresentationViaDevice, again.
Maybe the original intent was to call getOrientationRepresentationViaStatusBar if getOrientationRepresentationViaDevice failed. In the past I had my own additional command that I added to Frank to specifically get the orientation via the Status Bar, 'cause some times you MUST do this. I would prefer not to add my own code back in, since the code's here already. But I would like an option on the host side to call getOrientationRepresentationViaDevice or getOrientationRepresentationViaStatusBar depending on my needs.
I'd do this fix myself, except I'm unsure of how method names at this depth in the code get mapped to methods that the Frank Helper on the host side can call. Given some brief tutoring on this, I'd be happy to make the change, test it, and issue a Pull request.
The text was updated successfully, but these errors were encountered:
Looks like that's definitely a bug wrt calling [self getOrientationRepresentationViaDevice] twice. In fact, I think it's something I introduced here: 82c3b33
The way the command routing works on the server-side is something like:
it looks up a command to handle the request, based on the first path component in the url. If it finds a command it asks it to handle the request. Otherwise it returns a 404.
In the case of orientation, a GET to /orientation handled by the OrientationCommand, as you've discovered.
On the client side for the ruby gem, it works like this:
that method gets the orientation by sending a GET for the /orientation url to the frank server. It then parses the JSON response, pull out the orientation field, and reports it back to the client.
There's a method in src/Commands/OrientationCommand.m:
switch([[UIApplication sharedApplication] statusBarOrientation]){
case UIInterfaceOrientationLandscapeLeft:
return [self representOrientation:@"landscape" withDetailedOrientation:@"landscape_left"];
case UIInterfaceOrientationLandscapeRight:
return [self representOrientation:@"landscape" withDetailedOrientation:@"landscape_right"];
case UIInterfaceOrientationPortrait:
return [self representOrientation:@"portrait" withDetailedOrientation:@"portrait"];
case UIInterfaceOrientationPortraitUpsideDown:
return [self representOrientation:@"portrait" withDetailedOrientation:@"portrait_upside_down"];
default:
NSLog(@"Device orientation via status bar is unknown");
return nil;
}
}
but it is never called. The handleGet method seems to have a bug where if getOrientationRepresentationViaDevice returns nil then it calls the same method, getOrientationRepresentationViaDevice, again.
(NSString *)handleGet{
NSDictionary *orientationDescription = [self getOrientationRepresentationViaDevice];
if( !orientationDescription )
orientationDescription = [self getOrientationRepresentationViaDevice];
return TO_JSON(orientationDescription);
}
Maybe the original intent was to call getOrientationRepresentationViaStatusBar if getOrientationRepresentationViaDevice failed. In the past I had my own additional command that I added to Frank to specifically get the orientation via the Status Bar, 'cause some times you MUST do this. I would prefer not to add my own code back in, since the code's here already. But I would like an option on the host side to call getOrientationRepresentationViaDevice or getOrientationRepresentationViaStatusBar depending on my needs.
I'd do this fix myself, except I'm unsure of how method names at this depth in the code get mapped to methods that the Frank Helper on the host side can call. Given some brief tutoring on this, I'd be happy to make the change, test it, and issue a Pull request.
The text was updated successfully, but these errors were encountered: