Feedback updates

This commit is contained in:
Hafiz 2023-01-09 07:46:12 -05:00
parent 5d505fb59a
commit c50a07db35
4 changed files with 5 additions and 43 deletions

View file

@ -221,23 +221,10 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingEnd="@dimen/spacing_medium"
android:text="@string/push_notification_system_settings_description"
android:text="@string/push_notification_system_settings_reminders"
android:textColor="@color/text_quad"
android:textSize="12sp" />
<com.google.android.material.button.MaterialButton
android:id="@+id/enable_notifs_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/notifications_enabled_text"
android:background="@color/transparent"
android:insetBottom="0dp"
android:insetTop="0dp"
android:padding="0dp"
android:text="@string/enable_notifications"
android:textColor="@color/brand_300"
android:textSize="12sp" />
</RelativeLayout>
<com.habitrpg.android.habitica.ui.views.tasks.form.ReminderContainer

View file

@ -28,8 +28,9 @@
<string name="pref_push_notifications_checkbox">Use Push Notifications</string>
<string name="push_notifications">Push Notifications</string>
<string name="enable_notifications">Enable Notifications</string>
<string name="push_notification_system_settings_description">System Push Notifications for Habitica are disabled - you won\'t receive push notifications until they are enabled</string>
<string name="push_notification_system_settings_title">Push Notifications</string>
<string name="push_notification_system_settings_description">Allow Habitica notifications in the Settings app to receive push notifications</string>
<string name="push_notification_system_settings_reminders">Allow Habitica notifications in the Settings app to receive reminders</string>
<string name="push_notification_system_settings_title">Notifications Disabled</string>
<string name="push_notifications_sum">Set your push notifications settings</string>
<string name="preference_push_you_won_challenge">You won a Challenge!</string>
<string name="preference_push_received_a_private_message">Received a Private Message</string>

View file

@ -111,29 +111,6 @@ class TaskFormActivity : BaseActivity() {
private var challenge: Challenge? = null
private val notificationPermissionLauncher = registerForActivityResult(
ActivityResultContracts.RequestPermission()
) { granted ->
if (granted) {
pushNotificationManager.addPushDeviceUsingStoredToken()
} else {
//If user denies notification settings originally - they must manually enable it through notification settings.
val alert = HabiticaAlertDialog(this)
alert.setTitle(R.string.push_notification_system_settings_title)
alert.setMessage(R.string.push_notification_system_settings_description)
alert.addButton(R.string.settings, true, false) { _, _ ->
val notifSettingIntent: Intent = Intent(Settings.ACTION_APP_NOTIFICATION_SETTINGS)
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
.putExtra(Settings.EXTRA_APP_PACKAGE, applicationContext?.packageName)
startActivity(notifSettingIntent)
}
alert.addButton(R.string.cancel, false) { _, _ ->
alert.dismiss()
}
alert.show()
}
}
private var isCreating = true
private var isChallengeTask = false
private var usesTaskAttributeStats = false
@ -765,9 +742,6 @@ class TaskFormActivity : BaseActivity() {
private fun checkIfShowNotifLayout() {
if (!pushNotificationManager.notificationPermissionEnabled() && Build.VERSION.SDK_INT >= 33) {
binding.notificationsDisabledLayout.visibility = View.VISIBLE
binding.enableNotifsButton.setOnClickListener {
notificationPermissionLauncher.launch(android.Manifest.permission.POST_NOTIFICATIONS)
}
} else {
binding.notificationsDisabledLayout.visibility = View.GONE
}

View file

@ -197,7 +197,7 @@ class PreferencesFragment : BasePreferencesFragment(), SharedPreferences.OnShare
val alert = context?.let { HabiticaAlertDialog(it) }
alert?.setTitle(R.string.push_notification_system_settings_title)
alert?.setMessage(R.string.push_notification_system_settings_description)
alert?.addButton(R.string.settings, true, false) { _, _ ->
alert?.addButton(R.string.open_settings, true, false) { _, _ ->
val notifSettingIntent: Intent = Intent(Settings.ACTION_APP_NOTIFICATION_SETTINGS)
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
.putExtra(Settings.EXTRA_APP_PACKAGE, context?.applicationContext?.packageName)