Skip to content

Commit 05369ba

Browse files
authored
Merge pull request #17795 from wordpress-mobile/feature/media-permissions-dynamic-type
Adds dynamic type support to media permissions prompt
2 parents 1ee174f + 3d4d7dc commit 05369ba

File tree

6 files changed

+39
-11
lines changed

6 files changed

+39
-11
lines changed

Podfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ abstract_target 'Apps' do
210210

211211
pod 'NSURL+IDN', '~> 0.4'
212212

213-
pod 'WPMediaPicker', '~> 1.8.2-beta.1'
213+
pod 'WPMediaPicker', '~> 1.8.2-beta.2'
214214
# pod 'WPMediaPicker', :git => 'https://github.com/wordpress-mobile/MediaPicker-iOS.git', :tag => '1.7.0'
215215
## while PR is in review:
216216
# pod 'WPMediaPicker', :git => 'https://github.com/wordpress-mobile/MediaPicker-iOS.git', :branch => ''

Podfile.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,7 @@ PODS:
477477
- CocoaLumberjack (~> 3.4)
478478
- FormatterKit/TimeIntervalFormatter (~> 1.8)
479479
- WordPressUI (1.12.3)
480-
- WPMediaPicker (1.8.2-beta.1)
480+
- WPMediaPicker (1.8.2-beta.2)
481481
- wpxmlrpc (0.9.0)
482482
- Yoga (1.14.0)
483483
- ZendeskCommonUISDK (6.1.1)
@@ -573,7 +573,7 @@ DEPENDENCIES:
573573
- WordPressMocks (~> 0.0.15)
574574
- WordPressShared (~> 1.17.0)
575575
- WordPressUI (~> 1.12.3)
576-
- WPMediaPicker (~> 1.8.2-beta.1)
576+
- WPMediaPicker (~> 1.8.2-beta.2)
577577
- Yoga (from `https://raw.githubusercontent.com/wordpress-mobile/gutenberg-mobile/v1.70.0/third-party-podspecs/Yoga.podspec.json`)
578578
- ZendeskSupportSDK (= 5.3.0)
579579
- ZIPFoundation (~> 0.9.8)
@@ -837,7 +837,7 @@ SPEC CHECKSUMS:
837837
WordPressMocks: 6b52b0764d9939408151367dd9c6e8a910877f4d
838838
WordPressShared: a4b0308a6345d4dda20c8f7ad9317df4246b4a00
839839
WordPressUI: 45591178e843ecb82e65e868ec766148befe9f9f
840-
WPMediaPicker: e3c1e9c226eed11408210351b5c92cb800045278
840+
WPMediaPicker: 95682a64d24d2a1de4e140e7da68da79030f8173
841841
wpxmlrpc: bf55a43a7e710bd2a4fb8c02dfe83b1246f14f13
842842
Yoga: 2ca978c40e0fd6d7f54bcb1602bc0cbbc79454a7
843843
ZendeskCommonUISDK: 5808802951ad2bb424f0bed4259dc3c0ce9b52ec
@@ -849,6 +849,6 @@ SPEC CHECKSUMS:
849849
ZendeskSupportSDK: 3a8e508ab1d9dd22dc038df6c694466414e037ba
850850
ZIPFoundation: e27423c004a5a1410c15933407747374e7c6cb6e
851851

852-
PODFILE CHECKSUM: ebdcdd2b30dd680be23e92f8167141254e055594
852+
PODFILE CHECKSUM: 2198bf3dcf133317995199bc08b6af69a74ee863
853853

854854
COCOAPODS: 1.11.2

