Skip to content

Commit

Permalink
#128 fixed usage of deprecated api
Browse files Browse the repository at this point in the history
  • Loading branch information
Dorofeev committed Oct 16, 2024
1 parent c26d960 commit f8f5607
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class PermissionsController : PermissionsControllerProtocol {

override fun openAppSettings() {
val settingsUrl: NSURL = NSURL.URLWithString(UIApplicationOpenSettingsURLString)!!
UIApplication.sharedApplication.openURL(settingsUrl)
UIApplication.sharedApplication.openURL(settingsUrl, mapOf<Any?, Any>(), null)
}

private fun getDelegate(permission: Permission): PermissionDelegate {
Expand Down
22 changes: 16 additions & 6 deletions sample/ios-app/src/Resources/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14490.70" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="zIh-nI-gcX">
<device id="retina4_0" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="32700.99.1234" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="zIh-nI-gcX">
<device id="retina4_0" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14490.49"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22685"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
Expand Down Expand Up @@ -37,7 +35,7 @@
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="wrA-Wa-jvv">
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="wrA-Wa-jvv">
<rect key="frame" x="128" y="269" width="64" height="30"/>
<state key="normal" title="Press me"/>
<connections>
Expand All @@ -50,12 +48,24 @@
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="jlX-n2-E1L">
<rect key="frame" x="102" y="222" width="116.5" height="31"/>
<state key="normal" title="Button"/>
<buttonConfiguration key="configuration" style="plain" title="Open Settings">
<fontDescription key="titleFontDescription" type="system" pointSize="14"/>
</buttonConfiguration>
<connections>
<action selector="onOpenSettingsPressed" destination="TTy-86-aNs" eventType="touchUpInside" id="8gX-ul-uJn"/>
</connections>
</button>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstItem="wrA-Wa-jvv" firstAttribute="centerY" secondItem="KxK-oh-5KO" secondAttribute="centerY" id="0g2-Uu-Q0F"/>
<constraint firstItem="wrA-Wa-jvv" firstAttribute="centerX" secondItem="KxK-oh-5KO" secondAttribute="centerX" id="FGq-2f-QAF"/>
<constraint firstItem="wrA-Wa-jvv" firstAttribute="top" secondItem="jlX-n2-E1L" secondAttribute="bottom" constant="16" id="Qps-Mk-tYJ"/>
<constraint firstItem="SC7-EO-Tfy" firstAttribute="centerX" secondItem="KxK-oh-5KO" secondAttribute="centerX" id="Qw1-Gl-wBe"/>
<constraint firstItem="jlX-n2-E1L" firstAttribute="centerX" secondItem="KxK-oh-5KO" secondAttribute="centerX" id="WvE-2P-C0q"/>
<constraint firstItem="SC7-EO-Tfy" firstAttribute="top" secondItem="wrA-Wa-jvv" secondAttribute="bottom" constant="8" id="hoL-Vh-IjN"/>
</constraints>
</view>
Expand Down
4 changes: 4 additions & 0 deletions sample/ios-app/src/TestViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ class TestViewController: UIViewController {
@IBAction func onPermissionPressed() {
viewModel.onRequestPermissionButtonPressed()
}

@IBAction func onOpenSettingsPressed() {
PermissionsController().openAppSettings()
}
}

extension TestViewController: SampleViewModelEventListener {
Expand Down

0 comments on commit f8f5607

Please sign in to comment.