Skip to content

Commit

Permalink
Revert "fix(liveness): Liveness web socket expiration retry (#2615)"
Browse files Browse the repository at this point in the history
This reverts commit acdaa9e.
  • Loading branch information
gpanshu committed Nov 9, 2023
1 parent d3012b3 commit 67b117d
Show file tree
Hide file tree
Showing 22 changed files with 46 additions and 228 deletions.
2 changes: 1 addition & 1 deletion aws-analytics-pinpoint/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*/

plugins {
id("org.jetbrains.kotlin.plugin.serialization") version "1.9.10"
id("org.jetbrains.kotlin.plugin.serialization") version "1.6.10"
id("com.android.library")
id("kotlin-android")
}
Expand Down
2 changes: 1 addition & 1 deletion aws-auth-cognito/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*/

plugins {
id("org.jetbrains.kotlin.plugin.serialization") version "1.9.10"
id("org.jetbrains.kotlin.plugin.serialization") version "1.6.10"
id("com.android.library")
id("kotlin-android")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ package com.amplifyframework.auth.cognito
import aws.sdk.kotlin.runtime.http.operation.customUserAgentMetadata
import aws.sdk.kotlin.services.cognitoidentity.CognitoIdentityClient
import aws.sdk.kotlin.services.cognitoidentityprovider.CognitoIdentityProviderClient
import aws.sdk.kotlin.services.cognitoidentityprovider.endpoints.CognitoIdentityProviderEndpointProvider
import aws.smithy.kotlin.runtime.client.RequestInterceptorContext
import aws.smithy.kotlin.runtime.client.endpoints.Endpoint
import aws.smithy.kotlin.runtime.client.endpoints.EndpointProvider
import aws.smithy.kotlin.runtime.http.interceptors.HttpInterceptor
import com.amplifyframework.statemachine.codegen.data.AuthConfiguration

Expand All @@ -36,7 +36,7 @@ interface AWSCognitoAuthService {
CognitoIdentityProviderClient {
this.region = it.region
this.endpointProvider = it.endpoint?.let { endpoint ->
CognitoIdentityProviderEndpointProvider { Endpoint(endpoint) }
EndpointProvider { Endpoint(endpoint) }
}
this.interceptors += object : HttpInterceptor {
override suspend fun modifyBeforeSerialization(context: RequestInterceptorContext<Any>): Any {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,6 @@ class RealAWSCognitoAuthPluginTest {
authService.cognitoIdentityProviderClient?.getUser(any())
} returns GetUserResponse.invoke {
this.userAttributes = userAttributes
username = ""
}

every {
Expand Down Expand Up @@ -1807,8 +1806,6 @@ class RealAWSCognitoAuthPluginTest {
GetUserResponse.invoke {
userMfaSettingList = listOf("SMS_MFA", "SOFTWARE_TOKEN_MFA")
preferredMfaSetting = "SOFTWARE_TOKEN_MFA"
userAttributes = listOf()
username = ""
}
}
plugin.fetchMFAPreference(onSuccess, onError)
Expand Down Expand Up @@ -1845,8 +1842,6 @@ class RealAWSCognitoAuthPluginTest {
GetUserResponse.invoke {
userMfaSettingList = null
preferredMfaSetting = null
userAttributes = listOf()
username = ""
}
}
plugin.updateMFAPreference(MFAPreference.ENABLED, MFAPreference.PREFERRED, onSuccess, onError)
Expand Down Expand Up @@ -1892,8 +1887,6 @@ class RealAWSCognitoAuthPluginTest {
GetUserResponse.invoke {
userMfaSettingList = listOf("SMS_MFA", "SOFTWARE_TOKEN_MFA")
preferredMfaSetting = "SOFTWARE_TOKEN_MFA"
userAttributes = listOf()
username = ""
}
}

Expand Down Expand Up @@ -1944,8 +1937,6 @@ class RealAWSCognitoAuthPluginTest {
GetUserResponse.invoke {
userMfaSettingList = listOf("SMS_MFA", "SOFTWARE_TOKEN_MFA")
preferredMfaSetting = "SMS_MFA"
userAttributes = listOf()
username = ""
}
}

Expand Down Expand Up @@ -2049,8 +2040,6 @@ class RealAWSCognitoAuthPluginTest {
GetUserResponse.invoke {
userMfaSettingList = null
preferredMfaSetting = null
userAttributes = listOf()
username = ""
}
}

Expand Down Expand Up @@ -2101,8 +2090,6 @@ class RealAWSCognitoAuthPluginTest {
GetUserResponse.invoke {
userMfaSettingList = null
preferredMfaSetting = null
userAttributes = listOf()
username = ""
}
}

Expand Down Expand Up @@ -2153,8 +2140,6 @@ class RealAWSCognitoAuthPluginTest {
GetUserResponse.invoke {
userMfaSettingList = null
preferredMfaSetting = null
userAttributes = listOf()
username = ""
}
}

Expand Down Expand Up @@ -2205,8 +2190,6 @@ class RealAWSCognitoAuthPluginTest {
GetUserResponse.invoke {
userMfaSettingList = null
preferredMfaSetting = null
userAttributes = listOf()
username = ""
}
}

Expand Down Expand Up @@ -2257,8 +2240,6 @@ class RealAWSCognitoAuthPluginTest {
GetUserResponse.invoke {
userMfaSettingList = null
preferredMfaSetting = null
userAttributes = listOf()
username = ""
}
}

Expand Down Expand Up @@ -2309,8 +2290,6 @@ class RealAWSCognitoAuthPluginTest {
GetUserResponse.invoke {
userMfaSettingList = null
preferredMfaSetting = null
userAttributes = listOf()
username = ""
}
}

Expand Down Expand Up @@ -2361,8 +2340,6 @@ class RealAWSCognitoAuthPluginTest {
GetUserResponse.invoke {
userMfaSettingList = null
preferredMfaSetting = null
userAttributes = listOf()
username = ""
}
}

Expand Down Expand Up @@ -2413,8 +2390,6 @@ class RealAWSCognitoAuthPluginTest {
GetUserResponse.invoke {
userMfaSettingList = listOf("SOFTWARE_TOKEN_MFA")
preferredMfaSetting = "SOFTWARE_TOKEN_MFA"
userAttributes = listOf()
username = ""
}
}

Expand Down Expand Up @@ -2465,8 +2440,6 @@ class RealAWSCognitoAuthPluginTest {
GetUserResponse.invoke {
userMfaSettingList = listOf("SMS_MFA")
preferredMfaSetting = "SMS_MFA"
userAttributes = listOf()
username = ""
}
}

Expand Down Expand Up @@ -2517,8 +2490,6 @@ class RealAWSCognitoAuthPluginTest {
GetUserResponse.invoke {
userMfaSettingList = listOf("SMS_MFA")
preferredMfaSetting = "SMS_MFA"
userAttributes = listOf()
username = ""
}
}

Expand Down Expand Up @@ -2569,8 +2540,6 @@ class RealAWSCognitoAuthPluginTest {
GetUserResponse.invoke {
userMfaSettingList = listOf("SOFTWARE_TOKEN_MFA")
preferredMfaSetting = "SOFTWARE_TOKEN_MFA"
userAttributes = listOf()
username = ""
}
}

Expand Down Expand Up @@ -2621,8 +2590,6 @@ class RealAWSCognitoAuthPluginTest {
GetUserResponse.invoke {
userMfaSettingList = listOf("SMS_MFA")
preferredMfaSetting = "SMS_MFA"
userAttributes = listOf()
username = ""
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ class CognitoMockFactory(
this.userConfirmed = if (responseObject.containsKey("userConfirmed")) {
(responseObject["userConfirmed"] as? JsonPrimitive)?.boolean ?: false
} else false
this.userSub = ""
}
}
}
Expand Down Expand Up @@ -140,7 +139,6 @@ class CognitoMockFactory(
value = "000-000-0000"
}
)
username = ""
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,7 @@
"signUpStep": "DONE",
"additionalInfo": {
}
},
"userId": ""
}
}
}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,7 @@
"deliveryMedium": "EMAIL",
"attributeName": "attributeName"
}
},
"userId": ""
}
}
}
]
Expand Down
2 changes: 1 addition & 1 deletion aws-auth-plugins-core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*/

