Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for getOrientationRepresentationViaStatusBar #203

Open
CMTaylor opened this issue May 1, 2013 · 2 comments
Open

Support for getOrientationRepresentationViaStatusBar #203

CMTaylor opened this issue May 1, 2013 · 2 comments

Comments

@CMTaylor
Copy link

CMTaylor commented May 1, 2013

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.

  • (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.

@moredip
Copy link
Owner

moredip commented May 10, 2013

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:

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:

Hope that helps some.

@CMTaylor
Copy link
Author

I have an implementation for this that works on my iPads. I can't do a pull request just yet due to two things:

  1. I need to get my employer's legal folks to OK my contribution to this Open Source project.
  2. I'm reluctant to commit this until we can figure out why, and fix, the issue where MY build of libFrank.a breaks certain "touch" features.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants