mirror of
https://github.com/oxen-io/session-ios.git
synced 2023-12-13 21:30:14 +01:00
Show light mode announcement sheet to existing users
This commit is contained in:
parent
717d44c204
commit
44ca8c293a
8 changed files with 77 additions and 14 deletions
|
@ -573,6 +573,7 @@
|
||||||
BFF3FB9730634F37D25903F4 /* Pods_Signal.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D17BB5C25D615AB49813100C /* Pods_Signal.framework */; };
|
BFF3FB9730634F37D25903F4 /* Pods_Signal.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D17BB5C25D615AB49813100C /* Pods_Signal.framework */; };
|
||||||
C31A6C5A247F214E001123EF /* UIView+Glow.swift in Sources */ = {isa = PBXBuildFile; fileRef = C31A6C59247F214E001123EF /* UIView+Glow.swift */; };
|
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 */; };
|
C31A6C5C247F2CF3001123EF /* CGRect+Utilities.swift in Sources */ = {isa = PBXBuildFile; fileRef = C31A6C5B247F2CF3001123EF /* CGRect+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 */; };
|
C34C8F7423A7830B00D82669 /* SpaceMono-Bold.ttf in Resources */ = {isa = PBXBuildFile; fileRef = C34C8F7323A7830A00D82669 /* SpaceMono-Bold.ttf */; };
|
||||||
C353F8F9244809150011121A /* PNOptionView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C353F8F8244809150011121A /* PNOptionView.swift */; };
|
C353F8F9244809150011121A /* PNOptionView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C353F8F8244809150011121A /* PNOptionView.swift */; };
|
||||||
C3548F0624456447009433A8 /* PNModeVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3548F0524456447009433A8 /* PNModeVC.swift */; };
|
C3548F0624456447009433A8 /* PNModeVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3548F0524456447009433A8 /* PNModeVC.swift */; };
|
||||||
|
@ -1365,6 +1366,7 @@
|
||||||
B9EB5ABC1884C002007CBB57 /* MessageUI.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MessageUI.framework; path = System/Library/Frameworks/MessageUI.framework; sourceTree = SDKROOT; };
|
B9EB5ABC1884C002007CBB57 /* MessageUI.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MessageUI.framework; path = System/Library/Frameworks/MessageUI.framework; sourceTree = SDKROOT; };
|
||||||
C31A6C59247F214E001123EF /* UIView+Glow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIView+Glow.swift"; sourceTree = "<group>"; };
|
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>"; };
|
C31A6C5B247F2CF3001123EF /* CGRect+Utilities.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "CGRect+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>"; };
|
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>"; };
|
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>"; };
|
C3548F0524456447009433A8 /* PNModeVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PNModeVC.swift; sourceTree = "<group>"; };
|
||||||
|
@ -2716,6 +2718,7 @@
|
||||||
B8BB82A4238F627000BA5194 /* HomeVC.swift */,
|
B8BB82A4238F627000BA5194 /* HomeVC.swift */,
|
||||||
B8CCF63E23975CFB0091D419 /* JoinPublicChatVC.swift */,
|
B8CCF63E23975CFB0091D419 /* JoinPublicChatVC.swift */,
|
||||||
B82B40872399EB0E00A248E7 /* LandingVC.swift */,
|
B82B40872399EB0E00A248E7 /* LandingVC.swift */,
|
||||||
|
C329FEEB24F7277900B1C64C /* LightModeSheet.swift */,
|
||||||
B85357C423A1F13800AAF6CD /* LinkDeviceVC.swift */,
|
B85357C423A1F13800AAF6CD /* LinkDeviceVC.swift */,
|
||||||
B85357C623A1FB5100AAF6CD /* LinkDeviceVCDelegate.swift */,
|
B85357C623A1FB5100AAF6CD /* LinkDeviceVCDelegate.swift */,
|
||||||
B86BD08323399ACF000F5AE3 /* Modal.swift */,
|
B86BD08323399ACF000F5AE3 /* Modal.swift */,
|
||||||
|
@ -3843,6 +3846,7 @@
|
||||||
45A6DAD61EBBF85500893231 /* ReminderView.swift in Sources */,
|
45A6DAD61EBBF85500893231 /* ReminderView.swift in Sources */,
|
||||||
34D1F0881F8678AA0066283D /* ConversationViewLayout.m in Sources */,
|
34D1F0881F8678AA0066283D /* ConversationViewLayout.m in Sources */,
|
||||||
B82B408E239DC00D00A248E7 /* DisplayNameVC.swift in Sources */,
|
B82B408E239DC00D00A248E7 /* DisplayNameVC.swift in Sources */,
|
||||||
|
C329FEEC24F7277900B1C64C /* LightModeSheet.swift in Sources */,
|
||||||
4CA485BB2232339F004B9E7D /* PhotoCaptureViewController.swift in Sources */,
|
4CA485BB2232339F004B9E7D /* PhotoCaptureViewController.swift in Sources */,
|
||||||
34330AA31E79686200DF2FB9 /* OWSProgressView.m in Sources */,
|
34330AA31E79686200DF2FB9 /* OWSProgressView.m in Sources */,
|
||||||
344825C6211390C800DB4BD8 /* OWSOrphanDataCleaner.m in Sources */,
|
344825C6211390C800DB4BD8 /* OWSOrphanDataCleaner.m in Sources */,
|
||||||
|
|
12
Signal/Images.xcassets/Loki V2/Sun.imageset/Contents.json
vendored
Normal file
12
Signal/Images.xcassets/Loki V2/Sun.imageset/Contents.json
vendored
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
{
|
||||||
|
"images" : [
|
||||||
|
{
|
||||||
|
"filename" : "Sun.pdf",
|
||||||
|
"idiom" : "universal"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"info" : {
|
||||||
|
"author" : "xcode",
|
||||||
|
"version" : 1
|
||||||
|
}
|
||||||
|
}
|
BIN
Signal/Images.xcassets/Loki V2/Sun.imageset/Sun.pdf
vendored
Normal file
BIN
Signal/Images.xcassets/Loki V2/Sun.imageset/Sun.pdf
vendored
Normal file
Binary file not shown.
|
@ -183,16 +183,13 @@ final class HomeVC : BaseVC, UITableViewDataSource, UITableViewDelegate, UIScrol
|
||||||
override func viewDidAppear(_ animated: Bool) {
|
override func viewDidAppear(_ animated: Bool) {
|
||||||
super.viewDidAppear(animated)
|
super.viewDidAppear(animated)
|
||||||
isViewVisible = true
|
isViewVisible = true
|
||||||
let hasSeenMultiDeviceRemovalSheet = UserDefaults.standard[.hasSeenMultiDeviceRemovalSheet]
|
let hasSeenLightModeSheet = UserDefaults.standard[.hasSeenLightModeSheet]
|
||||||
if !hasSeenMultiDeviceRemovalSheet {
|
if !hasSeenLightModeSheet {
|
||||||
let _ = FileServerAPI.getDeviceLinks(associatedWith: getUserHexEncodedPublicKey()).done(on: DispatchQueue.main) { [weak self] deviceLinks in
|
let lightModeSheet = LightModeSheet()
|
||||||
guard !deviceLinks.isEmpty else { return }
|
lightModeSheet.modalPresentationStyle = .overFullScreen
|
||||||
let multiDeviceRemovalSheet = MultiDeviceRemovalSheet()
|
lightModeSheet.modalTransitionStyle = .crossDissolve
|
||||||
multiDeviceRemovalSheet.modalPresentationStyle = .overFullScreen
|
present(lightModeSheet, animated: true, completion: nil)
|
||||||
multiDeviceRemovalSheet.modalTransitionStyle = .crossDissolve
|
UserDefaults.standard[.hasSeenLightModeSheet] = true
|
||||||
self?.present(multiDeviceRemovalSheet, animated: true, completion: nil)
|
|
||||||
}
|
|
||||||
UserDefaults.standard[.hasSeenMultiDeviceRemovalSheet] = true
|
|
||||||
}
|
}
|
||||||
UserDefaults.standard[.hasLaunchedOnce] = true
|
UserDefaults.standard[.hasLaunchedOnce] = true
|
||||||
}
|
}
|
||||||
|
|
47
Signal/src/Loki/View Controllers/LightModeSheet.swift
Normal file
47
Signal/src/Loki/View Controllers/LightModeSheet.swift
Normal file
|
@ -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[.isUsingFullAPNs] = (selectedOptionView == apnsOptionView)
|
||||||
UserDefaults.standard[.hasSeenMultiDeviceRemovalSheet] = true
|
UserDefaults.standard[.hasSeenMultiDeviceRemovalSheet] = true
|
||||||
|
UserDefaults.standard[.hasSeenLightModeSheet] = true
|
||||||
TSAccountManager.sharedInstance().didRegister()
|
TSAccountManager.sharedInstance().didRegister()
|
||||||
let homeVC = HomeVC()
|
let homeVC = HomeVC()
|
||||||
navigationController!.setViewControllers([ homeVC ], animated: true)
|
navigationController!.setViewControllers([ homeVC ], animated: true)
|
||||||
|
|
|
@ -11,18 +11,19 @@ class Sheet : BaseVC {
|
||||||
result.backgroundColor = Colors.modalBackground
|
result.backgroundColor = Colors.modalBackground
|
||||||
result.layer.cornerRadius = 24
|
result.layer.cornerRadius = 24
|
||||||
result.layer.masksToBounds = false
|
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.borderWidth = Values.borderThickness
|
||||||
result.layer.shadowColor = UIColor.black.cgColor
|
result.layer.shadowColor = UIColor.black.cgColor
|
||||||
result.layer.shadowRadius = 8
|
result.layer.shadowRadius = isLightMode ? 2 : 8
|
||||||
result.layer.shadowOpacity = 0.64
|
result.layer.shadowOpacity = isLightMode ? 0.1 : 0.64
|
||||||
return result
|
return result
|
||||||
}()
|
}()
|
||||||
|
|
||||||
// MARK: Lifecycle
|
// MARK: Lifecycle
|
||||||
override func viewDidLoad() {
|
override func viewDidLoad() {
|
||||||
super.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))
|
let swipeGestureRecognizer = UISwipeGestureRecognizer(target: self, action: #selector(close))
|
||||||
swipeGestureRecognizer.direction = .down
|
swipeGestureRecognizer.direction = .down
|
||||||
view.addGestureRecognizer(swipeGestureRecognizer)
|
view.addGestureRecognizer(swipeGestureRecognizer)
|
||||||
|
|
|
@ -5,6 +5,7 @@ public enum LKUserDefaults {
|
||||||
public enum Bool : Swift.String {
|
public enum Bool : Swift.String {
|
||||||
case hasLaunchedOnce
|
case hasLaunchedOnce
|
||||||
case hasSeenGIFMetadataWarning
|
case hasSeenGIFMetadataWarning
|
||||||
|
case hasSeenLightModeSheet
|
||||||
case hasSeenMultiDeviceRemovalSheet
|
case hasSeenMultiDeviceRemovalSheet
|
||||||
case hasSeenOpenGroupSuggestionSheet
|
case hasSeenOpenGroupSuggestionSheet
|
||||||
case hasViewedSeed
|
case hasViewedSeed
|
||||||
|
|
Loading…
Reference in a new issue