Toggle navigation
Toggle navigation
This project
Loading...
Sign in
open-source
/
warply_sdk_framework
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Graphs
Network
Create a new issue
Commits
Issue Boards
Authored by
Manos Chorianopoulos
2026-03-13 13:51:52 +0200
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
79f3e63ffb746376b0aceb470324e2c5a7149438
79f3e63f
1 parent
63a75679
CouponViewController redesign part2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
135 deletions
SwiftWarplyFramework/SwiftWarplyFramework.xcworkspace/xcuserdata/manoschorianopoulos.xcuserdatad/UserInterfaceState.xcuserstate
SwiftWarplyFramework/SwiftWarplyFramework/screens/CouponViewController/CouponViewController.swift
SwiftWarplyFramework/SwiftWarplyFramework/screens/CouponViewController/CouponViewController.xib
SwiftWarplyFramework/SwiftWarplyFramework.xcworkspace/xcuserdata/manoschorianopoulos.xcuserdatad/UserInterfaceState.xcuserstate
View file @
79f3e63
No preview for this file type
SwiftWarplyFramework/SwiftWarplyFramework/screens/CouponViewController/CouponViewController.swift
View file @
79f3e63
...
...
@@ -38,39 +38,14 @@ import UIKit
@IBOutlet
weak
var
expirationLabel
:
UILabel
!
@IBOutlet
weak
var
detailsLabel
:
UILabel
!
// MARK: - IBOutlets for Coupon Code Section
@IBOutlet
weak
var
couponCodeContainerView
:
UIView
!
@IBOutlet
weak
var
couponCodeHeaderView
:
UIView
!
@IBOutlet
weak
var
couponCodeContentView
:
UIView
!
// Header elements
@IBOutlet
weak
var
couponCodeTitleLabel
:
UILabel
!
@IBOutlet
weak
var
couponCodeArrowImage
:
UIImageView
!
@IBOutlet
weak
var
couponCodeButton
:
UIButton
!
// Content elements (initially hidden)
@IBOutlet
weak
var
couponCodeValueLabel
:
UILabel
!
@IBOutlet
weak
var
copyButtonImage
:
UIImageView
!
@IBOutlet
weak
var
copyButton
:
UIButton
!
// Constraints for animation
@IBOutlet
weak
var
couponCodeContentHeightConstraint
:
NSLayoutConstraint
!
// MARK: - IBOutlets for Coupon Code Section
@IBOutlet
weak
var
couponQRContainerView
:
UIView
!
@IBOutlet
weak
var
couponQRHeaderView
:
UIView
!
@IBOutlet
weak
var
couponQRContentView
:
UIView
!
// Header elements
@IBOutlet
weak
var
couponQRTitleLabel
:
UILabel
!
@IBOutlet
weak
var
couponQRArrowImage
:
UIImageView
!
@IBOutlet
weak
var
couponQRButton
:
UIButton
!
// Content elements (initially hidden)
@IBOutlet
weak
var
couponQRImage
:
UIImageView
!
// Constraints for animation
@IBOutlet
weak
var
couponQRContentHeightConstraint
:
NSLayoutConstraint
!
// MARK: - IBOutlets for Unified Available Code Card
@IBOutlet
weak
var
couponQRContainerView
:
UIView
!
// outer light-blue card
@IBOutlet
weak
var
couponQRTitleLabel
:
UILabel
!
// "Available code"
@IBOutlet
weak
var
couponQRContentView
:
UIView
!
// inner white card
@IBOutlet
weak
var
couponQRImage
:
UIImageView
!
// barcode image
@IBOutlet
weak
var
couponCodeValueLabel
:
UILabel
!
// code text
@IBOutlet
weak
var
copyButtonImage
:
UIImageView
!
// copy icon
@IBOutlet
weak
var
copyButton
:
UIButton
!
// invisible tap target
@IBOutlet
weak
var
termsButtonView
:
UIView
!
@IBOutlet
weak
var
termsButtonTitleLabel
:
UILabel
!
...
...
@@ -85,8 +60,6 @@ import UIKit
var
coupon
:
CouponItemModel
?
private
var
isDetailsExpanded
=
false
private
var
isCouponCodeExpanded
=
false
private
var
isCouponQRExpanded
=
false
private
var
isTermsExpanded
=
false
public
override
func
viewDidLoad
()
{
...
...
@@ -113,10 +86,8 @@ import UIKit
infoView
.
layer
.
borderColor
=
UIColor
(
red
:
0.01
,
green
:
0.05
,
blue
:
0.11
,
alpha
:
0.19
)
.
cgColor
infoImage
.
image
=
UIImage
(
named
:
"info"
,
in
:
Bundle
.
frameworkResourceBundle
,
compatibleWith
:
nil
)
shareImage
.
image
=
UIImage
(
named
:
"share"
,
in
:
Bundle
.
frameworkResourceBundle
,
compatibleWith
:
nil
)
couponCodeArrowImage
.
image
=
UIImage
(
named
:
"arrow_down"
,
in
:
Bundle
.
frameworkResourceBundle
,
compatibleWith
:
nil
)
copyButtonImage
.
image
=
UIImage
(
named
:
"copy"
,
in
:
Bundle
.
frameworkResourceBundle
,
compatibleWith
:
nil
)
couponQRArrowImage
.
image
=
UIImage
(
named
:
"arrow_down"
,
in
:
Bundle
.
frameworkResourceBundle
,
compatibleWith
:
nil
)
shareImage
.
image
=
UIImage
(
named
:
"share_circle"
,
in
:
Bundle
.
frameworkResourceBundle
,
compatibleWith
:
nil
)
copyButtonImage
.
image
=
UIImage
(
named
:
"copy_circle"
,
in
:
Bundle
.
frameworkResourceBundle
,
compatibleWith
:
nil
)
couponQRImage
.
image
=
UIImage
(
named
:
"barcode_2"
,
in
:
Bundle
.
frameworkResourceBundle
,
compatibleWith
:
nil
)
termsButtonArrowImage
.
image
=
UIImage
(
named
:
"arrow_down"
,
in
:
Bundle
.
frameworkResourceBundle
,
compatibleWith
:
nil
)
expirationImage
.
image
=
UIImage
(
named
:
"clock"
,
in
:
Bundle
.
frameworkResourceBundle
,
compatibleWith
:
nil
)
...
...
@@ -125,19 +96,15 @@ import UIKit
infoLabel
.
textColor
=
UIColor
(
rgb
:
0x020E1C
)
infoLabel
.
text
=
"Περισσότερα"
couponCodeContainerView
.
backgroundColor
=
UIColor
(
rgb
:
0xFFFFFF
)
couponCodeContainerView
.
layer
.
cornerRadius
=
8.0
couponCodeContainerView
.
clipsToBounds
=
true
couponCodeButton
.
addTarget
(
self
,
action
:
#selector(
toggleCouponCode
)
,
for
:
.
touchUpInside
)
couponCodeContentHeightConstraint
.
constant
=
0
couponCodeContentView
.
isHidden
=
true
couponQRContainerView
.
backgroundColor
=
UIColor
(
rgb
:
0xFFFFFF
)
couponQRContainerView
.
layer
.
cornerRadius
=
8.0
// Unified Available Code card — outer container
couponQRContainerView
.
backgroundColor
=
UIColor
(
rgb
:
0xDDEFFB
)
couponQRContainerView
.
layer
.
cornerRadius
=
12.0
couponQRContainerView
.
clipsToBounds
=
true
couponQRButton
.
addTarget
(
self
,
action
:
#selector(
toggleCouponQR
)
,
for
:
.
touchUpInside
)
couponQRContentHeightConstraint
.
constant
=
0
couponQRContentView
.
isHidden
=
true
// Inner white card
couponQRContentView
.
backgroundColor
=
UIColor
(
rgb
:
0xFFFFFF
)
couponQRContentView
.
layer
.
cornerRadius
=
10.0
couponQRContentView
.
clipsToBounds
=
true
expirationView
.
backgroundColor
=
UIColor
(
rgb
:
0xDDEFFB
)
expirationView
.
layer
.
cornerRadius
=
6.0
...
...
@@ -252,21 +219,16 @@ import UIKit
// Description — from couponset_data description
setupExpandableDetails
(
with
:
coupon
)
//
Coupon
Code section
coupon
CodeTitleLabel
.
font
=
UIFont
(
name
:
"PingLCG-Regular"
,
size
:
16
)
coupon
Code
TitleLabel
.
textColor
=
UIColor
(
rgb
:
0x000F1E
)
coupon
CodeTitleLabel
.
text
=
"Κωδικός Κουπονιού
"
//
Unified Available
Code section
coupon
QRTitleLabel
.
font
=
UIFont
(
name
:
"PingLCG-Bold"
,
size
:
14
)
coupon
QR
TitleLabel
.
textColor
=
UIColor
(
rgb
:
0x000F1E
)
coupon
QRTitleLabel
.
text
=
"Available code
"
couponCodeValueLabel
.
font
=
UIFont
(
name
:
"PingLCG-Bold"
,
size
:
24
)
couponCodeValueLabel
.
font
=
UIFont
(
name
:
"PingLCG-Bold"
,
size
:
18
)
couponCodeValueLabel
.
textColor
=
UIColor
(
rgb
:
0x000F1E
)
couponCodeValueLabel
.
text
=
coupon
.
coupon
??
""
copyButton
.
addTarget
(
self
,
action
:
#selector(
copyButtonTapped
)
,
for
:
.
touchUpInside
)
// QR Code section
couponQRTitleLabel
.
font
=
UIFont
(
name
:
"PingLCG-Regular"
,
size
:
16
)
couponQRTitleLabel
.
textColor
=
UIColor
(
rgb
:
0x000F1E
)
couponQRTitleLabel
.
text
=
"Barcode Κουπονιού"
// Terms — from couponset_data terms
termsLabel
.
font
=
UIFont
(
name
:
"PingLCG-Regular"
,
size
:
15
)
termsLabel
.
textColor
=
UIColor
(
rgb
:
0x5C6369
)
...
...
@@ -398,80 +360,6 @@ import UIKit
}
}
@objc
private
func
toggleCouponCode
()
{
isCouponCodeExpanded
.
toggle
()
// Calculate the target height before animation
let
targetHeight
:
CGFloat
=
isCouponCodeExpanded
?
80.67
:
0
// Set a fixed height instead of intrinsicContentSize
// Show content immediately if expanding
if
isCouponCodeExpanded
{
couponCodeContentView
.
isHidden
=
false
couponCodeContentView
.
alpha
=
0
}
UIView
.
animate
(
withDuration
:
0.3
,
animations
:
{
// // Update arrow image
// self.couponCodeArrowImage.image = UIImage(named: self.isCouponCodeExpanded ? "arrow_up" : "arrow_down", in: MyEmptyClass.resourceBundle(), compatibleWith: nil)
// Update arrow with rotation
let
rotation
=
self
.
isCouponCodeExpanded
?
CGAffineTransform
(
rotationAngle
:
.
pi
)
:
.
identity
self
.
couponCodeArrowImage
.
transform
=
rotation
// Update height constraint
self
.
couponCodeContentHeightConstraint
.
constant
=
targetHeight
// Update alpha for smooth fade
self
.
couponCodeContentView
.
alpha
=
self
.
isCouponCodeExpanded
?
1.0
:
0.0
// Force layout update
self
.
view
.
layoutIfNeeded
()
})
{
_
in
// Hide content after animation completes if collapsing
if
!
self
.
isCouponCodeExpanded
{
self
.
couponCodeContentView
.
isHidden
=
true
}
}
}
@objc
private
func
toggleCouponQR
()
{
isCouponQRExpanded
.
toggle
()
// Calculate the target height before animation
let
targetHeight
:
CGFloat
=
isCouponQRExpanded
?
250
:
0
// Set a fixed height for QR code
// Show content immediately if expanding
if
isCouponQRExpanded
{
couponQRContentView
.
isHidden
=
false
couponQRContentView
.
alpha
=
0
}
UIView
.
animate
(
withDuration
:
0.3
,
animations
:
{
// Update arrow image
// self.couponQRArrowImage.image = UIImage(named: self.isCouponQRExpanded ? "arrow_up" : "arrow_down", in: MyEmptyClass.resourceBundle(), compatibleWith: nil)
// Update arrow with rotation
let
rotation
=
self
.
isCouponQRExpanded
?
CGAffineTransform
(
rotationAngle
:
.
pi
)
:
.
identity
self
.
couponQRArrowImage
.
transform
=
rotation
// Update height constraint
self
.
couponQRContentHeightConstraint
.
constant
=
targetHeight
// Update alpha for smooth fade
self
.
couponQRContentView
.
alpha
=
self
.
isCouponQRExpanded
?
1.0
:
0.0
// Force layout update
self
.
view
.
layoutIfNeeded
()
})
{
_
in
// Hide content after animation completes if collapsing
if
!
self
.
isCouponQRExpanded
{
self
.
couponQRContentView
.
isHidden
=
true
}
}
}
@objc
private
func
toggleTerms
()
{
isTermsExpanded
.
toggle
()
...
...
SwiftWarplyFramework/SwiftWarplyFramework/screens/CouponViewController/CouponViewController.xib
View file @
79f3e63
This diff is collapsed. Click to expand it.
Please
register
or
login
to post a comment