Merge branch 'light-mode' into cleanup
This commit is contained in:
commit
80bcef142c
|
@ -573,6 +573,7 @@
|
|||
C31A6C5A247F214E001123EF /* UIView+Glow.swift in Sources */ = {isa = PBXBuildFile; fileRef = C31A6C59247F214E001123EF /* UIView+Glow.swift */; };
|
||||
C31A6C5C247F2CF3001123EF /* CGRect+Utilities.swift in Sources */ = {isa = PBXBuildFile; fileRef = C31A6C5B247F2CF3001123EF /* CGRect+Utilities.swift */; };
|
||||
C329FEEF24F7743F00B1C64C /* UIViewController+Utilities.swift in Sources */ = {isa = PBXBuildFile; fileRef = C329FEED24F7742E00B1C64C /* UIViewController+Utilities.swift */; };
|
||||
C329FEEC24F7277900B1C64C /* LightModeSheet.swift in Sources */ = {isa = PBXBuildFile; fileRef = C329FEEB24F7277900B1C64C /* LightModeSheet.swift */; };
|
||||
C34C8F7423A7830B00D82669 /* SpaceMono-Bold.ttf in Resources */ = {isa = PBXBuildFile; fileRef = C34C8F7323A7830A00D82669 /* SpaceMono-Bold.ttf */; };
|
||||
C353F8F9244809150011121A /* PNOptionView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C353F8F8244809150011121A /* PNOptionView.swift */; };
|
||||
C3548F0624456447009433A8 /* PNModeVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3548F0524456447009433A8 /* PNModeVC.swift */; };
|
||||
|
@ -585,6 +586,9 @@
|
|||
C3638C0524C7F0B500AF29BC /* LK002RemoveFriendRequests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3638C0424C7F0B500AF29BC /* LK002RemoveFriendRequests.swift */; };
|
||||
C369549D24D27A3500CEB4E3 /* MultiDeviceRemovalSheet.swift in Sources */ = {isa = PBXBuildFile; fileRef = C369549C24D27A3500CEB4E3 /* MultiDeviceRemovalSheet.swift */; };
|
||||
C36B8707243C50C60049991D /* SignalMessaging.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 453518921FC63DBF00210559 /* SignalMessaging.framework */; };
|
||||
C39DD28824F3318C008590FC /* Colors.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C39DD28724F3318C008590FC /* Colors.xcassets */; };
|
||||
C39DD28A24F3336E008590FC /* Colors.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C39DD28724F3318C008590FC /* Colors.xcassets */; };
|
||||
C39DD28B24F3336F008590FC /* Colors.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C39DD28724F3318C008590FC /* Colors.xcassets */; };
|
||||
C3C3CF8924D8EED300E1CCE7 /* TextView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3C3CF8824D8EED300E1CCE7 /* TextView.swift */; };
|
||||
C3DAB3242480CB2B00725F25 /* SRCopyableLabel.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3DAB3232480CB2A00725F25 /* SRCopyableLabel.swift */; };
|
||||
C3DFFAC623E96F0D0058DAF8 /* Sheet.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3DFFAC523E96F0D0058DAF8 /* Sheet.swift */; };
|
||||
|
@ -1361,6 +1365,7 @@
|
|||
C31A6C59247F214E001123EF /* UIView+Glow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIView+Glow.swift"; sourceTree = "<group>"; };
|
||||
C31A6C5B247F2CF3001123EF /* CGRect+Utilities.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "CGRect+Utilities.swift"; sourceTree = "<group>"; };
|
||||
C329FEED24F7742E00B1C64C /* UIViewController+Utilities.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIViewController+Utilities.swift"; sourceTree = "<group>"; };
|
||||
C329FEEB24F7277900B1C64C /* LightModeSheet.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LightModeSheet.swift; sourceTree = "<group>"; };
|
||||
C34C8F7323A7830A00D82669 /* SpaceMono-Bold.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "SpaceMono-Bold.ttf"; sourceTree = "<group>"; };
|
||||
C353F8F8244809150011121A /* PNOptionView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PNOptionView.swift; sourceTree = "<group>"; };
|
||||
C3548F0524456447009433A8 /* PNModeVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PNModeVC.swift; sourceTree = "<group>"; };
|
||||
|
@ -1372,6 +1377,7 @@
|
|||
C35E8AAD2485E51D00ACB629 /* IP2Country.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IP2Country.swift; sourceTree = "<group>"; };
|
||||
C3638C0424C7F0B500AF29BC /* LK002RemoveFriendRequests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LK002RemoveFriendRequests.swift; sourceTree = "<group>"; };
|
||||
C369549C24D27A3500CEB4E3 /* MultiDeviceRemovalSheet.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MultiDeviceRemovalSheet.swift; sourceTree = "<group>"; };
|
||||
C39DD28724F3318C008590FC /* Colors.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Colors.xcassets; sourceTree = "<group>"; };
|
||||
C3AA6BB824CE8F1B002358B6 /* Migrating Translations from Android.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = "Migrating Translations from Android.md"; sourceTree = "<group>"; };
|
||||
C3AECBEA24EF5244005743DE /* fa */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = fa; path = translations/fa.lproj/Localizable.strings; sourceTree = "<group>"; };
|
||||
C3C3CF8824D8EED300E1CCE7 /* TextView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TextView.swift; sourceTree = "<group>"; };
|
||||
|
@ -2612,6 +2618,7 @@
|
|||
children = (
|
||||
B8C9689023FA1401005F64E0 /* AppMode.swift */,
|
||||
B8BB829F238F322400BA5194 /* Colors.swift */,
|
||||
C39DD28724F3318C008590FC /* Colors.xcassets */,
|
||||
B8BB82BD2394D4CE00BA5194 /* Fonts.swift */,
|
||||
B8BB82A8238F62FB00BA5194 /* Gradients.swift */,
|
||||
B8BB82A1238F356100BA5194 /* Values.swift */,
|
||||
|
@ -2709,6 +2716,7 @@
|
|||
B8BB82A4238F627000BA5194 /* HomeVC.swift */,
|
||||
B8CCF63E23975CFB0091D419 /* JoinPublicChatVC.swift */,
|
||||
B82B40872399EB0E00A248E7 /* LandingVC.swift */,
|
||||
C329FEEB24F7277900B1C64C /* LightModeSheet.swift */,
|
||||
B85357C423A1F13800AAF6CD /* LinkDeviceVC.swift */,
|
||||
B85357C623A1FB5100AAF6CD /* LinkDeviceVCDelegate.swift */,
|
||||
B86BD08323399ACF000F5AE3 /* Modal.swift */,
|
||||
|
@ -3172,6 +3180,7 @@
|
|||
347850331FD7494A007B8332 /* fontawesome-webfont.ttf in Resources */,
|
||||
3478504C1FD7496D007B8332 /* Images.xcassets in Resources */,
|
||||
347850311FD7494A007B8332 /* dripicons-v2.ttf in Resources */,
|
||||
C39DD28B24F3336F008590FC /* Colors.xcassets in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
@ -3179,6 +3188,7 @@
|
|||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
C39DD28824F3318C008590FC /* Colors.xcassets in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
@ -3239,6 +3249,7 @@
|
|||
45B74A852044AAB600CD42F8 /* bamboo.aifc in Resources */,
|
||||
45B74A782044AAB600CD42F8 /* bamboo-quiet.aifc in Resources */,
|
||||
45B74A7B2044AAB600CD42F8 /* chord.aifc in Resources */,
|
||||
C39DD28A24F3336E008590FC /* Colors.xcassets in Resources */,
|
||||
45B74A812044AAB600CD42F8 /* chord-quiet.aifc in Resources */,
|
||||
45B74A832044AAB600CD42F8 /* circles.aifc in Resources */,
|
||||
45B74A892044AAB600CD42F8 /* circles-quiet.aifc in Resources */,
|
||||
|
@ -3834,6 +3845,7 @@
|
|||
45A6DAD61EBBF85500893231 /* ReminderView.swift in Sources */,
|
||||
34D1F0881F8678AA0066283D /* ConversationViewLayout.m in Sources */,
|
||||
B82B408E239DC00D00A248E7 /* DisplayNameVC.swift in Sources */,
|
||||
C329FEEC24F7277900B1C64C /* LightModeSheet.swift in Sources */,
|
||||
4CA485BB2232339F004B9E7D /* PhotoCaptureViewController.swift in Sources */,
|
||||
34330AA31E79686200DF2FB9 /* OWSProgressView.m in Sources */,
|
||||
344825C6211390C800DB4BD8 /* OWSOrphanDataCleaner.m in Sources */,
|
||||
|
@ -4086,7 +4098,7 @@
|
|||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
CURRENT_PROJECT_VERSION = 103;
|
||||
CURRENT_PROJECT_VERSION = 105;
|
||||
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||
DEVELOPMENT_TEAM = SUQ8J2PCT7;
|
||||
FRAMEWORK_SEARCH_PATHS = "$(inherited)";
|
||||
|
@ -4100,7 +4112,7 @@
|
|||
INFOPLIST_FILE = SignalShareExtension/Info.plist;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks";
|
||||
MARKETING_VERSION = 1.4.5;
|
||||
MARKETING_VERSION = 1.4.6;
|
||||
MTL_ENABLE_DEBUG_INFO = YES;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "com.loki-project.loki-messenger.share-extension";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
|
@ -4148,7 +4160,7 @@
|
|||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
CURRENT_PROJECT_VERSION = 103;
|
||||
CURRENT_PROJECT_VERSION = 105;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
DEVELOPMENT_TEAM = SUQ8J2PCT7;
|
||||
ENABLE_NS_ASSERTIONS = NO;
|
||||
|
@ -4167,7 +4179,7 @@
|
|||
INFOPLIST_FILE = SignalShareExtension/Info.plist;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks";
|
||||
MARKETING_VERSION = 1.4.5;
|
||||
MARKETING_VERSION = 1.4.6;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "com.loki-project.loki-messenger.share-extension";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
|
@ -4202,7 +4214,7 @@
|
|||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
CURRENT_PROJECT_VERSION = 103;
|
||||
CURRENT_PROJECT_VERSION = 105;
|
||||
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||
DEFINES_MODULE = YES;
|
||||
DEVELOPMENT_TEAM = SUQ8J2PCT7;
|
||||
|
@ -4221,7 +4233,7 @@
|
|||
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||
MARKETING_VERSION = 1.4.5;
|
||||
MARKETING_VERSION = 1.4.6;
|
||||
MTL_ENABLE_DEBUG_INFO = YES;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "com.loki-project.loki-messenger.utilities";
|
||||
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
|
||||
|
@ -4272,7 +4284,7 @@
|
|||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
CURRENT_PROJECT_VERSION = 103;
|
||||
CURRENT_PROJECT_VERSION = 105;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
DEFINES_MODULE = YES;
|
||||
DEVELOPMENT_TEAM = SUQ8J2PCT7;
|
||||
|
@ -4296,7 +4308,7 @@
|
|||
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||
MARKETING_VERSION = 1.4.5;
|
||||
MARKETING_VERSION = 1.4.6;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "com.loki-project.loki-messenger.utilities";
|
||||
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
|
||||
|
@ -4334,7 +4346,7 @@
|
|||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
CURRENT_PROJECT_VERSION = 103;
|
||||
CURRENT_PROJECT_VERSION = 105;
|
||||
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||
DEVELOPMENT_TEAM = SUQ8J2PCT7;
|
||||
FRAMEWORK_SEARCH_PATHS = "$(inherited)";
|
||||
|
@ -4346,7 +4358,7 @@
|
|||
INFOPLIST_FILE = LokiPushNotificationService/Info.plist;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks";
|
||||
MARKETING_VERSION = 1.4.5;
|
||||
MARKETING_VERSION = 1.4.6;
|
||||
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
|
||||
MTL_FAST_MATH = YES;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "com.loki-project.loki-messenger.push-notification-service";
|
||||
|
@ -4397,7 +4409,7 @@
|
|||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
CURRENT_PROJECT_VERSION = 103;
|
||||
CURRENT_PROJECT_VERSION = 105;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
DEVELOPMENT_TEAM = SUQ8J2PCT7;
|
||||
ENABLE_NS_ASSERTIONS = NO;
|
||||
|
@ -4414,7 +4426,7 @@
|
|||
INFOPLIST_FILE = LokiPushNotificationService/Info.plist;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks";
|
||||
MARKETING_VERSION = 1.4.5;
|
||||
MARKETING_VERSION = 1.4.6;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
MTL_FAST_MATH = YES;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "com.loki-project.loki-messenger.push-notification-service";
|
||||
|
@ -4598,7 +4610,7 @@
|
|||
CODE_SIGN_ENTITLEMENTS = Signal/Signal.entitlements;
|
||||
CODE_SIGN_IDENTITY = "iPhone Developer";
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
CURRENT_PROJECT_VERSION = 103;
|
||||
CURRENT_PROJECT_VERSION = 105;
|
||||
DEVELOPMENT_TEAM = SUQ8J2PCT7;
|
||||
FRAMEWORK_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
|
@ -4633,7 +4645,7 @@
|
|||
"$(SRCROOT)",
|
||||
);
|
||||
LLVM_LTO = NO;
|
||||
MARKETING_VERSION = 1.4.5;
|
||||
MARKETING_VERSION = 1.4.6;
|
||||
OTHER_LDFLAGS = "$(inherited)";
|
||||
OTHER_SWIFT_FLAGS = "$(inherited) \"-D\" \"COCOAPODS\" \"-DDEBUG\"";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "com.loki-project.loki-messenger";
|
||||
|
@ -4666,7 +4678,7 @@
|
|||
CODE_SIGN_ENTITLEMENTS = Signal/Signal.entitlements;
|
||||
CODE_SIGN_IDENTITY = "iPhone Developer";
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
CURRENT_PROJECT_VERSION = 103;
|
||||
CURRENT_PROJECT_VERSION = 105;
|
||||
DEVELOPMENT_TEAM = SUQ8J2PCT7;
|
||||
FRAMEWORK_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
|
@ -4701,7 +4713,7 @@
|
|||
"$(SRCROOT)",
|
||||
);
|
||||
LLVM_LTO = NO;
|
||||
MARKETING_VERSION = 1.4.5;
|
||||
MARKETING_VERSION = 1.4.6;
|
||||
OTHER_LDFLAGS = "$(inherited)";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "com.loki-project.loki-messenger";
|
||||
PRODUCT_NAME = Session;
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"images" : [
|
||||
{
|
||||
"filename" : "Sun.pdf",
|
||||
"idiom" : "universal"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
Binary file not shown.
|
@ -56,7 +56,7 @@ static NSString *const kURLHostVerifyPrefix = @"verify";
|
|||
|
||||
static NSTimeInterval launchStartedAt;
|
||||
|
||||
@interface AppDelegate () <UNUserNotificationCenterDelegate>
|
||||
@interface AppDelegate () <UNUserNotificationCenterDelegate, LKAppModeManagerDelegate>
|
||||
|
||||
@property (nonatomic) BOOL hasInitialRootViewController;
|
||||
@property (nonatomic) BOOL areVersionMigrationsComplete;
|
||||
|
@ -190,6 +190,8 @@ static NSTimeInterval launchStartedAt;
|
|||
|
||||
launchStartedAt = CACurrentMediaTime();
|
||||
|
||||
[LKAppModeManager configureWithDelegate:self];
|
||||
|
||||
BOOL isLoggingEnabled;
|
||||
#ifdef DEBUG
|
||||
// Specified at Product -> Scheme -> Edit Scheme -> Test -> Arguments -> Environment to avoid things like
|
||||
|
@ -252,6 +254,9 @@ static NSTimeInterval launchStartedAt;
|
|||
mainWindow.rootViewController = [LoadingViewController new];
|
||||
[mainWindow makeKeyAndVisible];
|
||||
|
||||
LKAppMode appMode = [NSUserDefaults.standardUserDefaults integerForKey:@"appMode"];
|
||||
[self setCurrentAppMode:appMode];
|
||||
|
||||
if (@available(iOS 11, *)) {
|
||||
// This must happen in appDidFinishLaunching or earlier to ensure we don't
|
||||
// miss notifications.
|
||||
|
@ -306,6 +311,9 @@ static NSTimeInterval launchStartedAt;
|
|||
|
||||
[self ensureRootViewController];
|
||||
|
||||
LKAppMode appMode = [NSUserDefaults.standardUserDefaults integerForKey:@"appMode"];
|
||||
[self setCurrentAppMode:appMode];
|
||||
|
||||
[AppReadiness runNowOrWhenAppDidBecomeReady:^{
|
||||
[self handleActivation];
|
||||
}];
|
||||
|
@ -925,6 +933,41 @@ static NSTimeInterval launchStartedAt;
|
|||
|
||||
- (void)stopOpenGroupPollers { [LKPublicChatManager.shared stopPollers]; }
|
||||
|
||||
# pragma mark - App Mode
|
||||
|
||||
- (LKAppMode)getCurrentAppMode
|
||||
{
|
||||
UIWindow *window = UIApplication.sharedApplication.keyWindow;
|
||||
if (window == nil) { return LKAppModeLight; }
|
||||
UIUserInterfaceStyle userInterfaceStyle = window.traitCollection.userInterfaceStyle;
|
||||
BOOL isLightMode = userInterfaceStyle == UIUserInterfaceStyleLight || userInterfaceStyle == UIUserInterfaceStyleUnspecified;
|
||||
return isLightMode ? LKAppModeLight : LKAppModeDark;
|
||||
}
|
||||
|
||||
- (void)setCurrentAppMode:(LKAppMode)appMode
|
||||
{
|
||||
UIWindow *window = UIApplication.sharedApplication.keyWindow;
|
||||
if (window == nil) { return; }
|
||||
[NSUserDefaults.standardUserDefaults setInteger:appMode forKey:@"appMode"];
|
||||
switch (appMode) {
|
||||
case LKAppModeLight: {
|
||||
if (@available(iOS 13.0, *)) {
|
||||
window.overrideUserInterfaceStyle = UIUserInterfaceStyleLight;
|
||||
}
|
||||
window.backgroundColor = UIColor.whiteColor;
|
||||
break;
|
||||
}
|
||||
case LKAppModeDark: {
|
||||
if (@available(iOS 13.0, *)) {
|
||||
window.overrideUserInterfaceStyle = UIUserInterfaceStyleDark;
|
||||
}
|
||||
window.backgroundColor = UIColor.blackColor;
|
||||
break;
|
||||
}
|
||||
}
|
||||
[NSNotificationCenter.defaultCenter postNotificationName:NSNotification.appModeChanged object:nil];
|
||||
}
|
||||
|
||||
# pragma mark - Other
|
||||
|
||||
- (void)handleDataNukeRequested:(NSNotification *)notification
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
final class Button : UIButton {
|
||||
private let style: Style
|
||||
private let size: Size
|
||||
private var heightConstraint: NSLayoutConstraint!
|
||||
|
||||
enum Style {
|
||||
case unimportant, regular, prominentOutline, prominentFilled, regularBorderless
|
||||
|
@ -16,6 +17,7 @@ final class Button : UIButton {
|
|||
self.size = size
|
||||
super.init(frame: .zero)
|
||||
setUpStyle()
|
||||
NotificationCenter.default.addObserver(self, selector: #selector(handleAppModeChangedNotification(_:)), name: .appModeChanged, object: nil)
|
||||
}
|
||||
|
||||
override init(frame: CGRect) {
|
||||
|
@ -25,30 +27,34 @@ final class Button : UIButton {
|
|||
required init?(coder: NSCoder) {
|
||||
preconditionFailure("Use init(style:) instead.")
|
||||
}
|
||||
|
||||
|
||||
deinit {
|
||||
NotificationCenter.default.removeObserver(self)
|
||||
}
|
||||
|
||||
private func setUpStyle() {
|
||||
let fillColor: UIColor
|
||||
switch style {
|
||||
case .unimportant: fillColor = Colors.unimportantButtonBackground
|
||||
case .unimportant: fillColor = isLightMode ? UIColor.clear : Colors.unimportantButtonBackground
|
||||
case .regular: fillColor = UIColor.clear
|
||||
case .prominentOutline: fillColor = UIColor.clear
|
||||
case .prominentFilled: fillColor = Colors.accent
|
||||
case .prominentFilled: fillColor = isLightMode ? Colors.text : Colors.accent
|
||||
case .regularBorderless: fillColor = UIColor.clear
|
||||
}
|
||||
let borderColor: UIColor
|
||||
switch style {
|
||||
case .unimportant: borderColor = isLightMode ? Colors.text : Colors.unimportantButtonBackground
|
||||
case .regular: borderColor = Colors.text
|
||||
case .prominentOutline: borderColor = Colors.accent
|
||||
case .prominentFilled: borderColor = Colors.accent
|
||||
case .prominentOutline: borderColor = isLightMode ? Colors.text : Colors.accent
|
||||
case .prominentFilled: borderColor = isLightMode ? Colors.text : Colors.accent
|
||||
case .regularBorderless: borderColor = UIColor.clear
|
||||
}
|
||||
let textColor: UIColor
|
||||
switch style {
|
||||
case .unimportant: textColor = Colors.text
|
||||
case .regular: textColor = Colors.text
|
||||
case .prominentOutline: textColor = Colors.accent
|
||||
case .prominentFilled: textColor = Colors.text
|
||||
case .prominentOutline: textColor = isLightMode ? Colors.text : Colors.accent
|
||||
case .prominentFilled: textColor = isLightMode ? UIColor.white : Colors.text
|
||||
case .regularBorderless: textColor = Colors.text
|
||||
}
|
||||
let height: CGFloat
|
||||
|
@ -57,7 +63,7 @@ final class Button : UIButton {
|
|||
case .medium: height = Values.mediumButtonHeight
|
||||
case .large: height = Values.largeButtonHeight
|
||||
}
|
||||
set(.height, to: height)
|
||||
if heightConstraint == nil { heightConstraint = set(.height, to: height) }
|
||||
layer.cornerRadius = height / 2
|
||||
backgroundColor = fillColor
|
||||
layer.borderColor = borderColor.cgColor
|
||||
|
@ -66,4 +72,8 @@ final class Button : UIButton {
|
|||
titleLabel!.font = .boldSystemFont(ofSize: fontSize)
|
||||
setTitleColor(textColor, for: UIControl.State.normal)
|
||||
}
|
||||
|
||||
@objc private func handleAppModeChangedNotification(_ notification: Notification) {
|
||||
setUpStyle()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -217,6 +217,7 @@ private final class NewConversationButton : UIImageView {
|
|||
self.icon = icon
|
||||
super.init(frame: CGRect.zero)
|
||||
setUpViewHierarchy()
|
||||
NotificationCenter.default.addObserver(self, selector: #selector(handleAppModeChangedNotification(_:)), name: .appModeChanged, object: nil)
|
||||
}
|
||||
|
||||
override init(frame: CGRect) {
|
||||
|
@ -226,20 +227,31 @@ private final class NewConversationButton : UIImageView {
|
|||
required init?(coder: NSCoder) {
|
||||
preconditionFailure("Use init(isMainButton:) instead.")
|
||||
}
|
||||
|
||||
deinit {
|
||||
NotificationCenter.default.removeObserver(self)
|
||||
}
|
||||
|
||||
private func setUpViewHierarchy() {
|
||||
backgroundColor = isMainButton ? Colors.accent : Colors.newConversationButtonCollapsedBackground
|
||||
private func setUpViewHierarchy(isUpdate: Bool = false) {
|
||||
let newConversationButtonCollapsedBackground = isLightMode ? UIColor(hex: 0xF5F5F5) : UIColor(hex: 0x1F1F1F)
|
||||
backgroundColor = isMainButton ? Colors.accent : newConversationButtonCollapsedBackground
|
||||
let size = Values.newConversationButtonCollapsedSize
|
||||
layer.cornerRadius = size / 2
|
||||
let glowColor = isMainButton ? Colors.newConversationButtonShadow : (isLightMode ? UIColor.black.withAlphaComponent(0.4) : UIColor.black)
|
||||
let glowConfiguration = UIView.CircularGlowConfiguration(size: size, color: glowColor, isAnimated: false, radius: isLightMode ? 4 : 6)
|
||||
setCircularGlow(with: glowConfiguration)
|
||||
layer.masksToBounds = false
|
||||
let iconColor = (isMainButton && isLightMode) ? UIColor.white : Colors.text
|
||||
let iconColor = (isMainButton && isLightMode) ? UIColor.white : (isLightMode ? UIColor.black : UIColor.white)
|
||||
image = icon.asTintedImage(color: iconColor)!
|
||||
contentMode = .center
|
||||
widthConstraint = set(.width, to: size)
|
||||
heightConstraint = set(.height, to: size)
|
||||
if !isUpdate {
|
||||
widthConstraint = set(.width, to: size)
|
||||
heightConstraint = set(.height, to: size)
|
||||
}
|
||||
}
|
||||
|
||||
@objc private func handleAppModeChangedNotification(_ notification: Notification) {
|
||||
setUpViewHierarchy(isUpdate: true)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
|
||||
class BaseVC : UIViewController {
|
||||
private var hasGradient = false
|
||||
|
||||
override var preferredStatusBarStyle: UIStatusBarStyle { return isLightMode ? .default : .lightContent }
|
||||
|
||||
|
@ -23,10 +24,12 @@ class BaseVC : UIViewController {
|
|||
|
||||
override func viewDidLoad() {
|
||||
setNeedsStatusBarAppearanceUpdate()
|
||||
NotificationCenter.default.addObserver(self, selector: #selector(handleUnexpectedDeviceLinkRequestReceivedNotification), name: .unexpectedDeviceLinkRequestReceived, object: nil)
|
||||
NotificationCenter.default.addObserver(self, selector: #selector(handleUnexpectedDeviceLinkRequestReceivedNotification(_:)), name: .unexpectedDeviceLinkRequestReceived, object: nil)
|
||||
NotificationCenter.default.addObserver(self, selector: #selector(handleAppModeChangedNotification(_:)), name: .appModeChanged, object: nil)
|
||||
}
|
||||
|
||||
internal func setUpGradientBackground() {
|
||||
hasGradient = true
|
||||
view.backgroundColor = .clear
|
||||
let gradient = Gradients.defaultLokiBackground
|
||||
view.setGradient(gradient)
|
||||
|
@ -68,7 +71,7 @@ class BaseVC : UIViewController {
|
|||
NotificationCenter.default.removeObserver(self)
|
||||
}
|
||||
|
||||
@objc private func handleUnexpectedDeviceLinkRequestReceivedNotification() {
|
||||
@objc private func handleUnexpectedDeviceLinkRequestReceivedNotification(_ notification: Notification) {
|
||||
guard DeviceLinkingUtilities.shouldShowUnexpectedDeviceLinkRequestReceivedAlert else { return }
|
||||
DispatchQueue.main.async {
|
||||
let alert = UIAlertController(title: "Device Link Request Received", message: "Open the device link screen by going to \"Settings\" > \"Devices\" > \"Link a Device\" to link your devices.", preferredStyle: .alert)
|
||||
|
@ -76,4 +79,14 @@ class BaseVC : UIViewController {
|
|||
self.present(alert, animated: true, completion: nil)
|
||||
}
|
||||
}
|
||||
|
||||
override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) {
|
||||
// TODO: Post an appModeChanged notification?
|
||||
}
|
||||
|
||||
@objc internal func handleAppModeChangedNotification(_ notification: Notification) {
|
||||
if hasGradient {
|
||||
setUpGradientBackground() // Re-do the gradient
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -183,16 +183,13 @@ final class HomeVC : BaseVC, UITableViewDataSource, UITableViewDelegate, UIScrol
|
|||
override func viewDidAppear(_ animated: Bool) {
|
||||
super.viewDidAppear(animated)
|
||||
isViewVisible = true
|
||||
let hasSeenMultiDeviceRemovalSheet = UserDefaults.standard[.hasSeenMultiDeviceRemovalSheet]
|
||||
if !hasSeenMultiDeviceRemovalSheet {
|
||||
let _ = FileServerAPI.getDeviceLinks(associatedWith: getUserHexEncodedPublicKey()).done(on: DispatchQueue.main) { [weak self] deviceLinks in
|
||||
guard !deviceLinks.isEmpty else { return }
|
||||
let multiDeviceRemovalSheet = MultiDeviceRemovalSheet()
|
||||
multiDeviceRemovalSheet.modalPresentationStyle = .overFullScreen
|
||||
multiDeviceRemovalSheet.modalTransitionStyle = .crossDissolve
|
||||
self?.present(multiDeviceRemovalSheet, animated: true, completion: nil)
|
||||
}
|
||||
UserDefaults.standard[.hasSeenMultiDeviceRemovalSheet] = true
|
||||
let hasSeenLightModeSheet = UserDefaults.standard[.hasSeenLightModeSheet]
|
||||
if !hasSeenLightModeSheet {
|
||||
let lightModeSheet = LightModeSheet()
|
||||
lightModeSheet.modalPresentationStyle = .overFullScreen
|
||||
lightModeSheet.modalTransitionStyle = .crossDissolve
|
||||
present(lightModeSheet, animated: true, completion: nil)
|
||||
UserDefaults.standard[.hasSeenLightModeSheet] = true
|
||||
}
|
||||
UserDefaults.standard[.hasLaunchedOnce] = true
|
||||
}
|
||||
|
@ -348,6 +345,13 @@ final class HomeVC : BaseVC, UITableViewDataSource, UITableViewDelegate, UIScrol
|
|||
pathStatusViewContainer.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(showPath)))
|
||||
navigationItem.rightBarButtonItem = UIBarButtonItem(customView: pathStatusViewContainer)
|
||||
}
|
||||
|
||||
@objc override internal func handleAppModeChangedNotification(_ notification: Notification) {
|
||||
super.handleAppModeChangedNotification(notification)
|
||||
let gradient = Gradients.homeVCFade
|
||||
fadeView.setGradient(gradient) // Re-do the gradient
|
||||
tableView.reloadData()
|
||||
}
|
||||
|
||||
// MARK: Interaction
|
||||
func handleContinueButtonTapped(from seedReminderView: SeedReminderView) {
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
|
||||
final class LightModeSheet : Sheet {
|
||||
|
||||
override func populateContentView() {
|
||||
// Set up image view
|
||||
let imageView = UIImageView(image: #imageLiteral(resourceName: "Sun"))
|
||||
// Set up title label
|
||||
let titleLabel = UILabel()
|
||||
titleLabel.textColor = Colors.text
|
||||
titleLabel.font = .boldSystemFont(ofSize: isIPhone5OrSmaller ? Values.largeFontSize : Values.veryLargeFontSize)
|
||||
titleLabel.text = "Light Mode"
|
||||
titleLabel.numberOfLines = 0
|
||||
titleLabel.lineBreakMode = .byWordWrapping
|
||||
// Set up top stack view
|
||||
let topStackView = UIStackView(arrangedSubviews: [ imageView, titleLabel ])
|
||||
topStackView.axis = .vertical
|
||||
topStackView.spacing = Values.largeSpacing
|
||||
topStackView.alignment = .center
|
||||
// Set up explanation label
|
||||
let explanationLabel = UILabel()
|
||||
explanationLabel.textColor = Colors.text
|
||||
explanationLabel.font = .systemFont(ofSize: Values.smallFontSize)
|
||||
explanationLabel.text = """
|
||||
Who left the lights on? bla bla bla
|
||||
|
||||
Feeling the dark side more? Just pop into the in-app settings and tap the app mode button in the top-right to toggle dark mode again.
|
||||
"""
|
||||
explanationLabel.numberOfLines = 0
|
||||
explanationLabel.lineBreakMode = .byWordWrapping
|
||||
// Set up OK button
|
||||
let okButton = Button(style: .prominentOutline, size: .large)
|
||||
okButton.set(.width, to: 240)
|
||||
okButton.setTitle(NSLocalizedString("OK", comment: ""), for: UIControl.State.normal)
|
||||
okButton.addTarget(self, action: #selector(close), for: UIControl.Event.touchUpInside)
|
||||
// Set up main stack view
|
||||
let stackView = UIStackView(arrangedSubviews: [ topStackView, explanationLabel, okButton ])
|
||||
stackView.axis = .vertical
|
||||
stackView.spacing = Values.veryLargeSpacing
|
||||
stackView.alignment = .center
|
||||
// Set up constraints
|
||||
contentView.addSubview(stackView)
|
||||
stackView.pin(.leading, to: .leading, of: contentView, withInset: Values.veryLargeSpacing)
|
||||
stackView.pin(.top, to: .top, of: contentView, withInset: Values.largeSpacing)
|
||||
contentView.pin(.trailing, to: .trailing, of: stackView, withInset: Values.veryLargeSpacing)
|
||||
contentView.pin(.bottom, to: .bottom, of: stackView, withInset: Values.veryLargeSpacing + overshoot)
|
||||
}
|
||||
}
|
|
@ -90,6 +90,7 @@ final class PNModeVC : BaseVC, OptionViewDelegate {
|
|||
}
|
||||
UserDefaults.standard[.isUsingFullAPNs] = (selectedOptionView == apnsOptionView)
|
||||
UserDefaults.standard[.hasSeenMultiDeviceRemovalSheet] = true
|
||||
UserDefaults.standard[.hasSeenLightModeSheet] = true
|
||||
TSAccountManager.sharedInstance().didRegister()
|
||||
let homeVC = HomeVC()
|
||||
navigationController!.setViewControllers([ homeVC ], animated: true)
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import NVActivityIndicatorView
|
||||
import SwiftCSV
|
||||
|
||||
final class PathVC : BaseVC {
|
||||
|
||||
|
|
|
@ -49,6 +49,13 @@ final class SettingsVC : BaseVC, AvatarViewHelperDelegate {
|
|||
result.addTarget(self, action: #selector(copyPublicKey), for: UIControl.Event.touchUpInside)
|
||||
return result
|
||||
}()
|
||||
|
||||
private lazy var settingButtonsStackView: UIStackView = {
|
||||
let result = UIStackView()
|
||||
result.axis = .vertical
|
||||
result.alignment = .fill
|
||||
return result
|
||||
}()
|
||||
|
||||
// MARK: Lifecycle
|
||||
override func viewDidLoad() {
|
||||
|
@ -110,9 +117,9 @@ final class SettingsVC : BaseVC, AvatarViewHelperDelegate {
|
|||
topStackView.layoutMargins = UIEdgeInsets(top: 0, left: Values.largeSpacing, bottom: 0, right: Values.largeSpacing)
|
||||
topStackView.isLayoutMarginsRelativeArrangement = true
|
||||
// Set up setting buttons stack view
|
||||
let settingButtonsStackView = UIStackView(arrangedSubviews: getSettingButtons() )
|
||||
settingButtonsStackView.axis = .vertical
|
||||
settingButtonsStackView.alignment = .fill
|
||||
getSettingButtons().forEach { settingButtonOrSeparator in
|
||||
settingButtonsStackView.addArrangedSubview(settingButtonOrSeparator)
|
||||
}
|
||||
// Set up stack view
|
||||
let stackView = UIStackView(arrangedSubviews: [ topStackView, settingButtonsStackView ])
|
||||
stackView.axis = .vertical
|
||||
|
@ -128,12 +135,6 @@ final class SettingsVC : BaseVC, AvatarViewHelperDelegate {
|
|||
stackView.pin(to: scrollView)
|
||||
view.addSubview(scrollView)
|
||||
scrollView.pin(to: view)
|
||||
// Register for notifications
|
||||
NotificationCenter.default.addObserver(self, selector: #selector(handleAppModeSwitchedNotification(_:)), name: .appModeSwitched, object: nil)
|
||||
}
|
||||
|
||||
deinit {
|
||||
NotificationCenter.default.removeObserver(self)
|
||||
}
|
||||
|
||||
private func getSettingButtons() -> [UIView] {
|
||||
|
@ -159,8 +160,10 @@ final class SettingsVC : BaseVC, AvatarViewHelperDelegate {
|
|||
UIGraphicsEndImageContext()
|
||||
return image!
|
||||
}
|
||||
button.setBackgroundImage(getImage(withColor: Colors.buttonBackground), for: UIControl.State.normal)
|
||||
button.setBackgroundImage(getImage(withColor: Colors.settingButtonSelected), for: UIControl.State.highlighted)
|
||||
let backgroundColor = isLightMode ? UIColor(hex: 0xFCFCFC) : UIColor(hex: 0x1B1B1B)
|
||||
button.setBackgroundImage(getImage(withColor: backgroundColor), for: UIControl.State.normal)
|
||||
let selectedColor = isLightMode ? UIColor(hex: 0xDFDFDF) : UIColor(hex: 0x0C0C0C)
|
||||
button.setBackgroundImage(getImage(withColor: selectedColor), for: UIControl.State.highlighted)
|
||||
button.addTarget(self, action: selector, for: UIControl.Event.touchUpInside)
|
||||
button.set(.height, to: Values.settingButtonHeight)
|
||||
return button
|
||||
|
@ -209,11 +212,6 @@ final class SettingsVC : BaseVC, AvatarViewHelperDelegate {
|
|||
}
|
||||
|
||||
// MARK: Updating
|
||||
@objc private func handleAppModeSwitchedNotification(_ notification: Notification) {
|
||||
updateNavigationBarButtons()
|
||||
// TODO: Redraw UI
|
||||
}
|
||||
|
||||
private func handleIsEditingDisplayNameChanged() {
|
||||
updateNavigationBarButtons()
|
||||
UIView.animate(withDuration: 0.25) {
|
||||
|
@ -239,12 +237,27 @@ final class SettingsVC : BaseVC, AvatarViewHelperDelegate {
|
|||
let closeButton = UIBarButtonItem(image: #imageLiteral(resourceName: "X"), style: .plain, target: self, action: #selector(close))
|
||||
closeButton.tintColor = Colors.text
|
||||
navigationItem.leftBarButtonItem = closeButton
|
||||
let appModeIcon = UserDefaults.standard[.isUsingDarkMode] ? #imageLiteral(resourceName: "ic_dark_theme_on") : #imageLiteral(resourceName: "ic_dark_theme_off")
|
||||
let appModeButton = UIBarButtonItem(image: appModeIcon, style: .plain, target: self, action: #selector(switchAppMode))
|
||||
appModeButton.tintColor = Colors.text
|
||||
let qrCodeButton = UIBarButtonItem(image: #imageLiteral(resourceName: "QRCode"), style: .plain, target: self, action: #selector(showQRCode))
|
||||
qrCodeButton.tintColor = Colors.text
|
||||
navigationItem.rightBarButtonItems = [ qrCodeButton/*, appModeButton*/ ]
|
||||
if #available(iOS 13, *) { // Pre iOS 13 the user can't switch actively but the app still responds to system changes
|
||||
let appModeIcon = isDarkMode ? #imageLiteral(resourceName: "ic_dark_theme_on").withTintColor(.white) : #imageLiteral(resourceName: "ic_dark_theme_off").withTintColor(.black)
|
||||
let appModeButton = UIButton()
|
||||
appModeButton.setImage(appModeIcon, for: UIControl.State.normal)
|
||||
appModeButton.tintColor = Colors.text
|
||||
appModeButton.addTarget(self, action: #selector(switchAppMode), for: UIControl.Event.touchUpInside)
|
||||
let qrCodeIcon = isDarkMode ? #imageLiteral(resourceName: "QRCode").withTintColor(.white) : #imageLiteral(resourceName: "QRCode").withTintColor(.black)
|
||||
let qrCodeButton = UIButton()
|
||||
qrCodeButton.setImage(qrCodeIcon, for: UIControl.State.normal)
|
||||
qrCodeButton.tintColor = Colors.text
|
||||
qrCodeButton.addTarget(self, action: #selector(showQRCode), for: UIControl.Event.touchUpInside)
|
||||
let stackView = UIStackView(arrangedSubviews: [ appModeButton, qrCodeButton ])
|
||||
stackView.axis = .horizontal
|
||||
stackView.spacing = Values.mediumSpacing
|
||||
navigationItem.rightBarButtonItem = UIBarButtonItem(customView: stackView)
|
||||
} else {
|
||||
let qrCodeIcon = isDarkMode ? #imageLiteral(resourceName: "QRCode").asTintedImage(color: .white) : #imageLiteral(resourceName: "QRCode").asTintedImage(color: .black)
|
||||
let qrCodeButton = UIBarButtonItem(image: qrCodeIcon, style: .plain, target: self, action: #selector(showQRCode))
|
||||
qrCodeButton.tintColor = Colors.text
|
||||
navigationItem.rightBarButtonItem = qrCodeButton
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -290,6 +303,18 @@ final class SettingsVC : BaseVC, AvatarViewHelperDelegate {
|
|||
}, requiresSync: true)
|
||||
}
|
||||
}
|
||||
|
||||
@objc override internal func handleAppModeChangedNotification(_ notification: Notification) {
|
||||
super.handleAppModeChangedNotification(notification)
|
||||
updateNavigationBarButtons()
|
||||
settingButtonsStackView.arrangedSubviews.forEach { settingButton in
|
||||
settingButtonsStackView.removeArrangedSubview(settingButton)
|
||||
settingButton.removeFromSuperview()
|
||||
}
|
||||
getSettingButtons().forEach { settingButtonOrSeparator in
|
||||
settingButtonsStackView.addArrangedSubview(settingButtonOrSeparator) // Re-do the setting buttons
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: Interaction
|
||||
@objc private func close() {
|
||||
|
@ -297,9 +322,8 @@ final class SettingsVC : BaseVC, AvatarViewHelperDelegate {
|
|||
}
|
||||
|
||||
@objc private func switchAppMode() {
|
||||
let isUsingDarkMode = UserDefaults.standard[.isUsingDarkMode]
|
||||
UserDefaults.standard[.isUsingDarkMode] = !isUsingDarkMode
|
||||
NotificationCenter.default.post(name: .appModeSwitched, object: nil)
|
||||
let newAppMode: AppMode = isLightMode ? .dark : .light
|
||||
AppModeManager.shared.setCurrentAppMode(to: newAppMode)
|
||||
}
|
||||
|
||||
@objc private func showQRCode() {
|
||||
|
|
|
@ -11,18 +11,19 @@ class Sheet : BaseVC {
|
|||
result.backgroundColor = Colors.modalBackground
|
||||
result.layer.cornerRadius = 24
|
||||
result.layer.masksToBounds = false
|
||||
result.layer.borderColor = Colors.modalBorder.cgColor
|
||||
result.layer.borderColor = isLightMode ? UIColor.white.cgColor : Colors.modalBorder.cgColor
|
||||
result.layer.borderWidth = Values.borderThickness
|
||||
result.layer.shadowColor = UIColor.black.cgColor
|
||||
result.layer.shadowRadius = 8
|
||||
result.layer.shadowOpacity = 0.64
|
||||
result.layer.shadowRadius = isLightMode ? 2 : 8
|
||||
result.layer.shadowOpacity = isLightMode ? 0.1 : 0.64
|
||||
return result
|
||||
}()
|
||||
|
||||
// MARK: Lifecycle
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
view.backgroundColor = UIColor(hex: 0x000000).withAlphaComponent(Values.modalBackgroundOpacity)
|
||||
let alpha = isLightMode ? CGFloat(0.1) : Values.modalBackgroundOpacity
|
||||
view.backgroundColor = UIColor(hex: 0x000000).withAlphaComponent(alpha)
|
||||
let swipeGestureRecognizer = UISwipeGestureRecognizer(target: self, action: #selector(close))
|
||||
swipeGestureRecognizer.direction = .down
|
||||
view.addGestureRecognizer(swipeGestureRecognizer)
|
||||
|
|
|
@ -28,7 +28,7 @@ public class ConversationMediaView: UIView {
|
|||
private let maxMessageWidth: CGFloat
|
||||
private var loadBlock: (() -> Void)?
|
||||
private var unloadBlock: (() -> Void)?
|
||||
private let isProxied: Bool
|
||||
private let isOnionRouted: Bool
|
||||
|
||||
// MARK: - LoadState
|
||||
|
||||
|
@ -92,12 +92,12 @@ public class ConversationMediaView: UIView {
|
|||
attachment: TSAttachment,
|
||||
isOutgoing: Bool,
|
||||
maxMessageWidth: CGFloat,
|
||||
isProxied: Bool) {
|
||||
isOnionRouted: Bool) {
|
||||
self.mediaCache = mediaCache
|
||||
self.attachment = attachment
|
||||
self.isOutgoing = isOutgoing
|
||||
self.maxMessageWidth = maxMessageWidth
|
||||
self.isProxied = isProxied
|
||||
self.isOnionRouted = isOnionRouted
|
||||
|
||||
super.init(frame: .zero)
|
||||
|
||||
|
@ -185,7 +185,7 @@ public class ConversationMediaView: UIView {
|
|||
}
|
||||
guard !attachmentStream.isUploaded else { return false }
|
||||
let view: UIView
|
||||
if isProxied { // Loki: Due to the way proxying works we can't get upload progress for those attachments
|
||||
if isOnionRouted { // Loki: Due to the way onion routing works we can't get upload progress for those attachments
|
||||
let activityIndicatorView = UIActivityIndicatorView(style: .white)
|
||||
activityIndicatorView.isHidden = false
|
||||
activityIndicatorView.startAnimating()
|
||||
|
|
|
@ -27,14 +27,14 @@ public class MediaAlbumCellView: UIStackView {
|
|||
items: [ConversationMediaAlbumItem],
|
||||
isOutgoing: Bool,
|
||||
maxMessageWidth: CGFloat,
|
||||
isProxied: Bool) {
|
||||
isOnionRouted: Bool) {
|
||||
self.items = items
|
||||
self.itemViews = MediaAlbumCellView.itemsToDisplay(forItems: items).map {
|
||||
let result = ConversationMediaView(mediaCache: mediaCache,
|
||||
attachment: $0.attachment,
|
||||
isOutgoing: isOutgoing,
|
||||
maxMessageWidth: maxMessageWidth,
|
||||
isProxied: isProxied)
|
||||
isOnionRouted: isOnionRouted)
|
||||
return result
|
||||
}
|
||||
|
||||
|
|
|
@ -366,10 +366,9 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
|
||||
CGFloat maxGradientHeight = 40.f;
|
||||
CAGradientLayer *gradientLayer = [CAGradientLayer new];
|
||||
CGFloat whiteLevel = LKAppModeUtilities.isLightMode ? 1.f : 0.f;
|
||||
gradientLayer.colors = @[
|
||||
(id)[UIColor colorWithWhite:whiteLevel alpha:0.f].CGColor,
|
||||
(id)[UIColor colorWithWhite:whiteLevel alpha:0.4f].CGColor,
|
||||
(id)[UIColor colorWithWhite:0.0f alpha:0.f].CGColor,
|
||||
(id)[UIColor colorWithWhite:0.0f alpha:0.4f].CGColor,
|
||||
];
|
||||
OWSLayerView *gradientView =
|
||||
[[OWSLayerView alloc] initWithFrame:CGRectZero
|
||||
|
@ -806,24 +805,13 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
- (UIView *)loadViewForMediaAlbum
|
||||
{
|
||||
OWSAssertDebug(self.viewItem.mediaAlbumItems);
|
||||
|
||||
BOOL isProxied = NO;
|
||||
if ([self.viewItem.interaction isKindOfClass:TSOutgoingMessage.class]) {
|
||||
TSOutgoingMessage *message = (TSOutgoingMessage *)self.viewItem.interaction;
|
||||
if ([message.thread isKindOfClass:TSGroupThread.class]) {
|
||||
TSGroupThread *groupThread = (TSGroupThread *)message.thread;
|
||||
isProxied = (groupThread.groupModel.groupType == closedGroup);
|
||||
} else if ([message.thread isKindOfClass:TSContactThread.class]) {
|
||||
isProxied = YES;
|
||||
}
|
||||
}
|
||||
|
||||
OWSMediaAlbumCellView *albumView =
|
||||
[[OWSMediaAlbumCellView alloc] initWithMediaCache:self.cellMediaCache
|
||||
items:self.viewItem.mediaAlbumItems
|
||||
isOutgoing:self.isOutgoing
|
||||
maxMessageWidth:self.conversationStyle.maxMessageWidth
|
||||
isProxied:isProxied];
|
||||
isOnionRouted:YES];
|
||||
self.loadCellContentBlock = ^{
|
||||
[albumView loadMedia];
|
||||
};
|
||||
|
|
|
@ -96,7 +96,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
|
||||
UIColor *textColor;
|
||||
if (isOverlayingMedia) {
|
||||
textColor = LKColors.text;
|
||||
textColor = UIColor.whiteColor;
|
||||
} else {
|
||||
textColor = [conversationStyle bubbleSecondaryTextColorWithIsIncoming:isIncoming];
|
||||
}
|
||||
|
|
|
@ -263,7 +263,7 @@ class MediaGalleryNavigationController: OWSNavigationController {
|
|||
// MARK: View Lifecycle
|
||||
|
||||
override var preferredStatusBarStyle: UIStatusBarStyle {
|
||||
return .lightContent
|
||||
return isLightMode ? .default : .lightContent
|
||||
}
|
||||
|
||||
override func viewDidLoad() {
|
||||
|
@ -291,7 +291,12 @@ class MediaGalleryNavigationController: OWSNavigationController {
|
|||
return
|
||||
}
|
||||
|
||||
navigationBar.overrideTheme(type: .alwaysDark)
|
||||
view.backgroundColor = Colors.navigationBarBackground
|
||||
|
||||
navigationBar.setBackgroundImage(UIImage(), for: UIBarMetrics.default)
|
||||
navigationBar.shadowImage = UIImage()
|
||||
navigationBar.isTranslucent = false
|
||||
navigationBar.barTintColor = Colors.navigationBarBackground
|
||||
}
|
||||
|
||||
override func viewDidAppear(_ animated: Bool) {
|
||||
|
|
|
@ -144,7 +144,7 @@ class MenuActionsViewController: UIViewController, MenuActionSheetDelegate {
|
|||
|
||||
let backgroundDuration: TimeInterval = 0.1
|
||||
UIView.animate(withDuration: backgroundDuration) {
|
||||
let alpha: CGFloat = Theme.isDarkThemeEnabled ? 0.7 : 0.4
|
||||
let alpha: CGFloat = isDarkMode ? 0.7 : 0.4
|
||||
self.view.backgroundColor = UIColor.black.withAlphaComponent(alpha)
|
||||
}
|
||||
|
||||
|
@ -272,7 +272,7 @@ class MenuActionSheetView: UIView, MenuActionViewDelegate {
|
|||
|
||||
super.init(frame: frame)
|
||||
|
||||
backgroundColor = (Theme.isDarkThemeEnabled
|
||||
backgroundColor = (isDarkMode
|
||||
? UIColor.ows_gray90
|
||||
: UIColor.ows_gray05)
|
||||
addSubview(actionStackView)
|
||||
|
@ -398,27 +398,25 @@ class MenuActionView: UIButton {
|
|||
isUserInteractionEnabled = true
|
||||
backgroundColor = defaultBackgroundColor
|
||||
|
||||
let textColor = isLightMode ? UIColor.black : UIColor.white
|
||||
|
||||
var image = action.image
|
||||
if Theme.isDarkThemeEnabled {
|
||||
image = image.withRenderingMode(.alwaysTemplate)
|
||||
}
|
||||
image = image.withRenderingMode(.alwaysTemplate)
|
||||
let imageView = UIImageView(image: image)
|
||||
if Theme.isDarkThemeEnabled {
|
||||
imageView.tintColor = Colors.text.withAlphaComponent(Values.unimportantElementOpacity)
|
||||
}
|
||||
imageView.tintColor = textColor.withAlphaComponent(Values.unimportantElementOpacity)
|
||||
let imageWidth: CGFloat = 24
|
||||
imageView.autoSetDimensions(to: CGSize(width: imageWidth, height: imageWidth))
|
||||
imageView.isUserInteractionEnabled = false
|
||||
|
||||
let titleLabel = UILabel()
|
||||
titleLabel.font = .systemFont(ofSize: Values.mediumFontSize)
|
||||
titleLabel.textColor = Colors.text
|
||||
titleLabel.textColor = textColor
|
||||
titleLabel.text = action.title
|
||||
titleLabel.isUserInteractionEnabled = false
|
||||
|
||||
let subtitleLabel = UILabel()
|
||||
subtitleLabel.font = .systemFont(ofSize: Values.smallFontSize)
|
||||
subtitleLabel.textColor = Colors.text.withAlphaComponent(Values.unimportantElementOpacity)
|
||||
subtitleLabel.textColor = textColor.withAlphaComponent(Values.unimportantElementOpacity)
|
||||
subtitleLabel.text = action.subtitle
|
||||
subtitleLabel.isUserInteractionEnabled = false
|
||||
|
||||
|
@ -443,11 +441,11 @@ class MenuActionView: UIButton {
|
|||
}
|
||||
|
||||
private var defaultBackgroundColor: UIColor {
|
||||
return Colors.cellBackground
|
||||
return isLightMode ? UIColor(hex: 0xFCFCFC) : UIColor(hex: 0x1B1B1B)
|
||||
}
|
||||
|
||||
private var highlightedBackgroundColor: UIColor {
|
||||
return Colors.cellSelected
|
||||
return isLightMode ? UIColor(hex: 0xDFDFDF) : UIColor(hex: 0x0C0C0C)
|
||||
}
|
||||
|
||||
override var isHighlighted: Bool {
|
||||
|
|
|
@ -1,28 +1,59 @@
|
|||
|
||||
public enum AppMode {
|
||||
@objc(LKAppModeManager)
|
||||
public final class AppModeManager : NSObject {
|
||||
private let delegate: AppModeManagerDelegate
|
||||
|
||||
public var currentAppMode: AppMode {
|
||||
return delegate.getCurrentAppMode()
|
||||
}
|
||||
|
||||
public static var shared: AppModeManager!
|
||||
|
||||
@objc(configureWithDelegate:)
|
||||
public static func configure(delegate: AppModeManagerDelegate) {
|
||||
shared = AppModeManager(delegate: delegate)
|
||||
}
|
||||
|
||||
private init(delegate: AppModeManagerDelegate) {
|
||||
self.delegate = delegate
|
||||
super.init()
|
||||
}
|
||||
|
||||
private override init() { preconditionFailure("Use init(delegate:) instead.") }
|
||||
|
||||
public func setCurrentAppMode(to appMode: AppMode) {
|
||||
delegate.setCurrentAppMode(to: appMode)
|
||||
}
|
||||
}
|
||||
|
||||
@objc(LKAppModeManagerDelegate)
|
||||
public protocol AppModeManagerDelegate {
|
||||
|
||||
func getCurrentAppMode() -> AppMode
|
||||
@objc(setCurrentAppMode:)
|
||||
func setCurrentAppMode(to appMode: AppMode)
|
||||
}
|
||||
|
||||
@objc(LKAppMode)
|
||||
public enum AppMode : Int {
|
||||
case light, dark
|
||||
|
||||
public static var current: AppMode = .dark
|
||||
// public static var current: AppMode {
|
||||
// return UserDefaults.standard[.isUsingDarkMode] ? .dark : .light
|
||||
// }
|
||||
}
|
||||
|
||||
public var isLightMode: Bool {
|
||||
return AppMode.current == .light
|
||||
return AppModeManager.shared.currentAppMode == .light
|
||||
}
|
||||
|
||||
public var isDarkMode: Bool {
|
||||
return AppMode.current == .dark
|
||||
return AppModeManager.shared.currentAppMode == .dark
|
||||
}
|
||||
|
||||
@objc public final class LKAppModeUtilities : NSObject {
|
||||
|
||||
@objc public static var isLightMode: Bool {
|
||||
return AppMode.current == .light
|
||||
return AppModeManager.shared.currentAppMode == .light
|
||||
}
|
||||
|
||||
@objc public static var isDarkMode: Bool {
|
||||
return AppMode.current == .dark
|
||||
return AppModeManager.shared.currentAppMode == .dark
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,31 +12,31 @@
|
|||
@objc(LKColors)
|
||||
public final class Colors : NSObject {
|
||||
|
||||
@objc public static var accent = isLightMode ? UIColor(hex: 0x00E97B) : UIColor(hex: 0x00F782)
|
||||
@objc public static var text = isLightMode ? UIColor(hex: 0x000000) : UIColor(hex: 0xFFFFFF)
|
||||
@objc public static var destructive = UIColor(hex: 0xFF453A)
|
||||
@objc public static var unimportant = UIColor(hex: 0xD8D8D8)
|
||||
@objc public static var border = UIColor(hex: 0x979797)
|
||||
@objc public static var cellBackground = isLightMode ? UIColor(hex: 0xFCFCFC) : UIColor(hex: 0x1B1B1B)
|
||||
@objc public static var cellSelected = isLightMode ? UIColor(hex: 0xDFDFDF) : UIColor(hex: 0x0C0C0C)
|
||||
@objc public static var navigationBarBackground = isLightMode ? UIColor(hex: 0xFCFCFC) : UIColor(hex: 0x161616)
|
||||
@objc public static var searchBarPlaceholder = UIColor(hex: 0x8E8E93) // Also used for the icons
|
||||
@objc public static var searchBarBackground = UIColor(red: 142 / 255, green: 142 / 255, blue: 147 / 255, alpha: 0.12)
|
||||
@objc public static var newConversationButtonShadow = UIColor(hex: 0x077C44)
|
||||
@objc public static var separator = UIColor(hex: 0x36383C)
|
||||
@objc public static var unimportantButtonBackground = isLightMode ? UIColor.clear : UIColor(hex: 0x323232)
|
||||
@objc public static var buttonBackground = isLightMode ? UIColor(hex: 0xFCFCFC) : UIColor(hex: 0x1B1B1B)
|
||||
@objc public static var settingButtonSelected = isLightMode ? UIColor(hex: 0xDFDFDF) : UIColor(hex: 0x0C0C0C)
|
||||
@objc public static var modalBackground = isLightMode ? UIColor(hex: 0xFCFCFC) : UIColor(hex: 0x101011)
|
||||
@objc public static var modalBorder = UIColor(hex: 0x212121)
|
||||
@objc public static var fakeChatBubbleBackground = isLightMode ? UIColor(hex: 0xF5F5F5) : UIColor(hex: 0x3F4146)
|
||||
@objc public static var fakeChatBubbleText = UIColor(hex: 0x000000)
|
||||
@objc public static var composeViewBackground = isLightMode ? UIColor(hex: 0xFCFCFC) : UIColor(hex: 0x1B1B1B)
|
||||
@objc public static var composeViewTextFieldBackground = isLightMode ? UIColor(hex: 0xEDEDED) : UIColor(hex: 0x141414)
|
||||
@objc public static var receivedMessageBackground = isLightMode ? UIColor(hex: 0xF5F5F5) : UIColor(hex: 0x222325)
|
||||
@objc public static var sentMessageBackground = isLightMode ? UIColor(hex: 0x00E97B) : UIColor(hex: 0x3F4146)
|
||||
@objc public static var newConversationButtonCollapsedBackground = isLightMode ? UIColor(hex: 0xF5F5F5) : UIColor(hex: 0x1F1F1F)
|
||||
@objc public static var pnOptionBackground = isLightMode ? UIColor(hex: 0xFCFCFC) : UIColor(hex: 0x1B1B1B)
|
||||
@objc public static var pnOptionBorder = UIColor(hex: 0x212121)
|
||||
@objc public static var pathsBuilding = UIColor(hex: 0xFFCE3A)
|
||||
@objc public static var accent: UIColor { UIColor(named: "session_accent")! }
|
||||
@objc public static var text: UIColor { UIColor(named: "session_text")! }
|
||||
@objc public static var destructive: UIColor { UIColor(named: "session_destructive")! }
|
||||
@objc public static var unimportant: UIColor { UIColor(named: "session_unimportant")! }
|
||||
@objc public static var border: UIColor { UIColor(named: "session_border")! }
|
||||
@objc public static var cellBackground: UIColor { UIColor(named: "session_cell_background")! }
|
||||
@objc public static var cellSelected: UIColor { UIColor(named: "session_cell_selected")! }
|
||||
@objc public static var navigationBarBackground: UIColor { UIColor(named: "session_navigation_bar_background")! }
|
||||
@objc public static var searchBarPlaceholder: UIColor { UIColor(named: "session_search_bar_placeholder")! } // Also used for the icons
|
||||
@objc public static var searchBarBackground: UIColor { UIColor(named: "session_search_bar_background")! }
|
||||
@objc public static var newConversationButtonShadow: UIColor { UIColor(named: "session_new_conversation_button_shadow")! }
|
||||
@objc public static var separator: UIColor { UIColor(named: "session_separator")! }
|
||||
@objc public static var unimportantButtonBackground: UIColor { UIColor(named: "session_unimportant_button_background")! }
|
||||
@objc public static var buttonBackground: UIColor { UIColor(named: "session_button_background")! }
|
||||
@objc public static var settingButtonSelected: UIColor { UIColor(named: "session_setting_button_selected")! }
|
||||
@objc public static var modalBackground: UIColor { UIColor(named: "session_modal_background")! }
|
||||
@objc public static var modalBorder: UIColor { UIColor(named: "session_modal_border")! }
|
||||
@objc public static var fakeChatBubbleBackground: UIColor { UIColor(named: "session_fake_chat_bubble_background")! }
|
||||
@objc public static var fakeChatBubbleText: UIColor { UIColor(named: "session_fake_chat_bubble_text")! }
|
||||
@objc public static var composeViewBackground: UIColor { UIColor(named: "session_compose_view_background")! }
|
||||
@objc public static var composeViewTextFieldBackground: UIColor { UIColor(named: "session_compose_view_text_field_background")! }
|
||||
@objc public static var receivedMessageBackground: UIColor { UIColor(named: "session_received_message_background")! }
|
||||
@objc public static var sentMessageBackground: UIColor { UIColor(named: "session_sent_message_background")! }
|
||||
@objc public static var newConversationButtonCollapsedBackground: UIColor { UIColor(named: "session_new_conversation_button_collapsed_background")! }
|
||||
@objc public static var pnOptionBackground: UIColor { UIColor(named: "session_pn_option_background")! }
|
||||
@objc public static var pnOptionBorder: UIColor { UIColor(named: "session_pn_option_border")! }
|
||||
@objc public static var pathsBuilding: UIColor { UIColor(named: "session_paths_building")! }
|
||||
}
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
{
|
||||
"colors" : [
|
||||
{
|
||||
"color" : {
|
||||
"color-space" : "srgb",
|
||||
"components" : {
|
||||
"alpha" : "1.000",
|
||||
"blue" : "0x7B",
|
||||
"green" : "0xE9",
|
||||
"red" : "0x00"
|
||||
}
|
||||
},
|
||||
"idiom" : "universal"
|
||||
},
|
||||
{
|
||||
"appearances" : [
|
||||
{
|
||||
"appearance" : "luminosity",
|
||||
"value" : "dark"
|
||||
}
|
||||
],
|
||||
"color" : {
|
||||
"color-space" : "srgb",
|
||||
"components" : {
|
||||
"alpha" : "1.000",
|
||||
"blue" : "0x82",
|
||||
"green" : "0xF7",
|
||||
"red" : "0x00"
|
||||
}
|
||||
},
|
||||
"idiom" : "universal"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
{
|
||||
"colors" : [
|
||||
{
|
||||
"color" : {
|
||||
"color-space" : "srgb",
|
||||
"components" : {
|
||||
"alpha" : "1.000",
|
||||
"blue" : "0x97",
|
||||
"green" : "0x97",
|
||||
"red" : "0x97"
|
||||
}
|
||||
},
|
||||
"idiom" : "universal"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
{
|
||||
"colors" : [
|
||||
{
|
||||
"color" : {
|
||||
"color-space" : "srgb",
|
||||
"components" : {
|
||||
"alpha" : "1.000",
|
||||
"blue" : "0xFC",
|
||||
"green" : "0xFC",
|
||||
"red" : "0xFC"
|
||||
}
|
||||
},
|
||||
"idiom" : "universal"
|
||||
},
|
||||
{
|
||||
"appearances" : [
|
||||
{
|
||||
"appearance" : "luminosity",
|
||||
"value" : "dark"
|
||||
}
|
||||
],
|
||||
"color" : {
|
||||
"color-space" : "srgb",
|
||||
"components" : {
|
||||
"alpha" : "1.000",
|
||||
"blue" : "0x1B",
|
||||
"green" : "0x1B",
|
||||
"red" : "0x1B"
|
||||
}
|
||||
},
|
||||
"idiom" : "universal"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
{
|
||||
"colors" : [
|
||||
{
|
||||
"color" : {
|
||||
"color-space" : "srgb",
|
||||
"components" : {
|
||||
"alpha" : "1.000",
|
||||
"blue" : "0xFC",
|
||||
"green" : "0xFC",
|
||||
"red" : "0xFC"
|
||||
}
|
||||
},
|
||||
"idiom" : "universal"
|
||||
},
|
||||
{
|
||||
"appearances" : [
|
||||
{
|
||||
"appearance" : "luminosity",
|
||||
"value" : "dark"
|
||||
}
|
||||
],
|
||||
"color" : {
|
||||
"color-space" : "srgb",
|
||||
"components" : {
|
||||
"alpha" : "1.000",
|
||||
"blue" : "0x1B",
|
||||
"green" : "0x1B",
|
||||
"red" : "0x1B"
|
||||
}
|
||||
},
|
||||
"idiom" : "universal"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
{
|
||||
"colors" : [
|
||||
{
|
||||
"color" : {
|
||||
"color-space" : "srgb",
|
||||
"components" : {
|
||||
"alpha" : "1.000",
|
||||
"blue" : "0xDF",
|
||||
"green" : "0xDF",
|
||||
"red" : "0xDF"
|
||||
}
|
||||
},
|
||||
"idiom" : "universal"
|
||||
},
|
||||
{
|
||||
"appearances" : [
|
||||
{
|
||||
"appearance" : "luminosity",
|
||||
"value" : "dark"
|
||||
}
|
||||
],
|
||||
"color" : {
|
||||
"color-space" : "srgb",
|
||||
"components" : {
|
||||
"alpha" : "1.000",
|
||||
"blue" : "0x0C",
|
||||
"green" : "0x0C",
|
||||
"red" : "0x0C"
|
||||
}
|
||||
},
|
||||
"idiom" : "universal"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
{
|
||||
"colors" : [
|
||||
{
|
||||
"color" : {
|
||||
"color-space" : "srgb",
|
||||
"components" : {
|
||||
"alpha" : "1.000",
|
||||
"blue" : "0xFC",
|
||||
"green" : "0xFC",
|
||||
"red" : "0xFC"
|
||||
}
|
||||
},
|
||||
"idiom" : "universal"
|
||||
},
|
||||
{
|
||||
"appearances" : [
|
||||
{
|
||||
"appearance" : "luminosity",
|
||||
"value" : "dark"
|
||||
}
|
||||
],
|
||||
"color" : {
|
||||
"color-space" : "srgb",
|
||||
"components" : {
|
||||
"alpha" : "1.000",
|
||||
"blue" : "0x1B",
|
||||
"green" : "0x1B",
|
||||
"red" : "0x1B"
|
||||
}
|
||||
},
|
||||
"idiom" : "universal"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
{
|
||||
"colors" : [
|
||||
{
|
||||
"color" : {
|
||||
"color-space" : "srgb",
|
||||
"components" : {
|
||||
"alpha" : "1.000",
|
||||
"blue" : "0xED",
|
||||
"green" : "0xED",
|
||||
"red" : "0xED"
|
||||
}
|
||||
},
|
||||
"idiom" : "universal"
|
||||
},
|
||||
{
|
||||
"appearances" : [
|
||||
{
|
||||
"appearance" : "luminosity",
|
||||
"value" : "dark"
|
||||
}
|
||||
],
|
||||
"color" : {
|
||||
"color-space" : "srgb",
|
||||
"components" : {
|
||||
"alpha" : "1.000",
|
||||
"blue" : "0x14",
|
||||
"green" : "0x14",
|
||||
"red" : "0x14"
|
||||
}
|
||||
},
|
||||
"idiom" : "universal"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
{
|
||||
"colors" : [
|
||||
{
|
||||
"color" : {
|
||||
"color-space" : "srgb",
|
||||
"components" : {
|
||||
"alpha" : "1.000",
|
||||
"blue" : "0x3A",
|
||||
"green" : "0x45",
|
||||
"red" : "0xFF"
|
||||
}
|
||||
},
|
||||
"idiom" : "universal"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
{
|
||||
"colors" : [
|
||||
{
|
||||
"color" : {
|
||||
"color-space" : "srgb",
|
||||
"components" : {
|
||||
"alpha" : "1.000",
|
||||
"blue" : "0xF5",
|
||||
"green" : "0xF5",
|
||||
"red" : "0xF5"
|
||||
}
|
||||
},
|
||||
"idiom" : "universal"
|
||||
},
|
||||
{
|
||||
"appearances" : [
|
||||
{
|
||||
"appearance" : "luminosity",
|
||||
"value" : "dark"
|
||||
}
|
||||
],
|
||||
"color" : {
|
||||
"color-space" : "srgb",
|
||||
"components" : {
|
||||
"alpha" : "1.000",
|
||||
"blue" : "0x46",
|
||||
"green" : "0x41",
|
||||
"red" : "0x3F"
|
||||
}
|
||||
},
|
||||
"idiom" : "universal"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
{
|
||||
"colors" : [
|
||||
{
|
||||
"color" : {
|
||||
"color-space" : "srgb",
|
||||
"components" : {
|
||||
"alpha" : "1.000",
|
||||
"blue" : "0x00",
|
||||
"green" : "0x00",
|
||||
"red" : "0x00"
|
||||
}
|
||||
},
|
||||
"idiom" : "universal"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
{
|
||||
"colors" : [
|
||||
{
|
||||
"color" : {
|
||||
"color-space" : "srgb",
|
||||
"components" : {
|
||||
"alpha" : "1.000",
|
||||
"blue" : "0xFC",
|
||||
"green" : "0xFC",
|
||||
"red" : "0xFC"
|
||||
}
|
||||
},
|
||||
"idiom" : "universal"
|
||||
},
|
||||
{
|
||||
"appearances" : [
|
||||
{
|
||||
"appearance" : "luminosity",
|
||||
"value" : "dark"
|
||||
}
|
||||
],
|
||||
"color" : {
|
||||
"color-space" : "srgb",
|
||||
"components" : {
|
||||
"alpha" : "1.000",
|
||||
"blue" : "0x11",
|
||||
"green" : "0x10",
|
||||
"red" : "0x10"
|
||||
}
|
||||
},
|
||||
"idiom" : "universal"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
{
|
||||
"colors" : [
|
||||
{
|
||||
"color" : {
|
||||
"color-space" : "srgb",
|
||||
"components" : {
|
||||
"alpha" : "1.000",
|
||||
"blue" : "0x21",
|
||||
"green" : "0x21",
|
||||
"red" : "0x21"
|
||||
}
|
||||
},
|
||||
"idiom" : "universal"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
{
|
||||
"colors" : [
|
||||
{
|
||||
"color" : {
|
||||
"color-space" : "srgb",
|
||||
"components" : {
|
||||
"alpha" : "1.000",
|
||||
"blue" : "0xFC",
|
||||
"green" : "0xFC",
|
||||
"red" : "0xFC"
|
||||
}
|
||||
},
|
||||
"idiom" : "universal"
|
||||
},
|
||||
{
|
||||
"appearances" : [
|
||||
{
|
||||
"appearance" : "luminosity",
|
||||
"value" : "dark"
|
||||
}
|
||||
],
|
||||
"color" : {
|
||||
"color-space" : "srgb",
|
||||
"components" : {
|
||||
"alpha" : "1.000",
|
||||
"blue" : "0x16",
|
||||
"green" : "0x16",
|
||||
"red" : "0x16"
|
||||
}
|
||||
},
|
||||
"idiom" : "universal"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
{
|
||||
"colors" : [
|
||||
{
|
||||
"color" : {
|
||||
"color-space" : "srgb",
|
||||
"components" : {
|
||||
"alpha" : "1.000",
|
||||
"blue" : "0xF5",
|
||||
"green" : "0xF5",
|
||||
"red" : "0xF5"
|
||||
}
|
||||
},
|
||||
"idiom" : "universal"
|
||||
},
|
||||
{
|
||||
"appearances" : [
|
||||
{
|
||||
"appearance" : "luminosity",
|
||||
"value" : "dark"
|
||||
}
|
||||
],
|
||||
"color" : {
|
||||
"color-space" : "srgb",
|
||||
"components" : {
|
||||
"alpha" : "1.000",
|
||||
"blue" : "0x1F",
|
||||
"green" : "0x1F",
|
||||
"red" : "0x1F"
|
||||
}
|
||||
},
|
||||
"idiom" : "universal"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
{
|
||||
"colors" : [
|
||||
{
|
||||
"color" : {
|
||||
"color-space" : "srgb",
|
||||
"components" : {
|
||||
"alpha" : "1.000",
|
||||
"blue" : "0x44",
|
||||
"green" : "0x7C",
|
||||
"red" : "0x07"
|
||||
}
|
||||
},
|
||||
"idiom" : "universal"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
{
|
||||
"colors" : [
|
||||
{
|
||||
"color" : {
|
||||
"color-space" : "srgb",
|
||||
"components" : {
|
||||
"alpha" : "1.000",
|
||||
"blue" : "0x3A",
|
||||
"green" : "0xCE",
|
||||
"red" : "0xFF"
|
||||
}
|
||||
},
|
||||
"idiom" : "universal"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
{
|
||||
"colors" : [
|
||||
{
|
||||
"color" : {
|
||||
"color-space" : "srgb",
|
||||
"components" : {
|
||||
"alpha" : "1.000",
|
||||
"blue" : "0xFC",
|
||||
"green" : "0xFC",
|
||||
"red" : "0xFC"
|
||||
}
|
||||
},
|
||||
"idiom" : "universal"
|
||||
},
|
||||
{
|
||||
"appearances" : [
|
||||
{
|
||||
"appearance" : "luminosity",
|
||||
"value" : "dark"
|
||||
}
|
||||
],
|
||||
"color" : {
|
||||
"color-space" : "srgb",
|
||||
"components" : {
|
||||
"alpha" : "1.000",
|
||||
"blue" : "0x1B",
|
||||
"green" : "0x1B",
|
||||
"red" : "0x1B"
|
||||
}
|
||||
},
|
||||
"idiom" : "universal"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
{
|
||||
"colors" : [
|
||||
{
|
||||
"color" : {
|
||||
"color-space" : "srgb",
|
||||
"components" : {
|
||||
"alpha" : "1.000",
|
||||
"blue" : "0x21",
|
||||
"green" : "0x21",
|
||||
"red" : "0x21"
|
||||
}
|
||||
},
|
||||
"idiom" : "universal"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
{
|
||||
"colors" : [
|
||||
{
|
||||
"color" : {
|
||||
"color-space" : "srgb",
|
||||
"components" : {
|
||||
"alpha" : "1.000",
|
||||
"blue" : "0xF5",
|
||||
"green" : "0xF5",
|
||||
"red" : "0xF5"
|
||||
}
|
||||
},
|
||||
"idiom" : "universal"
|
||||
},
|
||||
{
|
||||
"appearances" : [
|
||||
{
|
||||
"appearance" : "luminosity",
|
||||
"value" : "dark"
|
||||
}
|
||||
],
|
||||
"color" : {
|
||||
"color-space" : "srgb",
|
||||
"components" : {
|
||||
"alpha" : "1.000",
|
||||
"blue" : "0x25",
|
||||
"green" : "0x23",
|
||||
"red" : "0x22"
|
||||
}
|
||||
},
|
||||
"idiom" : "universal"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
{
|
||||
"colors" : [
|
||||
{
|
||||
"color" : {
|
||||
"color-space" : "srgb",
|
||||
"components" : {
|
||||
"alpha" : "0.120",
|
||||
"blue" : "147",
|
||||
"green" : "142",
|
||||
"red" : "142"
|
||||
}
|
||||
},
|
||||
"idiom" : "universal"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
{
|
||||
"colors" : [
|
||||
{
|
||||
"color" : {
|
||||
"color-space" : "srgb",
|
||||
"components" : {
|
||||
"alpha" : "1.000",
|
||||
"blue" : "0x93",
|
||||
"green" : "0x8E",
|
||||
"red" : "0x8E"
|
||||
}
|
||||
},
|
||||
"idiom" : "universal"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
{
|
||||
"colors" : [
|
||||
{
|
||||
"color" : {
|
||||
"color-space" : "srgb",
|
||||
"components" : {
|
||||
"alpha" : "1.000",
|
||||
"blue" : "0x7B",
|
||||
"green" : "0xE9",
|
||||
"red" : "0x00"
|
||||
}
|
||||
},
|
||||
"idiom" : "universal"
|
||||
},
|
||||
{
|
||||
"appearances" : [
|
||||
{
|
||||
"appearance" : "luminosity",
|
||||
"value" : "dark"
|
||||
}
|
||||
],
|
||||
"color" : {
|
||||
"color-space" : "srgb",
|
||||
"components" : {
|
||||
"alpha" : "1.000",
|
||||
"blue" : "0x46",
|
||||
"green" : "0x41",
|
||||
"red" : "0x3F"
|
||||
}
|
||||
},
|
||||
"idiom" : "universal"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
{
|
||||
"colors" : [
|
||||
{
|
||||
"color" : {
|
||||
"color-space" : "srgb",
|
||||
"components" : {
|
||||
"alpha" : "1.000",
|
||||
"blue" : "0x3C",
|
||||
"green" : "0x38",
|
||||
"red" : "0x36"
|
||||
}
|
||||
},
|
||||
"idiom" : "universal"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
{
|
||||
"colors" : [
|
||||
{
|
||||
"color" : {
|
||||
"color-space" : "srgb",
|
||||
"components" : {
|
||||
"alpha" : "1.000",
|
||||
"blue" : "0xDF",
|
||||
"green" : "0xDF",
|
||||
"red" : "0xDF"
|
||||
}
|
||||
},
|
||||
"idiom" : "universal"
|
||||
},
|
||||
{
|
||||
"appearances" : [
|
||||
{
|
||||
"appearance" : "luminosity",
|
||||
"value" : "dark"
|
||||
}
|
||||
],
|
||||
"color" : {
|
||||
"color-space" : "srgb",
|
||||
"components" : {
|
||||
"alpha" : "1.000",
|
||||
"blue" : "0x0C",
|
||||
"green" : "0x0C",
|
||||
"red" : "0x0C"
|
||||
}
|
||||
},
|
||||
"idiom" : "universal"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
{
|
||||
"colors" : [
|
||||
{
|
||||
"color" : {
|
||||
"color-space" : "srgb",
|
||||
"components" : {
|
||||
"alpha" : "1.000",
|
||||
"blue" : "0.000",
|
||||
"green" : "0.000",
|
||||
"red" : "0.000"
|
||||
}
|
||||
},
|
||||
"idiom" : "universal"
|
||||
},
|
||||
{
|
||||
"appearances" : [
|
||||
{
|
||||
"appearance" : "luminosity",
|
||||
"value" : "dark"
|
||||
}
|
||||
],
|
||||
"color" : {
|
||||
"color-space" : "srgb",
|
||||
"components" : {
|
||||
"alpha" : "1.000",
|
||||
"blue" : "1.000",
|
||||
"green" : "1.000",
|
||||
"red" : "1.000"
|
||||
}
|
||||
},
|
||||
"idiom" : "universal"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
{
|
||||
"colors" : [
|
||||
{
|
||||
"color" : {
|
||||
"color-space" : "srgb",
|
||||
"components" : {
|
||||
"alpha" : "1.000",
|
||||
"blue" : "0xD8",
|
||||
"green" : "0xD8",
|
||||
"red" : "0xD8"
|
||||
}
|
||||
},
|
||||
"idiom" : "universal"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
{
|
||||
"colors" : [
|
||||
{
|
||||
"color" : {
|
||||
"color-space" : "srgb",
|
||||
"components" : {
|
||||
"alpha" : "0.000",
|
||||
"blue" : "1.000",
|
||||
"green" : "1.000",
|
||||
"red" : "1.000"
|
||||
}
|
||||
},
|
||||
"idiom" : "universal"
|
||||
},
|
||||
{
|
||||
"appearances" : [
|
||||
{
|
||||
"appearance" : "luminosity",
|
||||
"value" : "dark"
|
||||
}
|
||||
],
|
||||
"color" : {
|
||||
"color-space" : "srgb",
|
||||
"components" : {
|
||||
"alpha" : "1.000",
|
||||
"blue" : "0x32",
|
||||
"green" : "0x32",
|
||||
"red" : "0x32"
|
||||
}
|
||||
},
|
||||
"idiom" : "universal"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
|
@ -19,7 +19,11 @@ public final class Gradient : NSObject {
|
|||
let layer = CAGradientLayer()
|
||||
layer.frame = UIScreen.main.bounds
|
||||
layer.colors = [ gradient.start.cgColor, gradient.end.cgColor ]
|
||||
self.layer.insertSublayer(layer, at: 0)
|
||||
if let existingSublayer = self.layer.sublayers?[0], existingSublayer is CAGradientLayer {
|
||||
self.layer.replaceSublayer(existingSublayer, with: layer)
|
||||
} else {
|
||||
self.layer.insertSublayer(layer, at: 0)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -27,14 +31,14 @@ public final class Gradient : NSObject {
|
|||
final public class Gradients : NSObject {
|
||||
|
||||
@objc public static var defaultLokiBackground: Gradient {
|
||||
switch AppMode.current {
|
||||
switch AppModeManager.shared.currentAppMode {
|
||||
case .light: return Gradient(start: UIColor(hex: 0xFCFCFC), end: UIColor(hex: 0xFFFFFF))
|
||||
case .dark: return Gradient(start: UIColor(hex: 0x171717), end: UIColor(hex: 0x121212))
|
||||
}
|
||||
}
|
||||
|
||||
@objc public static var homeVCFade: Gradient {
|
||||
switch AppMode.current {
|
||||
switch AppModeManager.shared.currentAppMode {
|
||||
case .light: return Gradient(start: UIColor(hex: 0xFFFFFF).withAlphaComponent(0), end: UIColor(hex: 0xFFFFFF))
|
||||
case .dark: return Gradient(start: UIColor(hex: 0x000000).withAlphaComponent(0), end: UIColor(hex: 0x000000))
|
||||
}
|
||||
|
|
|
@ -60,7 +60,7 @@ class AttachmentApprovalInputAccessoryView: UIView {
|
|||
|
||||
// Use a background view that extends below the keyboard to avoid animation glitches.
|
||||
let backgroundView = UIView()
|
||||
backgroundView.backgroundColor = UIColor.black.withAlphaComponent(0.6)
|
||||
backgroundView.backgroundColor = isLightMode ? UIColor.black.withAlphaComponent(0.2) : UIColor.black.withAlphaComponent(0.6)
|
||||
addSubview(backgroundView)
|
||||
backgroundView.autoPinEdgesToSuperviewEdges()
|
||||
|
||||
|
|
|
@ -438,6 +438,7 @@ extension AttachmentPrepViewController: ImageEditorViewDelegate {
|
|||
? .overFullScreen
|
||||
: .fullScreen)
|
||||
navigationController.ows_prefersStatusBarHidden = true
|
||||
navigationController.view.backgroundColor = Colors.navigationBarBackground
|
||||
|
||||
if let navigationBar = navigationController.navigationBar as? OWSNavigationBar {
|
||||
navigationBar.overrideTheme(type: .clear)
|
||||
|
|
|
@ -41,7 +41,9 @@ NSString *NSStringForScreenLockUIState(ScreenLockUIState value)
|
|||
self.view.backgroundColor = UIColor.clearColor;
|
||||
CAGradientLayer *layer = [CAGradientLayer new];
|
||||
layer.frame = UIScreen.mainScreen.bounds;
|
||||
layer.colors = @[ (id)[UIColor colorWithRGBHex:0x171717].CGColor, (id)[UIColor colorWithRGBHex:0x121212].CGColor ];
|
||||
UIColor *gradientStartColor = LKAppModeUtilities.isLightMode ? [UIColor colorWithRGBHex:0xFCFCFC] : [UIColor colorWithRGBHex:0x171717];
|
||||
UIColor *gradientEndColor = LKAppModeUtilities.isLightMode ? [UIColor colorWithRGBHex:0xFFFFFF] : [UIColor colorWithRGBHex:0x121212];
|
||||
layer.colors = @[ (id)gradientStartColor.CGColor, (id)gradientEndColor.CGColor ];
|
||||
[self.view.layer insertSublayer:layer atIndex:0];
|
||||
|
||||
UIView *edgesView = [UIView containerView];
|
||||
|
@ -64,7 +66,7 @@ NSString *NSStringForScreenLockUIState(ScreenLockUIState value)
|
|||
OWSFlatButton *button =
|
||||
[OWSFlatButton buttonWithTitle:NSLocalizedString(@"Unlock Session", @"")
|
||||
font:[UIFont boldSystemFontOfSize:LKValues.mediumFontSize]
|
||||
titleColor:UIColor.whiteColor
|
||||
titleColor:LKAppModeUtilities.isLightMode ? UIColor.blackColor : UIColor.whiteColor
|
||||
backgroundColor:UIColor.clearColor
|
||||
target:self
|
||||
selector:@selector(showUnlockUI)];
|
||||
|
|
|
@ -81,7 +81,9 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
self.tableViewController.view.backgroundColor = UIColor.clearColor;
|
||||
CAGradientLayer *layer = [CAGradientLayer new];
|
||||
layer.frame = UIScreen.mainScreen.bounds;
|
||||
layer.colors = @[ (id)[UIColor colorWithRGBHex:0x171717].CGColor, (id)[UIColor colorWithRGBHex:0x121212].CGColor ];
|
||||
UIColor *gradientStartColor = LKAppModeUtilities.isLightMode ? [UIColor colorWithRGBHex:0xFCFCFC] : [UIColor colorWithRGBHex:0x171717];
|
||||
UIColor *gradientEndColor = LKAppModeUtilities.isLightMode ? [UIColor colorWithRGBHex:0xFFFFFF] : [UIColor colorWithRGBHex:0x121212];
|
||||
layer.colors = @[ (id)gradientStartColor.CGColor, (id)gradientEndColor.CGColor ];
|
||||
[self.tableViewController.view.layer insertSublayer:layer atIndex:0];
|
||||
|
||||
// Loki: Set navigation bar background color
|
||||
|
|
|
@ -10,7 +10,7 @@ public extension NSObject {
|
|||
selector: Selector) -> UIView {
|
||||
let button = OWSButton()
|
||||
button.setImage(imageName: imageName)
|
||||
button.tintColor = Colors.text
|
||||
button.tintColor = isLightMode ? UIColor.black : UIColor.white
|
||||
button.addTarget(self, action: selector, for: .touchUpInside)
|
||||
return button
|
||||
}
|
||||
|
@ -51,9 +51,10 @@ public extension UIViewController {
|
|||
navigationBar.setBackgroundImage(UIImage(), for: UIBarMetrics.default)
|
||||
navigationBar.shadowImage = UIImage()
|
||||
navigationBar.isTranslucent = false
|
||||
navigationBar.barTintColor = Colors.navigationBarBackground
|
||||
navigationBar.backgroundColor = Colors.navigationBarBackground
|
||||
let backgroundImage = UIImage(color: Colors.navigationBarBackground)
|
||||
let color = isLightMode ? UIColor(hex: 0xFCFCFC) : UIColor(hex: 0x161616)
|
||||
navigationBar.barTintColor = color
|
||||
navigationBar.backgroundColor = color
|
||||
let backgroundImage = UIImage(color: color)
|
||||
navigationBar.setBackgroundImage(backgroundImage, for: .default)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -140,8 +140,7 @@ public class OWSFlatButton: UIView {
|
|||
|
||||
@objc
|
||||
public func setBackgroundColors(upColor: UIColor ) {
|
||||
setBackgroundColors(upColor: upColor,
|
||||
downColor: upColor.withAlphaComponent(0.7) )
|
||||
setBackgroundColors(upColor: upColor, downColor: upColor )
|
||||
}
|
||||
|
||||
@objc
|
||||
|
|
|
@ -46,10 +46,6 @@ NSString *const ThemeKeyThemeEnabled = @"ThemeKeyThemeEnabled";
|
|||
{
|
||||
OWSAssertIsOnMainThread();
|
||||
|
||||
if (!CurrentAppContext().isMainApp) {
|
||||
return NO;
|
||||
}
|
||||
|
||||
return LKAppModeUtilities.isDarkMode;
|
||||
}
|
||||
|
||||
|
@ -60,18 +56,7 @@ NSString *const ThemeKeyThemeEnabled = @"ThemeKeyThemeEnabled";
|
|||
|
||||
- (void)setIsDarkThemeEnabled:(BOOL)value
|
||||
{
|
||||
OWSAssertIsOnMainThread();
|
||||
|
||||
self.isDarkThemeEnabledNumber = @(value);
|
||||
[OWSPrimaryStorage.sharedManager.dbReadWriteConnection setBool:value
|
||||
forKey:ThemeKeyThemeEnabled
|
||||
inCollection:ThemeCollection];
|
||||
|
||||
[UIUtil setupSignalAppearence];
|
||||
|
||||
[UIView performWithoutAnimation:^{
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:ThemeDidChangeNotification object:nil userInfo:nil];
|
||||
}];
|
||||
return;
|
||||
}
|
||||
|
||||
+ (UIColor *)backgroundColor
|
||||
|
@ -197,7 +182,6 @@ NSString *const ThemeKeyThemeEnabled = @"ThemeKeyThemeEnabled";
|
|||
return UIKeyboardAppearanceDark;
|
||||
}
|
||||
|
||||
|
||||
#pragma mark - Search Bar
|
||||
|
||||
+ (UIBarStyle)barStyle
|
||||
|
|
|
@ -5,12 +5,12 @@ public enum LKUserDefaults {
|
|||
public enum Bool : Swift.String {
|
||||
case hasLaunchedOnce
|
||||
case hasSeenGIFMetadataWarning
|
||||
case hasSeenLightModeSheet
|
||||
case hasSeenMultiDeviceRemovalSheet
|
||||
case hasSeenOpenGroupSuggestionSheet
|
||||
case hasViewedSeed
|
||||
/// Whether the device was unlinked as a slave device (used to notify the user on the landing screen).
|
||||
case wasUnlinked
|
||||
case isUsingDarkMode
|
||||
case isUsingFullAPNs
|
||||
}
|
||||
|
||||
|
@ -21,6 +21,10 @@ public enum LKUserDefaults {
|
|||
public enum Double : Swift.String {
|
||||
case lastDeviceTokenUpload = "lastDeviceTokenUploadTime"
|
||||
}
|
||||
|
||||
public enum Int: Swift.String {
|
||||
case appMode
|
||||
}
|
||||
|
||||
public enum String {
|
||||
case slaveDeviceName(Swift.String)
|
||||
|
@ -54,6 +58,11 @@ public extension UserDefaults {
|
|||
get { return self.double(forKey: double.rawValue) }
|
||||
set { set(newValue, forKey: double.rawValue) }
|
||||
}
|
||||
|
||||
public subscript(int: LKUserDefaults.Int) -> Int {
|
||||
get { return self.integer(forKey: int.rawValue) }
|
||||
set { set(newValue, forKey: int.rawValue) }
|
||||
}
|
||||
|
||||
public subscript(string: LKUserDefaults.String) -> String? {
|
||||
get { return self.string(forKey: string.key) }
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
public extension Notification.Name {
|
||||
|
||||
// State changes
|
||||
public static let appModeSwitched = Notification.Name("appModeSwitched")
|
||||
public static let appModeChanged = Notification.Name("appModeChanged")
|
||||
public static let blockedContactsUpdated = Notification.Name("blockedContactsUpdated")
|
||||
public static let contactOnlineStatusChanged = Notification.Name("contactOnlineStatusChanged")
|
||||
public static let groupThreadUpdated = Notification.Name("groupThreadUpdated")
|
||||
|
@ -29,7 +29,7 @@ public extension Notification.Name {
|
|||
@objc public extension NSNotification {
|
||||
|
||||
// State changes
|
||||
@objc public static let appModeSwitched = Notification.Name.appModeSwitched.rawValue as NSString
|
||||
@objc public static let appModeChanged = Notification.Name.appModeChanged.rawValue as NSString
|
||||
@objc public static let blockedContactsUpdated = Notification.Name.blockedContactsUpdated.rawValue as NSString
|
||||
@objc public static let contactOnlineStatusChanged = Notification.Name.contactOnlineStatusChanged.rawValue as NSString
|
||||
@objc public static let groupThreadUpdated = Notification.Name.groupThreadUpdated.rawValue as NSString
|
||||
|
|
|
@ -47,7 +47,9 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
self.view.backgroundColor = UIColor.clearColor;
|
||||
CAGradientLayer *layer = [CAGradientLayer new];
|
||||
layer.frame = UIScreen.mainScreen.bounds;
|
||||
layer.colors = @[ (id)[UIColor colorWithRGBHex:0x171717].CGColor, (id)[UIColor colorWithRGBHex:0x121212].CGColor ];
|
||||
UIColor *gradientStartColor = LKAppModeUtilities.isLightMode ? [UIColor colorWithRGBHex:0xFCFCFC] : [UIColor colorWithRGBHex:0x171717];
|
||||
UIColor *gradientEndColor = LKAppModeUtilities.isLightMode ? [UIColor colorWithRGBHex:0xFFFFFF] : [UIColor colorWithRGBHex:0x121212];
|
||||
layer.colors = @[ (id)gradientStartColor.CGColor, (id)gradientEndColor.CGColor ];
|
||||
[self.view.layer insertSublayer:layer atIndex:0];
|
||||
|
||||
// Loki: Set navigation bar background color
|
||||
|
|
|
@ -10,7 +10,7 @@ import SessionServiceKit
|
|||
import PromiseKit
|
||||
|
||||
@objc
|
||||
public class ShareViewController: UIViewController, ShareViewDelegate, SAEFailedViewDelegate {
|
||||
public class ShareViewController: UIViewController, ShareViewDelegate, SAEFailedViewDelegate, AppModeManagerDelegate {
|
||||
|
||||
// MARK: - Dependencies
|
||||
|
||||
|
@ -43,6 +43,8 @@ public class ShareViewController: UIViewController, ShareViewDelegate, SAEFailed
|
|||
let appContext = ShareAppExtensionContext(rootViewController: self)
|
||||
SetCurrentAppContext(appContext)
|
||||
|
||||
AppModeManager.configure(delegate: self)
|
||||
|
||||
DebugLogger.shared().enableTTYLogging()
|
||||
if _isDebugAssertConfiguration() {
|
||||
DebugLogger.shared().enableFileLogging()
|
||||
|
@ -1033,6 +1035,19 @@ public class ShareViewController: UIViewController, ShareViewDelegate, SAEFailed
|
|||
// apply any conversion, so no need to relocate the app.
|
||||
return !itemProvider.registeredTypeIdentifiers.contains(kUTTypeMPEG4 as String)
|
||||
}
|
||||
|
||||
// MARK: App Mode
|
||||
|
||||
public func getCurrentAppMode() -> AppMode {
|
||||
guard let window = self.view.window else { return .light }
|
||||
let userInterfaceStyle = window.traitCollection.userInterfaceStyle
|
||||
let isLightMode = (userInterfaceStyle == .light || userInterfaceStyle == .unspecified)
|
||||
return isLightMode ? .light : .dark
|
||||
}
|
||||
|
||||
public func setCurrentAppMode(to appMode: AppMode) {
|
||||
return // Not applicable to share extensions
|
||||
}
|
||||
}
|
||||
|
||||
// Exposes a Progress object, whose progress is updated by polling the return of a given block
|
||||
|
|
Loading…
Reference in New Issue