@@ -109,39 +109,32 @@ GitHubSessionListener {
109
109
tableView. deselectRow ( at: indexPath, animated: trueUnlessReduceMotionEnabled)
110
110
let cell = tableView. cellForRow ( at: indexPath)
111
111
112
- if cell === reviewAccessCell {
113
- onReviewAccess ( )
114
- } else if cell === accountsCell {
115
- onAccounts ( )
116
- } else if cell === githubStatusCell {
117
- onGitHubStatus ( )
118
- } else if cell === reviewOnAppStoreCell {
119
- onReviewOnAppStore ( )
120
- } else if cell === reportBugCell {
121
- onReportBug ( )
122
- } else if cell === viewSourceCell {
123
- onViewSource ( )
124
- } else if cell === setDefaultReaction {
125
- onSetDefaultReaction ( )
126
- } else if cell === signOutCell {
127
- onSignOut ( )
128
- } else if cell === tryTestFlightBetaCell {
129
- onTryTestFlightBeta ( )
112
+ switch cell {
113
+ case reviewAccessCell: onReviewAccess ( )
114
+ case accountsCell: onAccounts ( )
115
+ case githubStatusCell: onGitHubStatus ( )
116
+ case reviewOnAppStoreCell: onReviewOnAppStore ( )
117
+ case reportBugCell: onReportBug ( )
118
+ case viewSourceCell: onViewSource ( )
119
+ case setDefaultReaction: onSetDefaultReaction ( )
120
+ case signOutCell: onSignOut ( )
121
+ case tryTestFlightBetaCell: onTryTestFlightBeta ( )
122
+ default : break
130
123
}
131
124
}
132
125
133
126
// MARK: Private API
134
127
135
- func updateDefaultReaction( ) {
128
+ private func updateDefaultReaction( ) {
136
129
defaultReactionLabel. text = ReactionContent . defaultReaction? . emoji
137
130
?? NSLocalizedString ( " Off " , comment: " " )
138
131
}
139
132
140
- func onReviewAccess( ) {
133
+ private func onReviewAccess( ) {
141
134
UIApplication . shared. openReviewAccess ( )
142
135
}
143
136
144
- func onAccounts( ) {
137
+ private func onAccounts( ) {
145
138
if let navigationController = UIStoryboard ( name: " Settings " , bundle: nil ) . instantiateViewController ( withIdentifier: " accountsNavigationController " ) as? UINavigationController ,
146
139
let accountsController = navigationController. topViewController as? SettingsAccountsViewController ,
147
140
let client = self . client {
@@ -150,17 +143,17 @@ GitHubSessionListener {
150
143
}
151
144
}
152
145
153
- func onGitHubStatus( ) {
146
+ private func onGitHubStatus( ) {
154
147
guard let url = URLBuilder ( host: " status.github.com " ) . add ( path: " messages " ) . url
155
148
else { return }
156
149
presentSafari ( url: url)
157
150
}
158
151
159
- func onReviewOnAppStore( ) {
152
+ private func onReviewOnAppStore( ) {
160
153
UIApplication . shared. openWriteReview ( )
161
154
}
162
155
163
- func onReportBug( ) {
156
+ private func onReportBug( ) {
164
157
guard let viewController = NewIssueTableViewController . create (
165
158
client: GithubClient ( userSession: sessionManager. focusedUserSession) ,
166
159
owner: " GitHawkApp " ,
@@ -176,7 +169,7 @@ GitHubSessionListener {
176
169
route_present ( to: navController)
177
170
}
178
171
179
- func onViewSource( ) {
172
+ private func onViewSource( ) {
180
173
guard let client = client else {
181
174
Squawk . showGenericError ( )
182
175
return
@@ -189,7 +182,7 @@ GitHubSessionListener {
189
182
route_detail ( to: RepositoryViewController ( client: client, repo: repo) )
190
183
}
191
184
192
- func onSetDefaultReaction( ) {
185
+ private func onSetDefaultReaction( ) {
193
186
let storyboard = UIStoryboard ( name: " Settings " , bundle: nil )
194
187
guard let viewController = storyboard. instantiateViewController ( withIdentifier: " DefaultReactionDetailController " ) as? DefaultReactionDetailController else {
195
188
fatalError ( " Cannot instantiate DefaultReactionDetailController instance " )
@@ -198,7 +191,7 @@ GitHubSessionListener {
198
191
route_detail ( to: viewController)
199
192
}
200
193
201
- func onTryTestFlightBeta( ) {
194
+ private func onTryTestFlightBeta( ) {
202
195
#if TESTFLIGHT
203
196
Squawk . showAlreadyOnBeta ( )
204
197
#else
@@ -208,7 +201,7 @@ GitHubSessionListener {
208
201
#endif
209
202
}
210
203
211
- func onSignOut( ) {
204
+ private func onSignOut( ) {
212
205
let title = NSLocalizedString ( " Are you sure? " , comment: " " )
213
206
let message = NSLocalizedString ( " All of your accounts will be signed out, and their bookmarks will be removed. Do you want to continue? " , comment: " " )
214
207
let alert = UIAlertController . configured ( title: title, message: message, preferredStyle: . alert)
@@ -225,11 +218,11 @@ GitHubSessionListener {
225
218
present ( alert, animated: trueUnlessReduceMotionEnabled)
226
219
}
227
220
228
- func signout( ) {
221
+ private func signout( ) {
229
222
sessionManager. logout ( )
230
223
}
231
224
232
- @objc func updateBadge( ) {
225
+ @objc private func updateBadge( ) {
233
226
BadgeNotifications . check { result in
234
227
let showSwitches : Bool
235
228
let pushEnabled : Bool
@@ -258,41 +251,41 @@ GitHubSessionListener {
258
251
}
259
252
}
260
253
261
- @IBAction func onBadgeChanged( ) {
254
+ private func updateActiveAccount( ) {
255
+ accountsCell. detailTextLabel? . text = sessionManager. focusedUserSession? . username ?? Constants . Strings. unknown
256
+ }
257
+
258
+ @IBAction private func onBadgeChanged( ) {
262
259
BadgeNotifications . isBadgeEnabled = badgeSwitch. isOn
263
260
BadgeNotifications . configure { _ in
264
261
self . updateBadge ( )
265
262
}
266
263
}
267
264
268
- @IBAction func onPushChanged( ) {
265
+ @IBAction private func onPushChanged( ) {
269
266
BadgeNotifications . isLocalNotificationEnabled = pushSwitch. isOn
270
267
BadgeNotifications . configure { _ in
271
268
self . updateBadge ( )
272
269
}
273
270
}
274
271
275
- @IBAction func onSettings( _ sender: Any ) {
272
+ @IBAction private func onSettings( _ sender: Any ) {
276
273
guard let url = URL ( string: UIApplicationOpenSettingsURLString) else { return }
277
274
UIApplication . shared. open ( url)
278
275
}
279
276
280
- @IBAction func onMarkRead( _ sender: Any ) {
277
+ @IBAction private func onMarkRead( _ sender: Any ) {
281
278
NotificationModelController . setReadOnOpen ( open: markReadSwitch. isOn)
282
279
}
283
280
284
- @IBAction func onSignature( _ sender: Any ) {
281
+ @IBAction private func onSignature( _ sender: Any ) {
285
282
Signature . enabled = signatureSwitch. isOn
286
283
}
287
284
288
- @IBAction func onPushNotificationsInfo( _ sender: Any ) {
285
+ @IBAction private func onPushNotificationsInfo( _ sender: Any ) {
289
286
showContextualMenu ( PushNotificationsDisclaimerViewController ( ) )
290
287
}
291
288
292
- func updateActiveAccount( ) {
293
- accountsCell. detailTextLabel? . text = sessionManager. focusedUserSession? . username ?? Constants . Strings. unknown
294
- }
295
-
296
289
// MARK: NewIssueTableViewControllerDelegate
297
290
298
291
func didDismissAfterCreatingIssue( model: IssueDetailsModel ) {
0 commit comments