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 12:22:26 +0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
0c138a3e4979d267eb756b8f1fc035696ddeb415
0c138a3e
1 parent
c4e6cce4
CouponVC expandables functionality
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
45 additions
and
14 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 @
0c138a3
No preview for this file type
SwiftWarplyFramework/SwiftWarplyFramework/screens/CouponViewController/CouponViewController.swift
View file @
0c138a3
...
...
@@ -56,6 +56,9 @@ import UIKit
// Constraints for animation
@IBOutlet
weak
var
couponQRContentHeightConstraint
:
NSLayoutConstraint
!
@IBOutlet
weak
var
termsButtonView
:
UIView
!
@IBOutlet
weak
var
termsButtonTitleLabel
:
UILabel
!
@IBOutlet
weak
var
termsButtonArrowImage
:
UIImageView
!
@IBOutlet
weak
var
termsButton
:
UIButton
!
@IBOutlet
weak
var
termsLabel
:
UILabel
!
@IBOutlet
weak
var
termsLabelHeight
:
NSLayoutConstraint
!
...
...
@@ -67,7 +70,7 @@ import UIKit
var
coupon
:
OfferModel
?
private
var
isDetailsExpanded
=
false
private
var
isCouponCodeExpanded
=
false
private
var
isCoupon
Barcode
Expanded
=
false
private
var
isCoupon
QR
Expanded
=
false
private
var
isTermsExpanded
=
false
public
override
func
viewDidLoad
()
{
...
...
@@ -89,6 +92,7 @@ import UIKit
copyButtonImage
.
image
=
UIImage
(
named
:
"copy"
,
in
:
MyEmptyClass
.
resourceBundle
(),
compatibleWith
:
nil
)
couponQRArrowImage
.
image
=
UIImage
(
named
:
"arrow_down"
,
in
:
MyEmptyClass
.
resourceBundle
(),
compatibleWith
:
nil
)
couponQRImage
.
image
=
UIImage
(
named
:
"barcode"
,
in
:
MyEmptyClass
.
resourceBundle
(),
compatibleWith
:
nil
)
termsButtonArrowImage
.
image
=
UIImage
(
named
:
"arrow_down"
,
in
:
MyEmptyClass
.
resourceBundle
(),
compatibleWith
:
nil
)
infoLabel
.
font
=
UIFont
(
name
:
"PingLCG-Regular"
,
size
:
13
)
infoLabel
.
textColor
=
UIColor
(
rgb
:
0x020E1C
)
...
...
@@ -99,22 +103,19 @@ import UIKit
couponCodeContainerView
.
backgroundColor
=
UIColor
(
rgb
:
0xFFFFFF
)
couponCodeContainerView
.
layer
.
cornerRadius
=
8.0
couponCodeContainerView
.
clipsToBounds
=
true
couponCodeButton
.
addTarget
(
self
,
action
:
#selector(
toggleCouponCode
)
,
for
:
.
touchUpInside
)
couponCodeContentHeightConstraint
.
constant
=
0
couponQRContainerView
.
backgroundColor
=
UIColor
(
rgb
:
0xFFFFFF
)
couponQRContainerView
.
layer
.
cornerRadius
=
8.0
couponQRContainerView
.
clipsToBounds
=
true
couponQRButton
.
addTarget
(
self
,
action
:
#selector(
toggleCouponQR
)
,
for
:
.
touchUpInside
)
couponQRContentHeightConstraint
.
constant
=
0
termsButton
.
titleLabel
?
.
font
=
UIFont
(
name
:
"PingLCG-Bold"
,
size
:
16
)
// termsButton.imageView?.layer.transform = CATransform3DMakeScale(1.5, 1.5, 1.5)
termsButton
.
setTitle
(
"Όροι Χρήσης"
,
for
:
.
normal
)
termsButton
.
setTitleColor
(
UIColor
(
rgb
:
0x020E1C
),
for
:
.
normal
)
termsButton
.
setImage
(
UIImage
(
named
:
"arrow_down.png"
,
in
:
MyEmptyClass
.
resourceBundle
(),
compatibleWith
:
nil
),
for
:
.
normal
)
termsButton
.
semanticContentAttribute
=
.
forceRightToLeft
termsButton
.
tintColor
=
UIColor
(
red
:
0.00
,
green
:
0.00
,
blue
:
0.00
,
alpha
:
1.00
)
termsButton
.
imageEdgeInsets
=
UIEdgeInsets
(
top
:
0
,
left
:
5
,
bottom
:
0
,
right
:
0
);
termsButton
.
titleEdgeInsets
=
UIEdgeInsets
(
top
:
0
,
left
:
0
,
bottom
:
0
,
right
:
5
);
termsButton
.
imageView
?
.
layer
.
transform
=
CATransform3DMakeScale
(
0.8
,
0.8
,
0.8
)
termsButtonTitleLabel
.
font
=
UIFont
(
name
:
"PingLCG-Bold"
,
size
:
16
)
termsButtonTitleLabel
.
textColor
=
UIColor
(
rgb
:
0x020E1C
)
termsButtonTitleLabel
.
text
=
"Όροι Χρήσης"
termsButton
.
addTarget
(
self
,
action
:
#selector(
toggleTerms
)
,
for
:
.
touchUpInside
)
termsLabelHeight
.
constant
=
0
mapButton
.
titleLabel
?
.
font
=
UIFont
(
name
:
"PingLCG-Bold"
,
size
:
16
)
...
...
@@ -180,12 +181,12 @@ import UIKit
detailsLabel
.
textColor
=
UIColor
(
rgb
:
0x020E1C
)
// Add tap gesture
let
tapGesture
=
UITapGestureRecognizer
(
target
:
self
,
action
:
#selector(
toggleDetails
Expansion
)
)
let
tapGesture
=
UITapGestureRecognizer
(
target
:
self
,
action
:
#selector(
toggleDetails
)
)
detailsLabel
.
isUserInteractionEnabled
=
true
detailsLabel
.
addGestureRecognizer
(
tapGesture
)
}
@objc
private
func
toggleDetails
Expansion
()
{
@objc
private
func
toggleDetails
()
{
isDetailsExpanded
.
toggle
()
UIView
.
animate
(
withDuration
:
0.3
)
{
...
...
@@ -193,4 +194,34 @@ import UIKit
self
.
view
.
layoutIfNeeded
()
}
}
@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
.
view
.
layoutIfNeeded
()
}
}
@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
.
view
.
layoutIfNeeded
()
}
}
@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
.
termsLabelHeight
.
constant
=
self
.
isTermsExpanded
?
self
.
termsLabel
.
intrinsicContentSize
.
height
:
0
self
.
view
.
layoutIfNeeded
()
}
}
}
...
...
SwiftWarplyFramework/SwiftWarplyFramework/screens/CouponViewController/CouponViewController.xib
View file @
0c138a3
This diff is collapsed. Click to expand it.
Please
register
or
login
to post a comment