diff --git a/app/src/main/java/com/keylesspalace/tusky/components/account/AccountActivity.kt b/app/src/main/java/com/keylesspalace/tusky/components/account/AccountActivity.kt index 6a8bc7dc..7b5b8d7d 100644 --- a/app/src/main/java/com/keylesspalace/tusky/components/account/AccountActivity.kt +++ b/app/src/main/java/com/keylesspalace/tusky/components/account/AccountActivity.kt @@ -84,6 +84,9 @@ import com.keylesspalace.tusky.view.showMuteAccountDialog import dagger.android.DispatchingAndroidInjector import dagger.android.HasAndroidInjector import java.text.NumberFormat +import java.text.ParseException +import java.text.SimpleDateFormat +import java.util.Locale import javax.inject.Inject import kotlin.math.abs @@ -413,6 +416,7 @@ class AccountActivity : BottomSheetActivity(), ActionButtonActivity, HasAndroidI updateToolbar() updateMovedAccount() updateRemoteAccount() + updateAccountJoinedDate() updateAccountStats() invalidateOptionsMenu() @@ -422,6 +426,20 @@ class AccountActivity : BottomSheetActivity(), ActionButtonActivity, HasAndroidI } } + private fun updateAccountJoinedDate() { + loadedAccount?.let { account -> + try { + binding.accountDateJoined.text = resources.getString( + R.string.account_date_joined, + SimpleDateFormat("MMMM, yyyy", Locale.getDefault()).format(account.createdAt) + ) + binding.accountDateJoined.visibility = View.VISIBLE + } catch (e: ParseException) { + binding.accountDateJoined.visibility = View.GONE + } + } + } + /** * Load account's avatar and header image */ diff --git a/app/src/main/java/com/keylesspalace/tusky/entity/Account.kt b/app/src/main/java/com/keylesspalace/tusky/entity/Account.kt index bf5431ee..4870c188 100644 --- a/app/src/main/java/com/keylesspalace/tusky/entity/Account.kt +++ b/app/src/main/java/com/keylesspalace/tusky/entity/Account.kt @@ -23,6 +23,7 @@ data class Account( @SerializedName("username") val localUsername: String, @SerializedName("acct") val username: String, @SerializedName("display_name") val displayName: String?, // should never be null per Api definition, but some servers break the contract + @SerializedName("created_at") val createdAt: Date, val note: String, val url: String, val avatar: String, diff --git a/app/src/main/res/layout/activity_account.xml b/app/src/main/res/layout/activity_account.xml index 31b37ad8..ff548dfc 100644 --- a/app/src/main/res/layout/activity_account.xml +++ b/app/src/main/res/layout/activity_account.xml @@ -235,6 +235,19 @@ tools:itemCount="2" tools:listitem="@layout/item_account_field" /> + + Unsubscribe Compose Post + + Joined %1$s + Saving draft… Re-login all accounts to enable push notification support. In order to use push notifications via UnifiedPush, Tusky needs permission to subscribe to notifications on your Mastodon server. This requires a re-login to change the OAuth scopes granted to Tusky. Using the re-login option here or in Account Preferences will preserve all of your local drafts and cache. You have re-logged into your current account to grant push subscription permission to Tusky. However, you still have other accounts that have not been migrated this way. Switch to them and re-login one by one in order to enable UnifiedPush notifications support. + diff --git a/app/src/test/java/com/keylesspalace/tusky/ComposeActivityTest.kt b/app/src/test/java/com/keylesspalace/tusky/ComposeActivityTest.kt index 3a8f2f23..95d1bae0 100644 --- a/app/src/test/java/com/keylesspalace/tusky/ComposeActivityTest.kt +++ b/app/src/test/java/com/keylesspalace/tusky/ComposeActivityTest.kt @@ -47,6 +47,8 @@ import org.robolectric.Robolectric import org.robolectric.Shadows.shadowOf import org.robolectric.annotation.Config import org.robolectric.fakes.RoboMenuItem +import java.util.Date +import kotlin.collections.HashMap /** * Created by charlag on 3/7/18. @@ -466,22 +468,23 @@ class ComposeActivityTest { null, listOf("en"), Account( - "1", - "admin", - "admin", - "admin", - "", - "https://example.token", - "", - "", - false, - 0, - 0, - 0, - null, - false, - emptyList(), - emptyList() + id = "1", + localUsername = "admin", + username = "admin", + displayName = "admin", + createdAt = Date(), + note = "", + url = "https://example.token", + avatar = "", + header = "", + locked = false, + statusesCount = 0, + followersCount = 0, + followingCount = 0, + source = null, + bot = false, + emojis = emptyList(), + fields = emptyList(), ), maximumLegacyTootCharacters, null,