Skip to content

[androidChatExample] Updated android example to consume SDK #239

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

mrajatttt
Copy link
Contributor

@mrajatttt mrajatttt commented Oct 18, 2024

Issue #, if available:

Description of changes:

Updating android chat example with latest example from SDK project, here

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@mrajatttt mrajatttt requested a review from a team as a code owner October 18, 2024 22:15
@mrajatttt mrajatttt requested review from psravankumarreddy, doreechi and mliao95 and removed request for a team October 18, 2024 22:15
@mrajatttt mrajatttt requested review from haomingli2020 and removed request for psravankumarreddy and doreechi October 18, 2024 22:30
haomingli2020
haomingli2020 previously approved these changes Oct 21, 2024
@spenlep-amzn spenlep-amzn changed the title Updated android chat example to consume SDK [androidChatExample] Updated android chat example to consume SDK May 23, 2025
@@ -0,0 +1,4 @@
// Learn more https://docs.expo.io/guides/customizing-metro
const { getDefaultConfig } = require('expo/metro-config');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Recommendation generated by Amazon CodeGuru Reviewer. Leave feedback on this recommendation by replying to the comment or by reacting to the comment using emoji.

We detected that you are importing a module inside a function, which is known as lazy loading. If modules are imported within a function, it might prevent other requests from being handled at a more critical time. We recommend that you load all modules at the beginning of each file, before and outside of any functions.

}

// Upload a selected attachment to the chat session
fun uploadAttachment(fileUri: Uri) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Recommendation generated by Amazon CodeGuru Reviewer. Leave feedback on this recommendation by replying to the comment or by reacting to the comment using emoji.

There is a lack of authentication on critical function. If an application fails to verify authentication before allowing access to sensitive functions or data it can lead to unauthorized users performing critical operations or accessing confidential information. To mitigate this, ensure critical functions are protected by authentication and authorization checks like usage of @PreAuthorize(...) or @secured(...) annotations. Use role-based access control (RBAC) to restrict sensitive actions to authorized users, and implement proper security mechanisms to verify identity before allowing such actions. Learn more https://cwe.mitre.org/data/definitions/306.html


@Singleton
@Provides
fun providesUserApi(): ApiInterface {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Recommendation generated by Amazon CodeGuru Reviewer. Leave feedback on this recommendation by replying to the comment or by reacting to the comment using emoji.

There is a lack of authentication on critical function. If an application fails to verify authentication before allowing access to sensitive functions or data it can lead to unauthorized users performing critical operations or accessing confidential information. To mitigate this, ensure critical functions are protected by authentication and authorization checks like usage of @PreAuthorize(...) or @secured(...) annotations. Use role-based access control (RBAC) to restrict sensitive actions to authorized users, and implement proper security mechanisms to verify identity before allowing such actions. Learn more https://cwe.mitre.org/data/definitions/306.html


@HiltAndroidApp
class ChatApplication: Application() {
override fun onCreate() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Recommendation generated by Amazon CodeGuru Reviewer. Leave feedback on this recommendation by replying to the comment or by reacting to the comment using emoji.

There is a lack of authentication on critical function. If an application fails to verify authentication before allowing access to sensitive functions or data it can lead to unauthorized users performing critical operations or accessing confidential information. To mitigate this, ensure critical functions are protected by authentication and authorization checks like usage of @PreAuthorize(...) or @secured(...) annotations. Use role-based access control (RBAC) to restrict sensitive actions to authorized users, and implement proper security mechanisms to verify identity before allowing such actions. Learn more https://cwe.mitre.org/data/definitions/306.html

}

// Create a connection to the participant chat session
private fun createParticipantConnection(chatDetails: ChatDetails) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Recommendation generated by Amazon CodeGuru Reviewer. Leave feedback on this recommendation by replying to the comment or by reacting to the comment using emoji.

There is a lack of authentication on critical function. If an application fails to verify authentication before allowing access to sensitive functions or data it can lead to unauthorized users performing critical operations or accessing confidential information. To mitigate this, ensure critical functions are protected by authentication and authorization checks like usage of @PreAuthorize(...) or @secured(...) annotations. Use role-based access control (RBAC) to restrict sensitive actions to authorized users, and implement proper security mechanisms to verify identity before allowing such actions. Learn more https://cwe.mitre.org/data/definitions/306.html

}

// Update the transcript when new messages or events are received
private fun onUpdateTranscript(transcriptList: List<TranscriptItem>) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Recommendation generated by Amazon CodeGuru Reviewer. Leave feedback on this recommendation by replying to the comment or by reacting to the comment using emoji.

There is a lack of authentication on critical function. If an application fails to verify authentication before allowing access to sensitive functions or data it can lead to unauthorized users performing critical operations or accessing confidential information. To mitigate this, ensure critical functions are protected by authentication and authorization checks like usage of @PreAuthorize(...) or @secured(...) annotations. Use role-based access control (RBAC) to restrict sensitive actions to authorized users, and implement proper security mechanisms to verify identity before allowing such actions. Learn more https://cwe.mitre.org/data/definitions/306.html

class MainActivity : ComponentActivity() {
private lateinit var chatViewModel: ChatViewModel

override fun onCreate(savedInstanceState: Bundle?) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Recommendation generated by Amazon CodeGuru Reviewer. Leave feedback on this recommendation by replying to the comment or by reacting to the comment using emoji.

There is a lack of authentication on critical function. If an application fails to verify authentication before allowing access to sensitive functions or data it can lead to unauthorized users performing critical operations or accessing confidential information. To mitigate this, ensure critical functions are protected by authentication and authorization checks like usage of @PreAuthorize(...) or @secured(...) annotations. Use role-based access control (RBAC) to restrict sensitive actions to authorized users, and implement proper security mechanisms to verify identity before allowing such actions. Learn more https://cwe.mitre.org/data/definitions/306.html

@spenlep-amzn spenlep-amzn changed the title [androidChatExample] Updated android chat example to consume SDK [androidChatExample] Updated android example to consume SDK May 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants