1
0
mirror of https://github.com/AllanWang/Frost-for-Facebook.git synced 2024-11-08 20:12:39 +01:00

revert sorting cookie list

This commit is contained in:
Allan Wang 2017-06-03 14:09:01 -07:00
parent 1ae19368bc
commit e5a43ed02a
3 changed files with 11 additions and 19 deletions

View File

@ -19,7 +19,6 @@ import co.zsmb.materialdrawerkt.draweritems.badgeable.primaryItem
import co.zsmb.materialdrawerkt.draweritems.profile.profile
import com.mikepenz.materialdrawer.AccountHeader
import com.mikepenz.materialdrawer.Drawer
import com.pitchedapps.frost.dbflow.CookieModel
import com.pitchedapps.frost.dbflow.loadFbTabs
import com.pitchedapps.frost.dbflow.saveAsync
import com.pitchedapps.frost.events.FbAccountEvent
@ -66,8 +65,8 @@ class MainActivity : AppCompatActivity() {
}
}
})
setupTabs()
setupDrawer(savedInstanceState)
setupTabs()
fab.setOnClickListener { view ->
Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
.setAction("Action", null).show()
@ -86,23 +85,19 @@ class MainActivity : AppCompatActivity() {
savedInstance = savedInstanceState
translucentStatusBar = false
drawerHeader = accountHeader {
cookies.forEach {
profile(name = it.name ?: "") {
iconUrl = PROFILE_PICTURE_URL(it.id)
cookies.forEach { (id, name) ->
profile(name = name ?: "") {
iconUrl = PROFILE_PICTURE_URL(id)
identifier = id
}
}
onProfileChanged { _, profile, current ->
if (current) WebOverlayActivity.newInstance(this@MainActivity, FbTab.PROFILE)
if (current) launchWebOverlay(FbTab.PROFILE.url)
else switchUser(profile.name.text)
false
}
}
// profile("a") {
//
// }
// if (Prefs.userId != Prefs.userIdDefault) {
// profile("a")
// }
drawerHeader.setActiveProfile(Prefs.userId)
primaryItem(FbTab.ACTIVITY_LOG)
primaryItem(FbTab.PHOTOS)
primaryItem(FbTab.GROUPS)

View File

@ -19,13 +19,7 @@ class StartActivity : AppCompatActivity() {
loadFbCookiesAsync {
cookies ->
L.d("Cookies loaded ${System.currentTimeMillis()} $cookies")
val sorted = ArrayList(cookies)
val current = cookies.filter { it.id == Prefs.userId }
if (current.isNotEmpty()) {
sorted.remove(current[0])
sorted.add(0, current[0])
}
launchNewTask(MainActivity::class.java, sorted)
launchNewTask(MainActivity::class.java, ArrayList(cookies))
}
}
}

View File

@ -42,4 +42,7 @@ class WebOverlayActivity : AppCompatActivity() {
SwipeBackHelper.onDestroy(this)
}
override fun onBackPressed() {
if (!frostWeb.onBackPressed()) super.onBackPressed()
}
}