TP-12345 | Refactor | Publishing | Spotless (#152)
This commit is contained in:
@@ -1,3 +1,10 @@
|
||||
/*
|
||||
*
|
||||
* * Copyright © 2024 by Navi Technologies Limited
|
||||
* * All rights reserved. Strictly confidential
|
||||
*
|
||||
*/
|
||||
|
||||
package com.navi.alfred.network
|
||||
|
||||
object AlfredApiLogsManager {
|
||||
@@ -14,4 +21,4 @@ object AlfredApiLogsManager {
|
||||
null
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
/*
|
||||
*
|
||||
* * Copyright © 2024 by Navi Technologies Limited
|
||||
* * All rights reserved. Strictly confidential
|
||||
*
|
||||
*/
|
||||
|
||||
package com.navi.alfred.network
|
||||
|
||||
import okhttp3.Request
|
||||
@@ -5,4 +12,4 @@ import okhttp3.Response
|
||||
|
||||
interface AlfredApiLogsProvider {
|
||||
fun sendApiLog(request: Request, response: Response)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,7 +68,8 @@ object AlfredFailureRetrofitProvider {
|
||||
.message(errorMessage.message.orEmpty())
|
||||
.build()
|
||||
}
|
||||
AlfredApiLogsManager.getAlfredApiLogsProvider()?.sendApiLog(request = request, response = response)
|
||||
AlfredApiLogsManager.getAlfredApiLogsProvider()
|
||||
?.sendApiLog(request = request, response = response)
|
||||
response
|
||||
}
|
||||
|
||||
|
||||
@@ -78,7 +78,8 @@ object AlfredRetrofitProvider {
|
||||
.message(errorMessage.message.orEmpty())
|
||||
.build()
|
||||
}
|
||||
AlfredApiLogsManager.getAlfredApiLogsProvider()?.sendApiLog(request = request, response = response)
|
||||
AlfredApiLogsManager.getAlfredApiLogsProvider()
|
||||
?.sendApiLog(request = request, response = response)
|
||||
response
|
||||
}
|
||||
|
||||
|
||||
@@ -51,10 +51,10 @@ internal suspend fun getCruiseConfig(cruiseApiSuccessful: (response: CruiseRespo
|
||||
AlfredConstants.DEFAULT_SEND_FAILURE_POST_URL,
|
||||
AlfredManager.config.getApiKey(),
|
||||
failureRequest =
|
||||
FailureRequest(
|
||||
failureAttributes = FailureAttributes(),
|
||||
events = listOf(cruiseFailure)
|
||||
)
|
||||
FailureRequest(
|
||||
failureAttributes = FailureAttributes(),
|
||||
events = listOf(cruiseFailure)
|
||||
)
|
||||
)
|
||||
} catch (e: Exception) {
|
||||
e.log()
|
||||
|
||||
@@ -282,7 +282,7 @@ internal suspend fun sendFailureEventsToServer(workManagerFlow: Boolean? = false
|
||||
(response.isSuccessful &&
|
||||
response.code() == AlfredConstants.CODE_API_SUCCESS) or
|
||||
(response.code() == AlfredConstants.CODE_API_BAD_REQUEST) or
|
||||
(isNoInternetResponse(response.code()))
|
||||
(isNoInternetResponse(response.code()))
|
||||
) {
|
||||
AlfredManager.failureEventDao.deleteFailureEvents(
|
||||
failureEvents.map { it.eventId }
|
||||
@@ -408,7 +408,8 @@ internal fun sendAlfredSessionEvent(
|
||||
errorType = API_ERROR,
|
||||
requestUrl = DEFAULT_SEND_SESSION_POST_URL,
|
||||
requestMethod = POST_METHOD,
|
||||
zipName = request.session_upload_event_attributes.eventId?.let { listOf(it) },
|
||||
zipName =
|
||||
request.session_upload_event_attributes.eventId?.let { listOf(it) },
|
||||
errorStatusCode = response.code().toLong(),
|
||||
errorMessage = response.message(),
|
||||
errorName = INGEST_SESSION_FAILURE,
|
||||
|
||||
@@ -43,7 +43,8 @@ internal fun handleException(e: Throwable): ErrorMessage {
|
||||
internal fun isNetworkAvailable(): Boolean {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
val connectivityManager =
|
||||
AlfredManager.applicationContext.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager
|
||||
AlfredManager.applicationContext.getSystemService(Context.CONNECTIVITY_SERVICE)
|
||||
as ConnectivityManager
|
||||
val network = connectivityManager.activeNetwork ?: return false
|
||||
val activeNetwork = connectivityManager.getNetworkCapabilities(network) ?: return false
|
||||
return when {
|
||||
@@ -53,7 +54,8 @@ internal fun isNetworkAvailable(): Boolean {
|
||||
}
|
||||
} else {
|
||||
val connectivityManager =
|
||||
AlfredManager.applicationContext.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager
|
||||
AlfredManager.applicationContext.getSystemService(Context.CONNECTIVITY_SERVICE)
|
||||
as ConnectivityManager
|
||||
val networkInfo = connectivityManager.activeNetworkInfo
|
||||
return networkInfo != null && networkInfo.isConnected
|
||||
}
|
||||
|
||||
@@ -212,10 +212,7 @@ internal suspend fun captureScreen(
|
||||
} else {
|
||||
if (rootView != null) {
|
||||
withContext(Dispatchers.Main) {
|
||||
captureComposeViewWithMasking(
|
||||
canvas,
|
||||
rootView
|
||||
)
|
||||
captureComposeViewWithMasking(canvas, rootView)
|
||||
}
|
||||
} else {
|
||||
withContext(Dispatchers.Main) { v.draw(canvas) }
|
||||
@@ -319,14 +316,10 @@ internal suspend fun captureBottomSheet(
|
||||
}
|
||||
}
|
||||
|
||||
internal fun captureComposeViewWithMasking(
|
||||
canvas: Canvas,
|
||||
rootView: View
|
||||
) {
|
||||
internal fun captureComposeViewWithMasking(canvas: Canvas, rootView: View) {
|
||||
rootView.draw(canvas)
|
||||
|
||||
val sensitiveCoordinates =
|
||||
AlfredManager.sensitiveComposeRepository.sensitiveCoordinates
|
||||
val sensitiveCoordinates = AlfredManager.sensitiveComposeRepository.sensitiveCoordinates
|
||||
|
||||
val paint = Paint()
|
||||
paint.color = Color.BLACK
|
||||
|
||||
Reference in New Issue
Block a user