Git Product home page Git Product logo

Comments (1)

conath avatar conath commented on June 3, 2024

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

from appcenter.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.