session-android/app/src/main/java/org/thoughtcrime/securesms/onboarding/LandingActivity.kt

46 lines
1.7 KiB
Kotlin
Raw Normal View History

2021-07-09 03:14:21 +02:00
package org.thoughtcrime.securesms.onboarding
2019-12-16 11:43:08 +01:00
import android.content.Intent
import android.os.Bundle
import network.loki.messenger.databinding.ActivityLandingBinding
import org.session.libsession.utilities.TextSecurePreferences
2019-12-16 11:43:08 +01:00
import org.thoughtcrime.securesms.BaseActionBarActivity
import org.thoughtcrime.securesms.crypto.IdentityKeyUtil
import org.thoughtcrime.securesms.service.KeyCachingService
2021-07-09 05:18:48 +02:00
import org.thoughtcrime.securesms.util.push
import org.thoughtcrime.securesms.util.setUpActionBarSessionLogo
2019-12-16 11:43:08 +01:00
class LandingActivity : BaseActionBarActivity() {
2019-12-16 11:43:08 +01:00
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
val binding = ActivityLandingBinding.inflate(layoutInflater)
setContentView(binding.root)
2020-09-18 08:54:40 +02:00
setUpActionBarSessionLogo(true)
with(binding) {
fakeChatView.startAnimating()
registerButton.setOnClickListener { register() }
restoreButton.setOnClickListener { restore() }
linkButton.setOnClickListener { link() }
}
IdentityKeyUtil.generateIdentityKeyPair(this)
TextSecurePreferences.setPasswordDisabled(this, true)
2021-02-26 01:10:45 +01:00
// AC: This is a temporary workaround to trick the old code that the screen is unlocked.
KeyCachingService.setMasterSecret(applicationContext, Object())
}
2019-12-16 11:43:08 +01:00
private fun register() {
val intent = Intent(this, RegisterActivity::class.java)
2019-12-17 15:15:13 +01:00
push(intent)
2019-12-16 11:43:08 +01:00
}
2021-02-26 01:10:45 +01:00
private fun restore() {
val intent = Intent(this, RecoveryPhraseRestoreActivity::class.java)
2019-12-17 15:15:13 +01:00
push(intent)
2019-12-16 11:43:08 +01:00
}
2021-02-26 01:10:45 +01:00
private fun link() {
val intent = Intent(this, LinkDeviceActivity::class.java)
push(intent)
}
2019-12-16 11:43:08 +01:00
}