diff --git a/src-tauri/gen/android/app/src/main/AndroidManifest.xml b/src-tauri/gen/android/app/src/main/AndroidManifest.xml index 8c7f69d..a7feaf4 100644 --- a/src-tauri/gen/android/app/src/main/AndroidManifest.xml +++ b/src-tauri/gen/android/app/src/main/AndroidManifest.xml @@ -6,7 +6,6 @@ - diff --git a/src-tauri/gen/android/app/src/main/java/dev/baldav/app/MainActivity.kt b/src-tauri/gen/android/app/src/main/java/dev/baldav/app/MainActivity.kt index 8ba62ac..bce5a65 100644 --- a/src-tauri/gen/android/app/src/main/java/dev/baldav/app/MainActivity.kt +++ b/src-tauri/gen/android/app/src/main/java/dev/baldav/app/MainActivity.kt @@ -11,7 +11,6 @@ import android.provider.Settings import android.os.Bundle import android.os.FileObserver import android.provider.ContactsContract -import android.telephony.SmsManager import android.util.Log import android.webkit.WebView import androidx.activity.OnBackPressedCallback @@ -461,34 +460,10 @@ class MainActivity : TauriActivity() { return if (format == "geojson") track.formatAsGeoJson() else track.formatAsGpx() } - // Send the location SMS. If SEND_SMS was granted, send it straight over the cellular network - // (the in-app confirm was the only tap). Otherwise request the permission for next time and fall - // back to the system SMS composer, prefilled — which needs no permission. Either path works with - // no internet, over 2G/EDGE. + // Send the location SMS by opening the system SMS app prefilled (ACTION_SENDTO). This needs + // NO permission by design — the user taps send in their SMS app. Works offline over 2G/EDGE. private fun sendSms(number: String, text: String) { if (number.isBlank()) return - val granted = checkSelfPermission(android.Manifest.permission.SEND_SMS) == PackageManager.PERMISSION_GRANTED - if (granted) { - try { - val sm = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) - getSystemService(SmsManager::class.java) - else - @Suppress("DEPRECATION") SmsManager.getDefault() - val parts = sm.divideMessage(text) - if (parts.size > 1) sm.sendMultipartTextMessage(number, null, parts, null, null) - else sm.sendTextMessage(number, null, text, null, null) - Log.d("BalDav", "SMS sent directly to $number") - runOnUiThread { - android.widget.Toast.makeText(this, "СМС отправлено", android.widget.Toast.LENGTH_SHORT).show() - } - return - } catch (e: Exception) { - Log.w("BalDav", "direct SMS failed, falling back to composer: ${e.message}") - } - } else { - // Ask for the permission so the next send can go directly; this one still uses the composer. - try { requestPermissions(arrayOf(android.Manifest.permission.SEND_SMS), 4343) } catch (_: Exception) {} - } try { val intent = Intent(Intent.ACTION_SENDTO, Uri.parse("smsto:$number")).apply { putExtra("sms_body", text)