Skip to content

Commit

Permalink
Release/6.9.1 (#37)
Browse files Browse the repository at this point in the history
Releasing 6.9.1
  • Loading branch information
PoornimaApptentive authored Nov 20, 2024
1 parent 9358ff4 commit aac3f57
Show file tree
Hide file tree
Showing 11 changed files with 111 additions and 9 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# 2024-11-20 - v6.9.1
### Fixes
* Device updates are now accurately captured in the conversation metadata.
* Support for Android 15's edge-to-edge feature implemented via Apptentive theme override.
* Updated WebView configuration settings to address a security vulnerability.
* Resolved the profile screen freezing issue.

# 2024-09-18 - v6.9.0
### Fixes
* Draft messages are now saved correctly in the multiuser environment
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,14 @@ class ApptentiveDefaultClient(
}
}

conversationManager.deviceupdate.observe { deviceUpdated ->
if (deviceUpdated) {
val device = conversationManager.getConversation().device
val payload = device.toDevicePayload()
enqueuePayload(payload)
}
}

executors.main.execute {
Log.i(LIFE_CYCLE_OBSERVER, "Observing App lifecycle")
ProcessLifecycleOwner.get().lifecycle.addObserver(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import apptentive.com.android.util.InternalUseOnly

@InternalUseOnly
object Constants {
const val SDK_VERSION = "6.9.0"
const val SDK_VERSION = "6.9.1"
const val API_VERSION = 15
const val SERVER_URL = "https://api.apptentive.com"
const val REDACTED_DATA = "<REDACTED>"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,11 @@ internal class ConversationManager(
private val sdkAppReleaseUpdateSubject = BehaviorSubject(false)
val sdkAppReleaseUpdate: Observable<Boolean> get() = sdkAppReleaseUpdateSubject

private val deviceUpdateSubject = BehaviorSubject(false)
val deviceupdate: Observable<Boolean> get() = deviceUpdateSubject

var isSDKAppReleaseCheckDone = false
var isDeviceUpdateCheckDone = false

init {
val conversation = loadActiveConversation()
Expand All @@ -90,6 +94,7 @@ internal class ConversationManager(
fun onEncryptionSetupComplete() {
activeConversationSubject.observe(::saveConversation)
activeConversation.observe(::checkForSDKAppReleaseUpdates)
activeConversation.observe(::checkForDeviceUpdates)
}

@RequiresApi(Build.VERSION_CODES.M)
Expand Down Expand Up @@ -363,6 +368,18 @@ internal class ConversationManager(
return conversationRepository.createConversation(conversationId, conversationToken)
}

fun checkForDeviceUpdates(conversation: Conversation) {
if (isDeviceUpdateCheckDone) return else isDeviceUpdateCheckDone = true
Log.i(CONVERSATION, "Checking for device updates")
val currentDevice = conversationRepository.getCurrentDevice()
if (conversation.device != currentDevice) {
deviceUpdateSubject.value = true
Log.d(CONVERSATION, "Device updated: ${conversation.device} => $currentDevice")
// Keep the uuid same as the previous device conversation
updateDevice(currentDevice.copy(uuid = conversation.device.uuid))
}
}

fun checkForSDKAppReleaseUpdates(conversation: Conversation) {
// Check for SDK & AppRelease update once per session
if (isSDKAppReleaseCheckDone) return else isSDKAppReleaseCheckDone = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ internal interface ConversationRepository {

fun getCurrentAppRelease(): AppRelease

fun getCurrentDevice(): Device

fun getCurrentSdk(): SDK

fun updateEncryption(encryption: Encryption)
Expand Down Expand Up @@ -71,6 +73,8 @@ internal class DefaultConversationRepository(

override fun getCurrentSdk(): SDK = sdkFactory.create()

override fun getCurrentDevice(): Device = deviceFactory.create()

override fun updateEncryption(encryption: Encryption) {
conversationSerializer.setEncryption(encryption)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,37 @@ data class Device(
customData = customData.content,
integrationConfig = integrationConfig.toPayload()
)

override fun equals(other: Any?): Boolean {
if (this === other) return true
if (javaClass != other?.javaClass) return false

other as Device

return !(
osName != other.osName ||
osVersion != other.osVersion ||
osBuild != other.osBuild ||
osApiLevel != other.osApiLevel ||
manufacturer != other.manufacturer ||
model != other.model ||
board != other.board ||
product != other.product ||
brand != other.brand ||
cpu != other.cpu ||
device != other.device ||
buildType != other.buildType ||
buildId != other.buildId ||
carrier != other.carrier ||
currentCarrier != other.currentCarrier ||
networkType != other.networkType ||
bootloaderVersion != other.bootloaderVersion ||
radioVersion != other.radioVersion ||
localeCountryCode != other.localeCountryCode ||
localeLanguageCode != other.localeLanguageCode ||
localeRaw != other.localeRaw ||
customData != other.customData ||
integrationConfig != other.integrationConfig
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ class ConversationManagerTest : TestCase() {
conversationManager.getConversation().device

@Test
fun testDeviceUpdate() {
fun testCustomDataDeviceUpdate() {
DefaultStateMachine.reset()
DefaultStateMachine.onEvent(SDKEvent.RegisterSDK)
DefaultStateMachine.onEvent(SDKEvent.ClientStarted)
Expand All @@ -142,6 +142,17 @@ class ConversationManagerTest : TestCase() {
assertEquals(updatedCustomData.content.size, getUpdatedDevice(conversationManager).customData.content.size)
}

@Test
fun testNonCustomDataDeviceUpdate() {
DefaultStateMachine.reset()
DefaultStateMachine.onEvent(SDKEvent.RegisterSDK)
DefaultStateMachine.onEvent(SDKEvent.ClientStarted)
val conversationManager = createConversationManager()
// The mockConversationRepository updates the mockDevice with osApiLevel = 31, osVersion = "12" hence there is a device udpate
conversationManager.checkForDeviceUpdates(conversationManager.getConversation())
assertTrue(conversationManager.isDeviceUpdateCheckDone)
}

@Test
fun testAppReleaseSDKUpdate() {
DefaultStateMachine.reset()
Expand Down Expand Up @@ -270,6 +281,8 @@ class MockConversationRepository(val throwException: Boolean = false) :
versionName = "Version name updated"
)

override fun getCurrentDevice(): Device = mockDevice.copy(osApiLevel = 31, osVersion = "12")

override fun getCurrentSdk(): SDK = mockSdk.copy(
version = "Version updated"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,13 @@
"device/custom_data/string_qwerty": {
"$ends_with": "erty"
}
},
{
"$not": {
"device/custom_data/string_qwerty": {
"$contains": "wre"
}
}
}
]
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package apptentive.com.android.feedback.messagecenter.view

import android.os.Bundle
import androidx.activity.addCallback
import apptentive.com.android.feedback.messagecenter.R
import apptentive.com.android.feedback.messagecenter.utils.MessageCenterEvents
import apptentive.com.android.feedback.messagecenter.view.custom.ProfileView
Expand Down Expand Up @@ -69,7 +70,7 @@ internal class ProfileActivity : BaseProfileActivity() {
"button_label" to getString(R.string.apptentive_close)
)
)
super.onBackPressed()
finish()
}
)
confirmationDialog.show()
Expand All @@ -81,12 +82,11 @@ internal class ProfileActivity : BaseProfileActivity() {
"button_label" to saveButton.text.toString()
)
)
super.onBackPressed()
finish()
}
}
}

override fun onBackPressed() {
viewModel.exitProfileView(profileView.getName(), profileView.getEmail())
onBackPressedDispatcher.addCallback(this) {
viewModel.exitProfileView(profileView.getName(), profileView.getEmail().trim())
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package apptentive.com.android.feedback.link.view

import android.content.Intent
import android.net.Uri
import android.os.Build
import android.os.Bundle
import android.webkit.ValueCallback
import android.webkit.WebChromeClient
Expand Down Expand Up @@ -44,6 +45,18 @@ internal class NavigateTolinkActivity : BaseNavigateToLinkActivity() {
settings.domStorageEnabled = true
settings.mediaPlaybackRequiresUserGesture = false
settings.javaScriptCanOpenWindowsAutomatically = true
settings.allowFileAccess = false
settings.allowContentAccess = false

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
settings.safeBrowsingEnabled = true
}

if (Build.VERSION.SDK_INT < Build.VERSION_CODES.R) {
settings.allowFileAccessFromFileURLs = false
settings.allowUniversalAccessFromFileURLs = false
}

webView.webChromeClient = object : WebChromeClient() {
override fun onShowFileChooser(
webView: WebView?,
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ buildscript {
}

project.ext {
sonatypeVersion = '6.9.0'
sonatypeVersion = '6.9.1'
jfrogVersion = '6.8.1'

// Change this depending on where you are publishing to
Expand Down

0 comments on commit aac3f57

Please sign in to comment.