diff --git a/README.md b/README.md index 9b55f00d..8e3bc95f 100644 --- a/README.md +++ b/README.md @@ -37,4 +37,4 @@ We also have a Telegram server here: https://t.me/ladb_support. # Privacy Policy -LADB does not send any device data outside of the app. Your data is not collected or processed. +LADB does not send any device data outside the app. Your data is not collected or processed. diff --git a/app/build.gradle b/app/build.gradle index 55461da4..5a74ab16 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -12,8 +12,8 @@ android { applicationId "com.draco.ladb" minSdk 26 targetSdk 33 - versionCode 41 - versionName "2.2.1" + versionCode 43 + versionName "2.3.1" ndk { abiFilters 'arm64-v8a', 'armeabi-v7a', 'x86', 'x86_64' @@ -57,16 +57,16 @@ dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.4' - implementation 'androidx.core:core-ktx:1.9.0' + implementation 'androidx.core:core-ktx:1.10.1' implementation 'androidx.appcompat:appcompat:1.6.1' implementation 'androidx.preference:preference-ktx:1.2.0' - implementation 'androidx.fragment:fragment-ktx:1.5.6' + implementation 'androidx.fragment:fragment-ktx:1.6.0' implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.1' implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.6.1' implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.6.1' implementation 'com.github.javiersantos:PiracyChecker:1.2.8' - implementation 'com.google.android.material:material:1.7.0' - implementation 'com.google.android.gms:play-services-oss-licenses:17.0.0' + implementation 'com.google.android.material:material:1.9.0' + implementation 'com.google.android.gms:play-services-oss-licenses:17.0.1' } diff --git a/app/src/main/java/com/draco/ladb/utils/ADB.kt b/app/src/main/java/com/draco/ladb/utils/ADB.kt index 43511a2d..b5f6529f 100644 --- a/app/src/main/java/com/draco/ladb/utils/ADB.kt +++ b/app/src/main/java/com/draco/ladb/utils/ADB.kt @@ -249,22 +249,6 @@ class ADB(private val context: Context) { return processBuilder.start()!! } - /** - * Execute a script - */ - fun sendScript(code: String) { - /* Store script locally */ - val internalScript = File(scriptPath).apply { - bufferedWriter().use { - it.write(code) - } - deleteOnExit() - } - - /* Execute the script here */ - sendToShellProcess("sh ${internalScript.absolutePath}") - } - /** * Send commands directly to the shell process */ diff --git a/app/src/main/java/com/draco/ladb/viewmodels/MainActivityViewModel.kt b/app/src/main/java/com/draco/ladb/viewmodels/MainActivityViewModel.kt index a4c66670..ad4dc0dc 100644 --- a/app/src/main/java/com/draco/ladb/viewmodels/MainActivityViewModel.kt +++ b/app/src/main/java/com/draco/ladb/viewmodels/MainActivityViewModel.kt @@ -109,13 +109,8 @@ class MainActivityViewModel(application: Application) : AndroidViewModel(applica fun needsToPair(): Boolean { val context = getApplication().applicationContext - if (!sharedPreferences.getBoolean(context.getString(R.string.paired_key), false) && - (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) - ) { - return true - } - - return false + return !sharedPreferences.getBoolean(context.getString(R.string.paired_key), false) && + (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) } fun setPairedBefore(value: Boolean) { @@ -125,31 +120,6 @@ class MainActivityViewModel(application: Application) : AndroidViewModel(applica } } - /** - * Return the contents of the script from the intent - */ - fun getScriptFromIntent(intent: Intent): String? { - val context = getApplication().applicationContext - - return when (intent.type) { - "text/x-sh" -> { - val extra = if (Build.VERSION.SDK_INT >= 33) { - intent.getParcelableExtra(Intent.EXTRA_STREAM, Parcelable::class.java).toString() - } else { - intent.getParcelableExtra(Intent.EXTRA_STREAM).toString() - } - - val uri = Uri.parse(extra) - context.contentResolver.openInputStream(uri)?.bufferedReader().use { - it?.readText() - } - } - - "text/plain" -> intent.getStringExtra(Intent.EXTRA_TEXT) - else -> null - } - } - /** * Read the content of the ABD output file */ diff --git a/app/src/main/java/com/draco/ladb/views/MainActivity.kt b/app/src/main/java/com/draco/ladb/views/MainActivity.kt index 4630a323..e635fdf9 100644 --- a/app/src/main/java/com/draco/ladb/views/MainActivity.kt +++ b/app/src/main/java/com/draco/ladb/views/MainActivity.kt @@ -16,7 +16,9 @@ import androidx.activity.viewModels import androidx.appcompat.app.AlertDialog import androidx.appcompat.app.AppCompatActivity import androidx.core.content.FileProvider +import androidx.core.content.edit import androidx.lifecycle.lifecycleScope +import androidx.preference.PreferenceManager import com.draco.ladb.BuildConfig import com.draco.ladb.R import com.draco.ladb.databinding.ActivityMainBinding @@ -48,6 +50,7 @@ class MainActivity : AppCompatActivity() { .setView(R.layout.dialog_pair) .setPositiveButton(R.string.pair, null) .setNegativeButton(R.string.help, null) + .setNeutralButton(R.string.skip, null) binding.command.setOnKeyListener { _, keyCode, keyEvent -> if (keyCode == KeyEvent.KEYCODE_ENTER && keyEvent.action == KeyEvent.ACTION_DOWN) { @@ -176,7 +179,14 @@ class MainActivity : AppCompatActivity() { ) .show() } + } + getButton(AlertDialog.BUTTON_NEUTRAL).setOnClickListener { + PreferenceManager.getDefaultSharedPreferences(context).edit(true) { + putBoolean(getString(R.string.auto_shell_key), false) + } + dismiss() + callback?.invoke(true) } } } diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index ffb18230..7357a012 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -16,17 +16,18 @@ Cancel Done Pair + Skip Dismiss Are you sure you want to delete this? Intent failed to start - Executing script from file https://www.github.com/tytydraco https://www.github.com/tytydraco/LADB mailto:tnnijmeh@gmail.com - https://www.xda-developers.com/debloat-your-phone-run-adb-shell-commands-no-root-no-pc + https://www.xda-developers.com/debloat-your-phone-run-adb-shell-commands-no-root-no-pc + paired Port @@ -34,7 +35,10 @@ Pairing code Pairing information - You must connect this device to LADB using a pairing code from the \"Wireless debugging\" page in the Developer Settings page. If you have not done this before, click \"Help\" for a tutorial. + You must connect this device to LADB using a pairing code from the \"Wireless + debugging\" page in the Developer Settings page. If you have not done this before, click \"Help\" for a + tutorial. + Settings Troubleshooting @@ -49,11 +53,15 @@ restart Pair & shell - Automatically enter an ADB shell; disable to enter a regular, non-adb shell without pairing + Automatically enter an ADB shell; disable to enter a regular, non-adb shell + without pairing + auto_shell Buffer size - The size of the screen output buffer. Increasing this value will show more output on the screen at once at the cost of performance. (Default: 16384) + The size of the screen output buffer. Increasing this value will show more output + on the screen at once at the cost of performance. (Default: 16384) + buffer_size Startup command @@ -65,10 +73,16 @@ tutorial Stuck on \"Waiting\" - Either you entered the pairing information incorrectly, or your device is not being detected. First, ensure that Wireless Debugging is actually enabled. If that does not work, Try the \"Factory reset\" setting in LADB to try pairing again. + Either you entered the pairing information incorrectly, or your device is not + being detected. First, ensure that Wireless Debugging is actually enabled. If that does not work, Try the + \"Factory reset\" setting in LADB to try pairing again. + No \"Wireless Debugging\" toggle - Your device does not natively support Wireless Debugging, which is required by LADB. Alternatively, you can use a PC to enable this feature, even on unsupported devices. It will last until the next reboot. Connect the device to a PC and type: adb tcpip 5555 + Your device does not natively support Wireless Debugging, which + is required by LADB. Alternatively, you can use a PC to enable this feature, even on unsupported devices. It + will last until the next reboot. Connect the device to a PC and type: adb tcpip 5555 + Developer Tyler Nijmeh @@ -86,6 +100,5 @@ View the open source licenses licenses - preferences verified \ No newline at end of file diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index d2eab0ab..2f978c79 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -5,7 +5,7 @@ 12dp -