Remove Bluetooth from multiplayer
Multiplayer now runs over Wi-Fi (LAN) only. - Delete BluetoothTransport and drop it from LobbyController's transport list, leaving LanTransport as the sole transport. - Drop TransportKind.BLUETOOTH and the now-unused RFCOMM_UUID constant. - Remove the BLUETOOTH/BLUETOOTH_ADMIN/BLUETOOTH_CONNECT permissions and the android.hardware.bluetooth feature from the manifest, along with the runtime permission request in MainActivity and the requestBluetoothPermissions hook on AppEnv. - Update lobby copy so an empty transport list and an empty host list talk about Wi-Fi rather than pairing, and refresh the comments and README sections that described two transports. The transport abstraction itself is kept: everything after the handshake was already transport independent, so adding another one later needs no changes above LanTransport. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01YEsqYAMJKUJoM7UAavm169
This commit is contained in:
@@ -1,12 +1,9 @@
|
||||
package org.prolibertate.games
|
||||
|
||||
import android.Manifest
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.provider.Settings as AndroidSettings
|
||||
import androidx.activity.ComponentActivity
|
||||
import androidx.activity.compose.setContent
|
||||
import androidx.activity.result.contract.ActivityResultContracts
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import org.prolibertate.games.net.LobbyController
|
||||
import org.prolibertate.games.settings.SettingsRepository
|
||||
@@ -20,14 +17,6 @@ class MainActivity : ComponentActivity() {
|
||||
|
||||
private lateinit var env: AppEnv
|
||||
|
||||
/**
|
||||
* Bluetooth needs runtime consent from Android 12 onwards. The result is
|
||||
* ignored deliberately: refusing simply means the Bluetooth transport
|
||||
* reports itself unavailable and the lobby falls back to Wi-Fi.
|
||||
*/
|
||||
private val bluetoothPermissions =
|
||||
registerForActivityResult(ActivityResultContracts.RequestMultiplePermissions()) { }
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
@@ -36,7 +25,6 @@ class MainActivity : ComponentActivity() {
|
||||
updater = Updater(this),
|
||||
lobby = LobbyController(applicationContext, lifecycleScope),
|
||||
peerId = stablePeerId(),
|
||||
requestBluetoothPermissions = ::requestBluetoothPermissions,
|
||||
)
|
||||
|
||||
setContent {
|
||||
@@ -46,14 +34,6 @@ class MainActivity : ComponentActivity() {
|
||||
}
|
||||
}
|
||||
|
||||
private fun requestBluetoothPermissions() {
|
||||
// Only CONNECT: the transport reaches paired devices and never scans.
|
||||
// See the manifest for what discovery of unpaired devices would add.
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
|
||||
bluetoothPermissions.launch(arrayOf(Manifest.permission.BLUETOOTH_CONNECT))
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Identifies this device to a host for the length of an install. ANDROID_ID
|
||||
* is per-app-signing-key and survives restarts, which is all a lobby needs
|
||||
|
||||
Reference in New Issue
Block a user