diff --git a/Monal/Classes/BackgroundSettings.swift b/Monal/Classes/BackgroundSettings.swift index f5bd3ad035..bbb0985c9f 100644 --- a/Monal/Classes/BackgroundSettings.swift +++ b/Monal/Classes/BackgroundSettings.swift @@ -125,7 +125,7 @@ struct BackgroundSettings: View { } } } - .navigationBarTitle(contact != nil ? Text("Contact Background") : Text("Default Background")) + .navigationBarTitle(contact != nil ? Text("Chat Background") : Text("Default Background")) .onChange(of:inputImage) { _ in MLImageManager.sharedInstance().saveBackgroundImageData(inputImage?.pngData(), for:self.contact?.obj) } diff --git a/Monal/Classes/ContactDetails.swift b/Monal/Classes/ContactDetails.swift index 31a3685489..32c5177399 100644 --- a/Monal/Classes/ContactDetails.swift +++ b/Monal/Classes/ContactDetails.swift @@ -49,18 +49,15 @@ struct ContactDetails: View { if(contact.isMuted) { Image(systemName: "bell.slash.fill") .foregroundColor(.red) - Text("Contact is muted") - .foregroundColor(.accentColor) + contact.isGroup ? Text("Notifications disabled") : Text("Contact is muted") } else if(contact.isGroup && contact.isMentionOnly) { Image(systemName: "bell.badge") .foregroundColor(.accentColor) - Text("Group/Channel is mention only") - .foregroundColor(.accentColor) + Text("Notify only when mentioned") } else { Image(systemName: "bell.fill") .foregroundColor(.green) - Text("Contact is not muted") - .foregroundColor(.accentColor) + contact.isGroup ? Text("Notify on all messages") : Text("Contact is not muted") } } } @@ -115,7 +112,7 @@ struct ContactDetails: View { #endif if(!contact.isGroup && !contact.isSelfChat) { - TextField("Change Nickname", text: $contact.nickNameView) + TextField("Rename Contact", text: $contact.nickNameView) .textFieldStyle(RoundedBorderTextFieldStyle()) .addClearButton(text:$contact.nickNameView) } @@ -157,7 +154,7 @@ struct ContactDetails: View { } NavigationLink(destination: LazyClosureView(BackgroundSettings(contact:contact, delegate:delegate))) { - Text("Change Contact Background") + Text("Change Chat Background") } } .listStyle(.plain) diff --git a/Monal/Classes/ContactDetailsHeader.swift b/Monal/Classes/ContactDetailsHeader.swift index 4f9af126c4..c657df9b09 100644 --- a/Monal/Classes/ContactDetailsHeader.swift +++ b/Monal/Classes/ContactDetailsHeader.swift @@ -22,7 +22,7 @@ struct ContactDetailsHeader: View { Spacer() Image(uiImage: contact.avatar) .resizable() - .frame(minWidth: 100, idealWidth: 150, maxWidth: 200, minHeight: 100, idealHeight: 150, maxHeight: 200, alignment: .center) + .frame(width: 150, height: 150, alignment: .center) .scaledToFit() .shadow(radius: 7) Spacer() diff --git a/Monal/Classes/MLIQProcessor.m b/Monal/Classes/MLIQProcessor.m index 6c79d880a2..8265fed37c 100644 --- a/Monal/Classes/MLIQProcessor.m +++ b/Monal/Classes/MLIQProcessor.m @@ -526,6 +526,9 @@ +(BOOL) processRosterWithAccount:(xmpp*) account andIqNode:(XMPPIQ*) iqNode if([features containsObject:@"urn:xmpp:ping"]) account.connectionProperties.supportsPing = YES; + if([features containsObject:@"urn:xmpp:extdisco:2"]) + account.connectionProperties.supportsExternalServiceDiscovery = YES; + if([features containsObject:@"urn:xmpp:blocking"]) { account.connectionProperties.supportsBlocking = YES; @@ -537,7 +540,7 @@ +(BOOL) processRosterWithAccount:(xmpp*) account andIqNode:(XMPPIQ*) iqNode DDLogInfo(@"supports http upload with server: %@", iqNode.from); account.connectionProperties.supportsHTTPUpload = YES; account.connectionProperties.uploadServer = iqNode.from; - account.connectionProperties.uploadSize = [[iqNode findFirst:@"{http://jabber.org/protocol/disco#info}query/\\{urn:xmpp:http:upload}result@max-file-size\\|int"] integerValue]; + account.connectionProperties.uploadSize = [[iqNode findFirst:@"{http://jabber.org/protocol/disco#info}query/\\{urn:xmpp:http:upload:0}result@max-file-size\\|int"] integerValue]; DDLogInfo(@"Upload max filesize: %lu", account.connectionProperties.uploadSize); } $$ @@ -550,7 +553,7 @@ +(BOOL) processRosterWithAccount:(xmpp*) account andIqNode:(XMPPIQ*) iqNode DDLogInfo(@"supports http upload with server: %@", iqNode.from); account.connectionProperties.supportsHTTPUpload = YES; account.connectionProperties.uploadServer = iqNode.from; - account.connectionProperties.uploadSize = [[iqNode findFirst:@"{http://jabber.org/protocol/disco#info}query/\\{urn:xmpp:http:upload}result@max-file-size\\|int"] integerValue]; + account.connectionProperties.uploadSize = [[iqNode findFirst:@"{http://jabber.org/protocol/disco#info}query/\\{urn:xmpp:http:upload:0}result@max-file-size\\|int"] integerValue]; DDLogInfo(@"Upload max filesize: %lu", account.connectionProperties.uploadSize); } diff --git a/Monal/Classes/MLImageManager.m b/Monal/Classes/MLImageManager.m index 925254413b..97cc9543d4 100644 --- a/Monal/Classes/MLImageManager.m +++ b/Monal/Classes/MLImageManager.m @@ -7,6 +7,7 @@ // #import "MLImageManager.h" +#import "MLXMPPManager.h" #import "HelperTools.h" #import "DataLayer.h" #import "AESGcm.h" @@ -180,7 +181,16 @@ -(UIImage*) outboundImage -(UIImage*) generateDummyIconForContact:(MLContact*) contact { - NSString* contactLetter = [[[contact contactDisplayName] substringToIndex:1] uppercaseString]; + NSString* contactLetter; + + if(contact.isSelfChat) + { + xmpp* account = [[MLXMPPManager sharedInstance] getConnectedAccountForID:contact.accountId]; + contactLetter = [[[MLContact ownDisplayNameForAccount:account] substringToIndex:1] uppercaseString]; + } + else + contactLetter = [[[contact contactDisplayName] substringToIndex:1] uppercaseString]; + UIColor* background = [HelperTools generateColorFromJid:contact.contactJid]; UIColor* foreground = [UIColor blackColor]; if(![background isLightColor]) diff --git a/Monal/Classes/MLMessageProcessor.m b/Monal/Classes/MLMessageProcessor.m index 0b0e7c7bc4..9ca0c08e02 100644 --- a/Monal/Classes/MLMessageProcessor.m +++ b/Monal/Classes/MLMessageProcessor.m @@ -233,10 +233,17 @@ +(MLMessage* _Nullable) processMessage:(XMPPMessage*) messageNode andOuterMessag DDLogVerbose(@"Not a carbon copy of a muc pm for contact: %@", carbonTestContact); } + NSString* possibleUnkownContact; + if([messageNode.fromUser isEqualToString:account.connectionProperties.identity.jid]) + possibleUnkownContact = messageNode.toUser; + else + possibleUnkownContact = messageNode.fromUser; + if(([messageNode check:@"/"] || [messageNode check:@"{http://jabber.org/protocol/muc#user}x"]) && ![messageNode check:@"{http://jabber.org/protocol/muc#user}x/invite"]) { - // Ignore all group chat msgs from unkown groups - if([[DataLayer sharedInstance] isContactInList:messageNode.fromUser forAccount:account.accountNo] == NO) + // Ignore all group chat msgs from unkown groups or 1:1 chats + MLContact* mucTestContact = [MLContact createContactFromJid:possibleUnkownContact andAccountNo:account.accountNo]; + if([[DataLayer sharedInstance] isContactInList:messageNode.fromUser forAccount:account.accountNo] == NO || !mucTestContact.isGroup) { // ignore message DDLogWarn(@"Ignoring groupchat message from %@", messageNode.toUser); @@ -245,12 +252,6 @@ +(MLMessage* _Nullable) processMessage:(XMPPMessage*) messageNode andOuterMessag } else { - NSString* possibleUnkownContact; - if([messageNode.fromUser isEqualToString:account.connectionProperties.identity.jid]) - possibleUnkownContact = messageNode.toUser; - else - possibleUnkownContact = messageNode.fromUser; - // handle KeyTransportMessages directly without adding a 1:1 buddy if([messageNode check:@"{eu.siacs.conversations.axolotl}encrypted/header"] == YES && [messageNode check:@"{eu.siacs.conversations.axolotl}encrypted/payload#"] == NO) { diff --git a/Monal/Classes/MLServerDetails.m b/Monal/Classes/MLServerDetails.m index 1b4dea7f9d..5a43557321 100644 --- a/Monal/Classes/MLServerDetails.m +++ b/Monal/Classes/MLServerDetails.m @@ -60,6 +60,14 @@ - (void)didReceiveMemoryWarning { -(void) checkServerCaps:(MLXMPPConnection*) connection { + // supportsPubSub + [self.serverCaps addObject:@{ + // see MLIQProcessor.m multiple xep required for pubsub + @"Title":NSLocalizedString(@"XEP-0163 Personal Eventing Protocol", @""), + @"Description":NSLocalizedString(@"This specification defines semantics for using the XMPP publish-subscribe protocol to broadcast state change events associated with an instant messaging and presence account.", @""), + @"Color": connection.supportsPubSub ? (connection.supportsModernPubSub ? @"Green" : @"Yellow") : @"Red" + }]; + // supportsBlocking [self.serverCaps addObject:@{ @"Title":NSLocalizedString(@"XEP-0191: Blocking Command", @""), @@ -85,7 +93,7 @@ -(void) checkServerCaps:(MLXMPPConnection*) connection [self.serverCaps addObject:@{ @"Title":NSLocalizedString(@"XEP-0215: External Service Discovery", @""), @"Description":NSLocalizedString(@"XMPP protocol extension for discovering services external to the XMPP network, like STUN or TURN servers needed for A/V calls.", @""), - @"Color": connection.supportsPing ? @"Green" : @"Red" + @"Color": connection.supportsExternalServiceDiscovery ? @"Green" : @"Red" }]; // supportsRosterVersion @@ -137,14 +145,6 @@ -(void) checkServerCaps:(MLXMPPConnection*) connection @"Color": connection.supportsRosterPreApproval ? @"Green" : @"Red" }]; - // supportsPubSub - [self.serverCaps addObject:@{ - // see MLIQProcessor.m multiple xep required for pubsub - @"Title":NSLocalizedString(@"XEP-0163 Personal Eventing Protocol", @""), - @"Description":NSLocalizedString(@"This specification defines semantics for using the XMPP publish-subscribe protocol to broadcast state change events associated with an instant messaging and presence account.", @""), - @"Color": connection.supportsPubSub ? (connection.supportsModernPubSub ? @"Green" : @"Yellow") : @"Red" - }]; - // supportsSSDP [self.serverCaps addObject:@{ // see MLIQProcessor.m multiple xep required for pubsub diff --git a/Monal/Classes/MLXMPPConnection.h b/Monal/Classes/MLXMPPConnection.h index bf2202c5d9..75856aca68 100644 --- a/Monal/Classes/MLXMPPConnection.h +++ b/Monal/Classes/MLXMPPConnection.h @@ -54,6 +54,7 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic, assign) BOOL supportsBlocking; @property (nonatomic, assign) BOOL supportsPing; +@property (nonatomic, assign) BOOL supportsExternalServiceDiscovery; @property (nonatomic, assign) BOOL supportsPubSub; @property (nonatomic, assign) BOOL supportsPubSubMax; @property (nonatomic, assign) BOOL supportsModernPubSub; diff --git a/Monal/Classes/chatViewController.m b/Monal/Classes/chatViewController.m index fd47eac18a..a115264390 100644 --- a/Monal/Classes/chatViewController.m +++ b/Monal/Classes/chatViewController.m @@ -2335,7 +2335,7 @@ -(void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath if([info[@"mimeType"] hasPrefix:@"image/gif"]) animatedImageData = [NSData dataWithContentsOfFile:info[@"cacheFile"]]; UIViewController* imageViewer = [[SwiftuiInterface new] makeImageViewer:image withFilename:info[@"filename"] andAnimatedImageData:animatedImageData]; - imageViewer.modalPresentationStyle = UIModalPresentationFullScreen; + imageViewer.modalPresentationStyle = UIModalPresentationOverFullScreen; [self presentViewController:imageViewer animated:YES completion:^{}]; }); } diff --git a/Monal/Classes/xmpp.m b/Monal/Classes/xmpp.m index dafffa7ac5..e31ad83a31 100644 --- a/Monal/Classes/xmpp.m +++ b/Monal/Classes/xmpp.m @@ -3333,6 +3333,7 @@ -(void) realPersistState [values setObject:[NSNumber numberWithBool:self.connectionProperties.supportsModernPubSub] forKey:@"supportsModernPubSub"]; [values setObject:[NSNumber numberWithBool:self.connectionProperties.supportsHTTPUpload] forKey:@"supportsHTTPUpload"]; [values setObject:[NSNumber numberWithBool:self.connectionProperties.supportsPing] forKey:@"supportsPing"]; + [values setObject:[NSNumber numberWithBool:self.connectionProperties.supportsExternalServiceDiscovery] forKey:@"supportsExternalServiceDiscovery"]; [values setObject:[NSNumber numberWithBool:self.connectionProperties.supportsRosterPreApproval] forKey:@"supportsRosterPreApproval"]; [values setObject:[NSNumber numberWithBool:self.connectionProperties.supportsBlocking] forKey:@"supportsBlocking"]; [values setObject:[NSNumber numberWithBool:self.connectionProperties.accountDiscoDone] forKey:@"accountDiscoDone"]; @@ -3531,6 +3532,12 @@ -(void) realReadState self.connectionProperties.supportsPing = supportsPing.boolValue; } + if([dic objectForKey:@"supportsExternalServiceDiscovery"]) + { + NSNumber* supportsExternalServiceDiscovery = [dic objectForKey:@"supportsExternalServiceDiscovery"]; + self.connectionProperties.supportsExternalServiceDiscovery = supportsExternalServiceDiscovery.boolValue; + } + if([dic objectForKey:@"lastInteractionDate"]) _lastInteractionDate = [dic objectForKey:@"lastInteractionDate"]; @@ -3826,6 +3833,7 @@ -(void) initSession self.connectionProperties.supportsModernPubSub = NO; self.connectionProperties.supportsHTTPUpload = NO; self.connectionProperties.supportsPing = NO; + self.connectionProperties.supportsExternalServiceDiscovery = NO; self.connectionProperties.supportsRosterPreApproval = NO; //clear list of running mam queries