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 14:07:30 +0200
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
4998d9715c040eb30f90f13665fe53aa46dd8319
4998d971
1 parent
38474771
MapsViewController accessibilities
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
74 additions
and
1 deletions
SwiftWarplyFramework/SwiftWarplyFramework/MapsViewController.swift
SwiftWarplyFramework/SwiftWarplyFramework/MapsViewController.swift
View file @
4998d97
...
...
@@ -56,6 +56,7 @@ import MapKit
mapView
.
delegate
=
self
mapView
.
centerToLocation
(
initialLocation
,
regionRadius
:
1000000
)
// mapView.isAccessibilityElement = false
// mapView.clipsToBounds = true
// mapView.layer.cornerRadius = 30
...
...
@@ -178,6 +179,8 @@ import MapKit
// let filteredMerchants = self.merchantsArray.filter({ return (($0._latitude != 0.0) && ($0._longitude != 0.0)) })
if
(
filteredMerchants
.
count
==
0
)
{
self
.
showDialog
(
"Καταστήματα συνεργάτη"
,
"Ο συνεργάτης διαθέτει μόνο ηλεκτρονικό κατάστημα για ηλεκτρονικές παραγγελίες."
)
}
else
{
UIAccessibility
.
post
(
notification
:
.
screenChanged
,
argument
:
self
.
navigationItem
.
titleView
)
}
}
...
...
@@ -374,6 +377,23 @@ import MapKit
// mapView.showAnnotations(mapView.annotations, animated: true)
}
private
func
getMerchantName
(
_
merchant
:
swiftApi
.
MerchantModel
)
->
String
{
if
let
parent
=
self
.
parentMerchantsArray
.
first
(
where
:
{(
$0
.
_uuid
==
merchant
.
_parent
)})
{
return
parent
.
_admin_name
}
else
{
return
merchant
.
_name
}
}
private
func
addPinAccessibility
(
annotationView
:
MKAnnotationView
?
,
merchantModel
:
swiftApi
.
MerchantModel
,
parentName
:
String
?)
{
annotationView
?
.
isAccessibilityElement
=
true
// annotationView?.accessibilityLabel = "Πινέζα, κατάστημα: " + (parent._admin_name)
// annotationView?.accessibilityLabel = "Πινέζα, κατάστημα: " + getMerchantName(merchantModel)
annotationView
?
.
accessibilityLabel
=
"Πινέζα, κατάστημα: "
+
(((
parentName
??
""
)
.
isEmpty
?
getMerchantName
(
merchantModel
)
:
parentName
)
??
""
)
annotationView
?
.
accessibilityHint
=
"Διπλό πάτημα για άνοιγμα"
annotationView
?
.
accessibilityTraits
=
.
button
}
private
func
loadPinDetailsView
(
_
annotation
:
MerchantAnnotation
)
{
self
.
selectedMerchant
=
annotation
.
model
...
...
@@ -395,12 +415,55 @@ import MapKit
self
.
hoursView
.
text
=
""
self
.
phoneView
.
text
=
self
.
selectedMerchant
?
.
_telephone
self
.
addressView
.
text
=
self
.
selectedMerchant
?
.
_address
setupAccessibilty
()
}
func
setupAccessibilty
()
{
self
.
titleView
.
isAccessibilityElement
=
true
self
.
titleView
.
accessibilityTraits
=
.
header
self
.
closeButton
.
isAccessibilityElement
=
true
self
.
closeButton
.
accessibilityLabel
=
"Κλείσιμο"
self
.
closeButton
.
accessibilityHint
=
"Διπλό πάτημα για κλείσιμο"
self
.
closeButton
.
accessibilityTraits
=
.
button
self
.
nameImageView
.
isAccessibilityElement
=
true
self
.
nameImageView
.
accessibilityLabel
=
"Λογότυπο καταστήματος"
self
.
nameImageView
.
accessibilityTraits
=
.
image
self
.
nameView
.
isAccessibilityElement
=
true
// self.nameView.accessibilityLabel = self.nameView.text
self
.
phoneImageView
.
isAccessibilityElement
=
true
self
.
phoneImageView
.
accessibilityLabel
=
"Τηλέφωνο"
self
.
phoneImageView
.
accessibilityTraits
=
.
image
self
.
phoneView
.
isAccessibilityElement
=
true
self
.
phoneView
.
accessibilityLabel
=
"Τηλέφωνο: "
+
formatPhoneNumber
(
self
.
phoneView
.
text
??
""
)
self
.
addressImageView
.
isAccessibilityElement
=
true
self
.
addressImageView
.
accessibilityLabel
=
"Διεύθυνση"
self
.
addressImageView
.
accessibilityTraits
=
.
image
self
.
addressView
.
isAccessibilityElement
=
true
// self.addressView.accessibilityLabel = self.addressView.text ?? ""
self
.
directionsButton
.
isAccessibilityElement
=
true
self
.
directionsButton
.
accessibilityLabel
=
self
.
directionsButton
.
title
(
for
:
.
normal
)
self
.
directionsButton
.
accessibilityHint
=
"Διπλό πάτημα για άνοιγμα"
self
.
directionsButton
.
accessibilityTraits
=
.
button
self
.
hoursView
.
isAccessibilityElement
=
true
// self.hoursView.accessibilityLabel = self.hoursView.text ?? ""
}
private
func
showPinDetailsView
()
{
self
.
infoTopConstraint
.
constant
=
-
320
UIView
.
animate
(
withDuration
:
1.0
)
{
self
.
view
.
layoutIfNeeded
()
UIAccessibility
.
post
(
notification
:
.
layoutChanged
,
argument
:
self
.
titleView
)
}
}
...
...
@@ -413,6 +476,12 @@ import MapKit
}
}
func
formatPhoneNumber
(
_
phoneNumber
:
String
)
->
String
{
let
cleanedPhoneNumber
=
phoneNumber
.
replacingOccurrences
(
of
:
"-"
,
with
:
""
)
.
replacingOccurrences
(
of
:
"."
,
with
:
""
)
return
cleanedPhoneNumber
}
// map view delegate
// public func mapView(_ mapView: MKMapView, viewFor annotation: MKAnnotation) -> MKAnnotationView? {
//
...
...
@@ -447,7 +516,7 @@ import MapKit
// guard !(annotation is MKUserLocation) else {
// return nil
// }
var
annotationView
=
mapView
.
dequeueReusableAnnotationView
(
withIdentifier
:
"warply_custom"
)
if
(
annotationView
==
nil
)
{
annotationView
=
MKAnnotationView
(
annotation
:
annotation
,
reuseIdentifier
:
"warply_custom"
)
...
...
@@ -484,6 +553,8 @@ import MapKit
pinImageView
.
addSubview
(
logoImageView
)
annotationView
?
.
addSubview
(
pinImageView
)
addPinAccessibility
(
annotationView
:
annotationView
,
merchantModel
:
merchantModel
,
parentName
:
parent
.
_admin_name
)
return
annotationView
}
else
{
return
nil
...
...
@@ -495,6 +566,8 @@ import MapKit
pinImageView
.
addSubview
(
logoImageView
)
annotationView
?
.
addSubview
(
pinImageView
)
addPinAccessibility
(
annotationView
:
annotationView
,
merchantModel
:
merchantModel
,
parentName
:
""
)
return
annotationView
}
...
...
Please
register
or
login
to post a comment