Updated on 2026-08-14
This commit is contained in:
parent
9fa7f9ea5e
commit
8c706b931d
5 changed files with 52 additions and 23 deletions
|
|
@ -10,7 +10,6 @@ import com.tangem.tap.foregroundActivityObserver
|
|||
import com.tangem.tap.persistence.PreferencesStorage
|
||||
import com.tangem.tap.withForegroundActivity
|
||||
import com.tangem.wallet.R
|
||||
import com.zendesk.logger.Logger
|
||||
import timber.log.Timber
|
||||
import zendesk.chat.Chat
|
||||
import zendesk.chat.ChatConfiguration
|
||||
|
|
@ -30,20 +29,17 @@ class FeedbackManager(
|
|||
val infoHolder: AdditionalFeedbackInfo,
|
||||
private val logCollector: TangemLogCollector,
|
||||
private val preferencesStorage: PreferencesStorage,
|
||||
private val logEnabled: Boolean = false,
|
||||
) {
|
||||
fun initChat(
|
||||
context: Context,
|
||||
zendeskConfig: ZendeskConfig,
|
||||
) {
|
||||
Chat.INSTANCE.init(
|
||||
context,
|
||||
zendeskConfig.accountKey,
|
||||
zendeskConfig.appId
|
||||
)
|
||||
private var lastUsedConfigForInitialization: ZendeskConfig? = null
|
||||
|
||||
// Zendesk logs
|
||||
Logger.setLoggable(logEnabled)
|
||||
var chatInitializer: ((ZendeskConfig) -> Unit)? = null
|
||||
|
||||
fun initChat(zendeskConfig: ZendeskConfig) {
|
||||
// prevent double initialization with the same config
|
||||
if (lastUsedConfigForInitialization == zendeskConfig) return
|
||||
|
||||
lastUsedConfigForInitialization = zendeskConfig
|
||||
chatInitializer?.invoke(zendeskConfig)
|
||||
}
|
||||
|
||||
fun sendEmail(feedbackData: FeedbackData, onFail: ((Exception) -> Unit)? = null) {
|
||||
|
|
@ -55,7 +51,7 @@ class FeedbackManager(
|
|||
subject = activity.getString(feedbackData.subjectResId),
|
||||
message = feedbackData.joinTogether(activity, infoHolder),
|
||||
file = fileLog,
|
||||
onFail = onFail
|
||||
onFail = onFail,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue