Skip to content

Commit

Permalink
Version 5.1.1b3028
Browse files Browse the repository at this point in the history
  • Loading branch information
Threema committed May 16, 2023
1 parent 1504100 commit ae2a8fd
Show file tree
Hide file tree
Showing 8 changed files with 84 additions and 58 deletions.
2 changes: 1 addition & 1 deletion SharedResources/Strings/de.lproj/Localizable.strings
Expand Up @@ -1516,7 +1516,7 @@ Sofern keine Medien und/oder Dateien in %@ fehlen, leeren Sie den Papierkorb, um

// Message senders
"accessibility_senderDescription_ownMessage" = "%@ von dir";
"accessibility_senderDescription_otherMessage_group" = "%@ from %@";
"accessibility_senderDescription_otherMessage_group" = "%@ von %@";
"accessibility_senderDescription_systemMessage" = "Info: %@";

// Message types
Expand Down
Expand Up @@ -1052,8 +1052,15 @@ extension ChatViewBaseTableViewCell {
status = BundleUtil.localizedString(forKey: "accessibility_voice_message_playing")
}

var quote = ""
if let quotedMessage = message as? QuoteMessageProvider,
let quoteMessage = quotedMessage.quoteMessage {
quote =
"\(BundleUtil.localizedString(forKey: "in_reply_to")) \(quoteMessage.accessibilitySenderAndMessageTypeText) \(quoteMessage.previewText() ?? "")."
}

let labelText =
"\(message.accessibilitySenderAndMessageTypeText) \(status) \(message.customAccessibilityLabel) \(message.accessibilityDateAndState)"
"\(message.accessibilitySenderAndMessageTypeText) \(status) \(message.customAccessibilityLabel) \(quote) \(message.accessibilityDateAndState)"
return labelText
}

