fix: harden reliability, clean up KMP compliance, and improve code quality (#5023)

This commit is contained in:
James Rich 2026-04-09 13:21:46 -05:00 committed by GitHub
parent 537029a71c
commit 14b381c1eb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
53 changed files with 370 additions and 409 deletions

View file

@ -16,9 +16,7 @@
*/
package org.meshtastic.core.ui.util
import android.app.Activity
import android.content.Context
import android.content.ContextWrapper
import android.content.Intent
import android.provider.Settings
import android.widget.Toast
@ -33,13 +31,6 @@ suspend fun Context.showToast(text: String) {
Toast.makeText(this, text, Toast.LENGTH_SHORT).show()
}
/** Finds the [Activity] from a [Context]. */
fun Context.findActivity(): Activity? = when (this) {
is Activity -> this
is ContextWrapper -> baseContext.findActivity()
else -> null
}
fun Context.openNfcSettings() {
val intent = Intent(Settings.ACTION_NFC_SETTINGS)
startActivity(intent)

View file

@ -14,8 +14,6 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
@file:Suppress("detekt:ALL")
package org.meshtastic.core.ui.component
import androidx.compose.foundation.layout.Arrangement
@ -30,28 +28,6 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import org.jetbrains.compose.resources.StringResource
import org.jetbrains.compose.resources.stringResource
@Deprecated(message = "Use overload that accepts Strings for button text.")
@Composable
fun PreferenceFooter(
enabled: Boolean,
negativeText: StringResource,
onNegativeClicked: () -> Unit,
positiveText: StringResource,
onPositiveClicked: () -> Unit,
modifier: Modifier = Modifier,
) {
PreferenceFooter(
modifier = modifier,
enabled = enabled,
negativeText = stringResource(negativeText),
onNegativeClicked = onNegativeClicked,
positiveText = stringResource(positiveText),
onPositiveClicked = onPositiveClicked,
)
}
@Composable
fun PreferenceFooter(