Re-enable NSException on Share extension dismiss.

Disable crash logging in the share extension because of this.
This commit is contained in:
Doug
2022-03-18 15:19:57 +00:00
committed by Doug
parent 0040f6391a
commit b61f012294
4 changed files with 17 additions and 2 deletions

View File

@@ -30,4 +30,9 @@ public extension Bundle {
}
return bundle
}
/// Whether or not the bundle is the RiotShareExtension.
var isShareExtension: Bool {
bundleURL.lastPathComponent.contains("RiotShareExtension.appex")
}
}

View File

@@ -121,8 +121,13 @@ import AnalyticsEvents
MXLog.debug("[Analytics] Started.")
// Catch and log crashes
MXLogger.logCrashes(true)
if Bundle.main.isShareExtension {
// Don't log crashes in the share extension
} else {
// Catch and log crashes
MXLogger.logCrashes(true)
}
MXLogger.setBuildVersion(AppInfo.current.buildInfo.readableBuildVersion)
}

View File

@@ -99,6 +99,10 @@
{
[self dismissViewControllerAnimated:true completion:^{
[self.presentingViewController dismissViewControllerAnimated:false completion:nil];
// FIXME: Share extension memory usage increase when launched several times and then crash due to some memory leaks.
// For now, we force the share extension to exit and free memory.
[NSException raise:@"Kill the app extension" format:@"Free memory used by share extension"];
}];
}

1
changelog.d/5805.bugfix Normal file
View File

@@ -0,0 +1 @@
Share Extension: Stop logging crashes due to intentional exception that frees up memory and handle changes to MXRoom in the SDK.