mirror of
https://github.com/nextcloud/talk-android.git
synced 2024-12-15 13:11:44 +03:00
add check if server notification app is installed for current user
Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
This commit is contained in:
parent
c559c6b0b4
commit
6f6c1896ed
4 changed files with 53 additions and 9 deletions
|
@ -1522,8 +1522,11 @@ class ConversationsListActivity :
|
||||||
val messagesChannelNotEnabled = !NotificationUtils.isMessagesNotificationChannelEnabled(this)
|
val messagesChannelNotEnabled = !NotificationUtils.isMessagesNotificationChannelEnabled(this)
|
||||||
val callsChannelNotEnabled = !NotificationUtils.isCallsNotificationChannelEnabled(this)
|
val callsChannelNotEnabled = !NotificationUtils.isCallsNotificationChannelEnabled(this)
|
||||||
|
|
||||||
|
val serverNotificationAppInstalled =
|
||||||
|
userManager.currentUser.blockingGet().capabilities?.notificationsCapability?.features?.isNotEmpty() ?: false
|
||||||
|
|
||||||
val settingsOfUserAreWrong = notificationPermissionNotGranted || batteryOptimizationNotIgnored ||
|
val settingsOfUserAreWrong = notificationPermissionNotGranted || batteryOptimizationNotIgnored ||
|
||||||
messagesChannelNotEnabled || callsChannelNotEnabled
|
messagesChannelNotEnabled || callsChannelNotEnabled || !serverNotificationAppInstalled
|
||||||
|
|
||||||
val userWantsToBeNotifiedAboutWrongSettings = appPreferences.getShowNotificationWarning()
|
val userWantsToBeNotifiedAboutWrongSettings = appPreferences.getShowNotificationWarning()
|
||||||
|
|
||||||
|
|
|
@ -284,6 +284,7 @@ class SettingsActivity : BaseActivity(), SetPhoneNumberDialogFragment.SetPhoneNu
|
||||||
private fun setupNotificationSettings() {
|
private fun setupNotificationSettings() {
|
||||||
setupNotificationSoundsSettings()
|
setupNotificationSoundsSettings()
|
||||||
setupNotificationPermissionSettings()
|
setupNotificationPermissionSettings()
|
||||||
|
setupServerNotificationAppCheck()
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressLint("StringFormatInvalid")
|
@SuppressLint("StringFormatInvalid")
|
||||||
|
@ -476,6 +477,24 @@ class SettingsActivity : BaseActivity(), SetPhoneNumberDialogFragment.SetPhoneNu
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun setupServerNotificationAppCheck() {
|
||||||
|
val serverNotificationAppInstalled =
|
||||||
|
userManager.currentUser.blockingGet().capabilities?.notificationsCapability?.features?.isNotEmpty() ?: false
|
||||||
|
if (!serverNotificationAppInstalled) {
|
||||||
|
binding.settingsServerNotificationAppWrapper.visibility = View.VISIBLE
|
||||||
|
|
||||||
|
val description = context.getString(R.string.nc_settings_contact_admin_of) + LINEBREAK +
|
||||||
|
userManager.currentUser.blockingGet().baseUrl!!
|
||||||
|
|
||||||
|
binding.settingsServerNotificationAppDescription.text = description
|
||||||
|
if (openedByNotificationWarning) {
|
||||||
|
blinkRipple(binding.settingsServerNotificationAppWrapper.background)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
binding.settingsServerNotificationAppWrapper.visibility = View.GONE
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun setupSourceCodeUrl() {
|
private fun setupSourceCodeUrl() {
|
||||||
if (!TextUtils.isEmpty(resources!!.getString(R.string.nc_source_code_url))) {
|
if (!TextUtils.isEmpty(resources!!.getString(R.string.nc_source_code_url))) {
|
||||||
binding.settingsSourceCode.setOnClickListener {
|
binding.settingsSourceCode.setOnClickListener {
|
||||||
|
@ -1421,6 +1440,7 @@ class SettingsActivity : BaseActivity(), SetPhoneNumberDialogFragment.SetPhoneNu
|
||||||
private const val START_DELAY: Long = 5000
|
private const val START_DELAY: Long = 5000
|
||||||
private const val DISABLED_ALPHA: Float = 0.38f
|
private const val DISABLED_ALPHA: Float = 0.38f
|
||||||
private const val ENABLED_ALPHA: Float = 1.0f
|
private const val ENABLED_ALPHA: Float = 1.0f
|
||||||
|
private const val LINEBREAK = "\n"
|
||||||
const val HTTP_CODE_OK: Int = 200
|
const val HTTP_CODE_OK: Int = 200
|
||||||
const val HTTP_ERROR_CODE_BAD_REQUEST: Int = 400
|
const val HTTP_ERROR_CODE_BAD_REQUEST: Int = 400
|
||||||
}
|
}
|
||||||
|
|
|
@ -311,12 +311,12 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:background="?android:attr/selectableItemBackground"
|
android:background="?android:attr/selectableItemBackground"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical"
|
||||||
|
android:padding="@dimen/standard_padding">
|
||||||
|
|
||||||
<com.google.android.material.textview.MaterialTextView
|
<com.google.android.material.textview.MaterialTextView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_margin="@dimen/standard_margin"
|
|
||||||
android:text="@string/nc_settings_call_ringtone"
|
android:text="@string/nc_settings_call_ringtone"
|
||||||
android:textSize="@dimen/headline_text_size"/>
|
android:textSize="@dimen/headline_text_size"/>
|
||||||
|
|
||||||
|
@ -324,8 +324,6 @@
|
||||||
android:id="@+id/calls_ringtone"
|
android:id="@+id/calls_ringtone"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginStart="@dimen/standard_margin"
|
|
||||||
android:layout_marginBottom="@dimen/standard_margin"
|
|
||||||
android:text="@string/nc_settings_default_ringtone"
|
android:text="@string/nc_settings_default_ringtone"
|
||||||
android:textSize="@dimen/supporting_text_text_size"/>
|
android:textSize="@dimen/supporting_text_text_size"/>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
@ -335,12 +333,12 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:background="?android:attr/selectableItemBackground"
|
android:background="?android:attr/selectableItemBackground"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical"
|
||||||
|
android:padding="@dimen/standard_padding">
|
||||||
|
|
||||||
<com.google.android.material.textview.MaterialTextView
|
<com.google.android.material.textview.MaterialTextView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_margin="@dimen/standard_margin"
|
|
||||||
android:text="@string/nc_settings_other_notifications_ringtone"
|
android:text="@string/nc_settings_other_notifications_ringtone"
|
||||||
android:textSize="@dimen/headline_text_size"/>
|
android:textSize="@dimen/headline_text_size"/>
|
||||||
|
|
||||||
|
@ -348,12 +346,33 @@
|
||||||
android:id="@+id/messages_ringtone"
|
android:id="@+id/messages_ringtone"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginStart="@dimen/standard_margin"
|
|
||||||
android:layout_marginBottom="@dimen/standard_margin"
|
|
||||||
android:text="@string/nc_settings_default_ringtone"
|
android:text="@string/nc_settings_default_ringtone"
|
||||||
android:textSize="@dimen/supporting_text_text_size"/>
|
android:textSize="@dimen/supporting_text_text_size"/>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/settings_server_notification_app_wrapper"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="?android:attr/selectableItemBackground"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:padding="@dimen/standard_padding">
|
||||||
|
|
||||||
|
<com.google.android.material.textview.MaterialTextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/nc_settings_server_notification_app_not_installed_title"
|
||||||
|
android:textSize="@dimen/headline_text_size"/>
|
||||||
|
|
||||||
|
<com.google.android.material.textview.MaterialTextView
|
||||||
|
android:id="@+id/settings_server_notification_app_description"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textColor="@color/nc_darkRed"
|
||||||
|
android:textSize="@dimen/supporting_text_text_size"
|
||||||
|
tools:text="Please contact the admin of www.example.com"/>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
|
|
@ -108,6 +108,8 @@ How to translate with transifex:
|
||||||
<string name="nc_settings_message_ringtone_key" translatable="false">message_ringtone</string>
|
<string name="nc_settings_message_ringtone_key" translatable="false">message_ringtone</string>
|
||||||
<string name="nc_settings_default_ringtone" translatable="false">Librem by feandesign</string>
|
<string name="nc_settings_default_ringtone" translatable="false">Librem by feandesign</string>
|
||||||
<string name="nc_settings_no_ringtone">No sound</string>
|
<string name="nc_settings_no_ringtone">No sound</string>
|
||||||
|
<string name="nc_settings_server_notification_app_not_installed_title">Server notification app not installed</string>
|
||||||
|
<string name="nc_settings_contact_admin_of">Please contact the administrator of</string>
|
||||||
|
|
||||||
<string name="nc_settings_appearance">Appearance</string>
|
<string name="nc_settings_appearance">Appearance</string>
|
||||||
<string name="nc_settings_theme_title">Theme</string>
|
<string name="nc_settings_theme_title">Theme</string>
|
||||||
|
|
Loading…
Reference in a new issue