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
|
2022-01-14 06:56:15 +01:00
|
|
|
import network.loki.messenger.databinding.ActivityLandingBinding
|
2021-06-07 03:53:17 +02:00
|
|
|
import org.session.libsession.utilities.TextSecurePreferences
|
2019-12-16 11:43:08 +01:00
|
|
|
import org.thoughtcrime.securesms.BaseActionBarActivity
|
2021-06-07 03:53:17 +02:00
|
|
|
import org.thoughtcrime.securesms.crypto.IdentityKeyUtil
|
2022-01-14 06:56:15 +01:00
|
|
|
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
|
|
|
|
2020-12-04 06:00:52 +01:00
|
|
|
class LandingActivity : BaseActionBarActivity() {
|
2019-12-16 11:43:08 +01:00
|
|
|
|
|
|
|
override fun onCreate(savedInstanceState: Bundle?) {
|
|
|
|
super.onCreate(savedInstanceState)
|
2022-01-14 06:56:15 +01:00
|
|
|
val binding = ActivityLandingBinding.inflate(layoutInflater)
|
|
|
|
setContentView(binding.root)
|
2020-09-18 08:54:40 +02:00
|
|
|
setUpActionBarSessionLogo(true)
|
2022-01-14 06:56:15 +01:00
|
|
|
with(binding) {
|
|
|
|
fakeChatView.startAnimating()
|
|
|
|
registerButton.setOnClickListener { register() }
|
|
|
|
restoreButton.setOnClickListener { restore() }
|
|
|
|
linkButton.setOnClickListener { link() }
|
|
|
|
}
|
2020-12-15 06:44:38 +01:00
|
|
|
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.
|
2020-12-15 07:16:05 +01:00
|
|
|
KeyCachingService.setMasterSecret(applicationContext, Object())
|
2020-01-08 05:16:34 +01:00
|
|
|
}
|
|
|
|
|
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() {
|
2020-12-04 06:00:52 +01:00
|
|
|
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
|
|
|
}
|
2020-01-08 05:16:34 +01:00
|
|
|
|
2021-02-26 01:10:45 +01:00
|
|
|
private fun link() {
|
|
|
|
val intent = Intent(this, LinkDeviceActivity::class.java)
|
2020-12-04 06:00:52 +01:00
|
|
|
push(intent)
|
2020-01-08 05:16:34 +01:00
|
|
|
}
|
2019-12-16 11:43:08 +01:00
|
|
|
}
|