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

Rotation not handled by app pages #3

Open
eswick opened this issue Feb 1, 2017 · 1 comment
Open

Rotation not handled by app pages #3

eswick opened this issue Feb 1, 2017 · 1 comment
Assignees
Labels

Comments

@eswick
Copy link
Owner

eswick commented Feb 1, 2017

No description provided.

@conath conath added the bug label Feb 1, 2017
@conath
Copy link
Collaborator

conath commented Feb 5, 2017

Tried to use the code from OS Experience to implement a fix for this. However it doesn't do anything on my 5S :/

SpringBoard.h

@protocol BSXPCCoding
@end

@interface BSMachPortRight : NSObject <BSXPCCoding, NSSecureCoding>
@end

@interface BSMachPortSendRight : BSMachPortRight <NSCopying>

- (unsigned int)sendRight;

@end

@interface SBApplication : NSObject

- (FBScene*)mainScene;
- (NSString*)bundleIdentifier;
- (BOOL)isRunning;
- (NSString*)displayName;
- (BOOL)hasHiddenTag;
- (BOOL)isActivating;
@property(retain, nonatomic) BSMachPortSendRight *xpcEventPort;
- (void)rotateToInterfaceOrientation:(int)orientation;//New

@end

Tweak.xm add #import <GraphicsServices/GraphicsServices.h>

%hook SBApplication

%new
- (void)rotateToInterfaceOrientation:(int)orientation{

	struct GSOrientationEvent {
		GSEventRecord record;
		GSDeviceOrientationInfo orientationInfo;
	} event;

	bzero(&event, sizeof(event));

	event.record.type = kGSEventDeviceOrientationChanged;
	event.record.flags = (GSEventFlags)0;
	event.record.infoSize = 4;
	event.orientationInfo.orientation = orientation;

	GSSendEvent((GSEventRecord*)&event, (mach_port_t)[[self xpcEventPort] sendRight]);
}

%new
- (void)appcenter_startBackgroundingWithCompletion:(void (^)(BOOL))completion {
  if (![self isRunning]) {
    [[%c(FBSSystemService) sharedService] openApplication:[self bundleIdentifier] options:@{ FBSOpenApplicationOptionKeyActivateSuspended : @true } withResult:^{
      [self appcenter_setBackgrounded:false withCompletion:completion];
    }];
  } else {
    [self appcenter_setBackgrounded:false withCompletion:completion];
  }
  UIInterfaceOrientation orientation = [[UIDevice currentDevice] orientation];
  [self rotateToInterfaceOrientation:orientation];
}

Not working but also not crashing. Presumably the GraphicsServices framework has changed. I have no clue about that so if you have any knowledge on this left from OSE maybe you can pick it up from here. 😄

EDIT: Here's a link to OSE code, rotation function is in line 739: https://github.com/eswick/osexperience/blob/master/Hooks.xm

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

No branches or pull requests

2 participants