@@ -163,7 +163,7 @@ import Foundation
163163 */
164164 open func setSubscriptions( interests: Array < String > ) {
165165 requestQueue. tasks += { _, next in
166- self . modifySubscription (
166+ self . replaceSubscriptionSet (
167167 interests: interests,
168168 successCallback: next
169169 )
@@ -192,7 +192,7 @@ import Foundation
192192 */
193193 private func addSubscriptionChangeToTaskQueue( interestName: String , change: SubscriptionChange ) {
194194 requestQueue. tasks += { _, next in
195- self . modifySubscription (
195+ self . subscribeOrUnsubscribeInterest (
196196 interest: interestName,
197197 change: change,
198198 successCallback: next
@@ -208,7 +208,7 @@ import Foundation
208208 - parameter change: Whether to subscribe or unsubscribe
209209 - parameter callback: Callback to be called upon success
210210 */
211- private func modifySubscription ( interest: String , change: SubscriptionChange , successCallback: @escaping ( Any ? ) -> Void ) {
211+ private func subscribeOrUnsubscribeInterest ( interest: String , change: SubscriptionChange , successCallback: @escaping ( Any ? ) -> Void ) {
212212 guard
213213 let clientId = clientId,
214214 let pusherAppKey = pusherAppKey
@@ -221,15 +221,15 @@ import Foundation
221221 let url = " \( CLIENT_API_V1_ENDPOINT) /clients/ \( clientId) /interests/ \( interest) "
222222 let params : [ String : Any ] = [ " app_key " : pusherAppKey]
223223 let request = self . setRequest ( url: url, params: params, change: change)
224- self . modifySubscription ( interests: [ interest] , request: request, change: change, successCallback: successCallback)
224+ self . doURLRequest ( interests: [ interest] , request: request, change: change, successCallback: successCallback)
225225 }
226226
227227 /**
228228 Makes a PUT request for given interests
229229 - parameter interests: The name of the interests to be subscribed to
230230 - parameter callback: Callback to be called upon success
231231 */
232- private func modifySubscription ( interests: Array < String > , successCallback: @escaping ( Any ? ) -> Void ) {
232+ private func replaceSubscriptionSet ( interests: Array < String > , successCallback: @escaping ( Any ? ) -> Void ) {
233233 guard
234234 let clientId = clientId,
235235 let pusherAppKey = pusherAppKey
@@ -242,10 +242,10 @@ import Foundation
242242 let url = " \( CLIENT_API_V1_ENDPOINT) /clients/ \( clientId) /interests/ "
243243 let params : [ String : Any ] = [ " app_key " : pusherAppKey, " interests " : interests]
244244 let request = self . setRequest ( url: url, params: params, change: . setSubscriptions)
245- self . modifySubscription ( interests: interests, request: request, change: . setSubscriptions, successCallback: successCallback)
245+ self . doURLRequest ( interests: interests, request: request, change: . setSubscriptions, successCallback: successCallback)
246246 }
247247
248- private func modifySubscription ( interests: Array < String > , request: URLRequest , change: SubscriptionChange , successCallback: @escaping ( Any ? ) -> Void ) {
248+ private func doURLRequest ( interests: Array < String > , request: URLRequest , change: SubscriptionChange , successCallback: @escaping ( Any ? ) -> Void ) {
249249 self . delegate? . debugLog ? ( message: " Attempt number: \( self . failedRequestAttempts + 1 ) of \( maxFailedRequestAttempts) " )
250250
251251 let task = URLSession . dataTask (
0 commit comments