[ios] Announce zoom level, visible annotations after zooming
Announce the zoom level and number of visible annotations after zooming using VoiceOver’s swipe up or swipe down gesture. Works toward #4821.
This commit is contained in:
committed by
Minh Nguyễn
parent
d5970f2ef3
commit
51cd97861c
@@ -220,6 +220,8 @@
|
||||
DABFB8711CBE9A0F00D62B32 /* MGLMapView+MGLCustomStyleLayerAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = DA8848381CBAFB8500AB86E3 /* MGLMapView+MGLCustomStyleLayerAdditions.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
DABFB8721CBE9A0F00D62B32 /* MGLUserLocation.h in Headers */ = {isa = PBXBuildFile; fileRef = DA8848391CBAFB8500AB86E3 /* MGLUserLocation.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
DABFB8731CBE9A9900D62B32 /* Mapbox.h in Headers */ = {isa = PBXBuildFile; fileRef = DA88485E1CBAFC2E00AB86E3 /* Mapbox.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
DAC49C5C1CD02BC9009E1AA3 /* Localizable.stringsdict in Resources */ = {isa = PBXBuildFile; fileRef = DAC49C5F1CD02BC9009E1AA3 /* Localizable.stringsdict */; };
|
||||
DAC49C5D1CD02BC9009E1AA3 /* Localizable.stringsdict in Resources */ = {isa = PBXBuildFile; fileRef = DAC49C5F1CD02BC9009E1AA3 /* Localizable.stringsdict */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXContainerItemProxy section */
|
||||
@@ -459,6 +461,7 @@
|
||||
DABCABBF1CB80717000A7C39 /* locations.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = locations.cpp; sourceTree = "<group>"; };
|
||||
DABCABC01CB80717000A7C39 /* locations.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = locations.hpp; sourceTree = "<group>"; };
|
||||
DAC07C961CBB2CD6000CB309 /* mbgl.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = mbgl.xcconfig; path = ../../build/ios/mbgl.xcconfig; sourceTree = "<group>"; };
|
||||
DAC49C5E1CD02BC9009E1AA3 /* Base */ = {isa = PBXFileReference; lastKnownFileType = text.plist.stringsdict; name = Base; path = Base.lproj/Localizable.stringsdict; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
@@ -720,6 +723,7 @@
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
DA89339F1CCC951200E68420 /* Localizable.strings */,
|
||||
DAC49C5F1CD02BC9009E1AA3 /* Localizable.stringsdict */,
|
||||
DA8848771CBAFD5C00AB86E3 /* api_mapbox_com-digicert.der */,
|
||||
DA8848781CBAFD5C00AB86E3 /* api_mapbox_com-geotrust.der */,
|
||||
DA8848791CBAFD5C00AB86E3 /* star_tilestream_net.der */,
|
||||
@@ -1160,6 +1164,7 @@
|
||||
DA8933F01CCD387900E68420 /* strip-frameworks.sh in Resources */,
|
||||
DA8848751CBAFCC100AB86E3 /* mapbox@3x.png in Resources */,
|
||||
DA88487B1CBAFD5C00AB86E3 /* api_mapbox_com-geotrust.der in Resources */,
|
||||
DAC49C5C1CD02BC9009E1AA3 /* Localizable.stringsdict in Resources */,
|
||||
DA8933BF1CCD2CAD00E68420 /* Foundation.stringsdict in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
@@ -1181,6 +1186,7 @@
|
||||
DA8933DB1CCD31D400E68420 /* Foundation.strings in Resources */,
|
||||
DA8933DC1CCD31D400E68420 /* Foundation.stringsdict in Resources */,
|
||||
DA8933DD1CCD31D400E68420 /* api_mapbox_com-digicert.der in Resources */,
|
||||
DAC49C5D1CD02BC9009E1AA3 /* Localizable.stringsdict in Resources */,
|
||||
DA8933DE1CCD31D400E68420 /* api_mapbox_com-geotrust.der in Resources */,
|
||||
DA8933DF1CCD31D400E68420 /* star_tilestream_net.der in Resources */,
|
||||
);
|
||||
@@ -1390,6 +1396,14 @@
|
||||
name = LaunchScreen.storyboard;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
DAC49C5F1CD02BC9009E1AA3 /* Localizable.stringsdict */ = {
|
||||
isa = PBXVariantGroup;
|
||||
children = (
|
||||
DAC49C5E1CD02BC9009E1AA3 /* Base */,
|
||||
);
|
||||
name = Localizable.stringsdict;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXVariantGroup section */
|
||||
|
||||
/* Begin XCBuildConfiguration section */
|
||||
|
||||
@@ -43,6 +43,9 @@
|
||||
/* Accessibility label */
|
||||
"MAP_A11Y_LABEL" = "Map";
|
||||
|
||||
/* Map accessibility value */
|
||||
"MAP_A11Y_VALUE" = "Zoom %1$dx\n%2$ld annotation(s) visible";
|
||||
|
||||
/* Action in attribution sheet */
|
||||
"MAP_FEEDBACK" = "Improve This Map";
|
||||
|
||||
|
||||
27
platform/ios/resources/Base.lproj/Localizable.stringsdict
Normal file
27
platform/ios/resources/Base.lproj/Localizable.stringsdict
Normal file
@@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>MAP_A11Y_VALUE</key>
|
||||
<dict>
|
||||
<key>NSStringLocalizedFormatKey</key>
|
||||
<string>%#@count@</string>
|
||||
<key>count</key>
|
||||
<dict>
|
||||
<key>NSStringFormatSpecTypeKey</key>
|
||||
<string>NSStringPluralRuleType</string>
|
||||
<key>NSStringFormatValueTypeKey</key>
|
||||
<string>ld</string>
|
||||
<key>zero</key>
|
||||
<string>Zoom %dx
|
||||
no annotations visible</string>
|
||||
<key>one</key>
|
||||
<string>Zoom %dx
|
||||
%d annotation visible</string>
|
||||
<key>other</key>
|
||||
<string>Zoom %dx
|
||||
%d annotations visible</string>
|
||||
</dict>
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -1848,6 +1848,12 @@ mbgl::Duration MGLDurationInSeconds(NSTimeInterval duration)
|
||||
|
||||
#pragma mark - Accessibility -
|
||||
|
||||
- (NSString *)accessibilityValue
|
||||
{
|
||||
double zoomLevel = round(self.zoomLevel - 1);
|
||||
return [NSString stringWithFormat:NSLocalizedStringWithDefaultValue(@"MAP_A11Y_VALUE", nil, nil, @"Zoom %dx\n%ld annotation(s) visible", @"Map accessibility value"), (int)zoomLevel, (long)self.accessibilityAnnotationCount];
|
||||
}
|
||||
|
||||
- (CGRect)accessibilityFrame
|
||||
{
|
||||
CGRect frame = [super accessibilityFrame];
|
||||
@@ -1881,8 +1887,7 @@ mbgl::Duration MGLDurationInSeconds(NSTimeInterval duration)
|
||||
{
|
||||
return 2 /* selectedAnnotationCalloutView, mapViewProxyAccessibilityElement */;
|
||||
}
|
||||
std::vector<MGLAnnotationTag> visibleAnnotations = [self annotationTagsInRect:self.bounds];
|
||||
NSInteger count = visibleAnnotations.size() + 2 /* compass, userLocationAnnotationView, attributionButton */;
|
||||
NSInteger count = self.accessibilityAnnotationCount + 2 /* compass, attributionButton */;
|
||||
if (self.userLocationAnnotationView)
|
||||
{
|
||||
count++;
|
||||
@@ -1890,6 +1895,12 @@ mbgl::Duration MGLDurationInSeconds(NSTimeInterval duration)
|
||||
return count;
|
||||
}
|
||||
|
||||
- (NSInteger)accessibilityAnnotationCount
|
||||
{
|
||||
std::vector<MGLAnnotationTag> visibleAnnotations = [self annotationTagsInRect:self.bounds];
|
||||
return visibleAnnotations.size();
|
||||
}
|
||||
|
||||
- (id)accessibilityElementAtIndex:(NSInteger)index
|
||||
{
|
||||
if (self.calloutViewForSelectedAnnotation)
|
||||
@@ -2045,6 +2056,8 @@ mbgl::Duration MGLDurationInSeconds(NSTimeInterval duration)
|
||||
}
|
||||
_mbglMap->scaleBy(scaleFactor, mbgl::ScreenCoordinate { centerPoint.x, centerPoint.y });
|
||||
[self unrotateIfNeededForGesture];
|
||||
|
||||
UIAccessibilityPostNotification(UIAccessibilityAnnouncementNotification, self.accessibilityValue);
|
||||
}
|
||||
|
||||
#pragma mark - Geography -
|
||||
|
||||
Reference in New Issue
Block a user