hide logos for conversation list and lockscreen if app is not nextcloud

Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
This commit is contained in:
Marcel Hibbe 2024-05-24 13:23:03 +02:00
parent ff52e8ebb4
commit 6f90623cab
No known key found for this signature in database
GPG key ID: C793F8B59F43CE7B
4 changed files with 37 additions and 2 deletions

View file

@ -101,6 +101,7 @@ import com.nextcloud.talk.ui.dialog.ConversationsListBottomDialog
import com.nextcloud.talk.ui.dialog.FilterConversationFragment
import com.nextcloud.talk.users.UserManager
import com.nextcloud.talk.utils.ApiUtils
import com.nextcloud.talk.utils.BrandingUtils
import com.nextcloud.talk.utils.CapabilitiesUtil.hasSpreedFeatureCapability
import com.nextcloud.talk.utils.CapabilitiesUtil.isServerEOL
import com.nextcloud.talk.utils.CapabilitiesUtil.isUnifiedSearchAvailable
@ -959,6 +960,8 @@ class ConversationsListActivity :
@SuppressLint("ClickableViewAccessibility")
private fun prepareViews() {
hideLogoForBrandedClients()
layoutManager = SmoothScrollLinearLayoutManager(this)
binding.recyclerView.layoutManager = layoutManager
binding.recyclerView.setHasFixedSize(true)
@ -1019,6 +1022,12 @@ class ConversationsListActivity :
binding?.newMentionPopupBubble?.let { viewThemeUtils.material.colorMaterialButtonPrimaryFilled(it) }
}
private fun hideLogoForBrandedClients() {
if (!BrandingUtils.isOriginalNextcloudClient(applicationContext)) {
binding.emptyListIcon.visibility = View.GONE
}
}
@SuppressLint("CheckResult")
@Suppress("Detekt.TooGenericExceptionCaught")
private fun checkToShowUnreadBubble() {

View file

@ -36,6 +36,7 @@ import com.nextcloud.talk.application.NextcloudTalkApplication
import com.nextcloud.talk.arbitrarystorage.ArbitraryStorageManager
import com.nextcloud.talk.databinding.ActivityDiagnoseBinding
import com.nextcloud.talk.users.UserManager
import com.nextcloud.talk.utils.BrandingUtils
import com.nextcloud.talk.utils.ClosedInterfaceImpl
import com.nextcloud.talk.utils.DisplayUtils
import com.nextcloud.talk.utils.NotificationUtils
@ -115,8 +116,7 @@ class DiagnoseActivity : BaseActivity() {
override fun onPrepareOptionsMenu(menu: Menu): Boolean {
super.onPrepareOptionsMenu(menu)
menu.findItem(R.id.create_issue).isVisible =
applicationContext.packageName.equals(ORIGINAL_NEXTCLOUD_TALK_APPLICATION_ID)
menu.findItem(R.id.create_issue).isVisible = BrandingUtils.isOriginalNextcloudClient(applicationContext)
return true
}

View file

@ -13,6 +13,7 @@ import android.app.KeyguardManager
import android.content.Context
import android.os.Bundle
import android.util.Log
import android.view.View
import androidx.activity.result.ActivityResult
import androidx.activity.result.contract.ActivityResultContracts
import androidx.appcompat.app.AppCompatActivity
@ -21,6 +22,7 @@ import autodagger.AutoInjector
import com.nextcloud.talk.R
import com.nextcloud.talk.application.NextcloudTalkApplication
import com.nextcloud.talk.databinding.ActivityLockedBinding
import com.nextcloud.talk.utils.BrandingUtils
import com.nextcloud.talk.utils.SecurityUtils
import com.nextcloud.talk.utils.preferences.AppPreferences
import java.util.concurrent.Executor
@ -55,6 +57,7 @@ class LockedActivity : AppCompatActivity() {
override fun onResume() {
super.onResume()
hideLogoForBrandedClients()
binding.unlockContainer.setOnClickListener {
checkIfWeAreSecure()
@ -62,6 +65,12 @@ class LockedActivity : AppCompatActivity() {
checkIfWeAreSecure()
}
private fun hideLogoForBrandedClients() {
if (!BrandingUtils.isOriginalNextcloudClient(applicationContext)) {
binding.appLogo.visibility = View.GONE
}
}
private fun checkIfWeAreSecure() {
val keyguardManager = getSystemService(Context.KEYGUARD_SERVICE) as KeyguardManager?
if (keyguardManager?.isKeyguardSecure == true && appPreferences.isScreenLocked) {

View file

@ -0,0 +1,17 @@
/*
* Nextcloud Talk - Android Client
*
* SPDX-FileCopyrightText: 2024 Marcel Hibbe <dev@mhibbe.de>
* SPDX-License-Identifier: GPL-3.0-or-later
*/
package com.nextcloud.talk.utils
import android.content.Context
object BrandingUtils {
private const val ORIGINAL_NEXTCLOUD_TALK_APPLICATION_ID = "com.nextcloud.talk2"
fun isOriginalNextcloudClient(context: Context): Boolean {
return context.packageName.equals(ORIGINAL_NEXTCLOUD_TALK_APPLICATION_ID)
}
}