Skip to content

Commit

Permalink
6.4.7 (#1308)
Browse files Browse the repository at this point in the history
- Add Arabic appstore description
- Fix crashes when backgrounding app
- Fix some more rare crashes
  • Loading branch information
tmolitor-stud-tu authored Dec 1, 2024
2 parents cbff369 + 561533d commit 6544999
Show file tree
Hide file tree
Showing 11 changed files with 118 additions and 73 deletions.
10 changes: 6 additions & 4 deletions Monal/Classes/DataLayer.m
Original file line number Diff line number Diff line change
Expand Up @@ -381,12 +381,14 @@ -(void) persistState:(NSDictionary*) state forAccount:(NSNumber*) accountNo

-(BOOL) addSelfChatForAccount:(NSNumber*) accountNo
{
BOOL encrypt = NO;
return [self.db boolWriteTransaction:^{
BOOL encrypt = NO;
#ifndef DISABLE_OMEMO
encrypt = [[HelperTools defaultsDB] boolForKey:@"OMEMODefaultOn"];
encrypt = [[HelperTools defaultsDB] boolForKey:@"OMEMODefaultOn"];
#endif// DISABLE_OMEMO
NSDictionary* accountDetails = [self detailsForAccount:accountNo];
return [self.db executeNonQuery:@"INSERT INTO buddylist ('account_id', 'buddy_name', 'full_name', 'nick_name', 'muc', 'muc_nick', 'encrypt') VALUES(?, ?, ?, ?, ?, ?, ?) ON CONFLICT(account_id, buddy_name) DO UPDATE SET subscription='both';" andArguments:@[accountNo, [NSString stringWithFormat:@"%@@%@", accountDetails[kUsername], accountDetails[kDomain]], @"", @"", @0, @"", @(encrypt)]];
NSDictionary* accountDetails = [self detailsForAccount:accountNo];
return [self.db executeNonQuery:@"INSERT INTO buddylist ('account_id', 'buddy_name', 'full_name', 'nick_name', 'muc', 'muc_nick', 'encrypt') VALUES(?, ?, ?, ?, ?, ?, ?) ON CONFLICT(account_id, buddy_name) DO UPDATE SET subscription='both';" andArguments:@[accountNo, [NSString stringWithFormat:@"%@@%@", accountDetails[kUsername], accountDetails[kDomain]], @"", @"", @0, @"", @(encrypt)]];
}];
}

-(BOOL) addContact:(NSString*) contact forAccount:(NSNumber*) accountNo nickname:(NSString*) nickName
Expand Down
2 changes: 2 additions & 0 deletions Monal/Classes/HelperTools.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ void swizzle(Class c, SEL orig, SEL new);
+(void) installExceptionHandler;
+(int) pendingCrashreportCount;
+(void) flushLogsWithTimeout:(double) timeout;
+(void) signalSuspension;
+(void) signalResumption;
+(void) __attribute__((noreturn)) MLAssertWithText:(NSString*) text andUserData:(id _Nullable) additionalData andFile:(const char* const) file andLine:(int) line andFunc:(const char* const) func;
+(void) __attribute__((noreturn)) handleRustPanicWithText:(NSString*) text andBacktrace:(NSString*) backtrace;
+(void) __attribute__((noreturn)) throwExceptionWithName:(NSString*) name reason:(NSString*) reason userInfo:(NSDictionary* _Nullable) userInfo;
Expand Down
31 changes: 31 additions & 0 deletions Monal/Classes/HelperTools.m
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ -(void) invalidate;
static char _origLogfilePath[1024] = "";
static char _logfilePath[1024] = "";
static NSObject* _isAppExtensionLock = nil;
static NSObject* _suspensionHandlingLock = nil;
static BOOL _suspensionHandlingIsSuspended = NO;
static NSMutableDictionary* _versionInfoCache;
static MLStreamRedirect* _stdoutRedirector = nil;
static MLStreamRedirect* _stderrRedirector = nil;
Expand Down Expand Up @@ -295,6 +297,8 @@ @implementation HelperTools

+(void) initialize
{
_suspensionHandlingLock = [NSObject new];
_suspensionHandlingIsSuspended = NO;
_isAppExtensionLock = [NSObject new];
_versionInfoCache = [NSMutableDictionary new];

Expand Down Expand Up @@ -1874,6 +1878,33 @@ +(void) flushLogsWithTimeout:(double) timeout
[MLUDPLogger flushWithTimeout:timeout];
}

+(void) signalSuspension
{
@synchronized(_suspensionHandlingLock) {
if(!_suspensionHandlingIsSuspended)
{
DDLogVerbose(@"Suspending logger queue...");
[HelperTools flushLogsWithTimeout:0.100];
dispatch_suspend([DDLog loggingQueue]);
_suspensionHandlingIsSuspended = YES;
}
}
DDLogVerbose(@"Posting kMonalIsFreezed notification now...");
[[NSNotificationCenter defaultCenter] postNotificationName:kMonalIsFreezed object:nil];
}

+(void) signalResumption
{
@synchronized(_suspensionHandlingLock) {
if(_suspensionHandlingIsSuspended)
{
DDLogVerbose(@"Resuming logger queue...");
dispatch_resume([DDLog loggingQueue]);
_suspensionHandlingIsSuspended = NO;
}
}
}

+(void) configureXcodeLogging
{
//only start console logger
Expand Down
13 changes: 0 additions & 13 deletions Monal/Classes/MLMucProcessor.m
Original file line number Diff line number Diff line change
Expand Up @@ -528,10 +528,6 @@ -(void) configureMuc:(NSString*) roomJid withMandatoryOptions:(NSDictionary*) ma
$$

$$instance_handler(handleRoomConfigForm, account.mucProcessor, $$ID(xmpp*, account), $$ID(XMPPIQ*, iqNode), $$ID(NSString*, roomJid), $$ID(NSDictionary*, mandatoryOptions), $$ID(NSDictionary*, optionalOptions), $$BOOL(deleteOnError), $$BOOL(joinOnSuccess))
MLAssert([iqNode.fromUser isEqualToString:roomJid], @"Room config form response jid not matching query jid!", (@{
@"iqNode.fromUser": [NSString stringWithFormat:@"%@", iqNode.fromUser],
@"roomJid": [NSString stringWithFormat:@"%@", roomJid],
}));
if([iqNode check:@"/<type=error>"])
{
DDLogError(@"Failed to fetch room config form for '%@': %@", roomJid, [iqNode findFirst:@"error"]);
Expand Down Expand Up @@ -619,10 +615,6 @@ -(void) configureMuc:(NSString*) roomJid withMandatoryOptions:(NSDictionary*) ma
[self handleError:[NSString stringWithFormat:NSLocalizedString(@"Could not configure group '%@'", @""), roomJid] forMuc:roomJid withNode:iqNode andIsSevere:YES];
return;
}
MLAssert([iqNode.fromUser isEqualToString:roomJid], @"Room config form response jid not matching query jid!", (@{
@"iqNode.fromUser": [NSString stringWithFormat:@"%@", iqNode.fromUser],
@"roomJid": [NSString stringWithFormat:@"%@", roomJid],
}));

//don't call success handler if we are only "half-joined" (see comments below for what that means)
if(joinOnSuccess)
Expand Down Expand Up @@ -1327,11 +1319,6 @@ -(void) publishAvatar:(UIImage* _Nullable) image forMuc:(NSString*) room
$$

$$instance_handler(handleDiscoResponse, account.mucProcessor, $$ID(xmpp*, account), $$ID(XMPPIQ*, iqNode), $$ID(NSString*, roomJid), $$BOOL(join), $$BOOL(updateBookmarks))
MLAssert([iqNode.fromUser isEqualToString:roomJid], @"Disco response jid not matching query jid!", (@{
@"iqNode.fromUser": [NSString stringWithFormat:@"%@", iqNode.fromUser],
@"roomJid": [NSString stringWithFormat:@"%@", roomJid],
}));

//no matter what the disco response is: we are not creating this muc anymore
//either because we successfully created it and called join afterwards,
//or because the user tried to simultaneously create and join this muc (the join has precendence in this case)
Expand Down
49 changes: 24 additions & 25 deletions Monal/Classes/MonalAppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,9 @@ -(void) updateUnread

-(BOOL) application:(UIApplication*) application willFinishLaunchingWithOptions:(NSDictionary*) launchOptions
{
//resume logging and other core tasks
[HelperTools signalResumption];

DDLogInfo(@"App launching with options: %@", launchOptions);

//init IPC and ProcessLock
Expand Down Expand Up @@ -662,6 +665,9 @@ -(void) windowHandling:(NSNotification*) notification
}
else if([notification.name isEqualToString:@"NSWindowDidBecomeKeyNotification"])
{
//resume logging and other core tasks
[HelperTools signalResumption];

DDLogInfo(@"Window got focus (key window)...");
[MLProcessLock lock];
@synchronized(self) {
Expand Down Expand Up @@ -1151,6 +1157,9 @@ -(void) prepareForFreeze:(NSNotification*) notification

-(void) applicationWillEnterForeground:(UIApplication*) application
{
//resume logging and other core tasks
[HelperTools signalResumption];

DDLogInfo(@"Entering FG");
[MLProcessLock lock];

Expand Down Expand Up @@ -1256,6 +1265,7 @@ -(void) applicationWillTerminate:(UIApplication *)application
[[MLXMPPManager sharedInstance] disconnectAll];
DDLogInfo(@"|~~| T E R M I N A T E D |~~|");
[DDLog flushLog];
[HelperTools flushLogsWithTimeout:0.025];
}
}

Expand Down Expand Up @@ -1464,11 +1474,7 @@ -(void) checkIfBackgroundTaskIsStillNeeded
[DDLog flushLog];
}
else
{
DDLogVerbose(@"Posting kMonalIsFreezed notification now...");
[[NSNotificationCenter defaultCenter] postNotificationName:kMonalIsFreezed object:nil];
[HelperTools flushLogsWithTimeout:0.100];
}
[HelperTools signalSuspension];
}];
}
}
Expand Down Expand Up @@ -1525,11 +1531,7 @@ -(void) addBackgroundTask
[[UIApplication sharedApplication] endBackgroundTask:task];

