Skip to content

Commit 2a70ee7

Browse files
author
Daniel Browne
committed
Change 'fileprivate' -> 'private' access levels
1 parent c265987 commit 2a70ee7

File tree

2 files changed

+28
-28
lines changed

2 files changed

+28
-28
lines changed

Sources/Models/PusherPresenceChannel.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ public typealias PusherUserInfoObject = [String: AnyObject]
132132

133133
- returns: A dictionary of channel data
134134
*/
135-
fileprivate func parse(channelData: String) -> [String: AnyObject]? {
135+
private func parse(channelData: String) -> [String: AnyObject]? {
136136
let data = (channelData as NSString).data(using: String.Encoding.utf8.rawValue, allowLossyConversion: false)
137137

138138
do {

Sources/Services/PusherConnection.swift

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ import NWWebSocket
218218
- parameter data: The data to be stringified and sent
219219
- parameter channel: The name of the channel
220220
*/
221-
fileprivate func sendClientEvent(event: String, data: Any, channel: PusherChannel?) {
221+
private func sendClientEvent(event: String, data: Any, channel: PusherChannel?) {
222222
guard let channel = channel else {
223223
return
224224
}
@@ -242,7 +242,7 @@ import NWWebSocket
242242

243243
- returns: A JSON-stringified version of the value
244244
*/
245-
fileprivate func JSONStringify(_ value: Any) -> String {
245+
private func JSONStringify(_ value: Any) -> String {
246246
if JSONSerialization.isValidJSONObject(value) {
247247
do {
248248
let data = try JSONSerialization.data(withJSONObject: value, options: [])
@@ -341,7 +341,7 @@ import NWWebSocket
341341
/**
342342
Update connection state and attempt subscriptions to unsubscribed channels
343343
*/
344-
fileprivate func setConnectionStateToConnectedAndAttemptSubscriptions() {
344+
private func setConnectionStateToConnectedAndAttemptSubscriptions() {
345345
if self.connectionEstablishedMessageReceived &&
346346
self.socketConnected &&
347347
self.connectionState != .connected {
@@ -355,7 +355,7 @@ import NWWebSocket
355355
reset connection-related state to initial state, and initiate reconnect
356356
process
357357
*/
358-
fileprivate func resetConnectionAndAttemptReconnect() {
358+
private func resetConnectionAndAttemptReconnect() {
359359
if connectionState != .disconnected {
360360
updateConnectionState(to: .disconnected)
361361
}
@@ -395,7 +395,7 @@ import NWWebSocket
395395
Schedule a timer to be fired if no activity occurs over the socket within
396396
the activityTimeoutInterval
397397
*/
398-
fileprivate func establishActivityTimeoutTimer() {
398+
private func establishActivityTimeoutTimer() {
399399
self.activityTimeoutTimer = Timer.scheduledTimer(
400400
timeInterval: self.activityTimeoutInterval,
401401
target: self,
@@ -408,7 +408,7 @@ import NWWebSocket
408408
/**
409409
Send a ping to the server
410410
*/
411-
@objc fileprivate func sendPing() {
411+
@objc private func sendPing() {
412412
socket.ping()
413413
PusherLogger.shared.debug(for: .pingSent)
414414
self.setupPongResponseTimeoutTimer()
@@ -418,7 +418,7 @@ import NWWebSocket
418418
Schedule a timer that will fire if no pong response is received within the
419419
pongResponseTimeoutInterval
420420
*/
421-
fileprivate func setupPongResponseTimeoutTimer() {
421+
private func setupPongResponseTimeoutTimer() {
422422
pongResponseTimeoutTimer = Timer.scheduledTimer(
423423
timeInterval: pongResponseTimeoutInterval,
424424
target: self,
@@ -432,7 +432,7 @@ import NWWebSocket
432432
Invalidate the pongResponseTimeoutTimer and set connection state to disconnected
433433
as well as marking channels as unsubscribed
434434
*/
435-
@objc fileprivate func cleanupAfterNoPongResponse() {
435+
@objc private func cleanupAfterNoPongResponse() {
436436
pongResponseTimeoutTimer?.invalidate()
437437
pongResponseTimeoutTimer = nil
438438
resetConnectionAndAttemptReconnect()
@@ -444,7 +444,7 @@ import NWWebSocket
444444

445445
- parameter json: The PusherEventJSON containing successful subscription data
446446
*/
447-
fileprivate func handleSubscriptionSucceededEvent(event: PusherEvent) {
447+
private func handleSubscriptionSucceededEvent(event: PusherEvent) {
448448
guard let channelName = event.channelName,
449449
let chan = self.channels.find(name: channelName) else {
450450
return
@@ -488,7 +488,7 @@ import NWWebSocket
488488

489489
- parameter event: The event to be processed
490490
*/
491-
fileprivate func handleConnectionEstablishedEvent(event: PusherEvent) {
491+
private func handleConnectionEstablishedEvent(event: PusherEvent) {
492492
guard let connectionData = event.dataToJSONObject() as? [String: Any],
493493
let socketId = connectionData[Constants.JSONKeys.socketId] as? String else {
494494
return
@@ -512,7 +512,7 @@ import NWWebSocket
512512
Attempts to make subscriptions that couldn't be attempted while the
513513
connection was not in a connected state
514514
*/
515-
fileprivate func attemptSubscriptionsToUnsubscribedChannels() {
515+
private func attemptSubscriptionsToUnsubscribedChannels() {
516516
for (_, channel) in self.channels.channels {
517517
if !self.authorize(channel, auth: channel.auth) {
518518
PusherLogger.shared.debug(for: .unableToSubscribeToChannel,
@@ -526,7 +526,7 @@ import NWWebSocket
526526

527527
- parameter event: The event to be processed
528528
*/
529-
fileprivate func handleMemberAddedEvent(event: PusherEvent) {
529+
private func handleMemberAddedEvent(event: PusherEvent) {
530530
guard let channelName = event.channelName,
531531
let chan = self.channels.find(name: channelName) as? PusherPresenceChannel else {
532532
return
@@ -544,7 +544,7 @@ import NWWebSocket
544544

545545
- parameter event: The event to be processed
546546
*/
547-
fileprivate func handleMemberRemovedEvent(event: PusherEvent) {
547+
private func handleMemberRemovedEvent(event: PusherEvent) {
548548
guard let channelName = event.channelName,
549549
let chan = self.channels.find(name: channelName) as? PusherPresenceChannel else {
550550
return
@@ -574,7 +574,7 @@ import NWWebSocket
574574
- parameter channelName: The name of channel for which authorization failed
575575
- parameter data: The error returned by the auth endpoint
576576
*/
577-
fileprivate func handleAuthorizationError(forChannel channelName: String, error: PusherAuthError) {
577+
private func handleAuthorizationError(forChannel channelName: String, error: PusherAuthError) {
578578
let eventName = Constants.Events.Pusher.subscriptionError
579579
let json = [
580580
Constants.JSONKeys.event: eventName,
@@ -631,7 +631,7 @@ import NWWebSocket
631631

632632
- parameter event: The incoming event
633633
*/
634-
fileprivate func callGlobalCallbacks(event: PusherEvent) {
634+
private func callGlobalCallbacks(event: PusherEvent) {
635635
globalChannel?.handleGlobalEvent(event: event)
636636
globalChannel?.handleGlobalEventLegacy(event: event.raw)
637637
}
@@ -647,7 +647,7 @@ import NWWebSocket
647647
- returns: A Bool indicating whether or not the authentication request was made
648648
successfully
649649
*/
650-
fileprivate func authorize(_ channel: PusherChannel, auth: PusherAuth? = nil) -> Bool {
650+
private func authorize(_ channel: PusherChannel, auth: PusherAuth? = nil) -> Bool {
651651
if channel.type != .presence && channel.type != .private {
652652
subscribeToNormalChannel(channel)
653653
return true
@@ -673,8 +673,8 @@ import NWWebSocket
673673
}
674674
}
675675

676-
fileprivate func requestPusherAuthFromAuthMethod(channel: PusherChannel,
677-
completionHandler: @escaping (PusherAuth?, PusherAuthError?) -> Void) -> Bool {
676+
private func requestPusherAuthFromAuthMethod(channel: PusherChannel,
677+
completionHandler: @escaping (PusherAuth?, PusherAuthError?) -> Void) -> Bool {
678678
guard let socketId = self.socketId else {
679679
let message = "socketId value not found. You may not be connected."
680680
completionHandler(nil, PusherAuthError(kind: .notConnected, message: message))
@@ -751,7 +751,7 @@ import NWWebSocket
751751

752752
- returns: A JSON stringified user data object
753753
*/
754-
fileprivate func getUserDataJSON() -> String {
754+
private func getUserDataJSON() -> String {
755755
if let userDataFetcher = self.userDataFetcher {
756756
let userData = userDataFetcher()
757757
if let userInfo: Any = userData.userInfo {
@@ -775,7 +775,7 @@ import NWWebSocket
775775

776776
- parameter channel: The PusherChannel to subscribe to
777777
*/
778-
fileprivate func subscribeToNormalChannel(_ channel: PusherChannel) {
778+
private func subscribeToNormalChannel(_ channel: PusherChannel) {
779779
self.sendEvent(
780780
event: Constants.Events.Pusher.subscribe,
781781
data: [
@@ -793,7 +793,7 @@ import NWWebSocket
793793

794794
- returns: URLRequest object to be used by the function making the auth request
795795
*/
796-
fileprivate func requestForAuthValue(from endpoint: String, socketId: String, channelName: String) -> URLRequest {
796+
private func requestForAuthValue(from endpoint: String, socketId: String, channelName: String) -> URLRequest {
797797
let allowedCharacterSet = CharacterSet(charactersIn: "!*'();:@&=+$,/?%#[] ").inverted
798798
let encodedChannelName = channelName.addingPercentEncoding(withAllowedCharacters: allowedCharacterSet) ?? channelName
799799

@@ -810,9 +810,9 @@ import NWWebSocket
810810
- parameter request: The request to send
811811
- parameter channel: The PusherChannel to authenticate subscription for
812812
*/
813-
fileprivate func sendAuthorizationRequest(request: URLRequest,
814-
channel: PusherChannel,
815-
completionHandler: @escaping (PusherAuth?, PusherAuthError?) -> Void) {
813+
private func sendAuthorizationRequest(request: URLRequest,
814+
channel: PusherChannel,
815+
completionHandler: @escaping (PusherAuth?, PusherAuthError?) -> Void) {
816816
let task = URLSession.dataTask(with: request, completionHandler: { data, response, sessionError in
817817
if let error = sessionError {
818818
let message = "Error authorizing channel [\(channel.name)]: \(error)"
@@ -879,7 +879,7 @@ import NWWebSocket
879879
- parameter channelData: The channelData to send along with the auth request
880880
- parameter channel: The PusherChannel to authorize the subscription for
881881
*/
882-
fileprivate func handleAuthInfo(pusherAuth: PusherAuth, channel: PusherChannel) {
882+
private func handleAuthInfo(pusherAuth: PusherAuth, channel: PusherChannel) {
883883
if let decryptionKey = pusherAuth.sharedSecret {
884884
channel.decryptionKey = decryptionKey
885885
}
@@ -898,7 +898,7 @@ import NWWebSocket
898898
- parameter channel: The PusherChannel to authorize subscription for
899899
- parameter channelData: The channelData to send along with the auth request
900900
*/
901-
fileprivate func handlePresenceChannelAuth(
901+
private func handlePresenceChannelAuth(
902902
authValue: String,
903903
channel: PusherChannel,
904904
channelData: String
@@ -921,7 +921,7 @@ import NWWebSocket
921921
- parameter auth: The auth string
922922
- parameter channel: The PusherChannel to authenticate subscription for
923923
*/
924-
fileprivate func handlePrivateChannelAuth(authValue auth: String, channel: PusherChannel) {
924+
private func handlePrivateChannelAuth(authValue auth: String, channel: PusherChannel) {
925925
self.sendEvent(
926926
event: Constants.Events.Pusher.subscribe,
927927
data: [

0 commit comments

Comments
 (0)