aboutsummaryrefslogtreecommitdiff
path: root/QSThingsPlugin/Actions
diff options
context:
space:
mode:
Diffstat (limited to 'QSThingsPlugin/Actions')
-rw-r--r--QSThingsPlugin/Actions/CompleteTaskAction.h2
-rw-r--r--QSThingsPlugin/Actions/CompleteTaskAction.m10
-rw-r--r--QSThingsPlugin/Actions/SearchThingsAction.h2
-rw-r--r--QSThingsPlugin/Actions/SearchThingsAction.m6
-rw-r--r--QSThingsPlugin/Actions/ShowInThingsAction.h1
-rw-r--r--QSThingsPlugin/Actions/ShowInThingsAction.m6
6 files changed, 11 insertions, 16 deletions
diff --git a/QSThingsPlugin/Actions/CompleteTaskAction.h b/QSThingsPlugin/Actions/CompleteTaskAction.h
index 19609b9..e542c30 100644
--- a/QSThingsPlugin/Actions/CompleteTaskAction.h
+++ b/QSThingsPlugin/Actions/CompleteTaskAction.h
@@ -1,5 +1,5 @@
#import "Constants.h"
-#import "KeychainHelper.h"
+#import "ThingsHelper.h"
#import <Foundation/Foundation.h>
#import <QSCore/QSCore.h>
diff --git a/QSThingsPlugin/Actions/CompleteTaskAction.m b/QSThingsPlugin/Actions/CompleteTaskAction.m
index 9673840..5ff1bd0 100644
--- a/QSThingsPlugin/Actions/CompleteTaskAction.m
+++ b/QSThingsPlugin/Actions/CompleteTaskAction.m
@@ -15,17 +15,15 @@ NS_ASSUME_NONNULL_BEGIN
if (authenticationKey && [validTypes containsObject:directObject.primaryType]) {
NSDictionary *contents = [directObject objectForType:directObject.primaryType];
- NSString *path = @"update";
+ ThingsURLRoute route = ThingsURLRouteUpdate;
if (directObject.primaryType == kProjectType) {
- path = @"update-project";
+ route = ThingsURLRouteUpdateProject;
}
if (contents) {
NSString *uuid = [contents objectForKey:@"uuid"];
if (uuid) {
- NSString *urlString = [NSString stringWithFormat:@"things:///%@?id=%@&auth-token=%@&completed=true", path, uuid, authenticationKey];
- NSURL *url = [NSURL URLWithString:urlString];
-
- [[NSWorkspace sharedWorkspace] openURL:url];
+ NSDictionary *parameters = @{@"id": uuid, @"completed": @"true"};
+ [ThingsHelper callRoute:route withParameters:parameters];
} else {
NSLog(@"Things object did not have a uuid.");
}
diff --git a/QSThingsPlugin/Actions/SearchThingsAction.h b/QSThingsPlugin/Actions/SearchThingsAction.h
index 5f0ed48..c35bb1a 100644
--- a/QSThingsPlugin/Actions/SearchThingsAction.h
+++ b/QSThingsPlugin/Actions/SearchThingsAction.h
@@ -1,4 +1,4 @@
-#import "Constants.h"
+#import "ThingsHelper.h"
#import <Foundation/Foundation.h>
#import <QSCore/QSCore.h>
diff --git a/QSThingsPlugin/Actions/SearchThingsAction.m b/QSThingsPlugin/Actions/SearchThingsAction.m
index 9b042b3..9f941e7 100644
--- a/QSThingsPlugin/Actions/SearchThingsAction.m
+++ b/QSThingsPlugin/Actions/SearchThingsAction.m
@@ -9,10 +9,8 @@ NS_ASSUME_NONNULL_BEGIN
NSString *contents = [directObject displayName];
if (contents) {
- NSString *urlString = [NSString stringWithFormat:@"things:///search?query=%@", contents];
- NSURL *url = [NSURL URLWithString:urlString];
-
- [[NSWorkspace sharedWorkspace] openURL:url];
+ NSDictionary *parameters = @{@"query": contents};
+ [ThingsHelper callRoute:ThingsURLRouteSearch withParameters:parameters];
} else {
NSLog(@"Could not get the text of the Things object.");
}
diff --git a/QSThingsPlugin/Actions/ShowInThingsAction.h b/QSThingsPlugin/Actions/ShowInThingsAction.h
index 8d7790c..7a2fbc4 100644
--- a/QSThingsPlugin/Actions/ShowInThingsAction.h
+++ b/QSThingsPlugin/Actions/ShowInThingsAction.h
@@ -1,4 +1,5 @@
#import "Constants.h"
+#import "ThingsHelper.h"
#import <Foundation/Foundation.h>
#import <QSCore/QSCore.h>
diff --git a/QSThingsPlugin/Actions/ShowInThingsAction.m b/QSThingsPlugin/Actions/ShowInThingsAction.m
index 91fe3ec..cd04f73 100644
--- a/QSThingsPlugin/Actions/ShowInThingsAction.m
+++ b/QSThingsPlugin/Actions/ShowInThingsAction.m
@@ -14,10 +14,8 @@ NS_ASSUME_NONNULL_BEGIN
if (contents) {
NSString *uuid = [contents objectForKey:@"uuid"];
if (uuid) {
- NSString *urlString = [NSString stringWithFormat:@"things:///show?id=%@", uuid];
- NSURL *url = [NSURL URLWithString:urlString];
-
- [[NSWorkspace sharedWorkspace] openURL:url];
+ NSDictionary *parameters = @{@"id": uuid};
+ [ThingsHelper callRoute:ThingsURLRouteShow withParameters:parameters];
} else {
NSLog(@"Things object did not have a uuid.");
}