Advertisement
Guest User

Untitled

a guest
Nov 8th, 2018
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #import <AudioToolbox/AudioToolbox.h>
  2. #import "FRPreferences/FRPrefs.h"
  3.  
  4. #define TWPlusTintColour [UIColor colorWithRed:46/255.0f green:205/255.0f blue:113/255.0f alpha:1.0f]
  5.  
  6.  
  7. @interface T1SettingsViewController : UIViewController
  8. @end
  9.  
  10. static NSString *segmentSelection;
  11. static FRPSegmentCell *segmentCell = [FRPSegmentCell cellWithTitle:@"Segment Cell"
  12.                                                     setting:[FRPSettings settingsWithKey:@"SegmentValue" defaultValue:@"1519"]
  13.                                                      values:@[@"1519",@"1520",@"1521"]
  14.                                             displayedValues:@[@"Peek",@"Pop",@"Nope"]
  15.                                            postNotification:nil
  16.                                                 changeBlock:^(NSString *item) {
  17.                                                     NSLog(@"Selected Item: %@",item);
  18.                                                 }];
  19.                                                
  20. %hook T1SettingsViewController
  21.  
  22. -(void)viewDidLoad
  23. {
  24. %orig;
  25. UIBarButtonItem *addButton = [[UIBarButtonItem alloc]  initWithTitle:@"TWPlus" style:UIBarButtonItemStylePlain target:self action:@selector(loadNewSettings:)];
  26. [self.navigationItem setRightBarButtonItem:addButton];
  27.  
  28.  
  29. %orig;
  30. }
  31.  
  32. %new
  33. - (void)loadNewSettings:(id)sender {
  34.    
  35.     FRPSection *section1 = [FRPSection sectionWithTitle:@"TWPlus" footer:nil];
  36.  
  37. /***** Removed old code from here ***/
  38.  
  39. [section1 addCell:segmentCell];
  40.  
  41. FRPreferences *table = [FRPreferences tableWithSections:@[section1] title:@"TWPlus" tintColor:TWPlusTintColour];
  42.  
  43. [self.navigationController pushViewController:table animated:YES];
  44.  
  45. }
  46.  
  47. %end
  48.  
  49. %hook T1DashAccountSwitcherBubble
  50. - (void)wasTapped:(id)arg1 {
  51. %orig;
  52. segmentSelection =[segmentCell objectForKey:@"SegmentValue"];
  53.  
  54. if([segmentSelection isEqualToString:@"1519"]) {
  55. AudioServicesPlaySystemSound(1519);}
  56.  
  57. if([segmentSelection isEqualToString:@"1520"]) {
  58. AudioServicesPlaySystemSound(1520);}
  59.  
  60. if([segmentSelection isEqualToString:@"1521"]) {
  61. AudioServicesPlaySystemSound(1521);}
  62. }
  63. %end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement