Skip to content

Instantly share code, notes, and snippets.

@jontelang
jontelang / PianoPasscodeLogoCell.mm
Created July 14, 2014 12:17
PianoPasscodeLogoCell.m
#include "_own_/Preferences5/Preferences.h"
@interface PianoPasscodeLogoCell : PSTableCell <PreferencesTableCustomView> {
UIImageView *_image;
}
@end
@implementation PianoPasscodeLogoCell
- (id)initWithSpecifier:(PSSpecifier *)specifier
{
//
// InstaTogglesWindow interface
//
@interface InstaTogglesWindow : UIWindow <LAListener>
...
@end
//
// InstaTogglesWindow implementation
- (void)activator:(LAActivator *)activator receiveEvent:(LAEvent *)event
{
if( self.hidden )
{
labelReferences = [[NSMutableDictionary alloc] init];
[self makeKeyAndVisible];
[self setAlpha:0];
[self buildToggles]; // Contains animations
ANIMATE(0.35f,0.0f) [self setAlpha:1]; AND STOP
[event setHandled:YES];
- (void)activator:(LAActivator *)activator receiveEvent:(LAEvent *)event
{
if( self.hidden )
{
labelReferences = [[NSMutableDictionary alloc] init];
[self makeKeyAndVisible];
[self setAlpha:0];
[self buildToggles]; // Contains animations
ANIMATE(0.35f,0.0f) [self setAlpha:1]; AND STOP
}
//
// Problem
// Creating a 'UIWindow' object in %ctor does not work
//
//
// Solution 1
//
//
// Includes
//
#import "/Users/jontelang/Files/Development/Flipswitch/FSSwitchPanel.h"
#import "Activator/libactivator.h"
//
// InstaTogglesWindow interface
//
@interface InstaTogglesWindow : UIWindow <LAListener>
#include <math.h>
%hook SBAwayController
@interface UIApplication ()
- (id)_accessibilityRunningApplications;
@end
@interface SBStatusBarDataManager
+ (id)sharedDataManager;
static void sFSSwitchPanelSwitchStateChangedNotification(){
[ITWindow syncTextColors];
}
%ctor
{
ITListenerObject = [[InstaTogglesListenerObject alloc] init];
[[LAActivator sharedInstance] registerListener:ITListenerObject forName:@"com.jontelang.instatoggles"];
CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(), NULL, (CFNotificationCallback)sFSSwitchPanelSwitchStateChangedNotification, (CFStringRef)FSSwitchPanelSwitchStateChangedNotification, NULL, CFNotificationSuspensionBehaviorCoalesce);
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key> <string>English</string>
<key>CFBundleIdentifier</key> <string>com.jontelang.instatoggles-template</string>
<key>CFBundleInfoDictionaryVersion</key> <string>6.0</string>
<key>CFBundlePackageType</key> <string>BNDL</string>
<key>CFBundleShortVersionString</key> <string>1.0.0</string>
<key>CFBundleSignature</key> <string>????</string>
@jontelang
jontelang / file.mm
Created June 13, 2014 16:20
CodeWhichILike
/*
*
* The code below simply returns a corrected frame for an object that has been "thrown" (with a flick
* of the finger), and that object is then animated to that frame elsewhere in this case. It also
* decides where it should end up based on some variables like if it should be 50% hidden or nog (not
* shown in video below).
*
* You might now think "that's not impressive" and I agree, it is pretty easy code and not even that
* pretty. I'll be honest, I don't think I have any code that will blow your mind, I'm not that good