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-04 16:25:05 +0200
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
21913e9606ebf1e52055a88ca43dab384a61ee94
21913e96
1 parent
dc65aba0
CouponsVC accessibilitues
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
56 additions
and
1 deletions
SwiftWarplyFramework/SwiftWarplyFramework/CouponsTableViewCell.swift
SwiftWarplyFramework/SwiftWarplyFramework/CouponsViewController.swift
SwiftWarplyFramework/SwiftWarplyFramework/ViewControllerExtensions.swift
SwiftWarplyFramework/SwiftWarplyFramework/swiftApi.swift
SwiftWarplyFramework/SwiftWarplyFramework/CouponsTableViewCell.swift
View file @
21913e9
...
...
@@ -193,6 +193,8 @@ import UIKit
// discriptionLabel.text = htmlText.htmlToString
discriptionLabel
.
text
=
couponSetData
?
.
inner_text
??
""
expirationLabel
.
text
=
"Ισχύει έως "
+
(
coupon
.
expiration
??
""
)
setupAccessibilty
(
name
:
nameLabel
.
text
??
""
,
discount
:
dicountLabel
.
text
??
""
,
description
:
discriptionLabel
.
text
??
""
,
expirationString
:
""
,
expirationDate
:
(
coupon
.
expirationDate
))
}
func
configureCell
(
coupon
:
swiftApi
.
CouponItemModel
,
isMarket
:
Bool
)
{
...
...
@@ -334,6 +336,8 @@ import UIKit
discriptionLabel
.
text
=
htmlText
.
htmlToString
// discriptionLabel.text = coupon.inner_text ?? ""
let
expirationString
=
expirationLabel
.
text
==
"Το κουπόνι έληξε"
?
"Το κουπόνι έληξε"
:
""
setupAccessibilty
(
name
:
nameLabel
.
text
??
""
,
discount
:
dicountLabel
.
text
??
""
,
description
:
discriptionLabel
.
text
??
""
,
expirationString
:
expirationString
,
expirationDate
:
(
coupon
.
expirationDate
))
}
func
configureCell
(
coupon
:
swiftApi
.
CouponItemModel
,
isSMCoupon
:
Bool
)
{
...
...
@@ -378,6 +382,34 @@ import UIKit
// discriptionLabel.text = htmlText.htmlToString
discriptionLabel
.
text
=
couponSetData
?
.
inner_text
??
""
expirationLabel
.
text
=
"Ισχύει έως "
+
(
coupon
.
expiration
??
""
)
setupAccessibilty
(
name
:
nameLabel
.
text
??
""
,
discount
:
dicountLabel
.
text
??
""
,
description
:
discriptionLabel
.
text
??
""
,
expirationString
:
""
,
expirationDate
:
(
coupon
.
expirationDate
))
}
func
setupAccessibilty
(
name
:
String
,
discount
:
String
,
description
:
String
,
expirationString
:
String
,
expirationDate
:
Date
?)
{
var
formatedExpiration
=
""
if
(
expirationString
.
isEmpty
)
{
let
dateFormatter
=
DateFormatter
()
// dateFormatter.dateFormat = "yyyy-MM-dd HH:mm:ss"
dateFormatter
.
locale
=
Locale
(
identifier
:
"en_US_POSIX"
)
if
let
date
=
expirationDate
{
// Set output format in Greek
dateFormatter
.
locale
=
Locale
(
identifier
:
"el_GR"
)
// Greek locale
dateFormatter
.
dateFormat
=
"d MMMM yyyy"
let
resultString
=
dateFormatter
.
string
(
from
:
date
)
formatedExpiration
=
"Ισχύει έως "
+
resultString
}
else
{
formatedExpiration
=
expirationString
}
}
else
{
formatedExpiration
=
expirationString
}
self
.
isAccessibilityElement
=
true
self
.
accessibilityLabel
=
name
+
", "
+
discount
+
", "
+
description
+
", "
+
formatedExpiration
self
.
accessibilityHint
=
"Διπλό πάτημα για άνοιγμα"
self
.
accessibilityTraits
=
.
button
}
// Configure the cell with visibility of the selectView, a selected state, and select Button Action
...
...
SwiftWarplyFramework/SwiftWarplyFramework/CouponsViewController.swift
View file @
21913e9
...
...
@@ -44,6 +44,9 @@ import SwiftEventBus
tableView
.
delegate
=
self
tableView
.
dataSource
=
self
// Temporarily disable the table view's accessibility to prevent immediate focus shift
self
.
tableView
.
accessibilityElementsHidden
=
true
// tableView.clipsToBounds = true
// tableView.layer.cornerRadius = 30
// tableView.layer.maskedCorners = [ .layerMinXMinYCorner] // Top left corner radius
...
...
@@ -65,6 +68,19 @@ import SwiftEventBus
self
.
navigationController
?
.
hideHairline
()
}
public
override
func
viewDidAppear
(
_
animated
:
Bool
)
{
super
.
viewDidAppear
(
animated
)
// DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
UIAccessibility
.
post
(
notification
:
.
screenChanged
,
argument
:
self
.
navigationItem
.
titleView
)
// }
// Re-enable table view accessibility after the announcement
DispatchQueue
.
main
.
asyncAfter
(
deadline
:
.
now
()
+
1.0
)
{
self
.
tableView
.
accessibilityElementsHidden
=
false
}
}
// MARK: - Functions
func
handleEmptyView
()
{
if
(
self
.
coupons
.
count
==
0
)
{
...
...
@@ -75,7 +91,7 @@ import SwiftEventBus
self
.
emptyViewHeight
.
constant
=
0
}
}
// MARK: - API Functions
func
getCouponsRequest
()
{
swiftApi
()
.
getCouponsAsync
(
getCouponsCallback
,
failureCallback
:
{
errorCode
in
...
...
SwiftWarplyFramework/SwiftWarplyFramework/ViewControllerExtensions.swift
View file @
21913e9
...
...
@@ -53,6 +53,10 @@ extension UIViewController {
if
let
imgBackArrow
=
UIImage
(
named
:
icon
,
in
:
MyEmptyClass
.
resourceBundle
(),
compatibleWith
:
nil
)
{
imageView
.
image
=
imgBackArrow
}
view
.
isAccessibilityElement
=
true
view
.
accessibilityLabel
=
"Πίσω"
view
.
accessibilityHint
=
"Διπλό πάτημα για άνοιγμα"
view
.
accessibilityTraits
=
.
button
view
.
addSubview
(
imageView
)
let
backTap
=
UITapGestureRecognizer
(
target
:
self
,
action
:
#selector(
moveToBack(_:)
)
)
...
...
SwiftWarplyFramework/SwiftWarplyFramework/swiftApi.swift
View file @
21913e9
...
...
@@ -841,6 +841,7 @@ public class swiftApi {
public
let
name
:
String
?
public
let
image
:
String
?
public
let
expiration
:
String
?
public
let
expirationDate
:
Date
?
public
let
created
:
String
?
public
let
description
:
String
?
public
let
discount
:
String
?
...
...
@@ -944,8 +945,10 @@ public class swiftApi {
dateFormatter
.
dateFormat
=
"dd/MM/yyyy"
let
resultString
=
dateFormatter
.
string
(
from
:
date
)
self
.
expiration
=
resultString
self
.
expirationDate
=
date
}
else
{
self
.
expiration
=
""
self
.
expirationDate
=
Date
()
}
let
createdString
=
dictionary
[
"created"
]
as?
String
?
??
""
...
...
Please
register
or
login
to post a comment