diff options
| author | Ruben Beltran del Rio <git@r.bdr.sh> | 2025-09-10 22:48:37 +0200 |
|---|---|---|
| committer | Ruben Beltran del Rio <git@r.bdr.sh> | 2025-09-10 22:48:37 +0200 |
| commit | 1613c951d49e6d85aff52f312d57fa087b35c079 (patch) | |
| tree | c31b74c56f32c3a60e628c187b6f7c236fffe36e /QSThingsPlugin/Actions | |
| parent | 7cf393095282077b0bbae3046826b67f4f20a8eb (diff) | |
Move things URL calls to a helper
Diffstat (limited to 'QSThingsPlugin/Actions')
| -rw-r--r-- | QSThingsPlugin/Actions/CompleteTaskAction.h | 2 | ||||
| -rw-r--r-- | QSThingsPlugin/Actions/CompleteTaskAction.m | 10 | ||||
| -rw-r--r-- | QSThingsPlugin/Actions/SearchThingsAction.h | 2 | ||||
| -rw-r--r-- | QSThingsPlugin/Actions/SearchThingsAction.m | 6 | ||||
| -rw-r--r-- | QSThingsPlugin/Actions/ShowInThingsAction.h | 1 | ||||
| -rw-r--r-- | QSThingsPlugin/Actions/ShowInThingsAction.m | 6 |
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."); } |