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
2025-05-28 14:36:15 +0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
94dd15cada5e5085b384d87a737928a6ce14f9cc
94dd15ca
1 parent
0c7dbddd
CouponViewController fixes
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
68 additions
and
17 deletions
SwiftWarplyFramework/SwiftWarplyFramework.xcworkspace/xcuserdata/manos.xcuserdatad/UserInterfaceState.xcuserstate
SwiftWarplyFramework/SwiftWarplyFramework/screens/CouponViewController/CouponViewController.swift
SwiftWarplyFramework/SwiftWarplyFramework/screens/CouponViewController/CouponViewController.xib
SwiftWarplyFramework/SwiftWarplyFramework.xcworkspace/xcuserdata/manos.xcuserdatad/UserInterfaceState.xcuserstate
View file @
94dd15c
No preview for this file type
SwiftWarplyFramework/SwiftWarplyFramework/screens/CouponViewController/CouponViewController.swift
View file @
94dd15c
...
...
@@ -26,7 +26,6 @@ import UIKit
@IBOutlet
weak
var
couponCodeContainerView
:
UIView
!
@IBOutlet
weak
var
couponCodeHeaderView
:
UIView
!
@IBOutlet
weak
var
couponCodeContentView
:
UIView
!
@IBOutlet
weak
var
couponCodeContainerViewHeight
:
NSLayoutConstraint
!
// Header elements
@IBOutlet
weak
var
couponCodeTitleLabel
:
UILabel
!
...
...
@@ -45,7 +44,6 @@ import UIKit
@IBOutlet
weak
var
couponQRContainerView
:
UIView
!
@IBOutlet
weak
var
couponQRHeaderView
:
UIView
!
@IBOutlet
weak
var
couponQRContentView
:
UIView
!
@IBOutlet
weak
var
couponQRContainerViewHeight
:
NSLayoutConstraint
!
// Header elements
@IBOutlet
weak
var
couponQRTitleLabel
:
UILabel
!
...
...
@@ -108,7 +106,6 @@ import UIKit
couponCodeButton
.
addTarget
(
self
,
action
:
#selector(
toggleCouponCode
)
,
for
:
.
touchUpInside
)
couponCodeContentHeightConstraint
.
constant
=
0
couponCodeContentView
.
isHidden
=
true
couponCodeContainerViewHeight
.
constant
=
couponCodeContainerView
.
intrinsicContentSize
.
height
couponQRContainerView
.
backgroundColor
=
UIColor
(
rgb
:
0xFFFFFF
)
couponQRContainerView
.
layer
.
cornerRadius
=
8.0
...
...
@@ -116,7 +113,6 @@ import UIKit
couponQRButton
.
addTarget
(
self
,
action
:
#selector(
toggleCouponQR
)
,
for
:
.
touchUpInside
)
couponQRContentHeightConstraint
.
constant
=
0
couponQRContentView
.
isHidden
=
true
couponQRContainerViewHeight
.
constant
=
couponQRContainerView
.
intrinsicContentSize
.
height
termsButtonTitleLabel
.
font
=
UIFont
(
name
:
"PingLCG-Bold"
,
size
:
16
)
termsButtonTitleLabel
.
textColor
=
UIColor
(
rgb
:
0x020E1C
)
...
...
@@ -204,32 +200,87 @@ import UIKit
@objc
private
func
toggleCouponCode
()
{
isCouponCodeExpanded
.
toggle
()
UIView
.
animate
(
withDuration
:
0.3
)
{
self
.
couponCodeArrowImage
.
image
=
UIImage
(
named
:
self
.
isCouponCodeExpanded
?
"arrow_up"
:
"arrow_down"
,
in
:
MyEmptyClass
.
resourceBundle
(),
compatibleWith
:
nil
)
self
.
couponCodeContentHeightConstraint
.
constant
=
self
.
isCouponCodeExpanded
?
self
.
couponCodeContentView
.
intrinsicContentSize
.
height
:
0
self
.
couponCodeContentView
.
isHidden
=
!
self
.
isCouponCodeExpanded
self
.
couponCodeContainerViewHeight
.
constant
=
self
.
couponCodeContainerView
.
intrinsicContentSize
.
height
// 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
()
UIView
.
animate
(
withDuration
:
0.3
)
{
self
.
couponQRArrowImage
.
image
=
UIImage
(
named
:
self
.
isCouponQRExpanded
?
"arrow_up"
:
"arrow_down"
,
in
:
MyEmptyClass
.
resourceBundle
(),
compatibleWith
:
nil
)
self
.
couponQRContentHeightConstraint
.
constant
=
self
.
isCouponQRExpanded
?
self
.
couponQRContentView
.
intrinsicContentSize
.
height
:
0
self
.
couponQRContentView
.
isHidden
=
!
self
.
isCouponQRExpanded
self
.
couponQRContainerViewHeight
.
constant
=
self
.
couponQRContainerView
.
intrinsicContentSize
.
height
// 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
()
UIView
.
animate
(
withDuration
:
0.3
)
{
self
.
termsButtonArrowImage
.
image
=
UIImage
(
named
:
self
.
isTermsExpanded
?
"arrow_up"
:
"arrow_down"
,
in
:
MyEmptyClass
.
resourceBundle
(),
compatibleWith
:
nil
)
// self.termsButtonArrowImage.image = UIImage(named: self.isTermsExpanded ? "arrow_up" : "arrow_down", in: MyEmptyClass.resourceBundle(), compatibleWith: nil)
// Update arrow with rotation
let
rotation
=
self
.
isTermsExpanded
?
CGAffineTransform
(
rotationAngle
:
.
pi
)
:
.
identity
self
.
termsButtonArrowImage
.
transform
=
rotation
self
.
termsLabelHeight
.
constant
=
self
.
isTermsExpanded
?
self
.
termsLabel
.
intrinsicContentSize
.
height
:
0
self
.
view
.
layoutIfNeeded
()
}
...
...
SwiftWarplyFramework/SwiftWarplyFramework/screens/CouponViewController/CouponViewController.xib
View file @
94dd15c
This diff is collapsed. Click to expand it.
Please
register
or
login
to post a comment