Skip to content
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

Feature/mob 3434 entry widget poc #1064

Draft
wants to merge 3 commits into
base: feature/entry-widget-and-secure-conversations-v2
Choose a base branch
from

Conversation

andrews-moc
Copy link
Contributor

@andrews-moc andrews-moc commented Aug 1, 2024

Project plan (draft)
Simplified way of using Glia Widgets SDK

Please have a look and share your early feedback. 🙏

What was implemented in this POC?

  • Entry Widget class with Bottom sheet (POC)
  • Entry Widget is created using constructor EntryWidget(Navigator)
  • Navigator object is responsible for starting engagement (chat, audio call, video call, messaging)
  • Navigator is obtained through GliaWidgets.getNavigator(queues, contextAssetId)
  • So, integrators will have to pass params to Navigator or explicitly pass null, and create EntryWidget using the Navigator
  • CallActivity becomes internal, CallActivity can now be started only through Navigator instead of Intent
  • At the moment POC is only for CallScreen

Screenshots:
Screenshot 2024-08-01 at 16 50 07
Screenshot 2024-08-01 at 16 50 33

@DavDo
Copy link
Collaborator

DavDo commented Aug 1, 2024

I think we can also simplify and remove a lot of stuff related to Activity creation and intents since this stuff becomes fully internal.

@andrews-moc
Copy link
Contributor Author

I think we can also simplify and remove a lot of stuff related to Activity creation and intents since this stuff becomes fully internal.

Yes, I will just need to go through that stuff and refactor.

@@ -326,6 +327,11 @@ public static CallVisualizer getCallVisualizer() {
return Dependencies.getCallVisualizerManager();
}

public static Navigator getNavigator(@Nullable ArrayList<String> queues,
@Nullable String contextAssetId) { // TODO: 01.08.2024 Wrap all params to some object? Ideally existing one, not new because there are to many config classes already.
Copy link
Contributor

Choose a reason for hiding this comment

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

contextAssetId is visitor context id?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, exactly.

@andrews-moc andrews-moc force-pushed the feature/MOB-3434-entry-widget-poc branch from 348f6b2 to 5007a98 Compare August 6, 2024 10:13
Copy link
Contributor

@igorkravchenko igorkravchenko left a comment

Choose a reason for hiding this comment

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

Overall looks good. Left some questions regarding alternative method to start interaction using enum.


private val gliaWidgetsConfig = Dependencies.getSdkConfigurationManager().createWidgetsConfiguration()

fun startToChat(context: Context) {
Copy link
Contributor

Choose a reason for hiding this comment

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

@andrews-moc @DavDo
While having dedicated method like startToChat, startAudioCall , startVideoCall , startSecureConversations is totally acceptable approach, an alternative way could be to have singe method someting like start(InteractionKind) where InteractionKind could enlist all possible kinds to start interaction.

In Swift it would be something like this:

enum InteractionKind {
case videoCall
case chat
case secureConversations
}

func start(interactionKind: InteractionKind, context: Context) { 
...

Having dedicated enum for all possible interactions seems more appealing to me, because we avoid having several very similar public method declarations.

Does it make sense?

cc: @EgorovEI @rasmustautsglia

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you for sharing this idea. It makes sense to me overall.

At the same time, I think that POC approach with separate functions has several advantages as well:

  • it's more readable and closer the the way we think about it in real life
  • anyway we would need separate functions, the difference is that with a single start(InteractionKind) method these methods would be private
  • although these functions have some common things, their implementation is different

I'm not against start(InteractionKind), let's hear other opinions.

Copy link
Collaborator

Choose a reason for hiding this comment

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

IMHO, this solution is not acceptable for this situation because I see a couple of issues.

  1. It is not enough flexible — in the case when some of the underlying methods (starting chat, video, or secure conversation) require additional parameters, we will have to deprecate this function and replace it with a new function/functions.
  2. It breaks the single responsibility principle - every InteractionKind type has its nature and will launch a completely different unit of our SDK, so it might be clearer if every single function was responsible only for starting one kind of interaction.
  3. With SC V2 we will have additional functionality inside each of these functions. This is to choose the right screen based on an ongoing SC + unread messages combination, so even if we repeat some functionality (that actually can be moved to some internal function), it is better to have separate functions to reduce complexity.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I would like to point out that the public access methods will be the main interaction point for integrators who will not be using the Entry Widget. So three defined functions seems less confusing even if I personally like the suggestion Igor proposed.

Copy link
Contributor

Choose a reason for hiding this comment

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

@DavDo

  1. In this case enum case will have associated required parameter so it's not a problem, at least in Swift. However if this is not possible in Kotlin, or will drastically differ, than it makes sense to use separate methods instead as it is now.
  2. Still enum with associated values allows singe entry point and we do not expand surface area for change/deprecation in future when all those methods will start to require additional parameters, so there would more to deprecate. I agree that it will grow complexity on the single method though.
  3. Agree totally.

I do not enforce the enum usage, especially because it may be problematic to have similar interface on both platforms. The goal is just to understand if it can bring some advantage. I'm fine with using separate methods.

Copy link
Collaborator

Choose a reason for hiding this comment

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

  1. It is also possible in Kotlin. I agree that this way we can avoid deprecation and make it more flexible.

Yes, I agree with @Pelkar. I like this kind of modern solution, but for public interfaces, I would prefer to have functions that are as straightforward as possible.

// Navigate to chat
}

fun startAudioCall(context: Context) {
Copy link
Collaborator

@DavDo DavDo Aug 6, 2024

Choose a reason for hiding this comment

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

@andrews-moc If I'm not mistaken, we can use application context from configuration properties, so most probably no need to explicitly pass it here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@DavDo I was not able to find a way to use it so far. Context is available for Glia core init only, as far as I see.

@andrews-moc andrews-moc force-pushed the feature/MOB-3434-entry-widget-poc branch from ed3b1d5 to d26bc68 Compare September 3, 2024 15:19
@andrews-moc andrews-moc changed the base branch from development to feature/entry-widget-and-secure-conversations-v2 September 3, 2024 15:23
@DavDo DavDo force-pushed the feature/entry-widget-and-secure-conversations-v2 branch from 167d8de to 94dee0f Compare September 15, 2024 19:27
- Bottom Sheet
- Navigator
- Start Call
@DavDo DavDo force-pushed the feature/MOB-3434-entry-widget-poc branch from d26bc68 to 9b93d0d Compare September 15, 2024 19:28
@gugalo gugalo removed their request for review September 30, 2024 08:56
@DavDo DavDo force-pushed the feature/entry-widget-and-secure-conversations-v2 branch from 206a8e8 to 76c6e8d Compare October 7, 2024 09:07
@DavDo DavDo force-pushed the feature/entry-widget-and-secure-conversations-v2 branch from 1e40530 to c0e2124 Compare October 18, 2024 10:01
@DavDo DavDo force-pushed the feature/entry-widget-and-secure-conversations-v2 branch from 8ae0b3e to c866c9d Compare November 1, 2024 11:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

5 participants