feat(universal-links): Adds universal links support for macOS
Fixes: #7957
This commit is contained in:
parent
7bf7f272f3
commit
aa8eb07f56
|
@ -0,0 +1,10 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
|
<plist version="1.0">
|
||||||
|
<dict>
|
||||||
|
<key>com.apple.developer.associated-domains</key>
|
||||||
|
<array>
|
||||||
|
<string>applinks:status.app</string>
|
||||||
|
</array>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
|
@ -0,0 +1,5 @@
|
||||||
|
namespace app_delegate {
|
||||||
|
|
||||||
|
void install();
|
||||||
|
|
||||||
|
}
|
|
@ -74,6 +74,7 @@
|
||||||
#include "DOtherSide/Status/OSNotification.h"
|
#include "DOtherSide/Status/OSNotification.h"
|
||||||
#include "DOtherSide/Status/KeychainManager.h"
|
#include "DOtherSide/Status/KeychainManager.h"
|
||||||
#include "DOtherSide/Status/SoundManager.h"
|
#include "DOtherSide/Status/SoundManager.h"
|
||||||
|
#include "DOtherSide/Status/AppDelegate.h"
|
||||||
|
|
||||||
#ifdef MONITORING
|
#ifdef MONITORING
|
||||||
#include <QProcessEnvironment>
|
#include <QProcessEnvironment>
|
||||||
|
@ -241,6 +242,9 @@ void dos_qguiapplication_create()
|
||||||
qInstallMessageHandler(myMessageOutput);
|
qInstallMessageHandler(myMessageOutput);
|
||||||
|
|
||||||
new QGuiApplication(argc, argv);
|
new QGuiApplication(argc, argv);
|
||||||
|
#ifdef Q_OS_MACOS
|
||||||
|
app_delegate::install();
|
||||||
|
#endif
|
||||||
register_meta_types();
|
register_meta_types();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,39 @@
|
||||||
|
#include "DOtherSide/Status/AppDelegate.h"
|
||||||
|
|
||||||
|
#include <QString>
|
||||||
|
#include <QUrl>
|
||||||
|
|
||||||
|
#import <AppKit/NSApplication.h>
|
||||||
|
|
||||||
|
|
||||||
|
@interface AppDelegate: NSObject <NSApplicationDelegate>
|
||||||
|
- (BOOL)application:(NSApplication *)application
|
||||||
|
continueUserActivity:(NSUserActivity *)userActivity
|
||||||
|
restorationHandler:(void (^)(NSArray<id<NSUserActivityRestoring>> *restorableObjects))restorationHandler;
|
||||||
|
@end
|
||||||
|
|
||||||
|
@implementation AppDelegate
|
||||||
|
- (BOOL)application:(NSApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void (^)(NSArray<id<NSUserActivityRestoring>> *))restorationHandler {
|
||||||
|
if (userActivity.activityType == NSUserActivityTypeBrowsingWeb) {
|
||||||
|
NSURL *url = userActivity.webpageURL;
|
||||||
|
if (!url) {
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
QUrl deeplink = QUrl::fromNSURL(url);
|
||||||
|
// set it to nim
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
namespace app_delegate {
|
||||||
|
|
||||||
|
void install()
|
||||||
|
{
|
||||||
|
NSApplication* applicationShared = [NSApplication sharedApplication];
|
||||||
|
[applicationShared setDelegate:([[[AppDelegate alloc] init] autorelease])];
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue