Skip to content

Commit fb05b35

Browse files
committed
ui: use AndroidX BundleCompat for extracting parcelable
Signed-off-by: Harsh Shandilya <[email protected]>
1 parent f13624c commit fb05b35

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ buildscript {
77
collectionVersion = '1.2.0'
88
constraintLayoutVersion = '2.1.4'
99
coordinatorLayoutVersion = '1.2.0'
10-
coreKtxVersion = '1.9.0'
10+
coreKtxVersion = '1.10.0-rc01'
1111
coroutinesVersion = '1.6.4'
1212
datastoreVersion = '1.0.0'
1313
desugarVersion = '1.1.5'

ui/src/main/java/com/wireguard/android/fragment/TunnelEditorFragment.kt

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import android.view.WindowManager
1919
import android.view.inputmethod.InputMethodManager
2020
import android.widget.EditText
2121
import android.widget.Toast
22+
import androidx.core.os.BundleCompat
2223
import androidx.core.view.MenuProvider
2324
import androidx.lifecycle.Lifecycle
2425
import androidx.lifecycle.lifecycleScope
@@ -272,12 +273,7 @@ class TunnelEditorFragment : BaseFragment(), MenuProvider {
272273
onSelectedTunnelChanged(null, selectedTunnel)
273274
} else {
274275
tunnel = selectedTunnel
275-
val config: ConfigProxy = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
276-
savedInstanceState.getParcelable(KEY_LOCAL_CONFIG, ConfigProxy::class.java)!!
277-
} else {
278-
@Suppress("DEPRECATION")
279-
savedInstanceState.getParcelable(KEY_LOCAL_CONFIG)!!
280-
}
276+
val config = BundleCompat.getParcelable(savedInstanceState, KEY_LOCAL_CONFIG, ConfigProxy::class.java)!!
281277
val originalName = savedInstanceState.getString(KEY_ORIGINAL_NAME)
282278
if (tunnel != null && tunnel!!.name != originalName) onSelectedTunnelChanged(null, tunnel) else binding!!.config = config
283279
}

0 commit comments

Comments
 (0)