if(stopped)
{
DDLogVerbose(@"Posting kMonalIsFreezed notification now...");
[[NSNotificationCenter defaultCenter] postNotificationName:kMonalIsFreezed object:nil];
[HelperTools flushLogsWithTimeout:0.100];
}
[HelperTools signalSuspension];
}
}];
}
Expand Down Expand Up @@ -1588,15 +1590,14 @@ -(void) handleBackgroundProcessingTask:(BGTask*) task
[task setTaskCompletedWithSuccess:!background];

if(stopped)
{
DDLogVerbose(@"Posting kMonalIsFreezed notification now...");
[[NSNotificationCenter defaultCenter] postNotificationName:kMonalIsFreezed object:nil];
[HelperTools flushLogsWithTimeout:0.100];
}
[HelperTools signalSuspension];
}
}];
};

//resume logging and other core tasks
[HelperTools signalResumption];

//only proceed with our BGTASK if the NotificationServiceExtension is not running
[MLProcessLock lock];
[[IPC sharedInstance] sendMessage:@"Monal.disconnectAll" withData:nil to:@"NotificationServiceExtension"];
Expand Down Expand Up @@ -1696,15 +1697,14 @@ -(void) handleBackgroundRefreshingTask:(BGTask*) task
[task setTaskCompletedWithSuccess:!background];