RELEASE-NOTES.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
* [*] Self-hosted login: Improved error messages. [#17724]
99
* [*] Share Sheet from Photos: Fix an issue where certain filenames would not upload or render in Post [#16773]
1010
* [*] Block editor: Fixed an issue where video thumbnails could show when selecting images, and vice versa. [#17670]
11+
* [**] Media: If a user has only enabled limited device media access, we now show a prompt to allow the user to change their selection. [#17795]
1112
* [**] Block editor: Fix content justification attribute in Buttons block [https://github.com/wordpress-mobile/gutenberg-mobile/pull/4451]
1213
* [*] Block editor: Hide help button from Unsupported Block Editor. [https://github.com/wordpress-mobile/gutenberg-mobile/pull/4352]
1314
* [*] Block editor: Add contrast checker to text-based blocks [https://github.com/wordpress-mobile/gutenberg-mobile/pull/4357]

WordPress/Classes/ViewRelated/Media/DeviceMediaPermissionsHeader.swift

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ class DeviceMediaPermissionsHeader: UICollectionReusableView {
1212
private let label: UILabel = {
1313
let label = UILabel()
1414
label.translatesAutoresizingMaskIntoConstraints = false
15+
label.adjustsFontForContentSizeCategory = true
1516
label.setContentHuggingPriority(.defaultLow, for: .vertical)
1617
label.setContentCompressionResistancePriority(.defaultHigh, for: .vertical)
1718
label.text = TextContent.message
@@ -48,6 +49,14 @@ class DeviceMediaPermissionsHeader: UICollectionReusableView {
4849
return infoIcon
4950
}()
5051

52+
private let buttonStackView: UIStackView = {
53+
let buttonStackView = UIStackView()
54+
buttonStackView.translatesAutoresizingMaskIntoConstraints = false
55+
buttonStackView.distribution = .fillEqually
56+
buttonStackView.spacing = Metrics.spacing
57+
return buttonStackView
58+
}()
59+
5160
override init(frame: CGRect) {
5261
super.init(frame: frame)
5362

@@ -80,12 +89,6 @@ class DeviceMediaPermissionsHeader: UICollectionReusableView {
8089
labelButtonsStackView.distribution = .fillProportionally
8190
labelButtonsStackView.spacing = Metrics.spacing
8291

83-
let buttonStackView = UIStackView()
84-
buttonStackView.translatesAutoresizingMaskIntoConstraints = false
85-
buttonStackView.axis = .horizontal
86-
buttonStackView.distribution = .fillEqually
87-
buttonStackView.spacing = Metrics.spacing
88-
8992
outerStackView.addArrangedSubviews([infoIcon, labelButtonsStackView])
9093
labelButtonsStackView.addArrangedSubviews([label, buttonStackView])
9194
buttonStackView.addArrangedSubviews([selectButton, settingsButton])
@@ -104,16 +107,36 @@ class DeviceMediaPermissionsHeader: UICollectionReusableView {
104107
infoIcon.widthAnchor.constraint(equalTo: infoIcon.heightAnchor),
105108
infoIcon.widthAnchor.constraint(equalToConstant: Metrics.iconSize)
106109
])
110+
111+
configureViewsForContentSizeCategoryChange()
107112
}
108113

109114
private func configureButton(_ button: UIButton) {
110115
button.translatesAutoresizingMaskIntoConstraints = false
111116
button.titleLabel?.font = .preferredFont(forTextStyle: .subheadline).bold()
112117
button.titleLabel?.lineBreakMode = .byTruncatingTail
118+
button.titleLabel?.adjustsFontForContentSizeCategory = true
113119
button.contentHorizontalAlignment = .leading
114120
button.setTitleColor(.invertedLink, for: .normal)
115121
}
116122

123+
private func configureViewsForContentSizeCategoryChange() {
124+
let isAccessibilityCategory = traitCollection.preferredContentSizeCategory.isAccessibilityCategory
125+
126+
buttonStackView.axis = isAccessibilityCategory ? .vertical : .horizontal
127+
buttonStackView.spacing = isAccessibilityCategory ? Metrics.spacing / 2.0 : Metrics.spacing
128+
129+
infoIcon.isHidden = isAccessibilityCategory
130+
}
131+
132+
override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) {
133+
super.traitCollectionDidChange(previousTraitCollection)
134+
135+
configureViewsForContentSizeCategoryChange()
136+
}
137+
138+
// MARK: - Actions
139+
117140
@objc private func selectMoreTapped() {
118141
if let presenter = presenter {
119142
PHPhotoLibrary.shared().presentLimitedLibraryPicker(from: presenter)

WordPress/Info.plist

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -503,6 +503,8 @@
503503
<string>org.wordpress.notifications</string>
504504
<string>org.wordpress.reader</string>
505505
</array>
506+
<key>PHPhotoLibraryPreventAutomaticLimitedAccessAlert</key>
507+
<true/>
506508
<key>UIAppFonts</key>
507509
<array>
508510
<string>Noticons.ttf</string>

WordPress/Jetpack/Info.plist

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,8 @@
103103
<string>org.wordpress.notifications</string>
104104
<string>org.wordpress.reader</string>
105105
</array>
106+
<key>PHPhotoLibraryPreventAutomaticLimitedAccessAlert</key>
107+
<true/>
106108
<key>UIAppFonts</key>
107109
<array>
108110
<string>Noticons.ttf</string>

0 commit comments

Comments
 (0)