Fix Tidal authentication on macOS
This commit is contained in:
@@ -78,7 +78,7 @@ const char *CommandlineOptions::kHelpText =
|
|||||||
|
|
||||||
const char *CommandlineOptions::kVersionText = "Strawberry %1";
|
const char *CommandlineOptions::kVersionText = "Strawberry %1";
|
||||||
|
|
||||||
CommandlineOptions::CommandlineOptions(int argc, char* *argv)
|
CommandlineOptions::CommandlineOptions(int argc, char **argv)
|
||||||
: argc_(argc),
|
: argc_(argc),
|
||||||
argv_(argv),
|
argv_(argv),
|
||||||
url_list_action_(UrlList_None),
|
url_list_action_(UrlList_None),
|
||||||
|
|||||||
@@ -148,8 +148,11 @@ QDebug operator<<(QDebug dbg, NSObject* object) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (void)applicationDidFinishLaunching:(NSNotification*)aNotification {
|
- (void)applicationDidFinishLaunching:(NSNotification*)aNotification {
|
||||||
|
|
||||||
Q_UNUSED(aNotification);
|
Q_UNUSED(aNotification);
|
||||||
|
|
||||||
|
[[NSAppleEventManager sharedAppleEventManager] setEventHandler:self andSelector:@selector(handleURLEvent:withReplyEvent:) forEventClass:kInternetEventClass andEventID:kAEGetURL];
|
||||||
|
|
||||||
key_tap_ = [ [SPMediaKeyTap alloc] initWithDelegate:self];
|
key_tap_ = [ [SPMediaKeyTap alloc] initWithDelegate:self];
|
||||||
if ([SPMediaKeyTap usesGlobalMediaKeyTap]) {
|
if ([SPMediaKeyTap usesGlobalMediaKeyTap]) {
|
||||||
if ([key_tap_ startWatchingMediaKeys]) {
|
if ([key_tap_ startWatchingMediaKeys]) {
|
||||||
@@ -187,6 +190,13 @@ QDebug operator<<(QDebug dbg, NSObject* object) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)handleURLEvent:(NSAppleEventDescriptor*)theEvent withReplyEvent:(NSAppleEventDescriptor*)replyEvent {
|
||||||
|
|
||||||
|
NSString *url = [[theEvent paramDescriptorForKeyword:keyDirectObject] stringValue];
|
||||||
|
application_handler_->LoadUrl(QString::fromNSString(url));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
- (void) mediaKeyTap: (SPMediaKeyTap*)keyTap receivedMediaKeyEvent:(NSEvent*)event {
|
- (void) mediaKeyTap: (SPMediaKeyTap*)keyTap receivedMediaKeyEvent:(NSEvent*)event {
|
||||||
#pragma unused(keyTap)
|
#pragma unused(keyTap)
|
||||||
[self handleMediaEvent:event];
|
[self handleMediaEvent:event];
|
||||||
|
|||||||
@@ -2391,13 +2391,23 @@ void MainWindow::Activate() {
|
|||||||
|
|
||||||
bool MainWindow::LoadUrl(const QString &url) {
|
bool MainWindow::LoadUrl(const QString &url) {
|
||||||
|
|
||||||
if (!QFile::exists(url)) return false;
|
if (QFile::exists(url)) {
|
||||||
|
MimeData *mimedata = new MimeData;
|
||||||
|
mimedata->setUrls(QList<QUrl>() << QUrl::fromLocalFile(url));
|
||||||
|
AddToPlaylist(mimedata);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
#ifdef HAVE_TIDAL
|
||||||
|
else if (url.startsWith("tidal://login")) {
|
||||||
|
emit AuthorizationUrlReceived(QUrl(url));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
else {
|
||||||
|
qLog(Error) << "Can't open" << url;
|
||||||
|
}
|
||||||
|
|
||||||
MimeData *mimedata = new MimeData;
|
return false;
|
||||||
mimedata->setUrls(QList<QUrl>() << QUrl::fromLocalFile(url));
|
|
||||||
AddToPlaylist(mimedata);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user