🐛 Fix connectivity issue

This commit is contained in:
Christian Basler 2018-08-24 17:34:58 +02:00
parent a9602368fb
commit e67a4ea71b
4 changed files with 18 additions and 14 deletions

View File

@ -32,7 +32,7 @@ class FullNodeDialogActivity : Activity() {
setContentView(R.layout.dialog_full_node)
ok.setOnClickListener {
preferences.wifiOnly = false
network.enableNode()
network.scheduleNodeStart()
finish()
}
dismiss.setOnClickListener {

View File

@ -5,20 +5,14 @@ import android.content.Intent
import android.support.v4.app.FragmentManager
import android.view.View
import android.widget.Toast
import com.mikepenz.materialdrawer.AccountHeader
import com.mikepenz.materialdrawer.model.ProfileDrawerItem
import com.mikepenz.materialdrawer.model.interfaces.IProfile
import ch.dissem.apps.abit.AddressDetailActivity
import ch.dissem.apps.abit.AddressDetailFragment
import ch.dissem.apps.abit.MainActivity
import ch.dissem.apps.abit.R
import android.widget.Toast.LENGTH_LONG
import ch.dissem.apps.abit.*
import ch.dissem.apps.abit.dialog.AddIdentityDialogFragment
import ch.dissem.apps.abit.service.Singleton
import ch.dissem.bitmessage.entity.BitmessageAddress
import android.widget.Toast.LENGTH_LONG
import com.mikepenz.materialdrawer.AccountHeader
import com.mikepenz.materialdrawer.model.ProfileDrawerItem
import com.mikepenz.materialdrawer.model.interfaces.IProfile
class ProfileSelectionListener(
private val ctx: Context,

View File

@ -34,6 +34,11 @@ class NodeStartupService : JobService() {
}
}
override fun onCreate() {
super.onCreate()
notification = NetworkNotification(this)
}
override fun onStartJob(params: JobParameters?): Boolean {
if (preferences.online) {
registerReceiver(
@ -43,7 +48,6 @@ class NodeStartupService : JobService() {
addAction(Intent.ACTION_BATTERY_CHANGED)
}
)
notification = NetworkNotification(this)
NodeStartupService.running = false
if (!isRunning) {
@ -67,7 +71,12 @@ class NodeStartupService : JobService() {
doAsync {
bmc.cleanup()
}
unregisterReceiver(connectivityReceiver)
try {
unregisterReceiver(connectivityReceiver)
} catch (_: IllegalArgumentException) {
// For some reason, onStartJob wasn't called so the receiver isn't registered.
// Let's just ignore this.
}
stopSelf()
}

View File

@ -24,6 +24,7 @@ import ch.dissem.apps.abit.adapter.SwipeableMessageAdapter
import ch.dissem.apps.abit.listener.MessageListener
import ch.dissem.apps.abit.repository.*
import ch.dissem.apps.abit.util.Observable
import ch.dissem.apps.abit.util.preferences
import ch.dissem.bitmessage.BitmessageContext
import ch.dissem.bitmessage.cryptography.sc.SpongyCryptography
import ch.dissem.bitmessage.entity.BitmessageAddress