-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit f271b4a
Showing
33 changed files
with
652 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
*.deb | ||
_ | ||
obj | ||
*.o | ||
theos | ||
*~ | ||
*.save | ||
.DS_Store |
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
debs/ws.hbang.common_1.0_iphoneos-arm.deb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
68 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
NSBundle *globalBundle; | ||
|
||
#define L18N(key) [globalBundle localizedStringForKey:key value:key table:@"TypeStatus"] | ||
#define URL_ENCODE(string) [(NSString *)CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault, (CFStringRef)(string), NULL, CFSTR(":/=,!$& '()*+;[]@#?"), kCFStringEncodingUTF8) autorelease] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#import "HBGlobal.h" | ||
|
||
%ctor { | ||
globalBundle = [[NSBundle bundleWithPath:@"/Library/PreferenceBundles/libhbangprefs.bundle"] retain]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
TARGET = :clang::4.0 | ||
|
||
include theos/makefiles/common.mk | ||
|
||
SUBPROJECTS = prefs | ||
include $(THEOS_MAKE_PATH)/aggregate.mk | ||
|
||
after-stage:: | ||
mkdir -p $(THEOS)/include/libhbangcommon | ||
rsync -rav *.h prefs/*.h $(THEOS)/include/libhbangcommon | ||
|
||
after-install:: | ||
install.exec "killall Preferences; sleep 0.2; sbopenurl 'prefs:root=Cydia&path=FlagPaint7'" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# libhbangcommon | ||
Common stuff shared by HASHBANG Productions packages. Documentation to come soon. | ||
|
||
_(Please don't release anything that relies on this package until the documentation is completed. Thanks!)_ | ||
|
||
[Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0.html) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
Package: ws.hbang.common | ||
Name: HASHBANG Productions Common | ||
Version: 1.0 | ||
Architecture: iphoneos-arm | ||
Description: Code shared by HASHBANG packages | ||
Maintainer: HASHBANG Productions <[email protected]> | ||
Author: HASHBANG Productions <[email protected]> | ||
Section: System | ||
Tag: role::developer |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#import "HBListController.h" | ||
#import <MessageUI/MFMailComposeViewController.h> | ||
|
||
@interface HBAboutListController : HBListController <MFMailComposeViewControllerDelegate> | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
#import "HBGlobal.h" | ||
#import "HBAboutListController.h" | ||
#import "HBOutputForShellCommand.h" | ||
#import <MobileGestalt/MobileGestalt.h> | ||
#include <version.h> | ||
|
||
@implementation HBAboutListController | ||
|
||
#pragma mark - Constants | ||
|
||
+ (NSURL *)hb_websiteURL { | ||
return [NSURL URLWithString:@"http://hbang.ws"]; | ||
} | ||
|
||
+ (NSURL *)hb_donateURL { | ||
return [NSURL URLWithString:@"http://hbang.ws/donate"]; | ||
} | ||
|
||
+ (NSString *)hb_supportEmailAddress { | ||
return @"HASHBANG Productions Support <[email protected]>"; | ||
} | ||
|
||
#pragma mark - PSListController | ||
|
||
- (NSArray *)specifiers { | ||
if (!_specifiers) { | ||
_specifiers = [[self loadSpecifiersFromPlistName:@"About" target:self] retain]; | ||
} | ||
|
||
return _specifiers; | ||
} | ||
|
||
#pragma mark - Callbacks | ||
|
||
- (void)hb_openWebsite { | ||
[[UIApplication sharedApplication] openURL:[self.class hb_websiteURL]]; | ||
} | ||
|
||
- (void)hb_openDonate { | ||
[[UIApplication sharedApplication] openURL:[self.class hb_donateURL]]; | ||
} | ||
|
||
- (void)hb_sendSupportEmail { | ||
if (![MFMailComposeViewController canSendMail]) { | ||
UIAlertView *alertView = [[[UIAlertView alloc] initWithTitle:L18N(@"No mail accounts are set up.") message:L18N(@"Use the Mail settings to add a new account.") delegate:nil cancelButtonTitle:L18N(@"OK") otherButtonTitles:nil] autorelease]; | ||
[alertView show]; | ||
|
||
return; | ||
} | ||
|
||
NSDictionary *info = [NSBundle bundleForClass:self.class].infoDictionary; | ||
|
||
MFMailComposeViewController *viewController = [[[MFMailComposeViewController alloc] init] autorelease]; | ||
viewController.mailComposeDelegate = self; | ||
viewController.toRecipients = @[ [self.class hb_supportEmailAddress] ]; | ||
viewController.subject = [NSString stringWithFormat:L18N(@"%@ %@ Support"), info[@"CFBundleName"], HBOutputForShellCommand([NSString stringWithFormat:@"/usr/bin/dpkg-query -f '${Version}' -W '%@'", info[@"HBPackageIdentifier"]])]; | ||
[viewController addAttachmentData:[HBOutputForShellCommand(@"/usr/bin/dpkg -l") dataUsingEncoding:NSUTF8StringEncoding] mimeType:@"text/plain" fileName:@"dpkgl.txt"]; | ||
|
||
NSString *product = nil, *version = nil, *build = nil; | ||
|
||
if (IS_IOS_OR_NEWER(iOS_6_0)) { | ||
product = (NSString *)MGCopyAnswer(kMGProductType); | ||
version = (NSString *)MGCopyAnswer(kMGProductVersion); | ||
build = (NSString *)MGCopyAnswer(kMGBuildVersion); | ||
} else { | ||
product = [UIDevice currentDevice].localizedModel; | ||
version = [UIDevice currentDevice].systemVersion; | ||
build = @"?"; | ||
} | ||
|
||
NSLog(@"wat");NSLog(@"%@ %@ %@",product,version,build); | ||
[viewController setMessageBody:[NSString stringWithFormat:L18N(@"\n\nDevice information: %@, iOS %@ (%@)"), product, version, build] isHTML:NO]; | ||
NSLog(@"yes"); | ||
|
||
[self.navigationController presentViewController:viewController animated:YES completion:nil]; | ||
} | ||
|
||
#pragma mark - MFMailComposeViewControllerDelegate | ||
|
||
- (void)mailComposeController:(MFMailComposeViewController *)viewController didFinishWithResult:(MFMailComposeResult)result error:(NSError *)error { | ||
[viewController dismissViewControllerAnimated:YES completion:nil]; | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../HBGlobal.h |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../HBGlobal.x |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#import <Preferences/PSListController.h> | ||
|
||
@interface HBListController : PSListController | ||
|
||
+ (UIColor *)hb_tintColor; | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
#import "HBListController.h" | ||
#import "HBTintedTableCell.h" | ||
#import <version.h> | ||
|
||
@class HBRootListController; | ||
|
||
#define IS_MODERN IS_IOS_OR_NEWER(iOS_7_0) | ||
; | ||
|
||
@interface HBListController () { | ||
UIColor *_cachedTintColor; | ||
} | ||
|
||
@end | ||
|
||
@implementation HBListController | ||
|
||
#pragma mark - Constants | ||
|
||
+ (UIColor *)hb_tintColor { | ||
return nil; | ||
} | ||
|
||
#pragma mark - UIViewController | ||
|
||
- (void)viewDidLoad { | ||
[super viewDidLoad]; | ||
|
||
if (IS_MODERN) { | ||
// https://www.youtube.com/watch?v=BkWl679wB1c | ||
UIColor *tintColor = [self.class hb_tintColor]; | ||
NSArray *viewControllers = self.navigationController.viewControllers; | ||
|
||
if (!tintColor) { | ||
NSInteger i = viewControllers.count; | ||
|
||
while (--i) { | ||
if ([((NSObject *)viewControllers[i]).class respondsToSelector:@selector(hb_tintColor)] && [((HBListController *)viewControllers[i]).class hb_tintColor]) { | ||
tintColor = [((HBListController *)viewControllers[i]).class hb_tintColor]; | ||
break; | ||
} | ||
} | ||
} | ||
|
||
_cachedTintColor = [tintColor copy]; | ||
|
||
[UISwitch appearanceWhenContainedIn:self.class, nil].onTintColor = tintColor; | ||
[UILabel appearanceWhenContainedIn:HBTintedTableCell.class, nil].textColor = tintColor; | ||
} | ||
} | ||
|
||
- (void)viewWillAppear:(BOOL)animated { | ||
[super viewWillAppear:animated]; | ||
|
||
// fix weird bug where selected row doesn't deselect | ||
// thanks insanj <4 | ||
[(UITableView *)self.view deselectRowAtIndexPath:((UITableView *)self.view).indexPathForSelectedRow animated:YES]; | ||
|
||
if (IS_MODERN) { | ||
self.view.tintColor = _cachedTintColor; | ||
self.navigationController.navigationBar.tintColor = _cachedTintColor; | ||
} | ||
} | ||
|
||
- (void)viewWillDisappear:(BOOL)animated { | ||
[super viewWillDisappear:animated]; | ||
|
||
if (IS_MODERN) { | ||
self.view.tintColor = nil; | ||
self.navigationController.navigationBar.tintColor = nil; | ||
} | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
NSString *HBOutputForShellCommand(NSString *command); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
NSString *HBOutputForShellCommand(NSString *command) { | ||
FILE *file = popen(command.UTF8String, "r"); | ||
|
||
if (!file) { | ||
return nil; | ||
} | ||
|
||
char data[1024]; | ||
NSMutableString *output = [NSMutableString string]; | ||
|
||
while (fgets(data, 1024, file) != NULL) { | ||
[output appendString:[NSString stringWithUTF8String:data]]; | ||
} | ||
|
||
if (pclose(file) != 0) { | ||
return nil; | ||
} | ||
|
||
return [NSString stringWithString:output]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#import "HBListController.h" | ||
|
||
@interface HBRootListController : HBListController | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#import "../HBGlobal.h" | ||
#import "HBRootListController.h" | ||
#import <Twitter/Twitter.h> | ||
|
||
@implementation HBRootListController | ||
|
||
#pragma mark - Constants | ||
|
||
+ (NSString *)hb_shareText { | ||
return nil; | ||
} | ||
|
||
+ (NSURL *)hb_shareURL { | ||
return nil; | ||
} | ||
|
||
#pragma mark - UIViewController | ||
|
||
- (void)loadView { | ||
[super loadView]; | ||
|
||
if ([self.class hb_shareText] && [self.class hb_shareURL]) { | ||
self.navigationItem.rightBarButtonItem = [[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAction target:self action:@selector(hb_shareTapped)] autorelease]; | ||
} | ||
} | ||
|
||
#pragma mark - Callbacks | ||
|
||
- (void)hb_shareTapped { | ||
if (%c(UIActivityViewController)) { | ||
UIActivityViewController *viewController = [[[UIActivityViewController alloc] initWithActivityItems:@[ [self.class hb_shareText], [self.class hb_shareURL] ] applicationActivities:nil] autorelease]; | ||
[self.navigationController presentViewController:viewController animated:YES completion:nil]; | ||
} else if (%c(TWTweetComposeViewController) && [TWTweetComposeViewController canSendTweet]) { | ||
TWTweetComposeViewController *viewController = [[[TWTweetComposeViewController alloc] init] autorelease]; | ||
viewController.initialText = [self.class hb_shareText]; | ||
[viewController addURL:[self.class hb_shareURL]]; | ||
[self.navigationController presentViewController:viewController animated:YES completion:nil]; | ||
} else { | ||
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:[NSString stringWithFormat:@"https://twitter.com/intent/tweet?text=%@%%20%@", URL_ENCODE([self.class hb_shareText]), URL_ENCODE([self.class hb_shareURL].absoluteString)]]]; | ||
} | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#import <Preferences/PSTableCell.h> | ||
|
||
@interface HBTintedTableCell : PSTableCell | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#import "HBTintedTableCell.h" | ||
|
||
@implementation HBTintedTableCell | ||
|
||
- (void)layoutSubviews { | ||
[super layoutSubviews]; | ||
|
||
if ([self respondsToSelector:@selector(tintColor)]) { | ||
self.textLabel.textColor = self.tintColor; | ||
} | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#import <Preferences/PSTableCell.h> | ||
|
||
@interface HBTwitterCell : PSTableCell | ||
|
||
@end |
Oops, something went wrong.