kopia lustrzana https://github.com/meshtastic/Meshtastic-Android
misc
rodzic
7818e6ccd9
commit
c6b11b60d2
2
TODO.md
2
TODO.md
|
@ -4,6 +4,7 @@
|
|||
|
||||
# Medium priority
|
||||
|
||||
* remove secret google settings json before open sourcing
|
||||
* require user auth to pair with the device (i.e. press button on device to allow a new phone to pair with it).
|
||||
Don't leave device discoverable. Don't let unpaired users do thing with device
|
||||
* add crash reporting
|
||||
|
@ -12,4 +13,5 @@ Don't leave device discoverable. Don't let unpaired users do thing with device
|
|||
|
||||
# Low priority
|
||||
|
||||
* possibly use finotes for analytics https://finotes.com/
|
||||
* also add a receiver that fires after a new update was installed from the play stoe
|
|
@ -23,7 +23,7 @@ android {
|
|||
|
||||
buildFeatures {
|
||||
// Enables Jetpack Compose for this module
|
||||
compose true
|
||||
compose false // FIXME, if true main app crashes
|
||||
}
|
||||
|
||||
// Set both the Java and Kotlin compilers to target Java 8.
|
||||
|
@ -50,9 +50,15 @@ dependencies {
|
|||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
|
||||
|
||||
// You also need to include the following Compose toolkit dependencies.
|
||||
implementation 'androidx.ui:ui-tooling:0.1.0-dev02'
|
||||
implementation 'androidx.ui:ui-layout:0.1.0-dev02'
|
||||
implementation 'androidx.ui:ui-material:0.1.0-dev02'
|
||||
implementation("androidx.compose:compose-runtime:$compose_version")
|
||||
implementation("androidx.ui:ui-framework:$compose_version")
|
||||
implementation("androidx.ui:ui-layout:$compose_version")
|
||||
implementation("androidx.ui:ui-material:$compose_version")
|
||||
implementation("androidx.ui:ui-foundation:$compose_version")
|
||||
implementation("androidx.ui:ui-animation:$compose_version")
|
||||
implementation "androidx.ui:ui-tooling:$compose_version"
|
||||
androidTestImplementation("androidx.ui:ui-platform:$compose_version")
|
||||
androidTestImplementation("androidx.ui:ui-test:$compose_version")
|
||||
|
||||
// add the Firebase SDK for Google Analytics
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@ import com.google.android.material.snackbar.Snackbar
|
|||
import androidx.appcompat.app.AppCompatActivity
|
||||
import android.view.Menu
|
||||
import android.view.MenuItem
|
||||
import android.widget.Toast
|
||||
import androidx.core.app.ActivityCompat
|
||||
import androidx.core.content.ContextCompat
|
||||
|
||||
|
@ -26,9 +27,9 @@ class MainActivity : AppCompatActivity() {
|
|||
const val DID_REQUEST_PERM = 11
|
||||
}
|
||||
|
||||
private val bluetoothAdapter: BluetoothAdapter by lazy(LazyThreadSafetyMode.NONE) {
|
||||
private val bluetoothAdapter: BluetoothAdapter? by lazy(LazyThreadSafetyMode.NONE) {
|
||||
val bluetoothManager = getSystemService(Context.BLUETOOTH_SERVICE) as BluetoothManager
|
||||
bluetoothManager.adapter!!
|
||||
bluetoothManager.adapter
|
||||
}
|
||||
|
||||
fun requestPermission() {
|
||||
|
@ -59,7 +60,6 @@ class MainActivity : AppCompatActivity() {
|
|||
// result of the request.
|
||||
} else {
|
||||
// Permission has already been granted
|
||||
SoftwareUpdateService.enqueueWork(this, SoftwareUpdateService.scanDevicesIntent)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -68,16 +68,25 @@ class MainActivity : AppCompatActivity() {
|
|||
setContentView(R.layout.activity_main)
|
||||
setSupportActionBar(toolbar)
|
||||
|
||||
fab.setOnClickListener { view ->
|
||||
Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
|
||||
.setAction("Action", null).show()
|
||||
fab.setOnClickListener { _ ->
|
||||
/* Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
|
||||
.setAction("Action", null).show() */
|
||||
|
||||
if(bluetoothAdapter != null) {
|
||||
SoftwareUpdateService.enqueueWork(this, SoftwareUpdateService.scanDevicesIntent)
|
||||
}
|
||||
}
|
||||
|
||||
// Ensures Bluetooth is available on the device and it is enabled. If not,
|
||||
// displays a dialog requesting user permission to enable Bluetooth.
|
||||
bluetoothAdapter.takeIf { !it.isEnabled }?.apply {
|
||||
val enableBtIntent = Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE)
|
||||
startActivityForResult(enableBtIntent, REQUEST_ENABLE_BT)
|
||||
if(bluetoothAdapter != null) {
|
||||
bluetoothAdapter!!.takeIf { !it.isEnabled }?.apply {
|
||||
val enableBtIntent = Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE)
|
||||
startActivityForResult(enableBtIntent, REQUEST_ENABLE_BT)
|
||||
}
|
||||
}
|
||||
else {
|
||||
Toast.makeText(this, "Error - this app requires bluetooth", Toast.LENGTH_LONG).show()
|
||||
}
|
||||
|
||||
requestPermission()
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
buildscript {
|
||||
ext.kotlin_version = '1.3.61'
|
||||
ext.compose_version = '0.1.0-dev03'
|
||||
repositories {
|
||||
google()
|
||||
jcenter()
|
||||
|
|
Ładowanie…
Reference in New Issue