Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
liberty
tunnel
liberty-tunnel-client-library-apple
Commits
76774971
Commit
76774971
authored
Jan 31, 2019
by
Jose Blaya
Browse files
Check if the app needs to clean the account info
parent
9bbaa10a
Changes
4
Hide whitespace changes
Inline
Side-by-side
PIALibrary/Sources/Core/Account/AccountProvider.swift
View file @
76774971
...
...
@@ -15,7 +15,10 @@ public protocol AccountProvider: class {
/// The in-app products required to purchase a `Plan`.
var
planProducts
:
[
Plan
:
InAppProduct
]?
{
get
}
#endif
/// Returns `true` if accountInfo is nil and loggedIn true.
var
shouldCleanAccount
:
Bool
{
get
}
/// Returns `true` if currently logged in, `false` otherwise.
var
isLoggedIn
:
Bool
{
get
}
...
...
PIALibrary/Sources/Library/Account/DefaultAccountProvider.swift
View file @
76774971
...
...
@@ -47,6 +47,14 @@ class DefaultAccountProvider: AccountProvider, ConfigurationAccess, DatabaseAcce
return
(
accessedDatabase
.
secure
.
password
(
for
:
username
)
!=
nil
)
}
var
shouldCleanAccount
:
Bool
{
if
self
.
accessedDatabase
.
plain
.
accountInfo
==
nil
,
self
.
isLoggedIn
{
return
true
}
return
false
}
var
publicUsername
:
String
?
{
guard
let
username
=
accessedDatabase
.
secure
.
publicUsername
()
else
{
return
nil
...
...
PIALibrary/Sources/Mock/MockAccountProvider.swift
View file @
76774971
...
...
@@ -106,6 +106,11 @@ public class MockAccountProvider: AccountProvider, WebServicesConsumer {
}
#endif
/// :nodoc:
public
var
shouldCleanAccount
:
Bool
{
return
false
}
/// :nodoc:
public
var
isLoggedIn
:
Bool
{
return
delegate
.
isLoggedIn
...
...
PIALibrary/Sources/UI/iOS/PIAWelcomeViewController.swift
View file @
76774971
...
...
@@ -324,6 +324,8 @@ class EphemeralAccountProvider: AccountProvider, ProvidersAccess, InAppAccess {
return
accessedProviders
.
accountProvider
.
planProducts
}
var
shouldCleanAccount
=
false
var
isLoggedIn
=
false
var
token
:
String
?
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment