Merge pull request #94 from geeksville/dev

misc atomic commits - see commit for details
pull/97/head
Kevin Hester 2020-07-07 15:01:25 -07:00 zatwierdzone przez GitHub
commit 36e2da4651
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
4 zmienionych plików z 30 dodań i 14 usunięć

Wyświetl plik

@ -37,7 +37,6 @@ the channel is encrypted, you can share the the channel key with others by qr co
* keep past messages in db, one db per channel (currently we just keep an array in saved preferences)
* show user avatars in chat (use the google user info api)
* let users save old channels (i.e. have a menu of channels the user can use)
* also add a receiver that fires after a new update was installed from the play store
* if the rxpacket queue on the device overflows (because android hasn't connected in a while) send a special packet to android which means 'X packets have been dropped because you were offline' -drop oldest packets first
* make sw update work over BLE

Wyświetl plik

@ -149,6 +149,7 @@
</activity>
<receiver android:name="com.geeksville.mesh.service.BootCompleteReceiver">
<!-- handle boot events -->
<intent-filter>
<category android:name="android.intent.category.DEFAULT" />
@ -160,6 +161,15 @@
<!-- for testing -->
<action android:name="com.geeksville.mesh.SIM_BOOT" />
</intent-filter>
<!-- Also restart our service if the app gets upgraded -->
<intent-filter>
<action android:name="android.intent.action.MY_PACKAGE_REPLACED" />
<!-- I was using PACKAGE_REPLACED, but MY_PACKAGE_REPLACED is newer and seems cleaner
<data
android:scheme="package"
android:path="com.geeksville.mesh" /> -->
</intent-filter>
</receiver>
</application>

Wyświetl plik

@ -6,6 +6,7 @@ import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.activityViewModels
import androidx.lifecycle.Observer
import com.geeksville.android.GeeksvilleApplication
import com.geeksville.android.Logging
import com.geeksville.mesh.NodeInfo
@ -130,7 +131,12 @@ class MapFragment : ScreenFragment("Map"), Logging {
}
var mapView: MapView? = null
var mapboxMap: MapboxMap? = null
/**
* Mapbox native code can crash painfully if you ever call a mapbox view function while the view is not actively being show
*/
private val isViewVisible: Boolean
get() = view != null && isResumed
override fun onViewCreated(viewIn: View, savedInstanceState: Bundle?) {
super.onViewCreated(viewIn, savedInstanceState)
@ -145,7 +151,6 @@ class MapFragment : ScreenFragment("Map"), Logging {
// Each time the pane is shown start fetching new map info (we do this here instead of
// onCreate because getMapAsync can die in native code if the view goes away)
v.getMapAsync { map ->
mapboxMap = map
if (view != null) { // it might have gone away by now
// val markerIcon = BitmapFactory.decodeResource(context.resources, R.drawable.ic_twotone_person_pin_24)
@ -161,7 +166,19 @@ class MapFragment : ScreenFragment("Map"), Logging {
//map.uiSettings.isScrollGesturesEnabled = true
//map.uiSettings.isZoomGesturesEnabled = true
// Provide initial positions
model.nodeDB.nodes.value?.let { nodes ->
onNodesChanged(map, nodes.values)
}
}
// Any times nodes change update our map
model.nodeDB.nodes.observe(viewLifecycleOwner, Observer { nodes ->
debug("Nodes updated! map visible = $isViewVisible")
if (isViewVisible)
onNodesChanged(map, nodes.values)
})
}
}
}
@ -185,16 +202,6 @@ class MapFragment : ScreenFragment("Map"), Logging {
override fun onResume() {
super.onResume()
mapView?.onResume()
// FIXME: for now we just set the node positions when the user pages to the map - because
// otherwise we try to update in the background which breaks mapbox native code (when view is not shown
mapboxMap?.let { map ->
// model.nodeDB.nodes.observe(viewLifecycleOwner, Observer { nodes ->
model.nodeDB.nodes.value?.values?.let {
onNodesChanged(map, it)
}
//})
}
}
override fun onDestroy() {

@ -1 +1 @@
Subproject commit 99dbf61fad087db910be7f74867a8f14aba877a4
Subproject commit ab381a83f5380358fa8412a58635e390c3729192