if(stopped)
{
DDLogVerbose(@"Posting kMonalIsFreezed notification now...");
[[NSNotificationCenter defaultCenter] postNotificationName:kMonalIsFreezed object:nil];
[HelperTools flushLogsWithTimeout:0.100];
}
[HelperTools signalSuspension];
}
}];
};

//resume logging and other core tasks
[HelperTools signalResumption];

//only proceed with our BGTASK if the NotificationServiceExtension is not running
[MLProcessLock lock];
[[IPC sharedInstance] sendMessage:@"Monal.disconnectAll" withData:nil to:@"NotificationServiceExtension"];
Expand Down Expand Up @@ -1845,6 +1845,9 @@ -(void) connectIfNecessaryWithOptions:(NSDictionary*) options

-(void) incomingWakeupWithCompletionHandler:(void (^)(UIBackgroundFetchResult result)) completionHandler
{
//resume logging and other core tasks
[HelperTools signalResumption];

if(![HelperTools isInBackground])
{
DDLogWarn(@"Ignoring incomingWakeupWithCompletionHandler: because app is in FG!");
Expand Down Expand Up @@ -1918,11 +1921,7 @@ -(void) incomingWakeupWithCompletionHandler:(void (^)(UIBackgroundFetchResult re
completionHandler(UIBackgroundFetchResultFailed);

if(stopped)
{
DDLogVerbose(@"Posting kMonalIsFreezed notification now...");
[[NSNotificationCenter defaultCenter] postNotificationName:kMonalIsFreezed object:nil];
[HelperTools flushLogsWithTimeout:0.100];
}
[HelperTools signalSuspension];

//trigger disconnect if we are idle and no timer is blocking us now
if(self->_bgTask != UIBackgroundTaskInvalid || self->_bgProcessing != nil || self->_bgRefreshing != nil)
Expand Down
62 changes: 31 additions & 31 deletions Monal/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3,66 +3,66 @@ PODS:
- CropViewController (2.7.4)
- DZNEmptyDataSet (1.8.1)
- FLAnimatedImage (1.0.17)
- KSCrash/Core (1.17.4):
- KSCrash/Core (1.17.7):
- KSCrash/Reporting/Filters/Basic
- KSCrash/Recording (1.17.4):
- KSCrash/Recording/Tools (= 1.17.4)
- KSCrash/Recording/Tools (1.17.4)
- KSCrash/Reporting/Filters/AppleFmt (1.17.4):
- KSCrash/Recording (1.17.7):
- KSCrash/Recording/Tools (= 1.17.7)
- KSCrash/Recording/Tools (1.17.7)
- KSCrash/Reporting/Filters/AppleFmt (1.17.7):
- KSCrash/Recording
- KSCrash/Reporting/Filters/Base
- KSCrash/Reporting/Filters/Base (1.17.4):
- KSCrash/Reporting/Filters/Base (1.17.7):
- KSCrash/Recording
- KSCrash/Reporting/Filters/Basic (1.17.4):
- KSCrash/Reporting/Filters/Basic (1.17.7):
- KSCrash/Recording
- KSCrash/Reporting/Filters/Base
- KSCrash/Reporting/Filters/GZip (1.17.4):
- KSCrash/Reporting/Filters/GZip (1.17.7):
- KSCrash/Recording
- KSCrash/Reporting/Filters/Base
- KSCrash/Reporting/Filters/JSON (1.17.4):
- KSCrash/Reporting/Filters/JSON (1.17.7):
- KSCrash/Recording
- KSCrash/Reporting/Filters/Base
- KSCrash/Reporting/Filters/Sets (1.17.4):
- KSCrash/Reporting/Filters/Sets (1.17.7):
- KSCrash/Recording
- KSCrash/Reporting/Filters/AppleFmt
- KSCrash/Reporting/Filters/Base
- KSCrash/Reporting/Filters/Basic
- KSCrash/Reporting/Filters/GZip
- KSCrash/Reporting/Filters/JSON
- KSCrash/Reporting/Filters/Stringify
- KSCrash/Reporting/Filters/Stringify (1.17.4):
- KSCrash/Reporting/Filters/Stringify (1.17.7):
- KSCrash/Recording
- KSCrash/Reporting/Filters/Base
- KSCrash/Reporting/Filters/Tools (1.17.4):
- KSCrash/Reporting/Filters/Tools (1.17.7):
- KSCrash/Recording
- KSCrash/Reporting/Tools (1.17.4):
- KSCrash/Reporting/Tools (1.17.7):
- KSCrash/Recording
- MarqueeLabel (4.3.2)
- MBProgressHUD (1.2.0)
- NotificationBannerSwift (3.2.1):
- MarqueeLabel (~> 4.3.0)
- SnapKit (~> 5.6.0)
- PromiseKit (8.1.1):
- PromiseKit/CorePromise (= 8.1.1)
- PromiseKit/Foundation (= 8.1.1)
- PromiseKit/UIKit (= 8.1.1)
- PromiseKit/CorePromise (8.1.1)
- PromiseKit/Foundation (8.1.1):
- PromiseKit (8.1.2):
- PromiseKit/CorePromise (= 8.1.2)
- PromiseKit/Foundation (= 8.1.2)
- PromiseKit/UIKit (= 8.1.2)
- PromiseKit/CorePromise (8.1.2)
- PromiseKit/Foundation (8.1.2):
- PromiseKit/CorePromise
- PromiseKit/UIKit (8.1.1):
- PromiseKit/UIKit (8.1.2):
- PromiseKit/CorePromise
- SAMKeychain (1.5.3)
- SDWebImage (5.19.4):
- SDWebImage/Core (= 5.19.4)
- SDWebImage/Core (5.19.4)
- SDWebImage (5.20.0):
- SDWebImage/Core (= 5.20.0)
- SDWebImage/Core (5.20.0)
- SignalProtocolC (2.3.3)
- SignalProtocolObjC (1.1.1):
- SignalProtocolC (~> 2.3.3)
- SnapKit (5.6.0)
- "sqlite3/common (3.46.0+1)"
- "sqlite3/perf-threadsafe (3.46.0+1)":
- sqlite3/common (3.47.0)
- sqlite3/perf-threadsafe (3.47.0):
- sqlite3/common
- WebRTC-lib (127.0.0)
- WebRTC-lib (130.0.0)

DEPENDENCIES:
- ASN1Decoder
Expand Down Expand Up @@ -122,18 +122,18 @@ SPEC CHECKSUMS:
CropViewController: 3489bbf95a3e11c654382b0bae08ac645cdf1b93
DZNEmptyDataSet: 9525833b9e68ac21c30253e1d3d7076cc828eaa7
FLAnimatedImage: bbf914596368867157cc71b38a8ec834b3eeb32b
KSCrash: 158a0998f08ae7d4e54ef8a2da62d6e08b46d03a
KSCrash: ea6fc545b7dbb916a141aaadd4343fb891141290
MarqueeLabel: 15e524a6762552bb279cb17438b8a94990269fb9
MBProgressHUD: 3ee5efcc380f6a79a7cc9b363dd669c5e1ae7406
NotificationBannerSwift: dce54ded532b26e30cd8e7f4d80e124a0f2ba7d1
PromiseKit: d1be44b474e5acfa16adf007a1f49f104e10fead
PromiseKit: e057b5b3c0ce9a0145674d633930924234104ee3
SAMKeychain: 483e1c9f32984d50ca961e26818a534283b4cd5c
SDWebImage: 066c47b573f408f18caa467d71deace7c0f8280d
SDWebImage: 73c6079366fea25fa4bb9640d5fb58f0893facd8
SignalProtocolC: 8092866e45b663a6bc3e45a8d13bad2571dbf236
SignalProtocolObjC: 1beb46b1d35733e7ab96a919f88bac20ec771c73
SnapKit: e01d52ebb8ddbc333eefe2132acf85c8227d9c25
sqlite3: 292c3e1bfe89f64e51ea7fc7dab9182a017c8630
WebRTC-lib: 3e56b5c5fe21b0d6b682e543c39f68c81ccc8f26
sqlite3: 0aa20658a9b238a3b1ff7175eb7bdd863b0ab4fd
WebRTC-lib: 73de4fee6337c39be0ab9ddd516dc64bb73cefc5

PODFILE CHECKSUM: e66b7bd410467c69adaa2ca9b0fca4fb025d8aa4

Expand Down
20 changes: 20 additions & 0 deletions appstore_metadata/ar-SA/description.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
لم يكن هناك وقت أفضل من الآن للانضمام إلى XMPP، شبكة دردشة عامة حرة لا يتحكم أو يمتلكها أحد. Monal وسيلة سريعة وسهلة للتعامل مع XMPP. ما عليك سوى تنزيل التطبيق، وتسجيل الدخول أو التسجيل، وستكون جاهزًا للدردشة في غضون دقائق. يبدو ويعمل بنفس الطريقة التي تعمل بها التطبيقات الأخرى، لذا لا داعي لـ "تعلم XMPP" أو حتى الاهتمام بما هو عليه.

الميزات:
- مفتوح المصدر
- بلا اعلانات! يركز على الخصوصية. بلا برمجيات تتبع.
- لا يقرأ اي بيانات شخصية.
- من خلال الاتصال المباشر بخادمك، لن يتم إرسال كلمة مرورك وجميع المعلومات الأخرى إلى جهة خارجية أبدًا.
- تشفير المحادثة بـ OMEMO.
- يعمل مع خوادم XMPP الخاصة بالشركات التي تتطلب VPN.
- المحادثة المتعددة مدعومة للمجموعات Multi user chat (MUC).
- مكالمات صوتية/فيديو.

Implements certain XMPP extensions intended to improve mobile communication:
- XEP-0357: Push Notifications
- XEP-0280: Message Carbons keep messages in synch between clients
- XEP-0198: Stream Management to quickly reconnect
- XEP-0199: XMPP Ping to maintain connections
- XEP-0313: Message Archive Management to download chat history
- XEP-0352: Client State Indication for dramatic reduction on power use
- XEP-0363: HTTP File Upload to send images in conversations
1 change: 1 addition & 0 deletions appstore_metadata/ar-SA/keywords.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
xmpp, jabber, chat, instant messaging, messaging, ejabberd, prosody, OMEMO
1 change: 1 addition & 0 deletions appstore_metadata/ar-SA/marketing_url.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
https://monal-im.org/
1 change: 1 addition & 0 deletions appstore_metadata/ar-SA/privacy_url.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
https://monal-im.org/privacy/
1 change: 1 addition & 0 deletions appstore_metadata/ar-SA/support_url.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
https://monal-im.org/support/

0 comments on commit 6544999

Please sign in to comment.