Expand Down
91 changes: 45 additions & 46 deletions Threema/SharedUI/Utilities/NewMessageToaster.m
Expand Up @@ -68,58 +68,57 @@ - (void)newMessageReceived:(NSNotification*)notification {
EntityManager *entityManager = [EntityManager new];
[entityManager performBlock:^{
BaseMessage *message = [[entityManager entityFetcher] existingObjectWithID:messageObjectID];
if (![message.read boolValue]) {
ContactEntity *contact = message.sender;
if (contact == nil) {
contact = message.conversation.contact;
}

// don't show toast for suppressed group ids
if (contact != nil) {
PushSetting *pushSetting = [PushSetting pushSettingForContact:contact];
if (![pushSetting canSendPushForBaseMessage:message]) {
return;
}
}

/* No toast if disabled, a system message or passcode showing */
if (![UserSettings sharedUserSettings].inAppPreview ||
[message isKindOfClass:[SystemMessage class]] || [AppDelegate sharedAppDelegate].isAppLocked)
return;

/* Are we currently in the foreground? */
if (![AppDelegate sharedAppDelegate].active) {
[queue addObject:notification];
ContactEntity *contact = message.sender;
if (contact == nil) {
contact = message.conversation.contact;
}

// don't show toast for suppressed group ids
if (contact != nil) {
PushSetting *pushSetting = [PushSetting pushSettingForContact:contact];
if (![pushSetting canSendPushForBaseMessage:message]) {
return;
}

/* Is this for the currently visible conversation? */
UITabBarController *mainTabBar = [AppDelegate getMainTabBarController];
if ([mainTabBar viewControllers].count <= kChatTabBarIndex) {
}

/* No toast if disabled, a system message or passcode showing */
if (![UserSettings sharedUserSettings].inAppPreview ||
[message isKindOfClass:[SystemMessage class]] || [AppDelegate sharedAppDelegate].isAppLocked)
return;

/* Are we currently in the foreground? */
if (![AppDelegate sharedAppDelegate].active) {
[queue addObject:notification];
return;
}

/* Is this for the currently visible conversation? */
UITabBarController *mainTabBar = [AppDelegate getMainTabBarController];
if ([mainTabBar viewControllers].count <= kChatTabBarIndex) {
return;
}
UINavigationController *chatNavVc = [[mainTabBar viewControllers] objectAtIndex:kChatTabBarIndex];

DDLogVerbose(@"curNavController: %@", chatNavVc);
if ([chatNavVc.topViewController isKindOfClass:[Old_ChatViewController class]]) {
Old_ChatViewController *curChatVc = (Old_ChatViewController*)chatNavVc.topViewController;
if (curChatVc.conversation.objectID == message.conversation.objectID)
return;
}
UINavigationController *chatNavVc = [[mainTabBar viewControllers] objectAtIndex:kChatTabBarIndex];

DDLogVerbose(@"curNavController: %@", chatNavVc);
if ([chatNavVc.topViewController isKindOfClass:[Old_ChatViewController class]]) {
Old_ChatViewController *curChatVc = (Old_ChatViewController*)chatNavVc.topViewController;
if (curChatVc.conversation.objectID == message.conversation.objectID)
return;
}

if ([chatNavVc.topViewController isKindOfClass:[ChatViewController class]]) {
ChatViewController *curChatVc = (ChatViewController*)chatNavVc.topViewController;
if (curChatVc.conversation.objectID == message.conversation.objectID) {
if (UIAccessibilityIsVoiceOverRunning()) {
NSString *accessibilityText = [NSString stringWithFormat:@"%@%@", [BundleUtil localizedStringForKey:@"new_message_accessibility"], [message previewText]];
UIAccessibilityPostNotification(UIAccessibilityAnnouncementNotification, accessibilityText);
}
return;
}

if ([chatNavVc.topViewController isKindOfClass:[ChatViewController class]]) {
ChatViewController *curChatVc = (ChatViewController*)chatNavVc.topViewController;
if (curChatVc.conversation.objectID == message.conversation.objectID) {
if (UIAccessibilityIsVoiceOverRunning()) {
NSString *accessibilityText = [NSString stringWithFormat:@"%@%@", [BundleUtil localizedStringForKey:@"new_message_accessibility"], [message previewText]];
UIAccessibilityPostNotification(UIAccessibilityAnnouncementNotification, accessibilityText);
}
return;
}

[NotificationBannerHelper newBannerWithBaseMessage: message];
}


[NotificationBannerHelper newBannerWithBaseMessage: message];
}];
}
}
Expand Down
2 changes: 2 additions & 0 deletions ThreemaFramework/Message/EncoderDecoder/MessageDecoder.m
Expand Up @@ -186,6 +186,8 @@ + (AbstractMessage*)decodeEncapsulated:(NSData*)data outer:(AbstractMessage*)out
msg.sendUserAck = outer.sendUserAck;
msg.nonce = outer.nonce;
msg.flags = outer.flags;
msg.receivedAfterInitialQueueSend = outer.receivedAfterInitialQueueSend;
msg.pushFromName = outer.pushFromName;
}

return msg;
Expand Down
Expand Up @@ -376,7 +376,11 @@ public class PendingUserNotificationManager: NSObject, PendingUserNotificationMa
public func isProcessed(pendingUserNotification: PendingUserNotification) -> Bool {
var isProcessed = isProcessed(key: pendingUserNotification.key)
if !isProcessed,
(pendingUserNotification.stage == .final && pendingUserNotification.fireDate == nil)
(
pendingUserNotification.stage == .final && pendingUserNotification
.fireDate == nil &&
!(pendingUserNotification.abstractMessage?.receivedAfterInitialQueueSend ?? false)
)
|| (pendingUserNotification.fireDate != nil && pendingUserNotification.fireDate! < Date()) {

addAsProcessed(pendingUserNotification: pendingUserNotification)
Expand Down
18 changes: 14 additions & 4 deletions ThreemaFramework/Notification/UserNotificationManager.swift
Expand Up @@ -152,10 +152,20 @@ public class UserNotificationManager: UserNotificationManagerProtocol {
if userNotificationContent.isGroupMessage {
userNotificationContent.title = baseMessage.conversation?.groupName ?? userNotificationContent
.fromName
userNotificationContent.body = TextStyleUtils
.makeMentionsString(
forText: "\(userNotificationContent.fromName!): \(baseMessage.previewText()!)"
)
// If we have create a communication notification, we don't add the name
if notificationType == .complete {
userNotificationContent.body = TextStyleUtils
.makeMentionsString(
forText: baseMessage.previewText()!
)
}
else {
userNotificationContent.body = TextStyleUtils
.makeMentionsString(
forText: "\(userNotificationContent.fromName!): \(baseMessage.previewText()!)"
)
}

userNotificationContent.groupID = baseMessage.conversation.groupID!
.base64EncodedString(options: NSData.Base64EncodingOptions(rawValue: 0))
}
Expand Down
10 changes: 7 additions & 3 deletions Vendor/KKPasscodeLock/KKPasscodeSettingsViewController.m
Expand Up @@ -46,7 +46,9 @@ - (void)viewDidLoad
_touchIdSwitch = [[UISwitch alloc] init];
[_touchIdSwitch addTarget:self action:@selector(touchIdSwitchChanged:) forControlEvents:UIControlEventValueChanged];

self.navigationItem.largeTitleDisplayMode = UINavigationItemLargeTitleDisplayModeNever;
if (@available(iOS 11.0, *)) {
self.navigationItem.largeTitleDisplayMode = UINavigationItemLargeTitleDisplayModeNever;
}
}

- (void)viewDidUnload
Expand Down Expand Up @@ -142,8 +144,10 @@ - (NSString *)touchIdType {
LAContext *context = [LAContext new];
if ([context canEvaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics error:nil]) {
BOOL haveFaceId = NO;
if (context.biometryType == LABiometryTypeFaceID) {
haveFaceId = YES;
if (@available(iOS 11.0, *)) {
if (context.biometryType == LABiometryTypeFaceID) {
haveFaceId = YES;
}
}

if (haveFaceId) {
Expand Down
4 changes: 2 additions & 2 deletions xcconfig/VersionBuildInfo.xcconfig
Expand Up @@ -21,5 +21,5 @@
// Configuration settings file format documentation can be found at:
// https://help.apple.com/xcode/#/dev745c5c974

VERSION_NUMBER=5.1
BUILD_NUMBER=3020
VERSION_NUMBER=5.1.1
BUILD_NUMBER=3028

0 comments on commit ae2a8fd

Please sign in to comment.