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-06 15:51:03 +0200
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
320c36b0ec01f1b3a961951d5f67cff10cad1b75
320c36b0
1 parent
4998d971
MarketPassViewController accessibilities
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
2 deletions
SwiftWarplyFramework/SwiftWarplyFramework/MarketPassViewController.swift
SwiftWarplyFramework/SwiftWarplyFramework/ViewControllerExtensions.swift
SwiftWarplyFramework/SwiftWarplyFramework/MarketPassViewController.swift
View file @
320c36b
...
...
@@ -59,6 +59,8 @@ import SwiftEventBus
self
.
navigationController
?
.
pushViewController
(
vc
,
animated
:
true
)
}
self
.
passContainerView
.
accessibilityElementsHidden
=
true
setupUI
()
}
...
...
@@ -134,6 +136,11 @@ import SwiftEventBus
mapButton
.
layer
.
borderWidth
=
2
mapButton
.
layer
.
borderColor
=
UIColor
(
rgb
:
0x006D26
)
.
cgColor
mapButton
.
isAccessibilityElement
=
true
mapButton
.
accessibilityLabel
=
mapButton
.
title
(
for
:
.
normal
)
mapButton
.
accessibilityHint
=
"Διπλό πάτημα για άνοιγμα"
mapButton
.
accessibilityTraits
=
.
button
smLogosView
.
layer
.
cornerRadius
=
16.0
smLogosView
.
layer
.
maskedCorners
=
[
.
layerMinXMaxYCorner
,
.
layerMaxXMaxYCorner
]
// Bottom left, right corner radius
...
...
@@ -171,6 +178,15 @@ import SwiftEventBus
if
let
tempMarketPassDetails
=
swiftApi
()
.
getMarketPassDetails
()
{
self
.
marketPassDetails
=
tempMarketPassDetails
self
.
updateUI
()
// 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
.
passContainerView
.
accessibilityElementsHidden
=
false
}
}
else
{
self
.
showDialog
(
"Αποτυχία"
,
"Κάτι πήγε στραβά"
)
}
...
...
@@ -183,9 +199,16 @@ import SwiftEventBus
barcodeLabel
.
frame
.
size
.
width
=
barcodeLabel
.
intrinsicContentSize
.
width
barcodeLabel
.
frame
.
size
.
height
=
barcodeLabel
.
intrinsicContentSize
.
height
barcodeLabel
.
isAccessibilityElement
=
true
barcodeLabel
.
accessibilityLabel
=
"Αριθμός barcode "
+
(
barcodeLabel
.
text
??
""
)
if
let
barcodeUIImage
=
RSUnifiedCodeGenerator
.
shared
.
generateCode
(
barcodeString
,
machineReadableCodeObjectType
:
AVMetadataObject
.
ObjectType
.
ean13
.
rawValue
,
targetSize
:
CGSize
(
width
:
self
.
uiscreen
.
width
*
0.8
,
height
:
self
.
uiscreen
.
height
*
0.12
))
{
// if let barcodeUIImage = RSUnifiedCodeGenerator.shared.generateCode(barcodeString, machineReadableCodeObjectType: AVMetadataObject.ObjectType.ean13.rawValue, targetSize: CGSize(width: 110, height: 83)) {
barcodeImage
.
image
=
barcodeUIImage
barcodeImage
.
isAccessibilityElement
=
true
barcodeImage
.
accessibilityLabel
=
"Barcode"
barcodeImage
.
accessibilityTraits
=
.
image
barcodeImageHeight
.
constant
=
self
.
uiscreen
.
height
*
0.12
// barcodeImageHeight.constant = 83
...
...
@@ -209,6 +232,10 @@ import SwiftEventBus
couponsValueAttributedString
.
append
(
couponsValueBoldString
)
couponsValueLabel
.
attributedText
=
couponsValueAttributedString
let
formattedCost
=
couponsValueString
.
replacingOccurrences
(
of
:
"."
,
with
:
","
)
couponsValueLabel
.
isAccessibilityElement
=
true
couponsValueLabel
.
accessibilityLabel
=
"Έχεις κουπόνια συνολικής αξίας "
+
formattedCost
+
"€"
let
supermarkets
:
Array
<
swiftApi
.
SupermarketModel
>
=
marketPassDetails
?
.
_supermarkets
??
[]
// Create a horizontal stack view
...
...
@@ -227,6 +254,10 @@ import SwiftEventBus
imageView
.
load
(
link
:
sm
.
_logo
,
placeholder
:
UIImage
(),
cache
:
URLCache
())
imageView
.
isAccessibilityElement
=
true
imageView
.
accessibilityLabel
=
"Λογότυπο καταστήματος "
+
sm
.
_name
imageView
.
accessibilityTraits
=
.
image
// Add image view to the stack view
stackView
.
addArrangedSubview
(
imageView
)
}
...
...
SwiftWarplyFramework/SwiftWarplyFramework/ViewControllerExtensions.swift
View file @
320c36b
...
...
@@ -116,12 +116,14 @@ extension UIViewController {
func
setNavBarRightInfoButton
(
action
:
@escaping
InfoButtonAction
)
{
// Create a UIView for the custom info button
let
customInfoView
=
UIView
(
frame
:
CGRect
(
x
:
0
,
y
:
0
,
width
:
24
,
height
:
24
))
// let customInfoView = UIView(frame: CGRect(x: 0, y: 0, width: 24, height: 24))
let
customInfoView
=
UIView
(
frame
:
CGRect
(
x
:
0
,
y
:
0
,
width
:
40
,
height
:
40
))
// Create the UIImageView for the custom info image
let
infoImageView
=
UIImageView
(
image
:
UIImage
(
named
:
"info_icon"
,
in
:
MyEmptyClass
.
resourceBundle
(),
compatibleWith
:
nil
))
// Your custom image
infoImageView
.
contentMode
=
.
scaleAspectFit
// Adjust to fit the image correctly
infoImageView
.
frame
=
customInfoView
.
bounds
// Set the image to fill the view
// infoImageView.frame = customInfoView.bounds // Set the image to fill the view
infoImageView
.
frame
=
CGRect
(
x
:
8
,
y
:
8
,
width
:
24
,
height
:
24
)
// Add the image view to the custom view
customInfoView
.
addSubview
(
infoImageView
)
...
...
@@ -133,6 +135,11 @@ extension UIViewController {
let
tapGesture
=
UITapGestureRecognizer
(
target
:
self
,
action
:
#selector(
infoButtonTapped
)
)
customInfoView
.
addGestureRecognizer
(
tapGesture
)
customInfoView
.
isAccessibilityElement
=
true
customInfoView
.
accessibilityLabel
=
"Οδηγίες χρήσης"
customInfoView
.
accessibilityHint
=
"Διπλό πάτημα για άνοιγμα"
customInfoView
.
accessibilityTraits
=
.
button
// Add the custom view to the navigation bar as a UIBarButtonItem
let
infoBarButtonItem
=
UIBarButtonItem
(
customView
:
customInfoView
)
self
.
navigationItem
.
rightBarButtonItem
=
infoBarButtonItem
...
...
Please
register
or
login
to post a comment