Browse Source

loads the image in all the views, right now its hardcoded to the image path i know we have. need to make this smarter. also SHOULD work to spoof the proper vrsion now

Kevin Bradley 5 years ago
parent
commit
8acf954fd5

+ 7 - 6
DalesDeadBug.xm

@@ -15,7 +15,7 @@ extern const char *__progname;
 static BOOL Enabled;
 static __strong NSString* kCurrentiOSVersion = nil;
 static __strong NSString* kCurrentDeviceType = nil;
-const char * kCurrentiOSVersionSpoof;
+static __strong NSString* kCurrentiOSVersionSpoof = nil; //no idea why theres were chars, just overcomplicating things.
 const char * kCurrentDeviceTypeSpoof;
 static __strong NSString* kUserAgent = @"User-Agent";
 static __strong NSString* kFormatHeader = @"/%@ ";
@@ -29,11 +29,12 @@ static __strong NSString* kFormatHeader = @"/%@ ";
 	NSDictionary *LowerInstallPrefs = [[[NSDictionary alloc] initWithContentsOfFile:@PLIST_PATH_Settings]?:[NSDictionary dictionary] copy];
 	//HBLogInfo(@"###LowerInstallPrefs: %@", LowerInstallPrefs);
 	Enabled = (BOOL)[[LowerInstallPrefs objectForKey:@"Enabled"]?:@YES boolValue];
+	kCurrentiOSVersionSpoof = [LowerInstallPrefs objectForKey:@"SpoofVersion"]?:@"11.1";
 	if(Enabled && field && value && kUserAgent && [field isEqualToString:kUserAgent] && kCurrentiOSVersion && kCurrentiOSVersionSpoof) {
 		HBLogInfo(@"currentiOSVersion: %@ value: %@", kCurrentiOSVersion, value);
 		if([value rangeOfString:kCurrentiOSVersion].location != NSNotFound) {
 			//HBLogInfo(@"### are we inside here???");
-			value = [value stringByReplacingOccurrencesOfString:[NSString stringWithFormat:kFormatHeader, kCurrentiOSVersion] withString:[NSString stringWithFormat:kFormatHeader, [NSString stringWithUTF8String:kCurrentiOSVersionSpoof]]];
+			value = [value stringByReplacingOccurrencesOfString:[NSString stringWithFormat:kFormatHeader, kCurrentiOSVersion] withString:[NSString stringWithFormat:kFormatHeader, kCurrentiOSVersionSpoof]];
 			//HBLogInfo(@"### are we inside here??? 2");
 			//value = [value stringByReplacingOccurrencesOfString:[NSString stringWithFormat:kFormatHeader, kCurrentDeviceType] withString:[NSString stringWithFormat:kFormatHeader, [NSString stringWithUTF8String:kCurrentDeviceTypeSpoof]]];
 			//HBLogInfo(@"### are we inside here??? 3");
@@ -132,10 +133,10 @@ static void settingsChangedLowerInstall()
 	@autoreleasepool {
 		NSDictionary *LowerInstallPrefs = [[[NSDictionary alloc] initWithContentsOfFile:@PLIST_PATH_Settings]?:[NSDictionary dictionary] copy];
 		Enabled = (BOOL)[[LowerInstallPrefs objectForKey:@"Enabled"]?:@YES boolValue];
-		NSString* CurrentiOSVersionSpoof = [LowerInstallPrefs objectForKey:@"SpoofVersion"]?:@"11.1";
-		kCurrentiOSVersionSpoof = (const char*)(malloc([CurrentiOSVersionSpoof length]));
-		memcpy((void*)kCurrentiOSVersionSpoof,(const void*)CurrentiOSVersionSpoof.UTF8String, [CurrentiOSVersionSpoof length]);
-		((char*)kCurrentiOSVersionSpoof)[[CurrentiOSVersionSpoof length]] = '\0';
+		kCurrentiOSVersionSpoof = [LowerInstallPrefs objectForKey:@"SpoofVersion"]?:@"11.1";
+		//kCurrentiOSVersionSpoof = (const char*)(malloc([CurrentiOSVersionSpoof length]));
+		//memcpy((void*)kCurrentiOSVersionSpoof,(const void*)CurrentiOSVersionSpoof.UTF8String, [CurrentiOSVersionSpoof length]);
+		//((char*)kCurrentiOSVersionSpoof)[[CurrentiOSVersionSpoof length]] = '\0';
 		NSString* CurrentDeviceTypeSpoof = [LowerInstallPrefs objectForKey:@"SpoofDevice"]?:@"AppleTV5,3";
 		kCurrentDeviceTypeSpoof = (const char*)(malloc([CurrentDeviceTypeSpoof length]));
 		memcpy((void*)kCurrentDeviceTypeSpoof,(const void*)CurrentDeviceTypeSpoof.UTF8String, [CurrentDeviceTypeSpoof length]);

+ 1 - 1
TVSettingsTweakViewController.m

@@ -64,7 +64,7 @@
     
     
 
-    TSKSettingItem *multiItem = [TSKSettingItem multiValueItemWithTitle:@"Test" description:@"Science" representedObject:facade keyPath:@"version" availableValues:@[@"11.1", @"11.2", @"11.3", @"11.4"]];
+    TSKSettingItem *multiItem = [TSKSettingItem multiValueItemWithTitle:@"Test" description:@"Science" representedObject:facade keyPath:@"SpoofVersion" availableValues:@[@"11.1", @"11.2", @"11.3", @"11.4"]];
     TSKSettingGroup *group = [TSKSettingGroup groupWithTitle:nil settingItems:@[toggleItem, multiItem]];
     [_backingArray addObject:group];
     [self setValue:_backingArray forKey:@"_settingGroups"];

+ 31 - 35
ddbsettings/DDBSettingsController.m

@@ -1,16 +1,4 @@
-//#include "DDBRootListController.h"
-//
-//@implementation DDBRootListController
-//
-//- (NSArray *)specifiers {
-//    if (!_specifiers) {
-//        _specifiers = [[self loadSpecifiersFromPlistName:@"Root" target:self] retain];
-//    }
-//
-//    return _specifiers;
-//}
-//
-//@end
+
 
 #import "DDBSettingsController.h"
 
@@ -23,32 +11,17 @@
      
      +[<TSKSettingItem: 0x1ad71bc88> toggleItemWithTitle:Automatically Update Apps description:(null) representedObject:<TVSettingsPreferenceFacade: 0x1c0438480> keyPath:AutoUpdatesEnabled onTitle:(null) offTitle:(null)]
      */
-    
-    id facade = [[ NSClassFromString(@"TVSettingsPreferenceFacade") alloc] initWithDomain:@"com.nito.dalesdeadbug" notifyChanges:TRUE];
-    
+    NSLog(@"DDBSettings: main bundle: %@", [NSBundle bundleForClass:self.class]);
+   
+    id facade = [[NSClassFromString(@"TVSettingsPreferenceFacade") alloc] initWithDomain:@"com.nito.dalesdeadbug" notifyChanges:TRUE];
+    [facade setValue:[NSNumber numberWithBool:TRUE] forUndefinedKey:@"Enabled"];
+    [facade setValue:@"11.1" forUndefinedKey:@"SpoofVersion"];
     
     NSMutableArray *_backingArray = [NSMutableArray new];
     TSKSettingItem *toggleItem = [TSKSettingItem toggleItemWithTitle:@"Version spoofing" description:@"Whether or not to spoof a higher OS version to install officially unsupported application versions. " representedObject:facade keyPath:@"Enabled" onTitle:nil offTitle:nil];
     //TSKSettingItem *textEntryItem = [TSKSettingItem textInputItemWithTitle:@"Tests text entry" description:@"This is a test" representedObject:facade keyPath:@"textTest"];
-    /*
-     
-     multiValueItemWithTitle:Apple TV Name description:You can name your Apple TV to make it easy to recognize when you use AirPlay and Home Sharing. representedObject:<TVSettingsDeviceFacade: 0x1c087e2c0> keyPath:name availableValues:(
-     "Apple TV",
-     "Living Room",
-     "Family Room",
-     Bedroom,
-     Kitchen,
-     "Great Room",
-     Office
-     )]
-     
-     
-     */
-    
-    
-    
-    
-    TSKSettingItem *multiItem = [TSKSettingItem multiValueItemWithTitle:@"Spoofed Version" description:@"The version you are going to spoof." representedObject:facade keyPath:@"version" availableValues:@[@"11.1", @"11.2", @"11.3", @"11.4"]];
+
+    TSKSettingItem *multiItem = [TSKSettingItem multiValueItemWithTitle:@"Spoofed Version" description:@"The version you are going to spoof." representedObject:facade keyPath:@"SpoofVersion" availableValues:@[@"11.1", @"11.2", @"11.3", @"11.4"]];
     TSKSettingGroup *group = [TSKSettingGroup groupWithTitle:nil settingItems:@[toggleItem, multiItem]];
     [_backingArray addObject:group];
     [self setValue:_backingArray forKey:@"_settingGroups"];
@@ -57,4 +30,27 @@
     
 }
 
+-(id)previewForItemAtIndexPath:(NSIndexPath *)indexPath {
+    
+    NSLog(@"are we ever in ehre?!??!");
+    TSKPreviewViewController *item = [super previewForItemAtIndexPath:indexPath];
+    TSKSettingGroup *currentGroup = self.settingGroups[indexPath.section];
+    NSLog(@"currentGroup: %@", currentGroup);
+    TSKSettingItem *currentItem = currentGroup.settingItems[indexPath.row];
+    NSLog(@"current item: %@", currentItem);
+    NSString *imagePath = [[NSBundle bundleForClass:self.class] pathForResource:@"icon" ofType:@"jpg"];
+    UIImage *icon = [UIImage imageWithContentsOfFile:imagePath];
+    NSLog(@"DDBSettings: our icon: %@", imagePath);
+    if (icon != nil) {
+        TSKVibrantImageView *imageView = [[TSKVibrantImageView alloc] initWithImage:icon];
+        NSLog(@"current item: %@", imageView);
+        [item setContentView:imageView];
+    }
+    NSLog(@"previewForItemAtIndexPath: %@", item);
+    
+    return item;
+    
+}
+
+
 @end

+ 1 - 0
ddbsettings/Makefile

@@ -12,6 +12,7 @@ DDBSettings_INSTALL_PATH = /Library/PreferenceBundles
 DDBSettings_FRAMEWORKS = UIKit TVSettingKit
 DDBSettings_PRIVATE_FRAMEWORKS = Preferences
 DDBSettings_LDFLAGS = -undefined dynamic_lookup
+DDBSettings_CFLAGS+= -I. -ITVSettings
 
 include $(THEOS_MAKE_PATH)/bundle.mk
 

+ 60 - 0
ddbsettings/TVSettings/TSKPreviewViewController.h

@@ -0,0 +1,60 @@
+/*
+* This header is generated by classdump-dyld 1.0
+* on Sunday, July 22, 2018 at 11:13:55 PM Mountain Standard Time
+* Operating System: Version 11.3 (Build 15L211)
+* Image Source: /System/Library/PrivateFrameworks/TVSettingKit.framework/TVSettingKit
+* classdump-dyld is licensed under GPLv3, Copyright © 2013-2016 by Elias Limneos.
+*/
+
+#import <UIKit/UIViewController.h>
+
+@class NSArray, UIView, UILabel, UIProgressView, NSString, NSAttributedString;
+
+@interface TSKPreviewViewController : UIViewController {
+
+	NSArray* _contentConstraints;
+	BOOL _shouldShowProgress;
+	float _progress;
+	UIView* _contentView;
+	UIView* _contentContainer;
+	UIView* _metadataContainer;
+	UILabel* _descriptionLabel;
+	UILabel* _progressLabel;
+	UIProgressView* _progressView;
+
+}
+
+@property (nonatomic,readonly) UIView * contentContainer;                               //@synthesize contentContainer=_contentContainer - In the implementation block
+@property (nonatomic,readonly) UIView * metadataContainer;                              //@synthesize metadataContainer=_metadataContainer - In the implementation block
+@property (nonatomic,readonly) UIView * contentContainerSnapshot; 
+@property (nonatomic,readonly) UILabel * descriptionLabel;                              //@synthesize descriptionLabel=_descriptionLabel - In the implementation block
+@property (nonatomic,readonly) UILabel * progressLabel;                                 //@synthesize progressLabel=_progressLabel - In the implementation block
+@property (nonatomic,readonly) UIProgressView * progressView;                           //@synthesize progressView=_progressView - In the implementation block
+@property (nonatomic,retain) UIView * contentView;                                      //@synthesize contentView=_contentView - In the implementation block
+@property (nonatomic,copy) NSString * descriptionText; 
+@property (nonatomic,copy) NSAttributedString * attributedDescriptionText; 
+@property (assign,nonatomic) BOOL shouldShowProgress;                                   //@synthesize shouldShowProgress=_shouldShowProgress - In the implementation block
+@property (assign,nonatomic) float progress;                                            //@synthesize progress=_progress - In the implementation block
+-(NSString *)descriptionText;
+-(void)setDescriptionText:(NSString *)arg1 ;
+-(void)traitCollectionDidChange:(id)arg1 ;
+-(id)initWithNibName:(id)arg1 bundle:(id)arg2 ;
+-(UIView *)contentView;
+-(void)setContentView:(UIView *)arg1 ;
+-(void)setProgress:(float)arg1 ;
+-(void)viewDidLoad;
+-(void)setProgress:(float)arg1 animated:(BOOL)arg2 ;
+-(float)progress;
+-(UILabel *)descriptionLabel;
+-(UIProgressView *)progressView;
+-(UILabel *)progressLabel;
+-(void)setAttributedDescriptionText:(NSAttributedString *)arg1 ;
+-(void)setContentView:(id)arg1 animated:(BOOL)arg2 ;
+-(UIView *)contentContainerSnapshot;
+-(UIView *)contentContainer;
+-(UIView *)metadataContainer;
+-(NSAttributedString *)attributedDescriptionText;
+-(void)setShouldShowProgress:(BOOL)arg1 ;
+-(BOOL)shouldShowProgress;
+@end
+

+ 31 - 0
ddbsettings/TVSettings/TSKVibrantImageView.h

@@ -0,0 +1,31 @@
+/*
+* This header is generated by classdump-dyld 1.0
+* on Sunday, July 22, 2018 at 11:13:55 PM Mountain Standard Time
+* Operating System: Version 11.3 (Build 15L211)
+* Image Source: /System/Library/PrivateFrameworks/TVSettingKit.framework/TVSettingKit
+* classdump-dyld is licensed under GPLv3, Copyright © 2013-2016 by Elias Limneos.
+*/
+
+//#import <TVSettingKit/TVSettingKit-Structs.h>
+#import <UIKit/UIView.h>
+
+@class UIImage, UIImageView;
+
+@interface TSKVibrantImageView : UIView {
+
+	UIImage* _image;
+	UIImageView* _imageView;
+
+}
+
+@property (nonatomic,readonly) UIImageView * imageView;              //@synthesize imageView=_imageView - In the implementation block
+@property (nonatomic,readonly) UIImage * image;                      //@synthesize image=_image - In the implementation block
+-(void)setImage:(UIImage *)arg1 ;
+-(void)traitCollectionDidChange:(id)arg1 ;
+-(id)initWithImage:(id)arg1 ;
+-(CGSize)intrinsicContentSize;
+-(UIImage *)image;
+-(UIImageView *)imageView;
+-(id)initWithImage:(id)arg1 identifier:(id)arg2 ;
+@end
+

+ 2 - 0
ddbsettings/prefs.h

@@ -1,4 +1,6 @@
 #import <UIKit/UIKit.h>
+#import "TSKVibrantImageView.h"
+#import "TSKPreviewViewController.h"
 
 @interface TVSettingsPreferenceFacade : NSObject
 {