mirror of
https://github.com/ONLYOFFICE/desktop-apps.git
synced 2026-02-10 18:05:16 +08:00
[macos] open 'recovery' files on app launch
This commit is contained in:
@ -143,6 +143,7 @@
|
||||
addObserverFor(CEFEventNameCertificatePreview, @selector(onCEFCertificatePreview:));
|
||||
addObserverFor(ASCEventNameChangedUITheme, @selector(onUIThemeChanged:));
|
||||
addObserverFor(ASCEventNameChangedSystemTheme, @selector(onSystemThemeChanged:));
|
||||
addObserverFor(ASCEventNameRecoveryFiles, @selector(onRecoveryFiles:));
|
||||
|
||||
if (_externalDelegate && [_externalDelegate respondsToSelector:@selector(onCommonViewDidLoad:)]) {
|
||||
[_externalDelegate onCommonViewDidLoad:self];
|
||||
@ -1900,6 +1901,28 @@
|
||||
}
|
||||
}
|
||||
|
||||
-(void)onRecoveryFiles:(NSNotification *)notification {
|
||||
if (notification && notification.userInfo) {
|
||||
NSDictionary * params = (NSDictionary *)notification.userInfo;
|
||||
NSString * sfiles = params[@"files"];
|
||||
NSError * err = nil;
|
||||
NSArray * arrfiles = [NSJSONSerialization JSONObjectWithData:[sfiles dataUsingEncoding:NSUTF8StringEncoding]
|
||||
options:0
|
||||
error:&err];
|
||||
for (NSDictionary * f in arrfiles) {
|
||||
NSNotification * n = [NSNotification notificationWithName:CEFEventNameCreateTab
|
||||
object:nil
|
||||
userInfo:@{
|
||||
@"action" : @(ASCTabActionOpenLocalRecoverFile),
|
||||
@"active" : @(YES),
|
||||
@"fileId" : f[@"id"],
|
||||
@"path" : f[@"path"]
|
||||
}];
|
||||
[self onCEFCreateTab:n];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark ASCTabsControl Delegate
|
||||
|
||||
|
||||
@ -826,6 +826,12 @@ public:
|
||||
@"path" : json[@"path"]
|
||||
}];
|
||||
}
|
||||
} else if (cmd.find(L"recovery:update") != std::wstring::npos) {
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:ASCEventNameRecoveryFiles
|
||||
object:nil
|
||||
userInfo:@{
|
||||
@"files":[NSString stringWithstdwstring:param]
|
||||
}];
|
||||
} else if (cmd.find(L"webapps:features") != std::wstring::npos) {
|
||||
CAscApplicationManager * appManager = [NSAscApplicationWorker getAppManager];
|
||||
CCefView * pCefView = appManager->GetViewById(senderId);
|
||||
|
||||
@ -99,6 +99,7 @@ static NSString * const ASCEventNameMainWindowLoaded = @"UI_mainWindowLoa
|
||||
static NSString * const ASCEventNameOpenAppLinks = @"UI_openAppLinks";
|
||||
static NSString * const ASCEventNameChangedUITheme = @"UI_changedUITheme";
|
||||
static NSString * const ASCEventNameChangedSystemTheme = @"UI_changedSystemTheme";
|
||||
static NSString * const ASCEventNameRecoveryFiles = @"UI_recoveryFiles";
|
||||
|
||||
// CEF types
|
||||
static NSString * const CEFOpenFileFilterImage = @"images";
|
||||
|
||||
Reference in New Issue
Block a user