plugins {
id("org.jetbrains.kotlin.plugin.serialization") version "1.9.10"
id("org.jetbrains.kotlin.plugin.serialization") version "1.6.10"
id("com.android.library")
id("kotlin-android")
}
Expand Down
2 changes: 1 addition & 1 deletion aws-logging-cloudwatch/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*/

plugins {
id("org.jetbrains.kotlin.plugin.serialization") version "1.9.10"
id("org.jetbrains.kotlin.plugin.serialization") version "1.6.10"
id("com.android.library")
id("kotlin-android")
}
Expand Down
2 changes: 1 addition & 1 deletion aws-pinpoint-core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*/

plugins {
id("org.jetbrains.kotlin.plugin.serialization") version "1.9.10"
id("org.jetbrains.kotlin.plugin.serialization") version "1.6.10"
id("com.android.library")
id("kotlin-android")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ import com.amplifyframework.pinpoint.core.database.PinpointDatabase
import com.amplifyframework.pinpoint.core.endpointProfile.EndpointProfile
import com.amplifyframework.pinpoint.core.models.PinpointEvent
import com.amplifyframework.pinpoint.core.util.millisToIsoDate
import java.util.concurrent.atomic.AtomicBoolean
import kotlinx.coroutines.CoroutineDispatcher
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext
Expand All @@ -60,7 +59,7 @@ class EventRecorder(
AWS_PINPOINT_ANALYTICS_LOG_NAMESPACE.format(EventRecorder::class.java.simpleName)
)
) {
private var isSyncInProgress = AtomicBoolean(false)
private var isSyncInProgress = false
private val defaultMaxSubmissionAllowed = 3
private val defaultMaxSubmissionSize = 1024 * 100
private val serviceDefinedMaxEventsPerBatch: Int = 100
Expand All @@ -80,10 +79,12 @@ class EventRecorder(
}
}

