Merge pull request #524 from RyanRory/1.11.18

Improvements and bug fixes for 1.11.18
This commit is contained in:
RyanZhao 2021-10-19 13:37:53 +11:00 committed by GitHub
commit fa85a13469
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
44 changed files with 248 additions and 91 deletions

View File

@ -5,7 +5,7 @@
// Remaining search glitchiness
final class ConversationVC : BaseVC, ConversationViewModelDelegate, OWSConversationSettingsViewDelegate, ConversationSearchControllerDelegate, UITableViewDataSource, UITableViewDelegate {
let isUnsendRequestsEnabled = false // Set to true once unsend requests are done on all platforms
let isUnsendRequestsEnabled = true // Set to true once unsend requests are done on all platforms
let thread: TSThread
let focusedMessageID: String? // This isn't actually used ATM
var unreadViewItems: [ConversationViewItem] = []

View File

@ -1,19 +1,22 @@
import UIKit
/// Shown over a media message if it has a message body.
final class MediaTextOverlayView : UIView {
private let viewItem: ConversationViewItem
private let albumViewWidth: CGFloat
private let delegate: MessageCellDelegate
private let textColor: UIColor
var readMoreButton: UIButton?
// MARK: Settings
private static let maxHeight: CGFloat = 88;
// MARK: Lifecycle
init(viewItem: ConversationViewItem, albumViewWidth: CGFloat, delegate: MessageCellDelegate) {
init(viewItem: ConversationViewItem, albumViewWidth: CGFloat, textColor: UIColor, delegate: MessageCellDelegate) {
self.viewItem = viewItem
self.albumViewWidth = albumViewWidth
self.delegate = delegate
self.textColor = textColor
super.init(frame: CGRect.zero)
setUpViewHierarchy()
}
@ -28,29 +31,21 @@ final class MediaTextOverlayView : UIView {
private func setUpViewHierarchy() {
guard let message = viewItem.interaction as? TSMessage, let body = message.body, body.count > 0 else { return }
// Shadow
let shadowView = GradientView(from: .clear, to: UIColor.black.withAlphaComponent(0.7))
addSubview(shadowView)
shadowView.pin(to: self)
// Line
let lineView = UIView()
lineView.backgroundColor = Colors.accent
lineView.set(.width, to: Values.accentLineThickness)
// Body label
let bodyLabel = UILabel()
bodyLabel.numberOfLines = 0
bodyLabel.lineBreakMode = .byTruncatingTail
bodyLabel.text = given(body) { MentionUtilities.highlightMentions(in: $0, threadID: viewItem.interaction.uniqueThreadId) }
bodyLabel.textColor = .white
bodyLabel.font = .systemFont(ofSize: Values.smallFontSize)
bodyLabel.textColor = self.textColor
bodyLabel.font = .systemFont(ofSize: Values.mediumFontSize)
// Content stack view
let contentStackView = UIStackView(arrangedSubviews: [ lineView, bodyLabel ])
let contentStackView = UIStackView(arrangedSubviews: [ bodyLabel ])
contentStackView.axis = .horizontal
contentStackView.spacing = Values.smallSpacing
addSubview(contentStackView)
let inset = Values.mediumSpacing
let inset: CGFloat = 12
contentStackView.pin(.left, to: .left, of: self, withInset: inset)
contentStackView.pin(.top, to: .top, of: self, withInset: 3 * inset)
contentStackView.pin(.top, to: .top, of: self)
contentStackView.pin(.right, to: .right, of: self, withInset: -inset)
// Max height
bodyLabel.heightAnchor.constraint(lessThanOrEqualToConstant: MediaTextOverlayView.maxHeight).isActive = true

View File

@ -354,6 +354,11 @@ final class VisibleMessageCell : MessageCell, LinkPreviewViewDelegate {
showMediaPlaceholder()
} else {
guard let cache = delegate?.getMediaCache() else { preconditionFailure() }
// Stack view
let stackView = UIStackView(arrangedSubviews: [])
stackView.axis = .vertical
stackView.spacing = Values.smallSpacing
// Album view
let maxMessageWidth = VisibleMessageCell.getMaxWidth(for: viewItem)
let albumView = MediaAlbumView(mediaCache: cache, items: viewItem.mediaAlbumItems!, isOutgoing: isOutgoing, maxMessageWidth: maxMessageWidth)
self.albumView = albumView
@ -361,17 +366,20 @@ final class VisibleMessageCell : MessageCell, LinkPreviewViewDelegate {
let size = getSize(for: viewItem)
albumView.set(.width, to: size.width)
albumView.set(.height, to: size.height)
albumView.pin(to: snContentView)
albumView.loadMedia()
albumView.layer.mask = bubbleViewMaskLayer
stackView.addArrangedSubview(albumView)
// Body text view
if let message = viewItem.interaction as? TSMessage, let body = message.body, body.count > 0,
let delegate = delegate { // delegate should always be set at this point
let overlayView = MediaTextOverlayView(viewItem: viewItem, albumViewWidth: size.width, delegate: delegate)
let overlayView = MediaTextOverlayView(viewItem: viewItem, albumViewWidth: size.width, textColor: bodyLabelTextColor, delegate: delegate)
self.mediaTextOverlayView = overlayView
snContentView.addSubview(overlayView)
overlayView.pin([ UIView.HorizontalEdge.left, UIView.VerticalEdge.bottom, UIView.HorizontalEdge.right ], to: snContentView)
stackView.addArrangedSubview(overlayView)
}
unloadContent = { albumView.unloadMedia() }
// Constraints
snContentView.addSubview(stackView)
stackView.pin(to: snContentView)
}
case .audio:
if viewItem.interaction is TSIncomingMessage,

View File

@ -194,8 +194,8 @@ static NSTimeInterval launchStartedAt;
mainWindow.rootViewController = [LoadingViewController new];
[mainWindow makeKeyAndVisible];
LKAppMode appMode = [self getAppModeOrSystemDefault];
[self setCurrentAppMode:appMode];
LKAppMode appMode = [self getCurrentAppMode];
[self adaptAppMode:appMode];
if (@available(iOS 11, *)) {
// This must happen in appDidFinishLaunching or earlier to ensure we don't
@ -246,7 +246,7 @@ static NSTimeInterval launchStartedAt;
[self ensureRootViewController];
LKAppMode appMode = [self getCurrentAppMode];
[self setCurrentAppMode:appMode];
[self adaptAppMode:appMode];
[AppReadiness runNowOrWhenAppDidBecomeReady:^{
[self handleActivation];
@ -709,16 +709,10 @@ static NSTimeInterval launchStartedAt;
# pragma mark - App Mode
- (LKAppMode)getCurrentAppMode
{
return [NSUserDefaults.standardUserDefaults integerForKey:@"appMode"];
}
- (void)setCurrentAppMode:(LKAppMode)appMode
- (void)adaptAppMode:(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, *)) {
@ -735,9 +729,34 @@ static NSTimeInterval launchStartedAt;
break;
}
}
if (LKAppModeUtilities.isSystemDefault) {
if (@available(iOS 13.0, *)) {
window.overrideUserInterfaceStyle = UIUserInterfaceStyleUnspecified;
}
}
[NSNotificationCenter.defaultCenter postNotificationName:NSNotification.appModeChanged object:nil];
}
- (LKAppMode)getCurrentAppMode
{
LKAppMode appMode = [self getAppModeOrSystemDefault];
UIWindow *window = UIApplication.sharedApplication.keyWindow;
return appMode;
}
- (void)setCurrentAppMode:(LKAppMode)appMode
{
[NSUserDefaults.standardUserDefaults setInteger:appMode forKey:@"appMode"];
[self adaptAppMode:appMode];
}
- (void)setAppModeToSystemDefault
{
[NSUserDefaults.standardUserDefaults removeObjectForKey:@"appMode"];
LKAppMode appMode = [self getCurrentAppMode];
[self adaptAppMode:appMode];
}
# pragma mark - Other
- (void)handleDataNukeRequested:(NSNotification *)notification

View File

@ -1,23 +1,12 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "dark-theme-off-24@1x.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "dark-theme-off-24@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "dark-theme-off-24@3x.png",
"scale" : "3x"
"filename" : "moon.pdf",
"idiom" : "universal"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
"author" : "xcode",
"version" : 1
}
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 472 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 994 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

View File

@ -1,23 +1,12 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "dark-theme-on-24@1x.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "dark-theme-on-24@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "dark-theme-on-24@3x.png",
"scale" : "3x"
"filename" : "moon_fill.pdf",
"idiom" : "universal"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
"author" : "xcode",
"version" : 1
}
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 390 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 704 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

View File

@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "moon_auto.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

View File

@ -547,7 +547,7 @@
"vc_conversation_settings_invite_button_title" = "Mitglieder hinzufügen";
"vc_settings_faq_button_title" = "FAQ";
"vc_settings_survey_button_title" = "Feedback / Survey";
"vc_settings_support_button_title" = "Support";
"vc_settings_support_button_title" = "Debug Log";
"modal_send_seed_title" = "Warning";
"modal_send_seed_explanation" = "This is your recovery phrase. If you send it to someone they'll have full access to your account.";
"modal_send_seed_send_button_title" = "Send";
@ -571,3 +571,7 @@
"DISMISS_BUTTON_TEXT" = "Dismiss";
/* Button text which opens the settings app */
"OPEN_SETTINGS_BUTTON" = "Settings";
"APN_Message" = "You've got a new message";
"system_mode_theme" = "System";
"dark_mode_theme" = "Dark";
"light_mode_theme" = "Light";

View File

@ -547,7 +547,7 @@
"vc_conversation_settings_invite_button_title" = "Add Members";
"vc_settings_faq_button_title" = "FAQ";
"vc_settings_survey_button_title" = "Feedback / Survey";
"vc_settings_support_button_title" = "Support";
"vc_settings_support_button_title" = "Debug Log";
"modal_send_seed_title" = "Warning";
"modal_send_seed_explanation" = "This is your recovery phrase. If you send it to someone they'll have full access to your account.";
"modal_send_seed_send_button_title" = "Send";
@ -572,3 +572,7 @@
"DISMISS_BUTTON_TEXT" = "Dismiss";
/* Button text which opens the settings app */
"OPEN_SETTINGS_BUTTON" = "Settings";
"APN_Message" = "You've got a new message";
"system_mode_theme" = "System";
"dark_mode_theme" = "Dark";
"light_mode_theme" = "Light";

View File

@ -547,7 +547,7 @@
"vc_conversation_settings_invite_button_title" = "Añadir Miembros";
"vc_settings_faq_button_title" = "FAQ";
"vc_settings_survey_button_title" = "Feedback / Survey";
"vc_settings_support_button_title" = "Support";
"vc_settings_support_button_title" = "Debug Log";
"modal_send_seed_title" = "Warning";
"modal_send_seed_explanation" = "This is your recovery phrase. If you send it to someone they'll have full access to your account.";
"modal_send_seed_send_button_title" = "Send";
@ -571,3 +571,7 @@
"DISMISS_BUTTON_TEXT" = "Dismiss";
/* Button text which opens the settings app */
"OPEN_SETTINGS_BUTTON" = "Settings";
"APN_Message" = "You've got a new message";
"system_mode_theme" = "System";
"dark_mode_theme" = "Dark";
"light_mode_theme" = "Light";

View File

@ -547,7 +547,7 @@
"vc_conversation_settings_invite_button_title" = "Add Members";
"vc_settings_faq_button_title" = "FAQ";
"vc_settings_survey_button_title" = "Feedback / Survey";
"vc_settings_support_button_title" = "Support";
"vc_settings_support_button_title" = "Debug Log";
"modal_send_seed_title" = "Warning";
"modal_send_seed_explanation" = "This is your recovery phrase. If you send it to someone they'll have full access to your account.";
"modal_send_seed_send_button_title" = "Send";
@ -571,3 +571,7 @@
"DISMISS_BUTTON_TEXT" = "Dismiss";
/* Button text which opens the settings app */
"OPEN_SETTINGS_BUTTON" = "Settings";
"APN_Message" = "You've got a new message";
"system_mode_theme" = "System";
"dark_mode_theme" = "Dark";
"light_mode_theme" = "Light";

View File

@ -547,7 +547,7 @@
"vc_conversation_settings_invite_button_title" = "Lisää jäseniä";
"vc_settings_faq_button_title" = "FAQ";
"vc_settings_survey_button_title" = "Feedback / Survey";
"vc_settings_support_button_title" = "Support";
"vc_settings_support_button_title" = "Debug Log";
"modal_send_seed_title" = "Warning";
"modal_send_seed_explanation" = "This is your recovery phrase. If you send it to someone they'll have full access to your account.";
"modal_send_seed_send_button_title" = "Send";
@ -571,3 +571,7 @@
"DISMISS_BUTTON_TEXT" = "Dismiss";
/* Button text which opens the settings app */
"OPEN_SETTINGS_BUTTON" = "Settings";
"APN_Message" = "You've got a new message";
"system_mode_theme" = "System";
"dark_mode_theme" = "Dark";
"light_mode_theme" = "Light";

View File

@ -547,7 +547,7 @@
"vc_conversation_settings_invite_button_title" = "Ajouter des membres";
"vc_settings_faq_button_title" = "FAQ";
"vc_settings_survey_button_title" = "Feedback / Survey";
"vc_settings_support_button_title" = "Support";
"vc_settings_support_button_title" = "Debug Log";
"modal_send_seed_title" = "Warning";
"modal_send_seed_explanation" = "This is your recovery phrase. If you send it to someone they'll have full access to your account.";
"modal_send_seed_send_button_title" = "Send";
@ -571,3 +571,7 @@
"DISMISS_BUTTON_TEXT" = "Dismiss";
/* Button text which opens the settings app */
"OPEN_SETTINGS_BUTTON" = "Settings";
"APN_Message" = "You've got a new message";
"system_mode_theme" = "System";
"dark_mode_theme" = "Dark";
"light_mode_theme" = "Light";

View File

@ -547,7 +547,7 @@
"vc_conversation_settings_invite_button_title" = "सदस्य जोड़ें";
"vc_settings_faq_button_title" = "FAQ";
"vc_settings_survey_button_title" = "Feedback / Survey";
"vc_settings_support_button_title" = "Support";
"vc_settings_support_button_title" = "Debug Log";
"modal_send_seed_title" = "Warning";
"modal_send_seed_explanation" = "This is your recovery phrase. If you send it to someone they'll have full access to your account.";
"modal_send_seed_send_button_title" = "Send";
@ -571,3 +571,7 @@
"DISMISS_BUTTON_TEXT" = "Dismiss";
/* Button text which opens the settings app */
"OPEN_SETTINGS_BUTTON" = "Settings";
"APN_Message" = "You've got a new message";
"system_mode_theme" = "System";
"dark_mode_theme" = "Dark";
"light_mode_theme" = "Light";

View File

@ -547,7 +547,7 @@
"vc_conversation_settings_invite_button_title" = "Dodaj članove";
"vc_settings_faq_button_title" = "FAQ";
"vc_settings_survey_button_title" = "Feedback / Survey";
"vc_settings_support_button_title" = "Support";
"vc_settings_support_button_title" = "Debug Log";
"modal_send_seed_title" = "Warning";
"modal_send_seed_explanation" = "This is your recovery phrase. If you send it to someone they'll have full access to your account.";
"modal_send_seed_send_button_title" = "Send";
@ -571,3 +571,7 @@
"DISMISS_BUTTON_TEXT" = "Dismiss";
/* Button text which opens the settings app */
"OPEN_SETTINGS_BUTTON" = "Settings";
"APN_Message" = "You've got a new message";
"system_mode_theme" = "System";
"dark_mode_theme" = "Dark";
"light_mode_theme" = "Light";

View File

@ -547,7 +547,7 @@
"vc_conversation_settings_invite_button_title" = "Add Members";
"vc_settings_faq_button_title" = "FAQ";
"vc_settings_survey_button_title" = "Feedback / Survey";
"vc_settings_support_button_title" = "Support";
"vc_settings_support_button_title" = "Debug Log";
"modal_send_seed_title" = "Warning";
"modal_send_seed_explanation" = "This is your recovery phrase. If you send it to someone they'll have full access to your account.";
"modal_send_seed_send_button_title" = "Send";
@ -571,3 +571,7 @@
"DISMISS_BUTTON_TEXT" = "Dismiss";
/* Button text which opens the settings app */
"OPEN_SETTINGS_BUTTON" = "Settings";
"APN_Message" = "You've got a new message";
"system_mode_theme" = "System";
"dark_mode_theme" = "Dark";
"light_mode_theme" = "Light";

View File

@ -547,7 +547,7 @@
"vc_conversation_settings_invite_button_title" = "Aggiungi membri";
"vc_settings_faq_button_title" = "FAQ";
"vc_settings_survey_button_title" = "Feedback / Survey";
"vc_settings_support_button_title" = "Support";
"vc_settings_support_button_title" = "Debug Log";
"modal_send_seed_title" = "Warning";
"modal_send_seed_explanation" = "This is your recovery phrase. If you send it to someone they'll have full access to your account.";
"modal_send_seed_send_button_title" = "Send";
@ -571,3 +571,7 @@
"DISMISS_BUTTON_TEXT" = "Dismiss";
/* Button text which opens the settings app */
"OPEN_SETTINGS_BUTTON" = "Settings";
"APN_Message" = "You've got a new message";
"system_mode_theme" = "System";
"dark_mode_theme" = "Dark";
"light_mode_theme" = "Light";

View File

@ -547,7 +547,7 @@
"vc_conversation_settings_invite_button_title" = "メンバーを追加する";
"vc_settings_faq_button_title" = "FAQ";
"vc_settings_survey_button_title" = "Feedback / Survey";
"vc_settings_support_button_title" = "Support";
"vc_settings_support_button_title" = "Debug Log";
"modal_send_seed_title" = "Warning";
"modal_send_seed_explanation" = "This is your recovery phrase. If you send it to someone they'll have full access to your account.";
"modal_send_seed_send_button_title" = "Send";
@ -571,3 +571,7 @@
"DISMISS_BUTTON_TEXT" = "Dismiss";
/* Button text which opens the settings app */
"OPEN_SETTINGS_BUTTON" = "Settings";
"APN_Message" = "You've got a new message";
"system_mode_theme" = "System";
"dark_mode_theme" = "Dark";
"light_mode_theme" = "Light";

View File

@ -547,7 +547,7 @@
"vc_conversation_settings_invite_button_title" = "Voeg deelnemers toe";
"vc_settings_faq_button_title" = "FAQ";
"vc_settings_survey_button_title" = "Feedback / Survey";
"vc_settings_support_button_title" = "Support";
"vc_settings_support_button_title" = "Debug Log";
"modal_send_seed_title" = "Warning";
"modal_send_seed_explanation" = "This is your recovery phrase. If you send it to someone they'll have full access to your account.";
"modal_send_seed_send_button_title" = "Send";
@ -571,3 +571,7 @@
"DISMISS_BUTTON_TEXT" = "Dismiss";
/* Button text which opens the settings app */
"OPEN_SETTINGS_BUTTON" = "Settings";
"APN_Message" = "You've got a new message";
"system_mode_theme" = "System";
"dark_mode_theme" = "Dark";
"light_mode_theme" = "Light";

View File

@ -547,7 +547,7 @@
"vc_conversation_settings_invite_button_title" = "Dodaj użytkowników";
"vc_settings_faq_button_title" = "FAQ";
"vc_settings_survey_button_title" = "Feedback / Survey";
"vc_settings_support_button_title" = "Support";
"vc_settings_support_button_title" = "Debug Log";
"modal_send_seed_title" = "Warning";
"modal_send_seed_explanation" = "This is your recovery phrase. If you send it to someone they'll have full access to your account.";
"modal_send_seed_send_button_title" = "Send";
@ -571,3 +571,7 @@
"DISMISS_BUTTON_TEXT" = "Dismiss";
/* Button text which opens the settings app */
"OPEN_SETTINGS_BUTTON" = "Settings";
"APN_Message" = "You've got a new message";
"system_mode_theme" = "System";
"dark_mode_theme" = "Dark";
"light_mode_theme" = "Light";

View File

@ -547,7 +547,7 @@
"vc_conversation_settings_invite_button_title" = "Adicionar Membros";
"vc_settings_faq_button_title" = "FAQ";
"vc_settings_survey_button_title" = "Feedback / Survey";
"vc_settings_support_button_title" = "Support";
"vc_settings_support_button_title" = "Debug Log";
"modal_send_seed_title" = "Warning";
"modal_send_seed_explanation" = "This is your recovery phrase. If you send it to someone they'll have full access to your account.";
"modal_send_seed_send_button_title" = "Send";
@ -571,3 +571,7 @@
"DISMISS_BUTTON_TEXT" = "Dismiss";
/* Button text which opens the settings app */
"OPEN_SETTINGS_BUTTON" = "Settings";
"APN_Message" = "You've got a new message";
"system_mode_theme" = "System";
"dark_mode_theme" = "Dark";
"light_mode_theme" = "Light";

View File

@ -547,7 +547,7 @@
"vc_conversation_settings_invite_button_title" = "Добавить участников";
"vc_settings_faq_button_title" = "FAQ";
"vc_settings_survey_button_title" = "Feedback / Survey";
"vc_settings_support_button_title" = "Support";
"vc_settings_support_button_title" = "Debug Log";
"modal_send_seed_title" = "Warning";
"modal_send_seed_explanation" = "This is your recovery phrase. If you send it to someone they'll have full access to your account.";
"modal_send_seed_send_button_title" = "Send";
@ -571,3 +571,7 @@
"DISMISS_BUTTON_TEXT" = "Dismiss";
/* Button text which opens the settings app */
"OPEN_SETTINGS_BUTTON" = "Settings";
"APN_Message" = "You've got a new message";
"system_mode_theme" = "System";
"dark_mode_theme" = "Dark";
"light_mode_theme" = "Light";

View File

@ -547,7 +547,7 @@
"vc_conversation_settings_invite_button_title" = "Add Members";
"vc_settings_faq_button_title" = "FAQ";
"vc_settings_survey_button_title" = "Feedback / Survey";
"vc_settings_support_button_title" = "Support";
"vc_settings_support_button_title" = "Debug Log";
"modal_send_seed_title" = "Warning";
"modal_send_seed_explanation" = "This is your recovery phrase. If you send it to someone they'll have full access to your account.";
"modal_send_seed_send_button_title" = "Send";
@ -572,3 +572,7 @@
"DISMISS_BUTTON_TEXT" = "Dismiss";
/* Button text which opens the settings app */
"OPEN_SETTINGS_BUTTON" = "Settings";
"APN_Message" = "You've got a new message";
"system_mode_theme" = "System";
"dark_mode_theme" = "Dark";
"light_mode_theme" = "Light";

View File

@ -547,7 +547,7 @@
"vc_conversation_settings_invite_button_title" = "Pridať členov";
"vc_settings_faq_button_title" = "FAQ";
"vc_settings_survey_button_title" = "Feedback / Survey";
"vc_settings_support_button_title" = "Support";
"vc_settings_support_button_title" = "Debug Log";
"modal_send_seed_title" = "Warning";
"modal_send_seed_explanation" = "This is your recovery phrase. If you send it to someone they'll have full access to your account.";
"modal_send_seed_send_button_title" = "Send";
@ -571,3 +571,7 @@
"DISMISS_BUTTON_TEXT" = "Dismiss";
/* Button text which opens the settings app */
"OPEN_SETTINGS_BUTTON" = "Settings";
"APN_Message" = "You've got a new message";
"system_mode_theme" = "System";
"dark_mode_theme" = "Dark";
"light_mode_theme" = "Light";

View File

@ -547,7 +547,7 @@
"vc_conversation_settings_invite_button_title" = "Lägg till medlemmar";
"vc_settings_faq_button_title" = "FAQ";
"vc_settings_survey_button_title" = "Feedback / Survey";
"vc_settings_support_button_title" = "Support";
"vc_settings_support_button_title" = "Debug Log";
"modal_send_seed_title" = "Warning";
"modal_send_seed_explanation" = "This is your recovery phrase. If you send it to someone they'll have full access to your account.";
"modal_send_seed_send_button_title" = "Send";
@ -571,3 +571,7 @@
"DISMISS_BUTTON_TEXT" = "Dismiss";
/* Button text which opens the settings app */
"OPEN_SETTINGS_BUTTON" = "Settings";
"APN_Message" = "You've got a new message";
"system_mode_theme" = "System";
"dark_mode_theme" = "Dark";
"light_mode_theme" = "Light";

View File

@ -547,7 +547,7 @@
"vc_conversation_settings_invite_button_title" = "เพิ่มสมาชิก";
"vc_settings_faq_button_title" = "FAQ";
"vc_settings_survey_button_title" = "Feedback / Survey";
"vc_settings_support_button_title" = "Support";
"vc_settings_support_button_title" = "Debug Log";
"modal_send_seed_title" = "Warning";
"modal_send_seed_explanation" = "This is your recovery phrase. If you send it to someone they'll have full access to your account.";
"modal_send_seed_send_button_title" = "Send";
@ -571,3 +571,7 @@
"DISMISS_BUTTON_TEXT" = "Dismiss";
/* Button text which opens the settings app */
"OPEN_SETTINGS_BUTTON" = "Settings";
"APN_Message" = "You've got a new message";
"system_mode_theme" = "System";
"dark_mode_theme" = "Dark";
"light_mode_theme" = "Light";

View File

@ -547,7 +547,7 @@
"vc_conversation_settings_invite_button_title" = "Add Members";
"vc_settings_faq_button_title" = "FAQ";
"vc_settings_survey_button_title" = "Feedback / Survey";
"vc_settings_support_button_title" = "Support";
"vc_settings_support_button_title" = "Debug Log";
"modal_send_seed_title" = "Warning";
"modal_send_seed_explanation" = "This is your recovery phrase. If you send it to someone they'll have full access to your account.";
"modal_send_seed_send_button_title" = "Send";
@ -571,3 +571,7 @@
"DISMISS_BUTTON_TEXT" = "Dismiss";
/* Button text which opens the settings app */
"OPEN_SETTINGS_BUTTON" = "Settings";
"APN_Message" = "You've got a new message";
"system_mode_theme" = "System";
"dark_mode_theme" = "Dark";
"light_mode_theme" = "Light";

View File

@ -547,7 +547,7 @@
"vc_conversation_settings_invite_button_title" = "新增成員";
"vc_settings_faq_button_title" = "FAQ";
"vc_settings_survey_button_title" = "Feedback / Survey";
"vc_settings_support_button_title" = "Support";
"vc_settings_support_button_title" = "Debug Log";
"modal_send_seed_title" = "Warning";
"modal_send_seed_explanation" = "This is your recovery phrase. If you send it to someone they'll have full access to your account.";
"modal_send_seed_send_button_title" = "Send";
@ -571,3 +571,7 @@
"DISMISS_BUTTON_TEXT" = "Dismiss";
/* Button text which opens the settings app */
"OPEN_SETTINGS_BUTTON" = "Settings";
"APN_Message" = "You've got a new message";
"system_mode_theme" = "System";
"dark_mode_theme" = "Dark";
"light_mode_theme" = "Light";

View File

@ -547,7 +547,7 @@
"vc_conversation_settings_invite_button_title" = "添加成员";
"vc_settings_faq_button_title" = "FAQ";
"vc_settings_survey_button_title" = "Feedback / Survey";
"vc_settings_support_button_title" = "Support";
"vc_settings_support_button_title" = "Debug Log";
"modal_send_seed_title" = "Warning";
"modal_send_seed_explanation" = "This is your recovery phrase. If you send it to someone they'll have full access to your account.";
"modal_send_seed_send_button_title" = "Send";
@ -568,3 +568,10 @@
"accessibility_library_button" = "Photo library";
"accessibility_camera_button" = "Camera";
"accessibility_main_button_collapse" = "Collapse attachment options";
"DISMISS_BUTTON_TEXT" = "Dismiss";
/* Button text which opens the settings app */
"OPEN_SETTINGS_BUTTON" = "Settings";
"APN_Message" = "You've got a new message";
"system_mode_theme" = "System";
"dark_mode_theme" = "Dark";
"light_mode_theme" = "Light";

View File

@ -184,7 +184,7 @@ public class NotificationPresenter: NSObject, NotificationsProtocol {
let previewType = preferences.notificationPreviewType(with: transaction)
switch previewType {
case .noNameNoPreview:
notificationTitle = nil
notificationTitle = "Session"
case .nameNoPreview, .namePreview:
switch thread {
case is TSContactThread:

View File

@ -303,7 +303,12 @@ final class SettingsVC : BaseVC, AvatarViewHelperDelegate {
closeButton.isAccessibilityElement = true
navigationItem.leftBarButtonItem = closeButton
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 appModeIcon: UIImage
if isSystemDefault {
appModeIcon = isDarkMode ? #imageLiteral(resourceName: "ic_theme_auto").withTintColor(.white) : #imageLiteral(resourceName: "ic_theme_auto").withTintColor(.black)
} else {
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
@ -404,8 +409,26 @@ final class SettingsVC : BaseVC, AvatarViewHelperDelegate {
}
@objc private func switchAppMode() {
let newAppMode: AppMode = isLightMode ? .dark : .light
AppModeManager.shared.setCurrentAppMode(to: newAppMode)
let alertVC = UIAlertController.init(title: nil, message: nil, preferredStyle: .actionSheet)
let systemModeAction = UIAlertAction.init(title: NSLocalizedString("system_mode_theme", comment: ""), style: .default) { _ in
AppModeManager.shared.setAppModeToSystemDefault()
}
alertVC.addAction(systemModeAction)
let darkModeAction = UIAlertAction.init(title: NSLocalizedString("dark_mode_theme", comment: ""), style: .default) { _ in
AppModeManager.shared.setCurrentAppMode(to: .dark)
}
alertVC.addAction(darkModeAction)
let lightModeAction = UIAlertAction.init(title: NSLocalizedString("light_mode_theme", comment: ""), style: .default) { _ in
AppModeManager.shared.setCurrentAppMode(to: .light)
}
alertVC.addAction(lightModeAction)
let cancelAction = UIAlertAction.init(title: NSLocalizedString("TXT_CANCEL_TITLE", comment: ""), style: .cancel) {_ in }
alertVC.addAction(cancelAction)
self.presentAlert(alertVC)
}
@objc private func showQRCode() {

View File

@ -26,6 +26,16 @@ class BaseVC : UIViewController {
setNeedsStatusBarAppearanceUpdate()
NotificationCenter.default.addObserver(self, selector: #selector(handleAppModeChangedNotification(_:)), name: .appModeChanged, object: nil)
}
internal func ensureWindowBackground() {
let appMode = AppModeManager.shared.currentAppMode
switch appMode {
case .light:
UIApplication.shared.delegate?.window??.backgroundColor = .white
case .dark:
UIApplication.shared.delegate?.window??.backgroundColor = .black
}
}
internal func setUpGradientBackground() {
hasGradient = true
@ -80,12 +90,13 @@ class BaseVC : UIViewController {
}
override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) {
// TODO: Post an appModeChanged notification?
NotificationCenter.default.post(name: .appModeChanged, object: nil)
}
@objc internal func handleAppModeChangedNotification(_ notification: Notification) {
if hasGradient {
setUpGradientBackground() // Re-do the gradient
}
ensureWindowBackground()
}
}

View File

@ -104,15 +104,18 @@ public final class NotificationServiceExtension : UNNotificationServiceExtension
notificationContent.body = snippet
case .nameNoPreview:
notificationContent.title = senderDisplayName
notificationContent.body = "You've got a new message"
notificationContent.body = NotificationStrings.incomingMessageBody
case .noNameNoPreview:
notificationContent.title = "Session"
notificationContent.body = "You've got a new message"
notificationContent.body = NotificationStrings.incomingMessageBody
default: break
}
self.handleSuccess(for: notificationContent)
} catch {
self.handleFailure(for: notificationContent)
if let error = error as? MessageReceiver.Error, error.isRetryable {
self.handleFailure(for: notificationContent)
}
self.completeSilenty()
}
}
}

View File

@ -173,6 +173,10 @@ final class ShareVC : UINavigationController, ShareViewDelegate, AppModeManagerD
return // Not applicable to share extensions
}
public func setAppModeToSystemDefault() {
return // Not applicable to share extensions
}
// MARK: Updating
private func showLockScreenOrMainContent() {
if OWSScreenLock.shared.isScreenLockEnabled() {

View File

@ -25,6 +25,10 @@ public final class AppModeManager : NSObject {
public func setCurrentAppMode(to appMode: AppMode) {
delegate.setCurrentAppMode(to: appMode)
}
public func setAppModeToSystemDefault() {
delegate.setAppModeToSystemDefault()
}
}
@objc(LKAppModeManagerDelegate)
@ -33,6 +37,7 @@ public protocol AppModeManagerDelegate {
func getCurrentAppMode() -> AppMode
@objc(setCurrentAppMode:)
func setCurrentAppMode(to appMode: AppMode)
func setAppModeToSystemDefault()
}
@objc(LKAppMode)
@ -40,6 +45,10 @@ public enum AppMode : Int {
case light, dark
}
public var isSystemDefault: Bool {
return !UserDefaults.standard.dictionaryRepresentation().keys.contains("appMode")
}
public var isLightMode: Bool {
return AppModeManager.shared.currentAppMode == .light
}
@ -49,6 +58,10 @@ public var isDarkMode: Bool {
}
@objc public final class LKAppModeUtilities : NSObject {
@objc public static var isSystemDefault: Bool {
return !UserDefaults.standard.dictionaryRepresentation().keys.contains("appMode")
}
@objc public static var isLightMode: Bool {
return AppModeManager.shared.currentAppMode == .light