Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Open sidebar
liberty
tunnel
liberty-tunnel-client-library-apple
Commits
14f4a781
Commit
14f4a781
authored
Jan 13, 2021
by
Thomas Markiewicz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updates for Librem One
parent
82674ee6
Changes
15
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
97 additions
and
66 deletions
+97
-66
PIALibrary/Resources/UI/iOS/UI.xcassets/PIAX/Global/logo-dark.imageset/Contents.json
.../UI.xcassets/PIAX/Global/logo-dark.imageset/Contents.json
+1
-1
PIALibrary/Resources/UI/iOS/UI.xcassets/PIAX/Global/logo-dark.imageset/nav-logo-white@3x.png
...sets/PIAX/Global/logo-dark.imageset/nav-logo-white@3x.png
+0
-0
PIALibrary/Resources/UI/iOS/UI.xcassets/PIAX/Global/logo-dark.imageset/piaWhiteCopy.pdf
....xcassets/PIAX/Global/logo-dark.imageset/piaWhiteCopy.pdf
+0
-0
PIALibrary/Resources/UI/iOS/UI.xcassets/PIAX/Global/logo-light.imageset/Contents.json
...UI.xcassets/PIAX/Global/logo-light.imageset/Contents.json
+1
-1
PIALibrary/Resources/UI/iOS/UI.xcassets/PIAX/Global/logo-light.imageset/nav-logo@3x.png
....xcassets/PIAX/Global/logo-light.imageset/nav-logo@3x.png
+0
-0
PIALibrary/Resources/UI/iOS/UI.xcassets/PIAX/Global/logo-light.imageset/piaDark2Copy2.pdf
...cassets/PIAX/Global/logo-light.imageset/piaDark2Copy2.pdf
+0
-0
PIALibrary/Resources/UI/iOS/UI.xcassets/nav-logo.imageset/Contents.json
...ources/UI/iOS/UI.xcassets/nav-logo.imageset/Contents.json
+1
-1
PIALibrary/Resources/UI/iOS/UI.xcassets/nav-logo.imageset/nav-logo@3x.png
...rces/UI/iOS/UI.xcassets/nav-logo.imageset/nav-logo@3x.png
+0
-0
PIALibrary/Resources/UI/iOS/UI.xcassets/nav-logo.imageset/piaDark2Copy2.pdf
...es/UI/iOS/UI.xcassets/nav-logo.imageset/piaDark2Copy2.pdf
+0
-0
PIALibrary/Resources/UI/iOS/Welcome.storyboard
PIALibrary/Resources/UI/iOS/Welcome.storyboard
+51
-43
PIALibrary/Resources/UI/iOS/en.lproj/Welcome.strings
PIALibrary/Resources/UI/iOS/en.lproj/Welcome.strings
+4
-3
PIALibrary/Sources/UI/iOS/SwiftGen+Assets.swift
PIALibrary/Sources/UI/iOS/SwiftGen+Assets.swift
+7
-2
PIALibrary/Sources/UI/iOS/SwiftGen+Strings.swift
PIALibrary/Sources/UI/iOS/SwiftGen+Strings.swift
+13
-5
PIALibrary/Sources/UI/iOS/ViewControllers/GetStartedViewController.swift
...ces/UI/iOS/ViewControllers/GetStartedViewController.swift
+9
-6
PIALibrary/Sources/UI/iOS/ViewControllers/LoginViewController.swift
.../Sources/UI/iOS/ViewControllers/LoginViewController.swift
+10
-4
No files found.
PIALibrary/Resources/UI/iOS/UI.xcassets/PIAX/Global/logo-dark.imageset/Contents.json
View file @
14f4a781
...
...
@@ -2,7 +2,7 @@
"images"
:
[
{
"idiom"
:
"universal"
,
"filename"
:
"
piaWhiteCopy.pdf
"
"filename"
:
"
nav-logo-white@3x
"
}
],
"info"
:
{
...
...
PIALibrary/Resources/UI/iOS/UI.xcassets/PIAX/Global/logo-dark.imageset/nav-logo-white@3x.png
0 → 100644
View file @
14f4a781
12.2 KB
PIALibrary/Resources/UI/iOS/UI.xcassets/PIAX/Global/logo-dark.imageset/piaWhiteCopy.pdf
deleted
100644 → 0
View file @
82674ee6
File deleted
PIALibrary/Resources/UI/iOS/UI.xcassets/PIAX/Global/logo-light.imageset/Contents.json
View file @
14f4a781
...
...
@@ -2,7 +2,7 @@
"images"
:
[
{
"idiom"
:
"universal"
,
"filename"
:
"
piaDark2Copy2.pdf
"
"filename"
:
"
nav-logo@3x.png
"
}
],
"info"
:
{
...
...
PIALibrary/Resources/UI/iOS/UI.xcassets/PIAX/Global/logo-light.imageset/nav-logo@3x.png
0 → 100644
View file @
14f4a781
14.2 KB
PIALibrary/Resources/UI/iOS/UI.xcassets/PIAX/Global/logo-light.imageset/piaDark2Copy2.pdf
deleted
100644 → 0
View file @
82674ee6
File deleted
PIALibrary/Resources/UI/iOS/UI.xcassets/nav-logo.imageset/Contents.json
View file @
14f4a781
...
...
@@ -2,7 +2,7 @@
"images"
:
[
{
"idiom"
:
"universal"
,
"filename"
:
"
piaDark2Copy2.pdf
"
"filename"
:
"
nav-logo@3x.png
"
}
],
"info"
:
{
...
...
PIALibrary/Resources/UI/iOS/UI.xcassets/nav-logo.imageset/nav-logo@3x.png
0 → 100644
View file @
14f4a781
14.2 KB
PIALibrary/Resources/UI/iOS/UI.xcassets/nav-logo.imageset/piaDark2Copy2.pdf
deleted
100644 → 0
View file @
82674ee6
File deleted
PIALibrary/Resources/UI/iOS/Welcome.storyboard
View file @
14f4a781
This diff is collapsed.
Click to expand it.
PIALibrary/Resources/UI/iOS/en.lproj/Welcome.strings
View file @
14f4a781
...
...
@@ -9,18 +9,19 @@
"login.title" = "Sign in to your account";
"login.username.placeholder" = "Username (p1234567)";
"login.password.placeholder" = "Password";
"login.username.l1Placeholder" = "Librem One address";
"login.password.l1Placeholder" = "Passphrase";
"login.submit" = "LOGIN";
"login.restore.button" = "Didn't receive account details?";
"login.error.title" = "Log in";
"login.error.validation" = "You must enter a username and pass
word
.";
"login.error.unauthorized" = "Your username or pass
word
is incorrect.";
"login.error.validation" = "You must enter a username and pass
phrase
.";
"login.error.unauthorized" = "Your username or pass
phrase
is incorrect.";
"login.error.throttled" = "Too many failed login attempts with this username. Please try again later.";
"login.receipt.button" = "Login using purchase receipt";
"login.magic.link.title" = "Login using magic email link";
"login.magic.link.response" = "Please check your e-mail for a login link.";
"login.magic.link.send" = "Send Link";
"login.magic.link.invalid.email" = "Invalid email. Please try again.";
"purchase.title" = "Select a VPN plan";
"purchase.subtitle" = "30-day money back guarantee";
"purchase.email.placeholder" = "Email address";
...
...
PIALibrary/Sources/UI/iOS/SwiftGen+Assets.swift
View file @
14f4a781
...
...
@@ -68,7 +68,8 @@ internal struct ImageAsset {
#if os(iOS) || os(tvOS)
let
image
=
Image
(
named
:
name
,
in
:
bundle
,
compatibleWith
:
nil
)
#elseif os(macOS)
let
image
=
bundle
.
image
(
forResource
:
NSImage
.
Name
(
name
))
let
name
=
NSImage
.
Name
(
self
.
name
)
let
image
=
(
bundle
==
.
main
)
?
NSImage
(
named
:
name
)
:
bundle
.
image
(
forResource
:
name
)
#elseif os(watchOS)
let
image
=
Image
(
named
:
name
)
#endif
...
...
@@ -97,7 +98,11 @@ internal extension ImageAsset.Image {
// swiftlint:disable convenience_type
private
final
class
BundleToken
{
static
let
bundle
:
Bundle
=
{
Bundle
(
for
:
BundleToken
.
self
)
#if SWIFT_PACKAGE
return
Bundle
.
module
#else
return
Bundle
(
for
:
BundleToken
.
self
)
#endif
}()
}
// swiftlint:enable convenience_type
PIALibrary/Sources/UI/iOS/SwiftGen+Strings.swift
View file @
14f4a781
...
...
@@ -8,7 +8,7 @@ import Foundation
// MARK: - Strings
// swiftlint:disable explicit_type_interface function_parameter_count identifier_name line_length
// swiftlint:disable nesting type_body_length type_name
// swiftlint:disable nesting type_body_length type_name
vertical_whitespace_opening_braces
internal
enum
L10n
{
internal
enum
Signup
{
internal
enum
Failure
{
...
...
@@ -263,9 +263,9 @@ internal enum L10n {
internal
static
let
throttled
=
L10n
.
tr
(
"Welcome"
,
"login.error.throttled"
)
/// Log in
internal
static
let
title
=
L10n
.
tr
(
"Welcome"
,
"login.error.title"
)
/// Your username or pass
word
is incorrect.
/// Your username or pass
phrase
is incorrect.
internal
static
let
unauthorized
=
L10n
.
tr
(
"Welcome"
,
"login.error.unauthorized"
)
/// You must enter a username and pass
word
.
/// You must enter a username and pass
phrase
.
internal
static
let
validation
=
L10n
.
tr
(
"Welcome"
,
"login.error.validation"
)
}
internal
enum
Magic
{
...
...
@@ -283,6 +283,8 @@ internal enum L10n {
}
}
internal
enum
Password
{
/// Passphrase
internal
static
let
l1Placeholder
=
L10n
.
tr
(
"Welcome"
,
"login.password.l1Placeholder"
)
/// Password
internal
static
let
placeholder
=
L10n
.
tr
(
"Welcome"
,
"login.password.placeholder"
)
}
...
...
@@ -295,6 +297,8 @@ internal enum L10n {
internal
static
let
button
=
L10n
.
tr
(
"Welcome"
,
"login.restore.button"
)
}
internal
enum
Username
{
/// Librem One address
internal
static
let
l1Placeholder
=
L10n
.
tr
(
"Welcome"
,
"login.username.l1Placeholder"
)
/// Username (p1234567)
internal
static
let
placeholder
=
L10n
.
tr
(
"Welcome"
,
"login.username.placeholder"
)
}
...
...
@@ -424,7 +428,7 @@ internal enum L10n {
}
}
// swiftlint:enable explicit_type_interface function_parameter_count identifier_name line_length
// swiftlint:enable nesting type_body_length type_name
// swiftlint:enable nesting type_body_length type_name
vertical_whitespace_opening_braces
// MARK: - Implementation Details
...
...
@@ -438,7 +442,11 @@ extension L10n {
// swiftlint:disable convenience_type
private
final
class
BundleToken
{
static
let
bundle
:
Bundle
=
{
Bundle
(
for
:
BundleToken
.
self
)
#if SWIFT_PACKAGE
return
Bundle
.
module
#else
return
Bundle
(
for
:
BundleToken
.
self
)
#endif
}()
}
// swiftlint:enable convenience_type
PIALibrary/Sources/UI/iOS/ViewControllers/GetStartedViewController.swift
View file @
14f4a781
...
...
@@ -27,7 +27,7 @@ public class GetStartedViewController: PIAWelcomeViewController {
private
static
let
smallDeviceMaxViewHeight
:
CGFloat
=
520
private
static
let
maxViewHeight
:
CGFloat
=
500
private
static
let
extraViewButtonsHeight
:
CGFloat
=
48
private
static
let
defaultViewHeight
:
CGFloat
=
276
private
static
let
defaultViewHeight
:
CGFloat
=
100
@IBOutlet
private
weak
var
spinner
:
UIActivityIndicatorView
!
...
...
@@ -120,8 +120,11 @@ public class GetStartedViewController: PIAWelcomeViewController {
pageControl
.
numberOfPages
=
allData
.
count
visualEffectView
.
clipsToBounds
=
true
visualEffectView
.
layer
.
cornerRadius
=
15
visualEffectView
.
layer
.
maskedCorners
=
[
.
layerMaxXMinYCorner
,
.
layerMinXMinYCorner
]
/* Removed for L1
//visualEffectView.layer.cornerRadius = 15
//visualEffectView.layer.maskedCorners = [.layerMaxXMinYCorner, .layerMinXMinYCorner]
*/
let
swipeDown
=
UISwipeGestureRecognizer
(
target
:
self
,
action
:
#selector(
self.respondToSwipeGesture
)
)
swipeDown
.
direction
=
UISwipeGestureRecognizer
.
Direction
.
down
...
...
@@ -136,7 +139,7 @@ public class GetStartedViewController: PIAWelcomeViewController {
}
@objc
func
respondToSwipeGesture
(
gesture
:
UIGestureRecognizer
)
{
/* Removed for L1
if let swipeGesture = gesture as? UISwipeGestureRecognizer {
switch swipeGesture.direction {
...
...
@@ -148,7 +151,7 @@ public class GetStartedViewController: PIAWelcomeViewController {
break
}
}
*/
}
override
public
func
viewWillTransition
(
to
size
:
CGSize
,
with
coordinator
:
UIViewControllerTransitionCoordinator
)
{
...
...
PIALibrary/Sources/UI/iOS/ViewControllers/LoginViewController.swift
View file @
14f4a781
...
...
@@ -71,8 +71,8 @@ class LoginViewController: AutolayoutViewController, WelcomeChild {
NotificationCenter
.
default
.
addObserver
(
self
,
selector
:
#selector(
finishLoginWithMagicLink
)
,
name
:
.
PIAFinishLoginWithMagicLink
,
object
:
nil
)
labelTitle
.
text
=
L10n
.
Welcome
.
Login
.
title
textUsername
.
placeholder
=
L10n
.
Welcome
.
Login
.
Username
.
p
laceholder
textPassword
.
placeholder
=
L10n
.
Welcome
.
Login
.
Password
.
p
laceholder
textUsername
.
placeholder
=
L10n
.
Welcome
.
Login
.
Username
.
l1P
laceholder
textPassword
.
placeholder
=
L10n
.
Welcome
.
Login
.
Password
.
l1P
laceholder
textUsername
.
text
=
preset
.
loginUsername
textPassword
.
text
=
preset
.
loginPassword
...
...
@@ -256,8 +256,6 @@ class LoginViewController: AutolayoutViewController, WelcomeChild {
/* START Librem One specific */
// assume here for now that 'username' is in a form of an email
// if there is no @ sign, should I assume it's just the "username" part? (I think so...)
let
emailParts
=
username
.
split
(
separator
:
"@"
)
let
librem_username
=
emailParts
[
0
]
let
librem_domain
=
emailParts
.
count
>
1
?
emailParts
[
1
]
:
"librem.one"
;
...
...
@@ -270,6 +268,8 @@ class LoginViewController: AutolayoutViewController, WelcomeChild {
Alamofire
.
request
(
libremOneAccountUrl
,
headers
:
headers
)
.
responseJSON
{
response
in
var
errorMessage
:
String
?
if
let
result
=
response
.
result
.
value
{
// got some result successfully - get PIA username and password out of it
...
...
@@ -282,6 +282,9 @@ class LoginViewController: AutolayoutViewController, WelcomeChild {
self
.
logInToPIA
(
tunnelUser
,
tunnelPassword
,
username
)
}
else
{
log
.
error
(
"Failed to obtain valid PIA username and password from Librem One"
);
errorMessage
=
L10n
.
Welcome
.
Login
.
Error
.
unauthorized
Macros
.
displayImageNote
(
withImage
:
Asset
.
iconWarning
.
image
,
message
:
errorMessage
??
L10n
.
Welcome
.
Login
.
Error
.
title
)
self
.
enableInteractions
(
true
)
self
.
hideLoadingAnimation
()
}
...
...
@@ -289,6 +292,9 @@ class LoginViewController: AutolayoutViewController, WelcomeChild {
log
.
error
(
"Failed to obtain a response from Librem One login attempt"
);
self
.
enableInteractions
(
true
)
self
.
hideLoadingAnimation
()
Macros
.
displayImageNote
(
withImage
:
Asset
.
iconWarning
.
image
,
message
:
L10n
.
Welcome
.
Login
.
Error
.
title
)
}
}
...
...
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