Skip to content
This repository has been archived by the owner on Dec 9, 2022. It is now read-only.

Commit

Permalink
Show a background image on the first setup UI
Browse files Browse the repository at this point in the history
This is to avoid users thinking their device got restored on installation
  • Loading branch information
Matchstic committed Apr 14, 2019
1 parent faf353f commit 3c99ae4
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
1 change: 1 addition & 0 deletions Tweak/Setup/XENSetupWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
@interface XENHSetupWindow : UIWindow

@property (nonatomic, strong) UIView *bar;
@property (nonatomic, strong) UIImageView *backgroundImageView;
@property (nonatomic, readwrite) BOOL usingQuickSetup;

+(instancetype)sharedInstance;
Expand Down
23 changes: 23 additions & 0 deletions Tweak/Setup/XENSetupWindow.m
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,12 @@ - (bool)_shouldCreateContextAsSecure {
return YES;
}

- (void)layoutSubviews {
[super layoutSubviews];

self.backgroundImageView.frame = CGRectMake(0, 0, self.bounds.size.width, self.bounds.size.height);
}

-(id)initWithFrame:(CGRect)frame {
self = [super initWithFrame:frame];

Expand All @@ -89,6 +95,23 @@ -(id)initWithFrame:(CGRect)frame {

self.usingQuickSetup = NO;

// Background
NSString *imagePath = [NSString stringWithFormat:@"/Library/PreferenceBundles/XenHTMLPrefs.bundle/Background%@", [XENHResources imageSuffix]];

if (![[NSFileManager defaultManager] fileExistsAtPath:imagePath]) {
// Oh for crying out loud CoolStar
imagePath = [NSString stringWithFormat:@"/bootstrap/Library/PreferenceBundles/XenHTMLPrefs.bundle/Background%@", [XENHResources imageSuffix]];
}

UIImage *backgroundImage = [UIImage imageWithContentsOfFile:imagePath];

self.backgroundImageView = [[UIImageView alloc] initWithImage:backgroundImage];
self.backgroundImageView.frame = CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
self.backgroundImageView.alpha = 0.3;
self.backgroundImageView.contentMode = UIViewContentModeScaleAspectFill;

[self addSubview:self.backgroundImageView];

// We want a navigation controller
XENHSetupInitialController *initial = [[XENHSetupInitialController alloc] init];
UINavigationController *navigation = [[UINavigationController alloc] initWithRootViewController:initial];
Expand Down

0 comments on commit 3c99ae4

Please sign in to comment.