1
0
mirror of https://github.com/gilshahar7/SiriSpotlight.git synced 2025-06-28 00:46:46 +00:00

Initial release

This commit is contained in:
2017-02-18 12:11:50 +02:00
committed by GitHub
parent bda0f022d6
commit 55ad1cc9b0
4 changed files with 77 additions and 0 deletions

12
Makefile Normal file
View File

@ -0,0 +1,12 @@
ARCHS = armv7 arm64
DEBUG = 0
include $(THEOS)/makefiles/common.mk
TWEAK_NAME = SpotlightSiri10
SpotlightSiri10_FILES = Tweak.xm
SpotlightSiri10_FRAMEWORKS = UIKit
include $(THEOS_MAKE_PATH)/tweak.mk
after-install::
install.exec "killall -9 SpringBoard"

1
SpotlightSiri10.plist Normal file
View File

@ -0,0 +1 @@
{ Filter = { Bundles = ( "com.apple.springboard" ); }; }

55
Tweak.xm Normal file
View File

@ -0,0 +1,55 @@
#import <substrate.h>
#import <UIKit/UIKit.h>
@interface SPUITextField:UITextField
@end
@interface SPUISearchHeader
@property (retain) SPUITextField * searchField;
@end
@interface SpringBoard
- (void)setNextAssistantRecognitionStrings:(id)arg1;
@end
@interface SBAssistantController
+ (id)sharedInstance;
- (void)handleSiriButtonUpEventFromSource:(int)arg1;
- (_Bool)handleSiriButtonDownEventFromSource:(int)arg1 activationEvent:(int)arg2;
@end
@interface SPUISearchViewController
- (void)cancelButtonPressed;
@end
static SpringBoard *springBoard = nil;
%hook SpringBoard
- (void)applicationDidFinishLaunching:(id)fp8 {
%orig;
springBoard = self;
}
%end
%hook SPUISearchViewController
- (void)cancelButtonPressed{
SPUISearchHeader *_searchHeader = MSHookIvar<SPUISearchHeader*>(self, "_searchHeader");
SPUITextField *searchField = _searchHeader.searchField;
NSString *searchString = [searchField.text lowercaseString];
if ([searchString hasPrefix:@"siri"]) {
NSString *searchStringWithoutSiri = [searchString
stringByReplacingOccurrencesOfString:@"siri" withString:@""];
if (![[searchStringWithoutSiri stringByReplacingOccurrencesOfString:@" " withString:@""] isEqual:@""]) {
NSArray *myStrings = [NSArray arrayWithObjects:searchStringWithoutSiri, nil];
[springBoard setNextAssistantRecognitionStrings:myStrings];
}
SBAssistantController *assistantController = [%c(SBAssistantController) sharedInstance];
[assistantController handleSiriButtonDownEventFromSource:1 activationEvent:1];
[assistantController handleSiriButtonUpEventFromSource:1];
searchField.text = @"";
}
%orig;
}
%end

9
control Normal file
View File

@ -0,0 +1,9 @@
Package: com.gilshahar7.spotlightsiri10
Name: SpotlightSiri10
Depends: mobilesubstrate
Version: 1.1
Architecture: iphoneos-arm
Description: Use Siri by prefixing Spotlight searches with "Siri" and pressing cancel.
Maintainer: gilshahar7
Author: gilshahar7
Section: Tweaks