Skip to content

Commit

Permalink
Merge pull request #6 from amazon-connect/mikeliao/websocket-heartbeat
Browse files Browse the repository at this point in the history
Implementing WebSocketManager retry, NetworkConnectionManager and HeartbeatManager
  • Loading branch information
mliao95 authored Aug 9, 2024
2 parents c55d815 + 316f7b5 commit f81fe44
Show file tree
Hide file tree
Showing 23 changed files with 513 additions and 271 deletions.
1 change: 1 addition & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET"/>
<application
android:name=".ChatApplication"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ package com.amazon.connect.chat.androidchatexample
import com.amazonaws.regions.Regions

object Config {
val connectInstanceId: String = "6ceda8ca-5e6e-4a60-9bfb-4994cc1fec79"
val contactFlowId: String = "c8d90d07-a28c-4a97-9dfb-f4785b98d8d2"
val startChatEndpoint: String = "https://3r4nj9r68b.execute-api.us-east-1.amazonaws.com/"
val region: Regions = Regions.US_EAST_1
val connectInstanceId: String = "e816d0f3-eda3-46e4-bc67-9999e621eff6"
val contactFlowId: String = "f22bfa3b-400e-4250-939d-90a79eb1cd24"
val startChatEndpoint: String = "https://bqo00ujzld.execute-api.us-west-2.amazonaws.com/"
val region: Regions = Regions.US_WEST_2
val agentName = "AGENT"
val customerName = "CUSTOMER"
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,13 @@ import androidx.compose.ui.graphics.Color
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.hilt.navigation.compose.hiltViewModel
import com.amazon.connect.chat.androidchatexample.models.Message
import com.amazon.connect.chat.androidchatexample.models.MessageType
import com.amazon.connect.chat.androidchatexample.ui.theme.androidconnectchatandroidTheme
import com.amazon.connect.chat.androidchatexample.utils.CommonUtils.Companion.keyboardAsState
import com.amazon.connect.chat.androidchatexample.utils.ContentType
import com.amazon.connect.chat.sdk.model.Message
import com.amazon.connect.chat.sdk.model.MessageType
import com.amazon.connect.chat.sdk.utils.CommonUtils.Companion.keyboardAsState
import com.amazon.connect.chat.sdk.utils.ContentType
import com.amazon.connect.chat.androidchatexample.viewmodel.ChatViewModel
import com.amazon.connect.chat.androidchatexample.views.ChatMessageView
import com.amazon.connect.chat.androidchatexample.ui.theme.androidconnectchatandroidTheme
import com.amazon.connect.chat.sdk.GreetingFromSDK
import dagger.hilt.android.AndroidEntryPoint

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.amazon.connect.chat.androidchatexample.di

import android.content.Context
import android.content.SharedPreferences
import com.amazon.connect.chat.sdk.network.WebSocketManager
import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
Expand All @@ -18,4 +19,19 @@ object AppModule {
fun provideSharedPreferences(@ApplicationContext context: Context): SharedPreferences {
return context.getSharedPreferences("ConnectChat", Context.MODE_PRIVATE)
}

// // Provide the Context dependency
// @Provides
// @Singleton
// fun provideContext(@ApplicationContext appContext: Context): Context {
// return appContext
// }
//
// @Provides
// @Singleton
// fun provideWebSocketManager(
// context: Context,
// ): WebSocketManager {
// return WebSocketManager(context, {})
// }
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,20 @@ import com.amazonaws.services.connectparticipant.model.CreateParticipantConnecti
import com.amazonaws.services.connectparticipant.model.CreateParticipantConnectionResult
import com.amazonaws.services.connectparticipant.model.DisconnectParticipantRequest
import com.amazonaws.services.connectparticipant.model.GetTranscriptRequest
import com.amazonaws.services.connectparticipant.model.GetTranscriptResult
import com.amazonaws.services.connectparticipant.model.SendEventRequest
import com.amazonaws.services.connectparticipant.model.SendEventResult
import com.amazonaws.services.connectparticipant.model.SendMessageRequest
import com.amazonaws.services.connectparticipant.model.SendMessageResult
import com.amazon.connect.chat.androidchatexample.Config
import com.amazon.connect.chat.androidchatexample.models.MessageMetadata
import com.amazon.connect.chat.androidchatexample.models.Receipt
import com.amazon.connect.chat.sdk.model.MessageMetadata
import com.amazon.connect.chat.sdk.model.Receipt
import com.amazon.connect.chat.androidchatexample.models.StartChatRequest
import com.amazon.connect.chat.androidchatexample.models.StartChatResponse
import com.amazon.connect.chat.androidchatexample.models.TranscriptItem
import com.amazon.connect.chat.androidchatexample.models.TranscriptResponse
import com.amazon.connect.chat.sdk.model.TranscriptItem
import com.amazon.connect.chat.sdk.model.TranscriptResponse
import com.amazon.connect.chat.androidchatexample.network.ApiInterface
import com.amazon.connect.chat.androidchatexample.network.Resource
import com.amazon.connect.chat.androidchatexample.utils.ContentType
import com.amazon.connect.chat.sdk.utils.ContentType
import dagger.hilt.android.scopes.ActivityScoped
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext
Expand Down

This file was deleted.

Loading

0 comments on commit f81fe44

Please sign in to comment.