Commit 5e8bb32f authored by Thomas Markiewicz's avatar Thomas Markiewicz
Browse files

Cleaned up comments

parent 18a11c5b
Pipeline #52096 canceled with stages
......@@ -26,8 +26,6 @@ class OnboardingActivity : BaseActivity(), Injectable {
findViewById<Button>(R.id.buttonLoginLibremOne).setOnClickListener {
// TODO: use system Librem One account
// SEE: https://developer.android.com/reference/android/accounts/AccountManager
val am = AccountManager.get(this)
val accounts = am.getAccountsByType("librem.one")
val options = Bundle()
......@@ -100,9 +98,7 @@ class OnboardingActivity : BaseActivity(), Injectable {
DialogInterface.OnClickListener { dialog, id ->
// User cancelled the dialog
})
// Create the AlertDialog object and show it
builder.create().show()
}
private fun startInstallLibremOneActivity() {
......@@ -137,7 +133,7 @@ class OnboardingActivity : BaseActivity(), Injectable {
// Launch Librem One account login activity if requested
val launch = bundle.get(AccountManager.KEY_INTENT) as? Intent
if (launch != null) {
startActivityForResult(launch, 123)
startActivityForResult(launch, REQUEST_CODE)
return
}
......@@ -171,8 +167,6 @@ class OnboardingActivity : BaseActivity(), Injectable {
}
// if this is the last account token we've added,
// move on to main activity
processedLibremOneAccounts++
......@@ -185,7 +179,7 @@ class OnboardingActivity : BaseActivity(), Injectable {
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)
// Check which request we're responding to
if (requestCode == 123) {
if (requestCode == REQUEST_CODE) {
// Make sure the request was successful
if (resultCode == Activity.RESULT_OK) {
val token = data?.extras?.getString(AccountManager.KEY_AUTHTOKEN)
......@@ -198,6 +192,10 @@ class OnboardingActivity : BaseActivity(), Injectable {
}
companion object {
@JvmStatic
var REQUEST_CODE = 123;
@JvmStatic
fun getIntent(context: Context): Intent {
val intent = Intent(context, OnboardingActivity::class.java)
......
......@@ -36,8 +36,6 @@ class AccountManager(db: AppDatabase) {
init {
// TODO: should system-wide Librem One accounts be loaded here?
accounts = accountDao.loadAll().toMutableList()
activeAccount = accounts.find { acc ->
......@@ -82,7 +80,6 @@ class AccountManager(db: AppDatabase) {
Log.d(TAG, "saveAccount: saving account with id " + account.id)
accountDao.insertOrReplace(account)
}
}
/**
......@@ -91,8 +88,6 @@ class AccountManager(db: AppDatabase) {
*/
fun logActiveAccountOut(): AccountEntity? {
// TODO: also log out of the system-wide Librem One social account here
if (activeAccount == null) {
return null
} else {
......@@ -108,7 +103,6 @@ class AccountManager(db: AppDatabase) {
activeAccount = null
}
return activeAccount
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment