Skip to content

Commit

Permalink
Merge pull request #601 from baka-kaba/hotfix-3.5.1-beta
Browse files Browse the repository at this point in the history
Fix logout option not displaying login activity
  • Loading branch information
baka-kaba authored Apr 14, 2018
2 parents bb8fd7a + 18df8db commit 5e1b7dd
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 17 deletions.
4 changes: 2 additions & 2 deletions Awful.apk/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.ferg.awfulapp"
android:versionCode="10000"
android:versionName="3.5.0-beta"
android:versionCode="10001"
android:versionName="3.5.1-beta"
android:installLocation="auto">
<supports-screens
android:smallScreens="true"
Expand Down
28 changes: 15 additions & 13 deletions Awful.apk/src/main/java/com/ferg/awfulapp/Authentication.kt
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package com.ferg.awfulapp

import android.app.Activity
import android.app.AlertDialog
import android.content.Context
import android.app.Dialog
import android.content.Intent
import android.os.Bundle
import android.support.v4.app.DialogFragment
import android.support.v7.app.AlertDialog
import com.ferg.awfulapp.Authentication.logOut
import com.ferg.awfulapp.Authentication.reAuthenticate
import com.ferg.awfulapp.constants.Constants
Expand All @@ -18,17 +20,17 @@ import com.ferg.awfulapp.preferences.AwfulPreferences
/**
* A dialog that allows the user to log out and [reAuthenticate]
*/
class LogOutDialog(context: Context) : AlertDialog(context) {

init {
setTitle(context.getString(R.string.logout))
setMessage(context.getString(R.string.logout_message))
setButton(
BUTTON_POSITIVE,
context.getString(R.string.logout)
) { _, _ -> ownerActivity?.let { reAuthenticate(it) } ?: logOut() }
setButton(BUTTON_NEGATIVE, context.getString(R.string.cancel), { _, _ -> Unit })
}
class LogOutDialog : DialogFragment() {

override fun onCreateDialog(savedInstanceState: Bundle?): Dialog =
AlertDialog.Builder(activity!!)
.setTitle(R.string.logout)
.setMessage(R.string.logout_message)
.setPositiveButton(R.string.logout, { _, _ ->
activity?.let(::reAuthenticate) ?: logOut()
})
.setNegativeButton(R.string.cancel, { _, _ -> Unit })
.create()

}

Expand Down
2 changes: 1 addition & 1 deletion Awful.apk/src/main/java/com/ferg/awfulapp/AwfulActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ abstract class AwfulActivity : AppCompatActivity(), AwfulPreferences.AwfulPrefer
) =
startActivity(NavigationEvent.Thread(id, page, postJump).getIntent(applicationContext))

fun showLogoutDialog() = LogOutDialog(this).show()
fun showLogoutDialog() = LogOutDialog().show(supportFragmentManager, "logout dialog")

/** Display the announcements */
fun showAnnouncements() = AnnouncementsManager.getInstance().showAnnouncements(this)
Expand Down
3 changes: 2 additions & 1 deletion Awful.apk/src/main/res/values/changelog.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<resources>
<string-array name="changelog">
<item>
3.5.0:\n
3.5.1:\n
- Emote picker has smarter search and history :wow:\n\n
- You wanted a private message send confirmation, you got one\n\n
- Timestamps in searches\n\n
Expand All @@ -11,6 +11,7 @@
- A bunch of optimizations to enspeeden your forums experience\n\n
\n
Fixes:\n
- A logout bug where it didn\'t show the login screen\n\n
- Opening the bookmarks widget or an external link to a thread doesn\'t make them \'stick\' anymore\n\n
- Crashes and weird behavior when swiping on a code block\n\n
- Settings import/export\n\n
Expand Down

0 comments on commit 5e1b7dd

Please sign in to comment.