diff --git a/VoidLink/Base.lproj/iPad.storyboard b/VoidLink/Base.lproj/iPad.storyboard index dec89217..bfa5d299 100644 --- a/VoidLink/Base.lproj/iPad.storyboard +++ b/VoidLink/Base.lproj/iPad.storyboard @@ -1360,16 +1360,16 @@ - + - + @@ -1425,11 +1425,38 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/VoidLink/Base.lproj/iPhone.storyboard b/VoidLink/Base.lproj/iPhone.storyboard index e9f38bed..db84830e 100644 --- a/VoidLink/Base.lproj/iPhone.storyboard +++ b/VoidLink/Base.lproj/iPhone.storyboard @@ -1754,26 +1754,6 @@ - - - - - - - - - - - - - - - @@ -2188,6 +2168,31 @@ + + + + + + + + + + + + + + + + + + + + @@ -2208,11 +2213,33 @@ + + + + + + + + + + + + + + + + + diff --git a/VoidLink/Database/DataManager.h b/VoidLink/Database/DataManager.h index 5774bd79..8e1fc05d 100644 --- a/VoidLink/Database/DataManager.h +++ b/VoidLink/Database/DataManager.h @@ -16,6 +16,12 @@ @interface DataManager : NSObject +typedef NS_ENUM(NSUInteger, AppTheme) { + SystemTheme, + LightTheme, + DarkTheme +}; + typedef NS_ENUM(NSUInteger, UINavigationBarHeight) { UINavigationBarHeightIPad = 50, UINavigationBarHeightIPhone = 44 diff --git a/VoidLink/Database/TemporarySettings.h b/VoidLink/Database/TemporarySettings.h index 5fe019a4..b189ceed 100644 --- a/VoidLink/Database/TemporarySettings.h +++ b/VoidLink/Database/TemporarySettings.h @@ -80,6 +80,7 @@ @property (nonatomic) BOOL rememberFoldState; @property (nonatomic, retain) NSNumber * singleTapSensitivity; @property (nonatomic, retain) NSNumber * hapticEngine; +@property (nonatomic, retain) NSNumber * appTheme; @property (nonatomic, retain) NSNumber * edgeSlidingSensitivity; @property (nonatomic, retain) NSNumber * framePacingMode; diff --git a/VoidLink/Database/TemporarySettings.m b/VoidLink/Database/TemporarySettings.m index f3b1ba25..76e8b796 100644 --- a/VoidLink/Database/TemporarySettings.m +++ b/VoidLink/Database/TemporarySettings.m @@ -136,6 +136,7 @@ self.singleTapSensitivity = settings.singleTapSensitivity; self.backgroundSessionTimer = settings.backroundSessionTimer; self.edgeSlidingSensitivity = settings.edgeSlidingSensitivity; + self.appTheme = settings.appTheme; self.hapticEngine = settings.hapticEngine; #endif self.uniqueId = settings.uniqueId; diff --git a/VoidLink/Limelight.xcdatamodeld/VoidLink v1.0.xcdatamodel/contents b/VoidLink/Limelight.xcdatamodeld/VoidLink v1.0.xcdatamodel/contents index 5142e157..3d5150c6 100644 --- a/VoidLink/Limelight.xcdatamodeld/VoidLink v1.0.xcdatamodel/contents +++ b/VoidLink/Limelight.xcdatamodeld/VoidLink v1.0.xcdatamodel/contents @@ -21,6 +21,7 @@ + diff --git a/VoidLink/ThemeManager.m b/VoidLink/ThemeManager.m index 7b1a1437..8248c3a5 100644 --- a/VoidLink/ThemeManager.m +++ b/VoidLink/ThemeManager.m @@ -15,7 +15,7 @@ NSString * const ThemeDidChangeNotification = @"ThemeDidChangeNotification"; static UIUserInterfaceStyle _privateUserInterfaceStyle = UIUserInterfaceStyleUnspecified; static UIUserInterfaceStyle _userInterfaceStyle; -+ (UIColor *)getUIStyle{ ++ (UIColor *)setPublicUIStyle{ if (@available(iOS 13.0, *)) { UITraitCollection *traitCollection = [UIScreen mainScreen].traitCollection; if(_privateUserInterfaceStyle == UIUserInterfaceStyleUnspecified) { @@ -31,7 +31,7 @@ static UIUserInterfaceStyle _userInterfaceStyle; + (UIUserInterfaceStyle)userInterfaceStyle { - [ThemeManager getUIStyle]; + [ThemeManager setPublicUIStyle]; return _userInterfaceStyle; } @@ -40,12 +40,12 @@ static UIUserInterfaceStyle _userInterfaceStyle; return; } _privateUserInterfaceStyle = style; - [ThemeManager getUIStyle]; + [ThemeManager setPublicUIStyle]; [[NSNotificationCenter defaultCenter] postNotificationName:ThemeDidChangeNotification object:nil]; } + (UIColor *)appBackgroundColor { - [ThemeManager getUIStyle]; + [ThemeManager setPublicUIStyle]; switch (self.userInterfaceStyle) { case UIUserInterfaceStyleLight: return [UIColor colorWithRed:242.0/255.0 green:242.0/255.0 blue:247.0/255.0 alpha:1.0]; @@ -59,7 +59,7 @@ static UIUserInterfaceStyle _userInterfaceStyle; } + (UIColor *)widgetBackgroundColor { - [ThemeManager getUIStyle]; + [ThemeManager setPublicUIStyle]; switch (self.userInterfaceStyle) { case UIUserInterfaceStyleLight: return [UIColor whiteColor]; @@ -72,7 +72,7 @@ static UIUserInterfaceStyle _userInterfaceStyle; } + (UIColor *)separatorColor { - [ThemeManager getUIStyle]; + [ThemeManager setPublicUIStyle]; switch (self.userInterfaceStyle) { case UIUserInterfaceStyleLight: return [UIColor colorWithWhite:0.1 alpha:0.28]; @@ -86,7 +86,7 @@ static UIUserInterfaceStyle _userInterfaceStyle; + (UIColor *)textColor { - [ThemeManager getUIStyle]; + [ThemeManager setPublicUIStyle]; switch (self.userInterfaceStyle) { case UIUserInterfaceStyleLight: return [UIColor blackColor]; @@ -126,7 +126,7 @@ static UIUserInterfaceStyle _userInterfaceStyle; } + (UIColor *)appPrimaryColorWithAlpha { - [ThemeManager getUIStyle]; + [ThemeManager setPublicUIStyle]; switch (self.userInterfaceStyle) { case UIUserInterfaceStyleLight: return [[ThemeManager appPrimaryColor] colorWithAlphaComponent:0.24]; // #0A84FF diff --git a/VoidLink/ViewControllers/MainFrameViewController.m b/VoidLink/ViewControllers/MainFrameViewController.m index e2b0da31..09275b22 100644 --- a/VoidLink/ViewControllers/MainFrameViewController.m +++ b/VoidLink/ViewControllers/MainFrameViewController.m @@ -1193,6 +1193,7 @@ static NSMutableSet* hostList; [settingsViewController setHidden:_settingsExpandedInStreamView forStack:settingsViewController.externalDisplayModeStack]; [settingsViewController setHidden:_settingsExpandedInStreamView forStack:settingsViewController.audioConfigStack]; [settingsViewController setHidden:_settingsExpandedInStreamView forStack:settingsViewController.pipStack]; + [settingsViewController setHidden:_settingsExpandedInStreamView forStack:settingsViewController.appThemeStack]; [settingsViewController.renderingBackendSelector setEnabled:!_settingsExpandedInStreamView]; // Enable frame pacing mode selector only if not in stream view AND not in performance mode BOOL shouldEnableFramePacing = !_settingsExpandedInStreamView && (settingsViewController.renderingBackendSelector.selectedSegmentIndex != RENDER_METAL); @@ -1554,6 +1555,9 @@ static NSMutableSet* hostList; - (void)traitCollectionDidChange:(UITraitCollection *)previousTraitCollection { [super traitCollectionDidChange:previousTraitCollection]; if (@available(iOS 13.0, *)) { + DataManager* dataMan = [[DataManager alloc] init]; + TemporarySettings* tempSettings = [dataMan getSettings]; + if(tempSettings.appTheme.intValue != UIUserInterfaceStyleUnspecified) return; if ([self.traitCollection hasDifferentColorAppearanceComparedToTraitCollection:previousTraitCollection]) { [ThemeManager setUserInterfaceStyle:self.traitCollection.userInterfaceStyle]; } @@ -1563,8 +1567,10 @@ static NSMutableSet* hostList; - (void)viewDidLoad{ [super viewDidLoad]; - //[OrientationHelper updateOrientationToLandscape]; - // self.navigationController.delegate = self; + DataManager* dataMan = [[DataManager alloc] init]; + TemporarySettings* tempSettings = [dataMan getSettings]; + [ThemeManager setUserInterfaceStyle:tempSettings.appTheme.intValue]; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(deviceOrientationDidChange) // handle orientation change since i made portrait mode available name:UIDeviceOrientationDidChangeNotification diff --git a/VoidLink/ViewControllers/SettingsViewController.h b/VoidLink/ViewControllers/SettingsViewController.h index dc9e0abe..710c478e 100644 --- a/VoidLink/ViewControllers/SettingsViewController.h +++ b/VoidLink/ViewControllers/SettingsViewController.h @@ -175,6 +175,9 @@ @property (strong, nonatomic) IBOutlet UIStackView *edgeSlidingSensitivityStack; @property (strong, nonatomic) IBOutlet UISlider *edgeSlidingSensitivitySlider; +@property (strong, nonatomic) IBOutlet UIStackView *appThemeStack; +@property (strong, nonatomic) IBOutlet UISegmentedControl *appThemeSelector; + @property (strong, nonatomic) IBOutlet UIStackView *testStack; @property (nonatomic, strong) MicHandler *micHandler; diff --git a/VoidLink/ViewControllers/SettingsViewController.m b/VoidLink/ViewControllers/SettingsViewController.m index b6165dad..ca534da4 100644 --- a/VoidLink/ViewControllers/SettingsViewController.m +++ b/VoidLink/ViewControllers/SettingsViewController.m @@ -800,6 +800,7 @@ BOOL isCustomResolution(int resolutionSelected) { [self addSetting:self.statsOverlayStack ofId:@"statsOverlayStack" withInfoTag:NO withDynamicLabel:NO to:otherSection]; [self addSetting:self.unlockDisplayOrientationStack ofId:@"unlockDisplayOrientationStack" withInfoTag:YES withDynamicLabel:NO to:otherSection]; [self addSetting:self.backgroundSessionTimerStack ofId:@"backgroundSessionTimerStack" withInfoTag:NO withDynamicLabel:YES to:otherSection]; + [self addSetting:self.appThemeStack ofId:@"appThemeStack" withInfoTag:NO withDynamicLabel:NO to:otherSection]; [self addSetting:self.optimizeGamesStack ofId:@"optimizeGamesStack" withInfoTag:YES withDynamicLabel:NO to:otherSection]; [self addSetting:self.multiControllerStack ofId:@"multiControllerStack" withInfoTag:NO withDynamicLabel:NO to:otherSection]; [self addSetting:self.softKeyboardToolbarStack ofId:@"softKeyboardToolbarStack" withInfoTag:NO withDynamicLabel:NO to:otherSection]; @@ -1766,7 +1767,15 @@ BOOL isCustomResolution(int resolutionSelected) { [self.backgroundSessionTimerSlider setValue:(uint32_t)self->tempSettings.backgroundSessionTimer.floatValue]; [self.backgroundSessionTimerSlider addTarget:self action:@selector(backgroundSessionTimerSliderMoved:) forControlEvents:UIControlEventValueChanged]; [self backgroundSessionTimerSliderMoved:self.backgroundSessionTimerSlider]; - + + [self.appThemeSelector setSelectedSegmentIndex:self->tempSettings.appTheme.intValue]; + [self.appThemeSelector addTarget:self action:@selector(appThemeChanged:) forControlEvents:UIControlEventValueChanged]; + if (@available(iOS 13.0, *)) nil; + else{ + [self.appThemeSelector setSelectedSegmentIndex:UIUserInterfaceStyleDark]; + [self.appThemeSelector setEnabled:false]; + } + // lift streamview setting [self.liftStreamViewForKeyboardSelector setSelectedSegmentIndex:self->tempSettings.liftStreamViewForKeyboard ? 1 : 0];// Load old setting @@ -2211,6 +2220,12 @@ BOOL isCustomResolution(int resolutionSelected) { [self findDynamicLabelFromStack:self.backgroundSessionTimerStack].text = labelString; // Update label display } +- (void)appThemeChanged:(UISegmentedControl* )sender{ + [ThemeManager setUserInterfaceStyle:sender.selectedSegmentIndex]; + Settings* currentSettings = [self->dataMan retrieveSettings]; + currentSettings.appTheme = @(sender.selectedSegmentIndex); + [dataMan saveData]; +} // veloc factor upto 700% - (CGFloat) map_velocFactorDisplay_fromSliderValue:(CGFloat)sliderValue{ diff --git a/VoidLink/mul.lproj/iPad.xcstrings b/VoidLink/mul.lproj/iPad.xcstrings index 917d3ca6..ab4cf4dc 100644 --- a/VoidLink/mul.lproj/iPad.xcstrings +++ b/VoidLink/mul.lproj/iPad.xcstrings @@ -313,6 +313,36 @@ } } }, + "6GU-ZN-w6X.text" : { + "comment" : "Class = \"UILabel\"; text = \"Theme\"; ObjectID = \"6GU-ZN-w6X\";", + "extractionState" : "extracted_with_value", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "new", + "value" : "Theme" + } + }, + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "主题" + } + }, + "zh-Hant" : { + "stringUnit" : { + "state" : "translated", + "value" : "主題" + } + }, + "zh-HK" : { + "stringUnit" : { + "state" : "translated", + "value" : "主題" + } + } + } + }, "6gY-8I-NWq.text" : { "comment" : "Class = \"UILabel\"; text = \"Map Gyro to\"; ObjectID = \"6gY-8I-NWq\";", "extractionState" : "extracted_with_value", @@ -841,7 +871,7 @@ }, "zh-Hant" : { "stringUnit" : { - "state" : "needs_review", + "state" : "translated", "value" : "邊緣觸發靈敏度" } }, @@ -4321,6 +4351,96 @@ } } }, + "wi6-L4-KwS.segmentTitles[0]" : { + "comment" : "Class = \"UISegmentedControl\"; wi6-L4-KwS.segmentTitles[0] = \"System\"; ObjectID = \"wi6-L4-KwS\";", + "extractionState" : "extracted_with_value", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "new", + "value" : "System" + } + }, + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "跟随系统" + } + }, + "zh-Hant" : { + "stringUnit" : { + "state" : "translated", + "value" : "跟隨系統" + } + }, + "zh-HK" : { + "stringUnit" : { + "state" : "translated", + "value" : "跟隨系統" + } + } + } + }, + "wi6-L4-KwS.segmentTitles[1]" : { + "comment" : "Class = \"UISegmentedControl\"; wi6-L4-KwS.segmentTitles[1] = \"Light\"; ObjectID = \"wi6-L4-KwS\";", + "extractionState" : "extracted_with_value", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "new", + "value" : "Light" + } + }, + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "浅色" + } + }, + "zh-Hant" : { + "stringUnit" : { + "state" : "translated", + "value" : "淺色" + } + }, + "zh-HK" : { + "stringUnit" : { + "state" : "translated", + "value" : "淺色" + } + } + } + }, + "wi6-L4-KwS.segmentTitles[2]" : { + "comment" : "Class = \"UISegmentedControl\"; wi6-L4-KwS.segmentTitles[2] = \"Dark\"; ObjectID = \"wi6-L4-KwS\";", + "extractionState" : "extracted_with_value", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "new", + "value" : "Dark" + } + }, + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "深色" + } + }, + "zh-Hant" : { + "stringUnit" : { + "state" : "translated", + "value" : "深色" + } + }, + "zh-HK" : { + "stringUnit" : { + "state" : "translated", + "value" : "深色" + } + } + } + }, "xfv-K0-1CO.text" : { "comment" : "Class = \"UILabel\"; text = \"Tap any widget to load configuration (per widget)\\n\"; ObjectID = \"xfv-K0-1CO\";", "extractionState" : "extracted_with_value", diff --git a/VoidLink/mul.lproj/iPhone.xcstrings b/VoidLink/mul.lproj/iPhone.xcstrings index d0c86188..e5376279 100644 --- a/VoidLink/mul.lproj/iPhone.xcstrings +++ b/VoidLink/mul.lproj/iPhone.xcstrings @@ -3235,6 +3235,96 @@ } } }, + "pNz-vd-Sr9.segmentTitles[0]" : { + "comment" : "Class = \"UISegmentedControl\"; pNz-vd-Sr9.segmentTitles[0] = \"System\"; ObjectID = \"pNz-vd-Sr9\";", + "extractionState" : "extracted_with_value", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "new", + "value" : "System" + } + }, + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "跟随系统" + } + }, + "zh-Hant" : { + "stringUnit" : { + "state" : "translated", + "value" : "跟隨系統" + } + }, + "zh-HK" : { + "stringUnit" : { + "state" : "translated", + "value" : "跟隨系統" + } + } + } + }, + "pNz-vd-Sr9.segmentTitles[1]" : { + "comment" : "Class = \"UISegmentedControl\"; pNz-vd-Sr9.segmentTitles[1] = \"Light\"; ObjectID = \"pNz-vd-Sr9\";", + "extractionState" : "extracted_with_value", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "new", + "value" : "Light" + } + }, + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "浅色" + } + }, + "zh-Hant" : { + "stringUnit" : { + "state" : "translated", + "value" : "淺色" + } + }, + "zh-HK" : { + "stringUnit" : { + "state" : "translated", + "value" : "淺色" + } + } + } + }, + "pNz-vd-Sr9.segmentTitles[2]" : { + "comment" : "Class = \"UISegmentedControl\"; pNz-vd-Sr9.segmentTitles[2] = \"Dark\"; ObjectID = \"pNz-vd-Sr9\";", + "extractionState" : "extracted_with_value", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "new", + "value" : "Dark" + } + }, + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "深色" + } + }, + "zh-Hant" : { + "stringUnit" : { + "state" : "translated", + "value" : "深色" + } + }, + "zh-HK" : { + "stringUnit" : { + "state" : "translated", + "value" : "深色" + } + } + } + }, "q6v-Jb-ysy.segmentTitles[0]" : { "comment" : "Class = \"UISegmentedControl\"; q6v-Jb-ysy.segmentTitles[0] = \"Xbox 360\"; ObjectID = \"q6v-Jb-ysy\";", "extractionState" : "extracted_with_value", @@ -4435,6 +4525,36 @@ } } }, + "yF6-p8-b2s.text" : { + "comment" : "Class = \"UILabel\"; text = \"Theme\"; ObjectID = \"yF6-p8-b2s\";", + "extractionState" : "extracted_with_value", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "new", + "value" : "Theme" + } + }, + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "主题" + } + }, + "zh-Hant" : { + "stringUnit" : { + "state" : "translated", + "value" : "主題" + } + }, + "zh-HK" : { + "stringUnit" : { + "state" : "translated", + "value" : "主題" + } + } + } + }, "yJv-xb-5HL.text" : { "comment" : "Class = \"UILabel\"; text = \"Pitch Sensitivity\"; ObjectID = \"yJv-xb-5HL\";", "extractionState" : "extracted_with_value",