Browse Source

Initial release

master
gilshahar7 7 years ago
parent
commit
55ad1cc9b0
4 changed files with 77 additions and 0 deletions
  1. +12
    -0
      Makefile
  2. +1
    -0
      SpotlightSiri10.plist
  3. +55
    -0
      Tweak.xm
  4. +9
    -0
      control

+ 12
- 0
Makefile 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
- 0
SpotlightSiri10.plist View File

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

+ 55
- 0
Tweak.xm 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
- 0
control 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

Loading…
Cancel
Save