Skip to content

Commit f9bb654

Browse files
committed
Refactor Networking, Authentication, Fix TableView
- All DelugeClient networks calls were refactored to use PromiseKit - All network calls now check the Deluge API for errors - Added connection and authentication functions to ensure that credentials are always refreshed - Fixed a crash that can occur from TorrentInfoTableViewModel changing the amount of rows without notifying the tableview
1 parent 95c77d7 commit f9bb654

13 files changed

+574
-600
lines changed

Deluge Remote.xcodeproj/project.pbxproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -713,7 +713,7 @@
713713
CODE_SIGN_ENTITLEMENTS = "";
714714
CODE_SIGN_IDENTITY = "Apple Development";
715715
CODE_SIGN_STYLE = Automatic;
716-
CURRENT_PROJECT_VERSION = 1;
716+
CURRENT_PROJECT_VERSION = 2;
717717
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
718718
DEVELOPMENT_TEAM = NZ8449Y9W6;
719719
HEADER_SEARCH_PATHS = (
@@ -728,7 +728,7 @@
728728
"@executable_path/Frameworks",
729729
);
730730
LIBRARY_SEARCH_PATHS = "";
731-
MARKETING_VERSION = 1.5.2;
731+
MARKETING_VERSION = 1.5.3;
732732
OTHER_LDFLAGS = "-ObjC";
733733
PRODUCT_BUNDLE_IDENTIFIER = "io.rudybermudez.Deluge-Remote";
734734
PRODUCT_NAME = "$(TARGET_NAME)";
@@ -746,7 +746,7 @@
746746
CODE_SIGN_ENTITLEMENTS = "";
747747
CODE_SIGN_IDENTITY = "Apple Development";
748748
CODE_SIGN_STYLE = Automatic;
749-
CURRENT_PROJECT_VERSION = 1;
749+
CURRENT_PROJECT_VERSION = 2;
750750
DEVELOPMENT_TEAM = NZ8449Y9W6;
751751
HEADER_SEARCH_PATHS = (
752752
"$(SRCROOT)/NSBencodeSerialization/NSBencodeSerialization",
@@ -760,7 +760,7 @@
760760
"@executable_path/Frameworks",
761761
);
762762
LIBRARY_SEARCH_PATHS = "";
763-
MARKETING_VERSION = 1.5.2;
763+
MARKETING_VERSION = 1.5.3;
764764
OTHER_LDFLAGS = "-ObjC";
765765
PRODUCT_BUNDLE_IDENTIFIER = "io.rudybermudez.Deluge-Remote";
766766
PRODUCT_NAME = "$(TARGET_NAME)";

Deluge Remote/Sources/API/DelugeAPIRouter.swift

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ enum DelugeRouter: URLRequestConvertible {
1414
/// Authenticate to the Deluge API
1515
case login(ClientConfig)
1616

17+
case checkAuth(ClientConfig)
18+
19+
case isConnected(ClientConfig)
20+
1721
/// Get `TorrentMetadata`
1822
case getMetadata(ClientConfig,hash: String)
1923

@@ -95,6 +99,10 @@ enum DelugeRouter: URLRequestConvertible {
9599
switch self {
96100
case .login(let config):
97101
return config.url
102+
case .checkAuth(let config):
103+
return config.url
104+
case .isConnected(let config):
105+
return config.url
98106
case .getMetadata(let config, hash: _):
99107
return config.url
100108
case .getFiles(let config, hash: _):
@@ -144,6 +152,10 @@ enum DelugeRouter: URLRequestConvertible {
144152
switch self {
145153
case .login(let config):
146154
return paramsFor( method: "auth.login", with: [config.password])
155+
case .checkAuth(_):
156+
return paramsFor(method: "auth.check_session", with: [])
157+
case .isConnected(_):
158+
return paramsFor(method: "web.connected", with: [])
147159
case .getMetadata(_, hash: let hash):
148160
return paramsFor(method: "core.get_torrent_status", with: [hash, []])
149161
case .getFiles(_, hash: let hash):

0 commit comments

Comments
 (0)