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-02-05 14:32:30 +0200
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
59a33a504691423cbcf5485dbf15e46c33605dfe
59a33a50
1 parent
3bd95a00
fix CouponsViewController empty view accessibility
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
51 additions
and
11 deletions
SwiftWarplyFramework/SwiftWarplyFramework/CouponsViewController.swift
SwiftWarplyFramework/SwiftWarplyFramework/Main.storyboard
SwiftWarplyFramework/SwiftWarplyFramework/CouponsViewController.swift
View file @
59a33a5
...
...
@@ -17,6 +17,7 @@ import SwiftEventBus
@IBOutlet
weak
var
emptyLabel
:
UILabel
!
public
var
coupons
:
Array
<
swiftApi
.
CouponItemModel
>
=
[]
var
showEmptyView
:
Bool
=
false
;
public
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
...
...
@@ -84,11 +85,13 @@ import SwiftEventBus
// MARK: - Functions
func
handleEmptyView
()
{
if
(
self
.
coupons
.
count
==
0
)
{
self
.
emptyView
.
isHidden
=
false
self
.
emptyViewHeight
.
constant
=
self
.
emptyView
.
intrinsicContentSize
.
height
// self.emptyView.isHidden = false
// self.emptyViewHeight.constant = self.emptyView.intrinsicContentSize.height
self
.
showEmptyView
=
true
}
else
{
self
.
emptyView
.
isHidden
=
true
self
.
emptyViewHeight
.
constant
=
0
// self.emptyView.isHidden = true
// self.emptyViewHeight.constant = 0
self
.
showEmptyView
=
false
}
}
...
...
@@ -122,28 +125,53 @@ import SwiftEventBus
extension
CouponsViewController
:
UITableViewDelegate
,
UITableViewDataSource
{
public
func
numberOfSections
(
in
tableView
:
UITableView
)
->
Int
{
return
1
return
2
}
public
func
tableView
(
_
tableView
:
UITableView
,
numberOfRowsInSection
section
:
Int
)
->
Int
{
if
(
section
==
0
)
{
return
self
.
coupons
.
count
}
else
if
(
section
==
1
)
{
if
(
self
.
showEmptyView
==
true
)
{
return
1
}
else
{
return
0
}
}
else
{
return
0
}
}
public
func
tableView
(
_
tableView
:
UITableView
,
heightForRowAt
indexPath
:
IndexPath
)
->
CGFloat
{
if
(
indexPath
.
section
==
0
)
{
return
130.0
+
8.0
}
else
if
(
indexPath
.
section
==
1
)
{
if
(
self
.
showEmptyView
==
true
)
{
return
UITableView
.
automaticDimension
}
else
{
return
0.0
}
}
else
{
return
0.0
}
// return UITableViewAutomaticDimension
}
public
func
tableView
(
_
tableView
:
UITableView
,
cellForRowAt
indexPath
:
IndexPath
)
->
UITableViewCell
{
if
(
indexPath
.
section
==
0
)
{
let
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
"CouponsTableViewCellId"
,
for
:
indexPath
)
as!
CouponsTableViewCell
cell
.
configureCell
(
coupon
:
coupons
[
indexPath
.
row
])
return
cell
}
else
{
let
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
"CouponsEmptyViewTableViewCellId"
,
for
:
indexPath
)
as!
CouponsEmptyViewTableViewCell
return
cell
}
}
public
func
tableView
(
_
tableView
:
UITableView
,
didSelectRowAt
indexPath
:
IndexPath
)
{
if
(
indexPath
.
section
==
0
)
{
// SwiftEventBus.post("couponBarcodePressed", sender: coupons[indexPath.row])
// Logs
...
...
@@ -159,6 +187,10 @@ extension CouponsViewController: UITableViewDelegate, UITableViewDataSource{
let
vc
=
storyboard
.
instantiateViewController
(
withIdentifier
:
"CouponBarcodeViewController"
)
as!
SwiftWarplyFramework
.
CouponBarcodeViewController
vc
.
coupon
=
coupons
[
indexPath
.
row
]
self
.
navigationController
?
.
pushViewController
(
vc
,
animated
:
true
)
}
else
if
(
indexPath
.
section
==
1
)
{
// Do nothing
}
}
}
...
...
SwiftWarplyFramework/SwiftWarplyFramework/Main.storyboard
View file @
59a33a5
...
...
@@ -158,17 +158,17 @@
</connections>
</tableViewCell>
<tableViewCell
clipsSubviews=
"YES"
contentMode=
"scaleToFill"
insetsLayoutMarginsFromSafeArea=
"NO"
selectionStyle=
"none"
indentationWidth=
"0.0"
reuseIdentifier=
"CouponsEmptyViewTableViewCellId"
id=
"Q8g-pg-5xK"
customClass=
"CouponsEmptyViewTableViewCell"
customModule=
"SwiftWarplyFramework"
customModuleProvider=
"target"
>
<rect
key=
"frame"
x=
"0.0"
y=
"114.5"
width=
"414"
height=
"
44
"
/>
<rect
key=
"frame"
x=
"0.0"
y=
"114.5"
width=
"414"
height=
"
18.5
"
/>
<autoresizingMask
key=
"autoresizingMask"
/>
<tableViewCellContentView
key=
"contentView"
opaque=
"NO"
clipsSubviews=
"YES"
multipleTouchEnabled=
"YES"
contentMode=
"center"
preservesSuperviewLayoutMargins=
"YES"
insetsLayoutMarginsFromSafeArea=
"NO"
tableViewCell=
"Q8g-pg-5xK"
id=
"JYq-d6-s3q"
>
<rect
key=
"frame"
x=
"0.0"
y=
"0.0"
width=
"414"
height=
"
44
"
/>
<rect
key=
"frame"
x=
"0.0"
y=
"0.0"
width=
"414"
height=
"
18.5
"
/>
<autoresizingMask
key=
"autoresizingMask"
/>
<subviews>
<view
contentMode=
"scaleToFill"
ambiguous=
"YES"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"z9z-j6-tcA"
>
<rect
key=
"frame"
x=
"
20"
y=
"21.5"
width=
"374"
height=
"0.0
"
/>
<view
contentMode=
"scaleToFill"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"z9z-j6-tcA"
>
<rect
key=
"frame"
x=
"
0.0"
y=
"0.0"
width=
"414"
height=
"18.5
"
/>
<subviews>
<label
opaque=
"NO"
userInteractionEnabled=
"NO"
contentMode=
"left"
horizontalHuggingPriority=
"251"
verticalHuggingPriority=
"251"
text=
"Label"
textAlignment=
"center"
lineBreakMode=
"tailTruncation"
numberOfLines=
"0"
baselineAdjustment=
"alignBaselines"
adjustsFontSizeToFit=
"NO"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"c0T-sg-38i"
>
<rect
key=
"frame"
x=
"20"
y=
"0.0"
width=
"3
8.5
"
height=
"18.5"
/>
<rect
key=
"frame"
x=
"20"
y=
"0.0"
width=
"3
74
"
height=
"18.5"
/>
<fontDescription
key=
"fontDescription"
name=
"PeridotPE-Regular"
family=
"Peridot PE"
pointSize=
"15"
/>
<color
key=
"textColor"
red=
"0.12941176469999999"
green=
"0.12941176469999999"
blue=
"0.12941176469999999"
alpha=
"1"
colorSpace=
"calibratedRGB"
/>
<nil
key=
"highlightedColor"
/>
...
...
@@ -184,6 +184,12 @@
</view>
</subviews>
<color
key=
"backgroundColor"
white=
"0.0"
alpha=
"0.0"
colorSpace=
"custom"
customColorSpace=
"genericGamma22GrayColorSpace"
/>
<constraints>
<constraint
firstItem=
"z9z-j6-tcA"
firstAttribute=
"leading"
secondItem=
"JYq-d6-s3q"
secondAttribute=
"leading"
id=
"53J-AG-7CH"
/>
<constraint
firstAttribute=
"bottom"
secondItem=
"z9z-j6-tcA"
secondAttribute=
"bottom"
id=
"Ztu-bS-fcn"
/>
<constraint
firstItem=
"z9z-j6-tcA"
firstAttribute=
"top"
secondItem=
"JYq-d6-s3q"
secondAttribute=
"top"
id=
"Zwf-CZ-Fdw"
/>
<constraint
firstAttribute=
"trailing"
secondItem=
"z9z-j6-tcA"
secondAttribute=
"trailing"
id=
"vBa-MC-bSw"
/>
</constraints>
</tableViewCellContentView>
<color
key=
"backgroundColor"
white=
"0.0"
alpha=
"0.0"
colorSpace=
"custom"
customColorSpace=
"genericGamma22GrayColorSpace"
/>
<connections>
...
...
@@ -232,6 +238,7 @@
<variation
key=
"default"
>
<mask
key=
"subviews"
>
<exclude
reference=
"5rB-1e-ygb"
/>
<exclude
reference=
"pdh-2h-vVS"
/>
</mask>
</variation>
</view>
...
...
@@ -4505,6 +4512,7 @@
<outlet
property=
"dotRight"
destination=
"lSo-ay-XsD"
id=
"E2j-PC-Gb3"
/>
<outlet
property=
"dotRightHeight"
destination=
"HV6-Q8-2aO"
id=
"U9Z-Sh-b8t"
/>
<outlet
property=
"dotRightWidth"
destination=
"15e-YJ-Pxi"
id=
"ti6-L4-Nec"
/>
<outlet
property=
"historyButton"
destination=
"nmF-FM-3Dl"
id=
"ePm-nD-CZR"
/>
<outlet
property=
"historyButtonImage"
destination=
"Dhs-5p-kfA"
id=
"cek-Li-bJt"
/>
<outlet
property=
"sectionTitleLabel"
destination=
"2hO-dB-t2z"
id=
"lsu-hO-JQE"
/>
</connections>
...
...
Please
register
or
login
to post a comment