From 2e44b6c3776190a7da2ccf21903f38a85b78cef5 Mon Sep 17 00:00:00 2001 From: James Yang Date: Fri, 17 May 2024 11:44:31 -0700 Subject: [PATCH] Fix init in DBTransportBaseHostnameConfig (#383) * fix init in DBTransportBaseHostnameConfig * fix downloadContent setting * add comment to initializer --- .../Networking/DBTransportBaseHostnameConfig.h | 14 +++++++++++++- .../Networking/DBTransportBaseHostnameConfig.m | 18 ++++++++---------- 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/Source/ObjectiveDropboxOfficial/Shared/Handwritten/Networking/DBTransportBaseHostnameConfig.h b/Source/ObjectiveDropboxOfficial/Shared/Handwritten/Networking/DBTransportBaseHostnameConfig.h index ff77dedd8..38ed95cc4 100644 --- a/Source/ObjectiveDropboxOfficial/Shared/Handwritten/Networking/DBTransportBaseHostnameConfig.h +++ b/Source/ObjectiveDropboxOfficial/Shared/Handwritten/Networking/DBTransportBaseHostnameConfig.h @@ -40,6 +40,18 @@ NS_ASSUME_NONNULL_BEGIN /// - (instancetype)init; +/// +/// Constructor that takes in a set of custom hostnames to use for api calls. +/// +/// @param meta the hostname to metaserver +/// @param api the hostname to api server +/// @param content the hostname to content server +/// @param notify the hostname to notify server +/// +/// @return An initialized instance with the provided hostname configuration +/// +- (instancetype)initWithMeta:(NSString *)meta api:(NSString *)api content:(NSString *)content notify:(NSString *)notify; + /// /// Constructor that takes in a set of custom hostnames to use for api calls. /// @@ -51,7 +63,7 @@ NS_ASSUME_NONNULL_BEGIN /// /// @return An initialized instance with the provided hostname configuration /// -- (instancetype)initWithMeta:(NSString *)meta api:(NSString *)api content:(NSString *)content downloadContent:(NSString *)downloadContent notify:(NSString *)notify; +- (instancetype)initWithMeta:(NSString *)meta api:(NSString *)api content:(NSString *)content downloadContent:(NSString *)downloadContent notify:(NSString *)notify NS_DESIGNATED_INITIALIZER; /// /// Returns the prefix to use for API calls to the given route type. diff --git a/Source/ObjectiveDropboxOfficial/Shared/Handwritten/Networking/DBTransportBaseHostnameConfig.m b/Source/ObjectiveDropboxOfficial/Shared/Handwritten/Networking/DBTransportBaseHostnameConfig.m index 7772d423e..33a096b13 100644 --- a/Source/ObjectiveDropboxOfficial/Shared/Handwritten/Networking/DBTransportBaseHostnameConfig.m +++ b/Source/ObjectiveDropboxOfficial/Shared/Handwritten/Networking/DBTransportBaseHostnameConfig.m @@ -37,14 +37,7 @@ - (instancetype)initWithMeta:(NSString *)meta api:(NSString *)api content:(NSString *)content notify:(NSString *)notify { - if (self = [super init]) { - _meta = meta; - _api = api; - _content = content; - _downloadContent = content; - _notify = notify; - } - return self; + return [self initWithMeta:meta api:api content:content downloadContent:content notify:notify]; } - (instancetype)initWithMeta:(NSString *)meta @@ -52,8 +45,13 @@ - (instancetype)initWithMeta:(NSString *)meta content:(NSString *)content downloadContent:(NSString *)downloadContent notify:(NSString *)notify { - self = [self initWithMeta:meta api:api content:content notify:notify]; - _downloadContent = downloadContent; + if (self = [super init]) { + _meta = meta; + _api = api; + _content = content; + _downloadContent = downloadContent; + _notify = notify; + } return self; }