🔥 Massively simplified how Abit connects to the network
* Removed features "Synchronization" and "Server POW" * Service isn't foreground anymore (not yet sure this is a good decision) * "Full node" renamed to "online"
This commit is contained in:
@@ -31,7 +31,6 @@ import ch.dissem.apps.abit.listener.ListSelectionListener
|
||||
import ch.dissem.apps.abit.repository.AndroidLabelRepository.Companion.LABEL_ARCHIVE
|
||||
import ch.dissem.apps.abit.service.Singleton
|
||||
import ch.dissem.apps.abit.service.Singleton.currentLabel
|
||||
import ch.dissem.apps.abit.synchronization.SyncAdapter
|
||||
import ch.dissem.apps.abit.util.NetworkUtils
|
||||
import ch.dissem.apps.abit.util.Preferences
|
||||
import ch.dissem.apps.abit.util.getColor
|
||||
@@ -145,11 +144,6 @@ class MainActivity : AppCompatActivity(), ListSelectionListener<Serializable> {
|
||||
ComposeMessageActivity.launchReplyTo(this, item)
|
||||
}
|
||||
|
||||
if (Preferences.useTrustedNode(this)) {
|
||||
SyncAdapter.startSync(this)
|
||||
} else {
|
||||
SyncAdapter.stopSync(this)
|
||||
}
|
||||
if (drawer.isDrawerOpen) {
|
||||
MaterialShowcaseView.Builder(this)
|
||||
.setMaskColour(R.color.colorPrimary)
|
||||
@@ -179,8 +173,6 @@ class MainActivity : AppCompatActivity(), ListSelectionListener<Serializable> {
|
||||
.setDelay(1000)
|
||||
.show()
|
||||
}
|
||||
|
||||
SyncAdapter.startSync(this)
|
||||
}
|
||||
|
||||
private fun <F> changeList(listFragment: F) where F : Fragment, F : ListHolder<*> {
|
||||
@@ -259,14 +251,13 @@ class MainActivity : AppCompatActivity(), ListSelectionListener<Serializable> {
|
||||
|
||||
nodeSwitch = SwitchDrawerItem()
|
||||
.withIdentifier(ID_NODE_SWITCH)
|
||||
.withName(R.string.full_node)
|
||||
.withName(R.string.online)
|
||||
.withIcon(CommunityMaterial.Icon.cmd_cloud_outline)
|
||||
.withChecked(Preferences.isFullNodeActive(this))
|
||||
.withChecked(Preferences.isOnline(this))
|
||||
.withOnCheckedChangeListener { _, _, isChecked ->
|
||||
Preferences.setOnline(this, isChecked)
|
||||
if (isChecked) {
|
||||
NetworkUtils.enableNode(this@MainActivity)
|
||||
} else {
|
||||
NetworkUtils.disableNode(this@MainActivity)
|
||||
NetworkUtils.enableNode(this, true)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -369,10 +360,8 @@ class MainActivity : AppCompatActivity(), ListSelectionListener<Serializable> {
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
NetworkUtils.enableNode(this, false)
|
||||
updateUnread()
|
||||
if (Preferences.isFullNodeActive(this) && Preferences.isConnectionAllowed(this@MainActivity)) {
|
||||
NetworkUtils.enableNode(this, false)
|
||||
}
|
||||
Singleton.getMessageListener(this).resetNotification()
|
||||
currentLabel.addObserver(this) { label ->
|
||||
if (label != null && label.id is Long) {
|
||||
@@ -578,15 +567,6 @@ class MainActivity : AppCompatActivity(), ListSelectionListener<Serializable> {
|
||||
|
||||
private var instance: WeakReference<MainActivity>? = null
|
||||
|
||||
fun updateNodeSwitch() {
|
||||
apply {
|
||||
runOnUiThread {
|
||||
nodeSwitch.withChecked(Preferences.isFullNodeActive(this))
|
||||
drawer.updateStickyFooterItem(nodeSwitch)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Runs the given code in the main activity context, if it currently exists. Otherwise,
|
||||
* it's ignored.
|
||||
|
||||
Reference in New Issue
Block a user