@@ -28,36 +28,36 @@ class PersistedFirefoxAccount {
28
28
self . inner = inner
29
29
}
30
30
31
- public convenience init ( config: FxaConfig ) {
31
+ convenience init ( config: FxaConfig ) {
32
32
self . init ( inner: FirefoxAccount ( config: config) )
33
33
}
34
34
35
35
/// Registers a persistence callback. The callback will get called every time
36
36
/// the `FxAccounts` state needs to be saved. The callback must
37
37
/// persist the passed string in a secure location (like the keychain).
38
- public func registerPersistCallback( _ cb: PersistCallback ) {
38
+ func registerPersistCallback( _ cb: PersistCallback ) {
39
39
persistCallback = cb
40
40
}
41
41
42
42
/// Unregisters a persistence callback.
43
- public func unregisterPersistCallback( ) {
43
+ func unregisterPersistCallback( ) {
44
44
persistCallback = nil
45
45
}
46
46
47
- public static func fromJSON( data: String ) throws -> PersistedFirefoxAccount {
47
+ static func fromJSON( data: String ) throws -> PersistedFirefoxAccount {
48
48
return try PersistedFirefoxAccount ( inner: FirefoxAccount . fromJson ( data: data) )
49
49
}
50
50
51
- public func toJSON( ) throws -> String {
51
+ func toJSON( ) throws -> String {
52
52
try inner. toJson ( )
53
53
}
54
54
55
- public func setUserData( userData: UserData ) {
55
+ func setUserData( userData: UserData ) {
56
56
defer { tryPersistState ( ) }
57
57
inner. setUserData ( userData: userData)
58
58
}
59
59
60
- public func beginOAuthFlow(
60
+ func beginOAuthFlow(
61
61
scopes: [ String ] ,
62
62
entrypoint: String
63
63
) throws -> URL {
@@ -69,11 +69,11 @@ class PersistedFirefoxAccount {
69
69
}
70
70
}
71
71
72
- public func getPairingAuthorityURL( ) throws -> URL {
72
+ func getPairingAuthorityURL( ) throws -> URL {
73
73
return try URL ( string: inner. getPairingAuthorityUrl ( ) ) !
74
74
}
75
75
76
- public func beginPairingFlow(
76
+ func beginPairingFlow(
77
77
pairingUrl: String ,
78
78
scopes: [ String ] ,
79
79
entrypoint: String
@@ -85,33 +85,33 @@ class PersistedFirefoxAccount {
85
85
}
86
86
}
87
87
88
- public func completeOAuthFlow( code: String , state: String ) throws {
88
+ func completeOAuthFlow( code: String , state: String ) throws {
89
89
defer { tryPersistState ( ) }
90
90
try notifyAuthErrors {
91
91
try self . inner. completeOauthFlow ( code: code, state: state)
92
92
}
93
93
}
94
94
95
- public func checkAuthorizationStatus( ) throws -> AuthorizationInfo {
95
+ func checkAuthorizationStatus( ) throws -> AuthorizationInfo {
96
96
defer { tryPersistState ( ) }
97
97
return try notifyAuthErrors {
98
98
try self . inner. checkAuthorizationStatus ( )
99
99
}
100
100
}
101
101
102
- public func disconnect( ) {
102
+ func disconnect( ) {
103
103
defer { tryPersistState ( ) }
104
104
inner. disconnect ( )
105
105
}
106
106
107
- public func getProfile( ignoreCache: Bool ) throws -> Profile {
107
+ func getProfile( ignoreCache: Bool ) throws -> Profile {
108
108
defer { tryPersistState ( ) }
109
109
return try notifyAuthErrors {
110
110
try self . inner. getProfile ( ignoreCache: ignoreCache)
111
111
}
112
112
}
113
113
114
- public func initializeDevice(
114
+ func initializeDevice(
115
115
name: String ,
116
116
deviceType: DeviceType ,
117
117
supportedCapabilities: [ DeviceCapability ]
@@ -124,127 +124,127 @@ class PersistedFirefoxAccount {
124
124
}
125
125
}
126
126
127
- public func getCurrentDeviceId( ) throws -> String {
127
+ func getCurrentDeviceId( ) throws -> String {
128
128
return try notifyAuthErrors {
129
129
try self . inner. getCurrentDeviceId ( )
130
130
}
131
131
}
132
132
133
- public func getDevices( ignoreCache: Bool = false ) throws -> [ Device ] {
133
+ func getDevices( ignoreCache: Bool = false ) throws -> [ Device ] {
134
134
return try notifyAuthErrors {
135
135
try self . inner. getDevices ( ignoreCache: ignoreCache)
136
136
}
137
137
}
138
138
139
- public func getAttachedClients( ) throws -> [ AttachedClient ] {
139
+ func getAttachedClients( ) throws -> [ AttachedClient ] {
140
140
return try notifyAuthErrors {
141
141
try self . inner. getAttachedClients ( )
142
142
}
143
143
}
144
144
145
- public func setDeviceName( _ name: String ) throws {
145
+ func setDeviceName( _ name: String ) throws {
146
146
defer { tryPersistState ( ) }
147
147
try notifyAuthErrors {
148
148
try self . inner. setDeviceName ( displayName: name)
149
149
}
150
150
}
151
151
152
- public func clearDeviceName( ) throws {
152
+ func clearDeviceName( ) throws {
153
153
defer { tryPersistState ( ) }
154
154
try notifyAuthErrors {
155
155
try self . inner. clearDeviceName ( )
156
156
}
157
157
}
158
158
159
- public func ensureCapabilities( supportedCapabilities: [ DeviceCapability ] ) throws {
159
+ func ensureCapabilities( supportedCapabilities: [ DeviceCapability ] ) throws {
160
160
defer { tryPersistState ( ) }
161
161
try notifyAuthErrors {
162
162
try self . inner. ensureCapabilities ( supportedCapabilities: supportedCapabilities)
163
163
}
164
164
}
165
165
166
- public func setDevicePushSubscription( sub: DevicePushSubscription ) throws {
166
+ func setDevicePushSubscription( sub: DevicePushSubscription ) throws {
167
167
try notifyAuthErrors {
168
168
try self . inner. setPushSubscription ( subscription: sub)
169
169
}
170
170
}
171
171
172
- public func handlePushMessage( payload: String ) throws -> AccountEvent {
172
+ func handlePushMessage( payload: String ) throws -> AccountEvent {
173
173
defer { tryPersistState ( ) }
174
174
return try notifyAuthErrors {
175
175
try self . inner. handlePushMessage ( payload: payload)
176
176
}
177
177
}
178
178
179
- public func pollDeviceCommands( ) throws -> [ IncomingDeviceCommand ] {
179
+ func pollDeviceCommands( ) throws -> [ IncomingDeviceCommand ] {
180
180
defer { tryPersistState ( ) }
181
181
return try notifyAuthErrors {
182
182
try self . inner. pollDeviceCommands ( )
183
183
}
184
184
}
185
185
186
- public func sendSingleTab( targetDeviceId: String , title: String , url: String ) throws {
186
+ func sendSingleTab( targetDeviceId: String , title: String , url: String ) throws {
187
187
return try notifyAuthErrors {
188
188
try self . inner. sendSingleTab ( targetDeviceId: targetDeviceId, title: title, url: url)
189
189
}
190
190
}
191
191
192
- public func closeTabs( targetDeviceId: String , urls: [ String ] ) throws -> CloseTabsResult {
192
+ func closeTabs( targetDeviceId: String , urls: [ String ] ) throws -> CloseTabsResult {
193
193
return try notifyAuthErrors {
194
194
try self . inner. closeTabs ( targetDeviceId: targetDeviceId, urls: urls)
195
195
}
196
196
}
197
197
198
- public func getTokenServerEndpointURL( ) throws -> URL {
198
+ func getTokenServerEndpointURL( ) throws -> URL {
199
199
return try URL ( string: inner. getTokenServerEndpointUrl ( ) ) !
200
200
}
201
201
202
- public func getConnectionSuccessURL( ) throws -> URL {
202
+ func getConnectionSuccessURL( ) throws -> URL {
203
203
return try URL ( string: inner. getConnectionSuccessUrl ( ) ) !
204
204
}
205
205
206
- public func getManageAccountURL( entrypoint: String ) throws -> URL {
206
+ func getManageAccountURL( entrypoint: String ) throws -> URL {
207
207
return try URL ( string: inner. getManageAccountUrl ( entrypoint: entrypoint) ) !
208
208
}
209
209
210
- public func getManageDevicesURL( entrypoint: String ) throws -> URL {
210
+ func getManageDevicesURL( entrypoint: String ) throws -> URL {
211
211
return try URL ( string: inner. getManageDevicesUrl ( entrypoint: entrypoint) ) !
212
212
}
213
213
214
- public func getAccessToken( scope: String , ttl: UInt64 ? = nil ) throws -> AccessTokenInfo {
214
+ func getAccessToken( scope: String , ttl: UInt64 ? = nil ) throws -> AccessTokenInfo {
215
215
defer { tryPersistState ( ) }
216
216
return try notifyAuthErrors {
217
217
try self . inner. getAccessToken ( scope: scope, ttl: ttl == nil ? nil : Int64 ( clamping: ttl!) )
218
218
}
219
219
}
220
220
221
- public func getSessionToken( ) throws -> String {
221
+ func getSessionToken( ) throws -> String {
222
222
defer { tryPersistState ( ) }
223
223
return try notifyAuthErrors {
224
224
try self . inner. getSessionToken ( )
225
225
}
226
226
}
227
227
228
- public func handleSessionTokenChange( sessionToken: String ) throws {
228
+ func handleSessionTokenChange( sessionToken: String ) throws {
229
229
defer { tryPersistState ( ) }
230
230
return try notifyAuthErrors {
231
231
try self . inner. handleSessionTokenChange ( sessionToken: sessionToken)
232
232
}
233
233
}
234
234
235
- public func authorizeCodeUsingSessionToken( params: AuthorizationParameters ) throws -> String {
235
+ func authorizeCodeUsingSessionToken( params: AuthorizationParameters ) throws -> String {
236
236
defer { tryPersistState ( ) }
237
237
return try notifyAuthErrors {
238
238
try self . inner. authorizeCodeUsingSessionToken ( params: params)
239
239
}
240
240
}
241
241
242
- public func clearAccessTokenCache( ) {
242
+ func clearAccessTokenCache( ) {
243
243
defer { tryPersistState ( ) }
244
244
inner. clearAccessTokenCache ( )
245
245
}
246
246
247
- public func gatherTelemetry( ) throws -> String {
247
+ func gatherTelemetry( ) throws -> String {
248
248
return try notifyAuthErrors {
249
249
try self . inner. gatherTelemetry ( )
250
250
}
0 commit comments