Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
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
a1235a0f
Commit
a1235a0f
authored
May 15, 2018
by
Davide De Rosa
Browse files
Merge branch '41-add-sibling-links-to-redeem-page' into 'develop'
Resolve "Add sibling links to redeem page"
parents
aa25ad2b
deaa9033
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
PIALibrary/Resources/UI/iOS/Welcome.storyboard
View file @
a1235a0f
This diff is collapsed.
Click to expand it.
PIALibrary/Resources/UI/iOS/en.lproj/Signup.strings
View file @
a1235a0f
...
...
@@ -13,7 +13,7 @@
"success.title" = "Purchase complete";
"success.message_format" = "Thank you for signing up with us. We have sent your account username and password at your email address at %@";
"success.redeem.title" = "Completed!";
"success.redeem.message" = "You will receive an email shortly with your username and password.";
"success.redeem.message" = "You will
also
receive an email shortly with your username and password.";
"success.username.caption" = "Username";
"success.password.caption" = "Password";
"success.submit" = "GET STARTED";
...
...
PIALibrary/Resources/UI/iOS/en.lproj/Welcome.strings
View file @
a1235a0f
...
...
@@ -12,6 +12,8 @@
"login.submit" = "LOGIN";
"login.purchase.footer" = "Don’t have an account?";
"login.purchase.button" = "Buy now!";
"login.redeem.footer" = "Have a gift card or trial card?";
"login.redeem.button" = "Redeem now!";
"login.restore.button" = "Couldn't get your plan?";
"login.error.title" = "Log in";
"login.error.validation" = "You must enter an username and password.";
...
...
PIALibrary/Sources/UI/iOS/LoginViewController.swift
View file @
a1235a0f
...
...
@@ -30,6 +30,12 @@ class LoginViewController: AutolayoutViewController, WelcomeChild {
@IBOutlet
private
weak
var
labelPurchase2
:
UILabel
!
@IBOutlet
private
weak
var
viewRedeem
:
UIView
!
@IBOutlet
private
weak
var
labelRedeem1
:
UILabel
!
@IBOutlet
private
weak
var
labelRedeem2
:
UILabel
!
@IBOutlet
private
weak
var
buttonRestorePurchase
:
UIButton
!
var
preset
:
PIAWelcomeViewController
.
Preset
?
...
...
@@ -55,6 +61,8 @@ class LoginViewController: AutolayoutViewController, WelcomeChild {
buttonLogin
.
title
=
L10n
.
Welcome
.
Login
.
submit
labelPurchase1
.
text
=
L10n
.
Welcome
.
Login
.
Purchase
.
footer
labelPurchase2
.
text
=
L10n
.
Welcome
.
Login
.
Purchase
.
button
labelRedeem1
.
text
=
L10n
.
Welcome
.
Login
.
Redeem
.
footer
labelRedeem2
.
text
=
L10n
.
Welcome
.
Login
.
Redeem
.
button
buttonRestorePurchase
.
setTitle
(
L10n
.
Welcome
.
Login
.
Restore
.
button
,
for
:
.
normal
)
buttonRestorePurchase
.
titleLabel
?
.
textAlignment
=
.
center
buttonRestorePurchase
.
titleLabel
?
.
numberOfLines
=
0
...
...
@@ -151,6 +159,13 @@ class LoginViewController: AutolayoutViewController, WelcomeChild {
pageController
.
show
(
page
:
.
purchase
)
}
@IBAction
private
func
redeem
(
_
sender
:
Any
?)
{
guard
let
pageController
=
parent
as?
WelcomePageViewController
else
{
fatalError
(
"Not running in WelcomePageViewController"
)
}
pageController
.
show
(
page
:
.
redeem
)
}
override
func
prepare
(
for
segue
:
UIStoryboardSegue
,
sender
:
Any
?)
{
if
let
vc
=
segue
.
destination
as?
RestoreSignupViewController
{
vc
.
preset
=
preset
...
...
@@ -192,6 +207,8 @@ class LoginViewController: AutolayoutViewController, WelcomeChild {
Theme
.
current
.
applyActionButton
(
buttonLogin
)
Theme
.
current
.
applyBody1
(
labelPurchase1
,
appearance
:
.
dark
)
Theme
.
current
.
applyTextButton
(
labelPurchase2
)
Theme
.
current
.
applyBody1
(
labelRedeem1
,
appearance
:
.
dark
)
Theme
.
current
.
applyTextButton
(
labelRedeem2
)
Theme
.
current
.
applyTextButton
(
buttonRestorePurchase
)
}
}
...
...
PIALibrary/Sources/UI/iOS/RedeemViewController.swift
View file @
a1235a0f
...
...
@@ -34,13 +34,11 @@ class RedeemViewController: AutolayoutViewController, WelcomeChild {
@IBOutlet
private
weak
var
viewFooter
:
UIView
!
// @IBOutlet private weak var viewPurchase: UIView!
//
// @IBOutlet private weak var labelPurchase1: UILabel!
//
// @IBOutlet private weak var labelPurchase2: UILabel!
//
// @IBOutlet private weak var buttonRestorePurchase: UIButton!
@IBOutlet
private
weak
var
viewLogin
:
UIView
!
@IBOutlet
private
weak
var
labelLogin1
:
UILabel
!
@IBOutlet
private
weak
var
labelLogin2
:
UILabel
!
var
preset
:
PIAWelcomeViewController
.
Preset
?
...
...
@@ -81,15 +79,11 @@ class RedeemViewController: AutolayoutViewController, WelcomeChild {
privacyUrl
:
Client
.
configuration
.
privacyUrl
)
buttonRedeem
.
title
=
L10n
.
Welcome
.
Redeem
.
submit
// labelPurchase1.text = L10n.Welcome.Login.Purchase.footer
// labelPurchase2.text = L10n.Welcome.Login.Purchase.button
// buttonRestorePurchase.setTitle(L10n.Welcome.Login.Restore.button, for: .normal)
// buttonRestorePurchase.titleLabel?.textAlignment = .center
// buttonRestorePurchase.titleLabel?.numberOfLines = 0
labelLogin1
.
text
=
L10n
.
Welcome
.
Purchase
.
Login
.
footer
labelLogin2
.
text
=
L10n
.
Welcome
.
Purchase
.
Login
.
button
viewFooter
.
isHidden
=
true
// buttonLogin.accessibilityIdentifier = "uitests.redeem.submit"
// viewPurchase.accessibilityLabel = "\(labelPurchase1.text!) \(labelPurchase2.text!)"
buttonRedeem
.
accessibilityIdentifier
=
"uitests.redeem.submit"
viewLogin
.
accessibilityLabel
=
"
\(
labelLogin1
.
text
!
)
\(
labelLogin2
.
text
!
)
"
textEmail
.
text
=
preset
.
redeemEmail
if
let
code
=
preset
.
redeemCode
{
redeemCode
=
strippedRedeemCode
(
code
)
// will set textCode automatically
...
...
@@ -140,6 +134,13 @@ class RedeemViewController: AutolayoutViewController, WelcomeChild {
perform
(
segue
:
StoryboardSegue
.
Welcome
.
signupViaRedeemSegue
)
}
@IBAction
private
func
logIn
(
_
sender
:
Any
?)
{
guard
let
pageController
=
parent
as?
WelcomePageViewController
else
{
fatalError
(
"Not running in WelcomePageViewController"
)
}
pageController
.
show
(
page
:
.
login
)
}
override
func
prepare
(
for
segue
:
UIStoryboardSegue
,
sender
:
Any
?)
{
if
(
segue
.
identifier
==
StoryboardSegue
.
Welcome
.
signupViaRedeemSegue
.
rawValue
)
{
let
nav
=
segue
.
destination
as!
UINavigationController
...
...
@@ -196,9 +197,8 @@ class RedeemViewController: AutolayoutViewController, WelcomeChild {
Theme
.
current
.
applyInput
(
textCode
)
Theme
.
current
.
applyLinkAttributes
(
textAgreement
)
Theme
.
current
.
applyActionButton
(
buttonRedeem
)
// Theme.current.applyBody1(labelPurchase1, appearance: .dark)
// Theme.current.applyTextButton(labelPurchase2)
// Theme.current.applyTextButton(buttonRestorePurchase)
Theme
.
current
.
applyBody1
(
labelLogin1
,
appearance
:
.
dark
)
Theme
.
current
.
applyTextButton
(
labelLogin2
)
}
}
...
...
PIALibrary/Sources/UI/iOS/SwiftGen+Strings.swift
View file @
a1235a0f
...
...
@@ -63,6 +63,13 @@ enum L10n {
static
let
footer
=
L10n
.
tr
(
"Welcome"
,
"login.purchase.footer"
)
}
enum
Redeem
{
/// Redeem now!
static
let
button
=
L10n
.
tr
(
"Welcome"
,
"login.redeem.button"
)
/// Have a gift card or trial card?
static
let
footer
=
L10n
.
tr
(
"Welcome"
,
"login.redeem.footer"
)
}
enum
Restore
{
/// Couldn't get your plan?
static
let
button
=
L10n
.
tr
(
"Welcome"
,
"login.restore.button"
)
...
...
@@ -246,7 +253,7 @@ enum L10n {
}
enum
Redeem
{
/// You will receive an email shortly with your username and password.
/// You will
also
receive an email shortly with your username and password.
static
let
message
=
L10n
.
tr
(
"Signup"
,
"success.redeem.message"
)
/// Completed!
static
let
title
=
L10n
.
tr
(
"Signup"
,
"success.redeem.title"
)
...
...
PIALibrary/Sources/UI/iOS/WelcomePageViewController.swift
View file @
a1235a0f
...
...
@@ -39,8 +39,11 @@ class WelcomePageViewController: UIPageViewController {
guard
!
source
.
isEmpty
else
{
fatalError
(
"Source controllers are empty"
)
}
let
isSinglePage
=
(
source
.
count
==
1
)
guard
isSinglePage
||
(
preset
.
pages
==
.
all
)
else
{
fatalError
(
"Currently supports all pages or a single page, not a subset"
)
}
for
vc
in
source
{
guard
let
child
=
vc
as?
WelcomeChild
else
{
fatalError
(
"Source element must be a WelcomeChild"
)
...
...
@@ -54,7 +57,23 @@ class WelcomePageViewController: UIPageViewController {
}
func
show
(
page
:
PIAWelcomeViewController
.
Pages
)
{
let
index
=
page
.
rawValue
-
1
// XXX: quick temp solution for log2
let
index
:
Int
switch
page
{
case
.
login
:
index
=
0
case
.
purchase
:
index
=
1
case
.
redeem
:
index
=
2
default
:
return
}
guard
(
index
<
source
.
count
)
else
{
fatalError
(
"Page
\(
index
)
beyond source controllers (
\(
source
.
count
)
)"
)
}
...
...
Write
Preview
Supports
Markdown
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