NTP-60143 | Alfred events fixes (#335)
Co-authored-by: amansingh <aman.s@navi.com>
This commit is contained in:
@@ -192,13 +192,9 @@ object AlfredManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal fun updateRecordingState(isBackground: Boolean) {
|
internal fun resetWhenAppGoesInBackground() {
|
||||||
sessionConfig.isCriticalUserJourneyActive.set(false)
|
sessionConfig.isCriticalUserJourneyActive.set(false)
|
||||||
isAppInForeground.set(isBackground.not())
|
PixelCopyHandler.cleanup()
|
||||||
|
|
||||||
if (isBackground) {
|
|
||||||
PixelCopyHandler.cleanup()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setUserId(userId: String?) {
|
fun setUserId(userId: String?) {
|
||||||
|
|||||||
@@ -15,8 +15,8 @@ import com.navi.alfred.core.AlfredManager.initializeAlfredResources
|
|||||||
import com.navi.alfred.core.AlfredManager.ioCoroutineScope
|
import com.navi.alfred.core.AlfredManager.ioCoroutineScope
|
||||||
import com.navi.alfred.core.AlfredManager.isAlfredRecordingEnabled
|
import com.navi.alfred.core.AlfredManager.isAlfredRecordingEnabled
|
||||||
import com.navi.alfred.core.AlfredManager.isAppInForeground
|
import com.navi.alfred.core.AlfredManager.isAppInForeground
|
||||||
|
import com.navi.alfred.core.AlfredManager.resetWhenAppGoesInBackground
|
||||||
import com.navi.alfred.core.AlfredManager.screenRecordingScope
|
import com.navi.alfred.core.AlfredManager.screenRecordingScope
|
||||||
import com.navi.alfred.core.AlfredManager.updateRecordingState
|
|
||||||
import com.navi.alfred.core.handler.AlfredRecordingHandlerImpl.captureScreen
|
import com.navi.alfred.core.handler.AlfredRecordingHandlerImpl.captureScreen
|
||||||
import com.navi.alfred.core.handler.interfaces.AlfredLifecycleHandler
|
import com.navi.alfred.core.handler.interfaces.AlfredLifecycleHandler
|
||||||
import com.navi.alfred.model.EventType
|
import com.navi.alfred.model.EventType
|
||||||
@@ -100,13 +100,14 @@ object AlfredLifecycleHandlerImpl : AlfredLifecycleHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun onApplicationInBackground() {
|
override fun onApplicationInBackground() {
|
||||||
|
isAppInForeground.set(false)
|
||||||
if (!isAlfredRecordingEnabled()) {
|
if (!isAlfredRecordingEnabled()) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
ioCoroutineScope.launch {
|
ioCoroutineScope.launch {
|
||||||
prepareUploadWhenAppGoesInBackground(AlfredManager.sessionConfig.alfredZipName)
|
prepareUploadWhenAppGoesInBackground(AlfredManager.sessionConfig.alfredZipName)
|
||||||
}
|
}
|
||||||
updateRecordingState(isBackground = true)
|
resetWhenAppGoesInBackground()
|
||||||
sendAnalyticsEvent(eventName = ALFRED_STOP_RECORDING)
|
sendAnalyticsEvent(eventName = ALFRED_STOP_RECORDING)
|
||||||
dispatchEvent(
|
dispatchEvent(
|
||||||
EventType.StopRecording,
|
EventType.StopRecording,
|
||||||
|
|||||||
@@ -7,7 +7,6 @@
|
|||||||
|
|
||||||
package com.navi.alfred.sevenzutils
|
package com.navi.alfred.sevenzutils
|
||||||
|
|
||||||
import android.util.Log
|
|
||||||
import com.navi.alfred.sevenzutils.xz.LZMA2Options
|
import com.navi.alfred.sevenzutils.xz.LZMA2Options
|
||||||
import com.navi.alfred.sevenzutils.xz.XZOutputStream
|
import com.navi.alfred.sevenzutils.xz.XZOutputStream
|
||||||
import com.navi.alfred.utils.AnalyticsConstants.ALFRED_X_ZIP_COMPRESSED_FAILURE
|
import com.navi.alfred.utils.AnalyticsConstants.ALFRED_X_ZIP_COMPRESSED_FAILURE
|
||||||
@@ -22,20 +21,30 @@ internal fun compressTo7z(zipFileName: String): Boolean {
|
|||||||
if (!File(inputPath).exists()) return false
|
if (!File(inputPath).exists()) return false
|
||||||
try {
|
try {
|
||||||
val lzma2Options = LZMA2Options()
|
val lzma2Options = LZMA2Options()
|
||||||
|
lzma2Options.dictSize = 1 shl 20
|
||||||
|
|
||||||
val outputStream = XZOutputStream(FileOutputStream(zipFileName), lzma2Options)
|
val outputStream = XZOutputStream(FileOutputStream(zipFileName), lzma2Options)
|
||||||
val inputStream = FileInputStream(inputPath)
|
val inputStream = FileInputStream(inputPath)
|
||||||
val buf = ByteArray(8192)
|
val buf = ByteArray(4096)
|
||||||
var size: Int
|
var size: Int
|
||||||
while ((inputStream.read(buf).also { size = it }) != -1) outputStream.write(buf, 0, size)
|
while ((inputStream.read(buf).also { size = it }) != -1) outputStream.write(buf, 0, size)
|
||||||
outputStream.finish()
|
outputStream.finish()
|
||||||
sendAnalyticsEvent(ALFRED_X_ZIP_COMPRESSED_SUCCESS, mapOf("zipFileName" to zipFileName))
|
sendAnalyticsEvent(ALFRED_X_ZIP_COMPRESSED_SUCCESS, mapOf("zipFileName" to zipFileName))
|
||||||
return true
|
return true
|
||||||
|
} catch (e: OutOfMemoryError) {
|
||||||
|
sendAnalyticsEvent(
|
||||||
|
ALFRED_X_ZIP_COMPRESSED_FAILURE,
|
||||||
|
mapOf(
|
||||||
|
"exception" to "OutOfMemoryError",
|
||||||
|
"message" to (e.message ?: "Unknown OOM error"),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
return false
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
sendAnalyticsEvent(
|
sendAnalyticsEvent(
|
||||||
ALFRED_X_ZIP_COMPRESSED_FAILURE,
|
ALFRED_X_ZIP_COMPRESSED_FAILURE,
|
||||||
mapOf("exception" to e.message.toString()),
|
mapOf("exception" to e.message.toString()),
|
||||||
)
|
)
|
||||||
Log.e("GenerateZip", "Error compressing to 7z", e)
|
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import com.navi.alfred.db.dao.ZipDetailsDao
|
|||||||
import com.navi.alfred.db.model.ZipDetailsHelper
|
import com.navi.alfred.db.model.ZipDetailsHelper
|
||||||
import com.navi.alfred.network.AlfredNetworkRepository
|
import com.navi.alfred.network.AlfredNetworkRepository
|
||||||
import com.navi.alfred.utils.AlfredConstants
|
import com.navi.alfred.utils.AlfredConstants
|
||||||
|
import com.navi.alfred.utils.AlfredConstants.ALFRED_SESSION_ID
|
||||||
import com.navi.alfred.utils.AlfredConstants.FILE_TYPE_XZ
|
import com.navi.alfred.utils.AlfredConstants.FILE_TYPE_XZ
|
||||||
import com.navi.alfred.utils.AlfredConstants.FILE_TYPE_ZIP
|
import com.navi.alfred.utils.AlfredConstants.FILE_TYPE_ZIP
|
||||||
import com.navi.alfred.utils.AnalyticsConstants.ALFRED_GET_PRE_SIGNED_URL_CALLED
|
import com.navi.alfred.utils.AnalyticsConstants.ALFRED_GET_PRE_SIGNED_URL_CALLED
|
||||||
@@ -45,6 +46,8 @@ class UploadZipUseCase(
|
|||||||
mapOf(
|
mapOf(
|
||||||
"zipFileName" to zipFileDetail.zipFolderName,
|
"zipFileName" to zipFileDetail.zipFolderName,
|
||||||
"fileTypeExtension" to zipFileDetail.fileTypeExtension,
|
"fileTypeExtension" to zipFileDetail.fileTypeExtension,
|
||||||
|
"source" to zipFileDetail.source,
|
||||||
|
ALFRED_SESSION_ID to zipFileDetail.alfredSessionId,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -64,6 +67,8 @@ class UploadZipUseCase(
|
|||||||
"fileTypeExtension" to zipFileDetail.fileTypeExtension,
|
"fileTypeExtension" to zipFileDetail.fileTypeExtension,
|
||||||
"response_code" to preSignedUrl.code().toString(),
|
"response_code" to preSignedUrl.code().toString(),
|
||||||
"response_message" to preSignedUrl.message(),
|
"response_message" to preSignedUrl.message(),
|
||||||
|
"source" to zipFileDetail.source,
|
||||||
|
ALFRED_SESSION_ID to zipFileDetail.alfredSessionId,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -89,6 +94,8 @@ class UploadZipUseCase(
|
|||||||
mapOf(
|
mapOf(
|
||||||
"zipFileName" to detail.zipFolderName,
|
"zipFileName" to detail.zipFolderName,
|
||||||
"fileTypeExtension" to detail.fileTypeExtension,
|
"fileTypeExtension" to detail.fileTypeExtension,
|
||||||
|
"source" to detail.source,
|
||||||
|
ALFRED_SESSION_ID to detail.alfredSessionId,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -101,6 +108,8 @@ class UploadZipUseCase(
|
|||||||
"fileTypeExtension" to detail.fileTypeExtension,
|
"fileTypeExtension" to detail.fileTypeExtension,
|
||||||
"response_code" to resp.code().toString(),
|
"response_code" to resp.code().toString(),
|
||||||
"response_message" to resp.message(),
|
"response_message" to resp.message(),
|
||||||
|
"source" to detail.source,
|
||||||
|
ALFRED_SESSION_ID to detail.alfredSessionId,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
if (!resp.isSuccessful) return
|
if (!resp.isSuccessful) return
|
||||||
|
|||||||
@@ -12,6 +12,8 @@ object AnalyticsConstants {
|
|||||||
const val ALFRED_INIT = "ALFRED_INIT"
|
const val ALFRED_INIT = "ALFRED_INIT"
|
||||||
const val ALFRED_START_RECORDING = "START_RECORDING"
|
const val ALFRED_START_RECORDING = "START_RECORDING"
|
||||||
const val ALFRED_STOP_RECORDING = "STOP_RECORDING"
|
const val ALFRED_STOP_RECORDING = "STOP_RECORDING"
|
||||||
|
const val ALFRED_DELETE_FOLDER_CALLED = "ALFRED_DELETE_FOLDER_CALLED"
|
||||||
|
const val ALFRED_CLEAR_CORRUPT_FOLDER = "ALFRED_CLEAR_CORRUPT_FOLDER"
|
||||||
const val ALFRED_CRUISE_CALLED = "CRUISE_CALLED"
|
const val ALFRED_CRUISE_CALLED = "CRUISE_CALLED"
|
||||||
const val ALFRED_INIT_RECORDING_SETUP_COMPLETE = "INIT_RECORDING_SETUP_COMPLETE"
|
const val ALFRED_INIT_RECORDING_SETUP_COMPLETE = "INIT_RECORDING_SETUP_COMPLETE"
|
||||||
const val ALFRED_UPLOAD_FILE_WORKER_SCREENSHOT_SIZE = "UPLOAD_FILE_WORKER_SCREENSHOT_SIZE"
|
const val ALFRED_UPLOAD_FILE_WORKER_SCREENSHOT_SIZE = "UPLOAD_FILE_WORKER_SCREENSHOT_SIZE"
|
||||||
|
|||||||
@@ -34,7 +34,9 @@ fun recordException(e: Throwable) {
|
|||||||
|
|
||||||
internal fun sendAnalyticsEvent(eventName: String, eventAttributes: Map<String, String>? = null) {
|
internal fun sendAnalyticsEvent(eventName: String, eventAttributes: Map<String, String>? = null) {
|
||||||
val attribute = eventAttributes?.toMutableMap() ?: mutableMapOf()
|
val attribute = eventAttributes?.toMutableMap() ?: mutableMapOf()
|
||||||
attribute[ALFRED_SESSION_ID] = AlfredManager.sessionConfig.alfredSessionId
|
if (attribute[ALFRED_SESSION_ID].isNullOrEmpty()) {
|
||||||
|
attribute[ALFRED_SESSION_ID] = AlfredManager.sessionConfig.alfredSessionId
|
||||||
|
}
|
||||||
AlfredAnalyticsManager.getAlfredAnalyticsProvider()
|
AlfredAnalyticsManager.getAlfredAnalyticsProvider()
|
||||||
?.sendEvent(eventName = "ALFRED_$eventName", eventAttributes = attribute)
|
?.sendEvent(eventName = "ALFRED_$eventName", eventAttributes = attribute)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ import com.navi.alfred.model.EventAttribute
|
|||||||
import com.navi.alfred.model.SessionEventAttribute
|
import com.navi.alfred.model.SessionEventAttribute
|
||||||
import com.navi.alfred.model.SessionRequest
|
import com.navi.alfred.model.SessionRequest
|
||||||
import com.navi.alfred.model.UploadSource
|
import com.navi.alfred.model.UploadSource
|
||||||
|
import com.navi.alfred.utils.AlfredConstants.ALFRED_SESSION_ID
|
||||||
import com.navi.alfred.utils.AlfredConstants.DEFAULT_SEND_SESSION_POST_URL
|
import com.navi.alfred.utils.AlfredConstants.DEFAULT_SEND_SESSION_POST_URL
|
||||||
import com.navi.alfred.utils.AlfredConstants.EMPTY
|
import com.navi.alfred.utils.AlfredConstants.EMPTY
|
||||||
import com.navi.alfred.utils.AnalyticsConstants.ALFRED_INGEST_SESSION_CALLED
|
import com.navi.alfred.utils.AnalyticsConstants.ALFRED_INGEST_SESSION_CALLED
|
||||||
@@ -133,6 +134,8 @@ internal fun sendAlfredSessionEvent(zipFileDetails: ZipDetailsHelper) {
|
|||||||
mapOf(
|
mapOf(
|
||||||
"zipFileName" to zipFileDetails.zipFolderName,
|
"zipFileName" to zipFileDetails.zipFolderName,
|
||||||
"fileTypeExtension" to zipFileDetails.fileTypeExtension,
|
"fileTypeExtension" to zipFileDetails.fileTypeExtension,
|
||||||
|
"source" to zipFileDetails.source,
|
||||||
|
ALFRED_SESSION_ID to zipFileDetails.alfredSessionId,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -151,6 +154,8 @@ internal fun sendAlfredSessionEvent(zipFileDetails: ZipDetailsHelper) {
|
|||||||
"fileTypeExtension" to zipFileDetails.fileTypeExtension,
|
"fileTypeExtension" to zipFileDetails.fileTypeExtension,
|
||||||
"response_code" to response.code().toString(),
|
"response_code" to response.code().toString(),
|
||||||
"response_message" to response.message(),
|
"response_message" to response.message(),
|
||||||
|
"source" to zipFileDetails.source,
|
||||||
|
ALFRED_SESSION_ID to zipFileDetails.alfredSessionId,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
if (response.isSuccessful && response.code() == AlfredConstants.CODE_API_SUCCESS) {
|
if (response.isSuccessful && response.code() == AlfredConstants.CODE_API_SUCCESS) {
|
||||||
|
|||||||
@@ -12,6 +12,8 @@ import androidx.core.content.edit
|
|||||||
import com.navi.alfred.core.AlfredManager
|
import com.navi.alfred.core.AlfredManager
|
||||||
import com.navi.alfred.utils.AlfredConstants.PREFS_NAME
|
import com.navi.alfred.utils.AlfredConstants.PREFS_NAME
|
||||||
import com.navi.alfred.utils.AlfredConstants.PREF_KEY_CLEANUP_DONE
|
import com.navi.alfred.utils.AlfredConstants.PREF_KEY_CLEANUP_DONE
|
||||||
|
import com.navi.alfred.utils.AnalyticsConstants.ALFRED_CLEAR_CORRUPT_FOLDER
|
||||||
|
import com.navi.alfred.utils.AnalyticsConstants.ALFRED_DELETE_FOLDER_CALLED
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
internal fun deleteFolderIfEmpty(folderName: String) {
|
internal fun deleteFolderIfEmpty(folderName: String) {
|
||||||
@@ -19,6 +21,10 @@ internal fun deleteFolderIfEmpty(folderName: String) {
|
|||||||
if (folder.exists() && folder.isDirectory && folder.list()?.isEmpty() == true) {
|
if (folder.exists() && folder.isDirectory && folder.list()?.isEmpty() == true) {
|
||||||
folder.delete()
|
folder.delete()
|
||||||
}
|
}
|
||||||
|
sendAnalyticsEvent(
|
||||||
|
eventName = ALFRED_DELETE_FOLDER_CALLED,
|
||||||
|
eventAttributes = mapOf("folderName" to folderName),
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
internal fun cleanUpCorruptFilesIfNeeded() {
|
internal fun cleanUpCorruptFilesIfNeeded() {
|
||||||
@@ -47,7 +53,10 @@ internal fun cleanUpCorruptAlfredSessions() {
|
|||||||
file.name.endsWith(AlfredConstants.ALFRED_ZIP_IDENTIFIER) ||
|
file.name.endsWith(AlfredConstants.ALFRED_ZIP_IDENTIFIER) ||
|
||||||
file.name.endsWith(AlfredConstants.TEMP_ZIP_FILE_SUFFIX))
|
file.name.endsWith(AlfredConstants.TEMP_ZIP_FILE_SUFFIX))
|
||||||
}
|
}
|
||||||
|
sendAnalyticsEvent(
|
||||||
|
ALFRED_CLEAR_CORRUPT_FOLDER,
|
||||||
|
mapOf("fileSize" to (files?.size ?: 0).toString()),
|
||||||
|
)
|
||||||
files?.forEach { file ->
|
files?.forEach { file ->
|
||||||
if (file.exists()) {
|
if (file.exists()) {
|
||||||
file.delete()
|
file.delete()
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import com.navi.alfred.core.AlfredManager
|
|||||||
import com.navi.alfred.db.model.ZipDetailsHelper
|
import com.navi.alfred.db.model.ZipDetailsHelper
|
||||||
import com.navi.alfred.model.UploadSource
|
import com.navi.alfred.model.UploadSource
|
||||||
import com.navi.alfred.sevenzutils.compressTo7z
|
import com.navi.alfred.sevenzutils.compressTo7z
|
||||||
|
import com.navi.alfred.utils.AlfredConstants.ALFRED_SESSION_ID
|
||||||
import com.navi.alfred.utils.AnalyticsConstants.ALFRED_ZIP_CREATION_FAILED
|
import com.navi.alfred.utils.AnalyticsConstants.ALFRED_ZIP_CREATION_FAILED
|
||||||
import com.navi.alfred.utils.AnalyticsConstants.ALFRED_ZIP_CREATION_SUCCESS
|
import com.navi.alfred.utils.AnalyticsConstants.ALFRED_ZIP_CREATION_SUCCESS
|
||||||
import com.navi.alfred.utils.AnalyticsConstants.ALFRED_ZIP_INITIATED
|
import com.navi.alfred.utils.AnalyticsConstants.ALFRED_ZIP_INITIATED
|
||||||
@@ -48,7 +49,6 @@ internal fun toZip(
|
|||||||
)
|
)
|
||||||
|
|
||||||
if (zip(fileList, zipFilePath, AlfredManager.config.zipFileTypeExtension) == true) {
|
if (zip(fileList, zipFilePath, AlfredManager.config.zipFileTypeExtension) == true) {
|
||||||
|
|
||||||
sendAnalyticsEvent(
|
sendAnalyticsEvent(
|
||||||
eventName = ALFRED_ZIP_CREATION_SUCCESS,
|
eventName = ALFRED_ZIP_CREATION_SUCCESS,
|
||||||
eventAttributes =
|
eventAttributes =
|
||||||
@@ -66,8 +66,8 @@ internal fun toZip(
|
|||||||
zipFolderName = zipFolderName,
|
zipFolderName = zipFolderName,
|
||||||
fileTypeExtension = AlfredManager.config.zipFileTypeExtension,
|
fileTypeExtension = AlfredManager.config.zipFileTypeExtension,
|
||||||
)
|
)
|
||||||
deleteScreenshotsInZipFolder(sessionFolderName, zipFolderName)
|
|
||||||
}
|
}
|
||||||
|
deleteScreenshotsInZipFolder(sessionFolderName, zipFolderName)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -92,6 +92,7 @@ internal fun toZipForWorkManager(
|
|||||||
"zipFilePath" to zipFilePath,
|
"zipFilePath" to zipFilePath,
|
||||||
"fileTypeExtension" to zipFileTypeExtension,
|
"fileTypeExtension" to zipFileTypeExtension,
|
||||||
"fileCount" to fileList.size.toString(),
|
"fileCount" to fileList.size.toString(),
|
||||||
|
ALFRED_SESSION_ID to sessionFolderName,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
if (zip(fileList, zipFilePath, zipFileTypeExtension) == true) {
|
if (zip(fileList, zipFilePath, zipFileTypeExtension) == true) {
|
||||||
@@ -101,6 +102,7 @@ internal fun toZipForWorkManager(
|
|||||||
mapOf(
|
mapOf(
|
||||||
"zipFilePath" to zipFilePath,
|
"zipFilePath" to zipFilePath,
|
||||||
"fileTypeExtension" to AlfredManager.config.zipFileTypeExtension,
|
"fileTypeExtension" to AlfredManager.config.zipFileTypeExtension,
|
||||||
|
ALFRED_SESSION_ID to sessionFolderName,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
insertZipDetailsToDbForUpload(
|
insertZipDetailsToDbForUpload(
|
||||||
@@ -112,8 +114,8 @@ internal fun toZipForWorkManager(
|
|||||||
fileTypeExtension = zipFileTypeExtension,
|
fileTypeExtension = zipFileTypeExtension,
|
||||||
source = UploadSource.WORKER,
|
source = UploadSource.WORKER,
|
||||||
)
|
)
|
||||||
deleteScreenshotsInZipFolder(sessionFolderName, zipFolderName)
|
|
||||||
}
|
}
|
||||||
|
deleteScreenshotsInZipFolder(sessionFolderName, zipFolderName)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -121,7 +123,7 @@ internal fun zip(files: List<String>, zipFilePath: String?, fileTypeExtension: S
|
|||||||
if (zipFilePath == null) {
|
if (zipFilePath == null) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
val buffer = 8192
|
val buffer = 4096
|
||||||
val tempZipFilePath =
|
val tempZipFilePath =
|
||||||
if (fileTypeExtension == AlfredConstants.XZ_FILE_EXTENSION) {
|
if (fileTypeExtension == AlfredConstants.XZ_FILE_EXTENSION) {
|
||||||
zipFilePath + "_zip"
|
zipFilePath + "_zip"
|
||||||
@@ -169,9 +171,26 @@ internal fun zip(files: List<String>, zipFilePath: String?, fileTypeExtension: S
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (fileTypeExtension == AlfredConstants.XZ_FILE_EXTENSION) {
|
if (fileTypeExtension == AlfredConstants.XZ_FILE_EXTENSION) {
|
||||||
if (compressTo7z(zipFilePath)) {
|
try {
|
||||||
File(tempZipFilePath).delete()
|
if (compressTo7z(zipFilePath)) {
|
||||||
return true
|
File(tempZipFilePath).delete()
|
||||||
|
return true
|
||||||
|
} else {
|
||||||
|
File(tempZipFilePath).delete()
|
||||||
|
sendAnalyticsEvent(
|
||||||
|
ALFRED_ZIP_CREATION_FAILED,
|
||||||
|
mapOf(
|
||||||
|
"zipFilePath" to zipFilePath,
|
||||||
|
"fileTypeExtension" to fileTypeExtension,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
} catch (e: Exception) {
|
||||||
|
sendAnalyticsEvent(
|
||||||
|
"ALFRED_FALLBACK_TO_ZIP_EXCEPTION",
|
||||||
|
mapOf("error" to e.message.toString(), "zipFilePath" to zipFilePath),
|
||||||
|
)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return true
|
return true
|
||||||
|
|||||||
Reference in New Issue
Block a user