Skip to content

Commit 45d59da

Browse files
committed
Cellular restrictions UI improvements
1 parent 69ba3ee commit 45d59da

File tree

3 files changed

+21
-5
lines changed

3 files changed

+21
-5
lines changed

iTorrent/Components/Overlays/CellularNotAllowedOverlay.swift

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ private extension CellularNotAllowedOverlay {
6262

6363
NSLayoutConstraint.activate([
6464
overlayViewController.view.layoutMarginsGuide.centerXAnchor.constraint(equalTo: overlayView.centerXAnchor),
65-
overlayViewController.view.layoutMarginsGuide.leadingAnchor.constraint(greaterThanOrEqualTo: overlayView.leadingAnchor),
66-
overlayView.trailingAnchor.constraint(greaterThanOrEqualTo: overlayViewController.view.layoutMarginsGuide.trailingAnchor),
65+
overlayViewController.view.layoutMarginsGuide.leadingAnchor.constraint(equalTo: overlayView.leadingAnchor),
66+
overlayView.trailingAnchor.constraint(equalTo: overlayViewController.view.layoutMarginsGuide.trailingAnchor),
6767
bottomConstraint
6868
])
6969

@@ -146,6 +146,15 @@ private extension CellularNotAllowedOverlay {
146146

147147
@MainActor
148148
func showCellularPreferences() {
149+
// Open iOS settings app, if restricted on system level
150+
if networkMonitoringService.cellularState == .restricted,
151+
let url = URL(string: UIApplication.openSettingsURLString)
152+
{
153+
UIApplication.shared.open(url)
154+
return
155+
}
156+
157+
// Otherwise open iTorrent's Preferences
149158
guard let scene = UIApplication.shared.connectedScenes.compactMap({ $0 as? UIWindowScene }).first,
150159
let window = scene.keyWindow,
151160
let viewController = window.rootViewController?.topPresented

iTorrent/Components/Overlays/MessageOverlayView/MessageOverlayView.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ class MessageOverlayView: BaseView {
2828
holder.layoutMargins.right = 16
2929

3030
holder.layer.borderWidth = 1 / traitCollection.displayScale
31-
holder.layer.borderColor = UIColor.separator.cgColor
3231

3332
holder.addAction(.init { [unowned self] _ in
3433
Task { await clickEvent?() }
@@ -41,6 +40,11 @@ class MessageOverlayView: BaseView {
4140
}
4241
}
4342

43+
override func layoutSubviews() {
44+
super.layoutSubviews()
45+
holder.layer.borderColor = UIColor.separator.cgColor
46+
}
47+
4448
override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? {
4549
let view = super.hitTest(point, with: event)
4650
if view == self { return nil }

iTorrent/Screens/TorrentList/TorrentListViewController.xib

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="23077.2" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
2+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="23094" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
33
<device id="retina6_12" orientation="portrait" appearance="light"/>
44
<dependencies>
55
<deployment identifier="iOS"/>
6-
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="23068.1"/>
6+
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="23084"/>
77
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
88
<capability name="System colors in document resources" minToolsVersion="11.0"/>
99
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
@@ -33,6 +33,9 @@
3333
</collectionView>
3434
<view contentMode="scaleToFill" placeholderIntrinsicWidth="393" placeholderIntrinsicHeight="64" translatesAutoresizingMaskIntoConstraints="NO" id="JsX-Hm-a5W" customClass="AdView" customModule="iTorrent" customModuleProvider="target">
3535
<rect key="frame" x="0.0" y="818" width="393" height="64"/>
36+
<constraints>
37+
<constraint firstAttribute="height" priority="1" id="uHw-fl-G7b"/>
38+
</constraints>
3639
</view>
3740
</subviews>
3841
<viewLayoutGuide key="safeArea" id="fnl-2z-Ty3"/>

0 commit comments

Comments
 (0)