Harigami
ログイン
1
anonymous タイトルなし
ObjectiveC
#include "XXXRootListController.h"
#import <spawn.h>

@implementation XXXRootListController

- (NSArray *)specifiers {
	if (!_specifiers) {
		_specifiers = [[self loadSpecifiersFromPlistName:@"Root" target:self] retain];
	}

	return _specifiers;
}

-(void)credits {
UIAlertView *alert1 = [[UIAlertView alloc]initWithTitle:@"Credits" message:@"Test by Rowl" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alert1 show];
}

- (void)resp

{

pid_t pid;

int status;

const char* args[] = {"killall", "-9", "backboardd", NULL};

posix_spawn(&pid, "/usr/bin/killall", NULL, NULL, (char* const*)args, NULL);

waitpid(pid, &status, WEXITED);

}

- (void)twitter {
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"https://twitter.com/Rowl_JB"]];
}

@synthesize respringButton;

- (instancetype)init {
    self = [super init];

    if (self) {
        HBAppearanceSettings *appearanceSettings = [[HBAppearanceSettings alloc] init];
        appearanceSettings.tintColor = [UIColor colorWithRed:0.1f green:0.1f blue:0.1f alpha:1];
        appearanceSettings.tableViewCellSeparatorColor = [UIColor colorWithWhite:0 alpha:0];
        self.hb_appearanceSettings = appearanceSettings;
        self.respringButton = [[UIBarButtonItem alloc] initWithTitle:@"Respring" 
                                    style:UIBarButtonItemStylePlain
                                    target:self 
                                    action:@selector(respring:)];
        self.respringButton.tintColor = [UIColor redColor];
        self.navigationItem.rightBarButtonItem = self.respringButton;
    }

    return self;
}

- (void)respring:(id)sender {
    NSTask *t = [[[NSTask alloc] init] autorelease];
    [t setLaunchPath:@"/usr/bin/killall"];
    [t setArguments:[NSArray arrayWithObjects:@"backboardd", nil]];
    [t launch];
}

@end
  • 0
  • 1
anonymous タイトルなし
ObjectiveC
- (void)twitter
{
	UIApplication *app = [UIApplication sharedApplication];
	if ([app canOpenURL:[NSURL URLWithString:@"twitter://user?screen_name=ray__kisaragi"]]) {
		[app openURL:[NSURL URLWithString:@"twitter://user?screen_name=ray__kisaragi"]];
	} else if ([app canOpenURL:[NSURL URLWithString:@"tweetbot:///user_profile/ray__kisaragi"]]) {
		[app openURL:[NSURL URLWithString:@"tweetbot:///user_profile/ray__kisaragi"]];		
	} else {
		[app openURL:[NSURL URLWithString:@"https://mobile.twitter.com/ray__kisaragi"]];
	}
}
  • 0
  • 0
anonymous タイトルなし
ObjectiveC
static BOOL enabled;
static BOOL textEnabled;

static float bgred;
static float bggreen;
static float bgblue;
static float bgalpha;

static float txred;
static float txgreen;
static float txblue;
static float txalpha;

#define PREF_PATH @"/var/mobile/Library/Preferences/com.rowl.filzatheme1b.plist"

static void loadPrefs()
{
	NSDictionary *prefs = [NSDictionary dictionaryWithContentsOfFile:PREF_PATH];
	
    enabled = [prefs objectForKey:@"enabled"] ? [[prefs objectForKey:@"enabled"] boolValue] : NO;

    textEnabled = [prefs objectForKey:@"textEnabled"] ? [[prefs objectForKey:@"textEnabled"] boolValue] : NO;



    bgred = [prefs objectForKey:@"bgred"] ? [[prefs objectForKey:@"bgred"] floatValue] : 255.0;

    bggreen = [prefs objectForKey:@"bggreen"] ? [[prefs objectForKey:@"bggreen"] floatValue] : 255.0;

    bgblue = [prefs objectForKey:@"bgblue"] ? [[prefs objectForKey:@"bgblue"] floatValue] : 255.0;

    bgalpha = [prefs objectForKey:@"bgalpha"] ? [[prefs objectForKey:@"bgalpha"] floatValue] : 255.0;



    txred = [prefs objectForKey:@"txred"] ? [[prefs objectForKey:@"txred"] floatValue] : 255.0;

    txgreen = [prefs objectForKey:@"txgreen"] ? [[prefs objectForKey:@"txgreen"] floatValue] : 255.0;

    txblue = [prefs objectForKey:@"txblue"] ? [[prefs objectForKey:@"txblue"] floatValue] : 255.0;

    txalpha = [prefs objectForKey:@"txalpha"] ? [[prefs objectForKey:@"txalpha"] floatValue] : 255.0;
}

%hook ThemeManager
-(id)background {
        if (enabled) {
            return [UIColor 
                colorWithRed:bgred/255.0 
                               green:bggreen/255.0 
                                  blue:bgblue/255.0 
                                alpha:bgalpha/255.0];
        } else {
            return %orig;
    } 
}


- (id)text {
    if (textEnabled) {
        return [UIColor 
            colorWithRed:txred/255.0 
                           green:txgreen/255.0 
                              blue:txblue/255.0 
                            alpha:txalpha/255.0];
        } else {
            return %orig;
    }
}
%end

%ctor 
{
    @autoreleasepool {
        loadPrefs();
        %init;
    }
}
  • 0
  • 1
あなたもコードを投稿しませんか?
投稿する
1