No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.

55 líneas
1.7KB

  1. #import <substrate.h>
  2. #import <UIKit/UIKit.h>
  3. @interface SPUITextField:UITextField
  4. @end
  5. @interface SPUISearchHeader
  6. @property (retain) SPUITextField * searchField;
  7. @end
  8. @interface SpringBoard
  9. - (void)setNextAssistantRecognitionStrings:(id)arg1;
  10. @end
  11. @interface SBAssistantController
  12. + (id)sharedInstance;
  13. - (void)handleSiriButtonUpEventFromSource:(int)arg1;
  14. - (_Bool)handleSiriButtonDownEventFromSource:(int)arg1 activationEvent:(int)arg2;
  15. @end
  16. @interface SPUISearchViewController
  17. - (void)cancelButtonPressed;
  18. @end
  19. static SpringBoard *springBoard = nil;
  20. %hook SpringBoard
  21. - (void)applicationDidFinishLaunching:(id)fp8 {
  22. %orig;
  23. springBoard = self;
  24. }
  25. %end
  26. %hook SPUISearchViewController
  27. - (void)cancelButtonPressed{
  28. SPUISearchHeader *_searchHeader = MSHookIvar<SPUISearchHeader*>(self, "_searchHeader");
  29. SPUITextField *searchField = _searchHeader.searchField;
  30. NSString *searchString = [searchField.text lowercaseString];
  31. if ([searchString hasPrefix:@"siri"]) {
  32. NSString *searchStringWithoutSiri = [searchString
  33. stringByReplacingOccurrencesOfString:@"siri" withString:@""];
  34. if (![[searchStringWithoutSiri stringByReplacingOccurrencesOfString:@" " withString:@""] isEqual:@""]) {
  35. NSArray *myStrings = [NSArray arrayWithObjects:searchStringWithoutSiri, nil];
  36. [springBoard setNextAssistantRecognitionStrings:myStrings];
  37. }
  38. SBAssistantController *assistantController = [%c(SBAssistantController) sharedInstance];
  39. [assistantController handleSiriButtonDownEventFromSource:1 activationEvent:1];
  40. [assistantController handleSiriButtonUpEventFromSource:1];
  41. searchField.text = @"";
  42. }
  43. %orig;
  44. }
  45. %end