@Synchronized
internal suspend fun submitEvents(): List<AnalyticsEvent> {
return withContext(coroutineDispatcher) {
val result = runCatching {
if (isSyncInProgress.compareAndSet(false, true)) {
if (!isSyncInProgress) {
isSyncInProgress = true
processEvents()
} else {
logger.info("Sync is already in progress, skipping")
Expand All @@ -92,11 +93,11 @@ class EventRecorder(
}
when {
result.isSuccess -> {
isSyncInProgress.set(false)
isSyncInProgress = false
result.getOrNull() ?: emptyList()
}
else -> {
isSyncInProgress.set(false)
isSyncInProgress = false
logger.error("Failed to submit events ${result.exceptionOrNull()}")
emptyList()
}
Expand Down
2 changes: 1 addition & 1 deletion aws-predictions/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*/

plugins {
id("org.jetbrains.kotlin.plugin.serialization") version "1.9.10"
id("org.jetbrains.kotlin.plugin.serialization") version "1.8.10"
id("com.android.library")
id("kotlin-android")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,6 @@ internal class AWSV4Signer {
timeFormatter.isLenient = false
}

// used in incorrect time flow where we send an invalid response first to get time offset
fun resetPriorSignature() {
priorSignature = ""
}

fun getSignedUri(
uri: URI,
credentials: Credentials,
Expand Down
Loading

0 comments on commit 67b117d

Please sign in to comment.