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