mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-28 12:35:17 +00:00
Cleanup DatabaseUpgradeActivity
This commit is contained in:
parent
3c042a8546
commit
e57c1cd56c
@ -16,36 +16,30 @@
|
|||||||
*/
|
*/
|
||||||
package org.thoughtcrime.securesms
|
package org.thoughtcrime.securesms
|
||||||
|
|
||||||
import android.annotation.SuppressLint
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.os.AsyncTask
|
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.os.Parcelable
|
import android.os.Parcelable
|
||||||
|
import androidx.lifecycle.lifecycleScope
|
||||||
|
import kotlinx.coroutines.launch
|
||||||
import org.thoughtcrime.securesms.util.Util
|
import org.thoughtcrime.securesms.util.Util
|
||||||
import org.thoughtcrime.securesms.util.VersionTracker.getLastSeenVersion
|
import org.thoughtcrime.securesms.util.VersionTracker.getLastSeenVersion
|
||||||
import org.thoughtcrime.securesms.util.VersionTracker.updateLastSeenVersion
|
import org.thoughtcrime.securesms.util.VersionTracker.updateLastSeenVersion
|
||||||
|
|
||||||
class DatabaseUpgradeActivity : BaseActivity() {
|
class DatabaseUpgradeActivity : BaseActivity() {
|
||||||
public override fun onCreate(bundle: Bundle?) {
|
public override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(bundle)
|
super.onCreate(savedInstanceState)
|
||||||
updateLastSeenVersion(this)
|
updateLastSeenVersion(this)
|
||||||
updateNotifications(this)
|
lifecycleScope.launch {
|
||||||
startActivity(intent.getParcelableExtra<Parcelable>("next_intent") as Intent?)
|
ApplicationContext.getInstance(this@DatabaseUpgradeActivity)
|
||||||
|
.messageNotifier.updateNotification(this@DatabaseUpgradeActivity)
|
||||||
|
}
|
||||||
|
startActivity(intent.getParcelableExtra<Parcelable>("next_intent") as? Intent)
|
||||||
finish()
|
finish()
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressLint("StaticFieldLeak")
|
|
||||||
private fun updateNotifications(context: Context) {
|
|
||||||
object : AsyncTask<Void?, Void?, Void?>() {
|
|
||||||
protected override fun doInBackground(vararg params: Void): Void? {
|
|
||||||
ApplicationContext.getInstance(context).messageNotifier.updateNotification(context)
|
|
||||||
return null
|
|
||||||
}
|
|
||||||
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR)
|
|
||||||
}
|
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
@JvmStatic
|
||||||
fun isUpdate(context: Context?): Boolean {
|
fun isUpdate(context: Context?): Boolean {
|
||||||
val currentVersionCode = Util.getCanonicalVersionCode()
|
val currentVersionCode = Util.getCanonicalVersionCode()
|
||||||
val previousVersionCode = getLastSeenVersion(context!!)
|
val previousVersionCode = getLastSeenVersion(context!!)
|
||||||
|
Loading…
Reference in New Issue
Block a user