Skip to content

Commit

Permalink
VPN-5101: cleanup logs after they are exported for iOS and desktop (#…
Browse files Browse the repository at this point in the history
…9231)

* VPN-5101 clean up iOS logs

* flush on other platforms
  • Loading branch information
mcleinman authored Mar 15, 2024
1 parent dd873b6 commit 2feb637
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
13 changes: 4 additions & 9 deletions src/loghandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -449,15 +449,10 @@ bool LogHandler::viewLogs() {
return ok;
#endif

if (writeAndShowLogs(QStandardPaths::DesktopLocation)) {
return true;
}

if (writeAndShowLogs(QStandardPaths::HomeLocation)) {
return true;
}

if (writeAndShowLogs(QStandardPaths::TempLocation)) {
if (writeAndShowLogs(QStandardPaths::DesktopLocation) ||
writeAndShowLogs(QStandardPaths::HomeLocation) ||
writeAndShowLogs(QStandardPaths::TempLocation)) {
flushLogs();
return true;
}

Expand Down
10 changes: 10 additions & 0 deletions src/platforms/ios/ioscommons.mm
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include "ioscommons.h"
#include "constants.h"
#include "logger.h"
#include "loghandler.h"
#include "qmlengineholder.h"

#include <QtGui/qpa/qplatformnativeinterface.h>
Expand Down Expand Up @@ -102,6 +103,15 @@ @interface StatusBarModifierViewController : UIViewController
activityViewController.popoverPresentationController.sourceRect =
CGRectMake(view.bounds.size.width / 2, view.bounds.size.height, 0, 0);
}
activityViewController.completionWithItemsHandler =
^(NSString* activityType, BOOL completed, NSArray* returnedItems, NSError* activityError) {
if (completed) {
logger.info() << "Clearing logs.";
LogHandler::instance()->flushLogs();
} else {
logger.info() << "No need to clear logs.";
}
};
[qtController presentViewController:activityViewController animated:YES completion:nil];
[activityViewController release];
}

0 comments on commit 2feb637

Please sign in to comment.