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

[Include to the next major release] Remove deprecated functions which are older than 1 year #890

Open
wants to merge 71 commits into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
71 commits
Select commit Hold shift + click to select a range
96a9115
Increment project version to 2.2.3
Nov 6, 2023
b1aea0e
Added retry message-sending logic
AndriiHorishniiMOC Oct 24, 2023
5f3e211
Make the error label support the Unified UI
AndriiHorishniiMOC Nov 6, 2023
0af1420
Fix - Sending image/file in SC is broken
DavDo Nov 10, 2023
377839f
Increment Core SDK version to 1.1.10
Nov 16, 2023
7b736b6
Send logs through Core SDK logger
andrews-moc Nov 1, 2023
ddc08ff
Log unified UI usage, log deprecated classes and functions usage
andrews-moc Nov 10, 2023
d8b79d1
Fixed chat head duplications and crash
Pelkar Nov 17, 2023
62be4eb
fixup! Fixed chat head duplications and crash
Pelkar Nov 20, 2023
66e2469
Send logs with important events
andrews-moc Nov 24, 2023
cd3dbfb
Unified stringProvider uninitialised errors and created a blocker for…
Pelkar Nov 27, 2023
d25bf54
Fix onHold handling
AndriiHorishniiMOC Dec 6, 2023
4a0bdc5
Create Live Observation Opt In Dialog
DavDo Sep 29, 2023
e2283c8
Show acknowledgment dialog before regular engagement
DavDo Oct 2, 2023
2661678
Show acknowledgment dialog for Call Visualizer engagement
DavDo Oct 3, 2023
a60f950
Resolve Rebase conflicts
DavDo Oct 11, 2023
dd911b8
Refactor Opt-in dialog strings to support Custom Locales
DavDo Oct 11, 2023
03f4e47
Add internal WIP Core SDK build with Live Observation
gugalo Oct 12, 2023
4336c76
Make acknowledgment dialog use site settings for CV engagements
gugalo Oct 16, 2023
af8c3b9
Make acknowledgment dialog use site settings for regular engagements
gugalo Oct 16, 2023
74b9c0a
Update the Core SDK dependency build to contain latest change
gugalo Oct 17, 2023
36f20e6
Rename acknowledgment/opt-in dialog into confirmation dialog
gugalo Oct 17, 2023
050c3f1
Add Unified UI Support for LO indicator
DavDo Oct 24, 2023
5824154
Create configurable SnackBar for LO indication
DavDo Oct 26, 2023
2c1f425
Show indication snackbar on LO start
DavDo Oct 30, 2023
1ffb1a6
Update Core SDK build with LO feature WIP
gugalo Nov 1, 2023
3b89e6d
Snapshot tests for LO SnackBar
DavDo Nov 1, 2023
5015ae2
Make confirmation dialog and LO toast message show by default
gugalo Nov 1, 2023
1ef283d
Update Core SDK version with Live Observation build that has LO WIP
gugalo Nov 3, 2023
58f8319
Update Core SDK version with Live Observation build that has LO WIP
gugalo Nov 10, 2023
46239e3
Refactor Dialogs to inflate views independently
DavDo Nov 7, 2023
ebe1b26
Remove Dialog-related business logic from the View layer
DavDo Nov 9, 2023
f63abae
Snapshot test for Alert Dialog
DavDo Nov 14, 2023
f2d84e9
Fix The dialog for screen sharing in the CV flow is not appearing
DavDo Nov 15, 2023
940a1f5
Fix The Overlay Dialog is Shown in the wrong activity for the CV flow
DavDo Nov 15, 2023
36c818c
Snapshot tests for operator ended engagement dialog
DavDo Nov 16, 2023
1f03372
Snapshot tests for screen sharing dialog
DavDo Nov 16, 2023
6051c1a
Snapshot tests for Options and Upgrade dialogs
DavDo Nov 16, 2023
1d75a2f
Fix broken dialog screens
DavDo Nov 20, 2023
f39d563
Update Core SDK dependency version with development branch build
gugalo Nov 22, 2023
bebd8ec
Mark authentication dialog as sensitive for observation
gugalo Nov 22, 2023
7d63a8f
Create pause and resume controls for LO in the testing app
DavDo Nov 24, 2023
69565a8
Add links support to the confirmation dialog
AndriiHorishniiMOC Nov 23, 2023
cb21543
Added WebView Activity for opening confirmation dialog button links
AndriiHorishniiMOC Nov 24, 2023
a1b3a4b
Added unit tests for confirmation dialog
AndriiHorishniiMOC Nov 28, 2023
60db13d
Added snapshot tests for confirmation alert with link buttons
AndriiHorishniiMOC Nov 30, 2023
723ea7a
Made confirmation dialog according to the design
AndriiHorishniiMOC Dec 6, 2023
9d0a670
Update Core SDK dependency to latest development build
gugalo Dec 8, 2023
cf7a952
Add a contributing file (#861)
sliiser Dec 12, 2023
81a6755
Correct typo in 'Show Upgrade 1WayVideo Dialog' log message
andrews-moc Dec 12, 2023
8644a4a
Fix queuing animation when current engagement is restored
DavDo Dec 12, 2023
549400f
Fix No notification permission screen sharing on CV
DavDo Dec 13, 2023
264c995
Fixed visitor's video view
AndriiHorishniiMOC Dec 14, 2023
dc58df4
Changed default screen sharing mode
Pelkar Dec 19, 2023
6b3a32d
Clean-up internal usages of deprecated functions
andrews-moc Dec 26, 2023
ab47818
Upgrade Core SDK version
DavDo Dec 27, 2023
900e24b
Update Core SDK dependency to latest development build
gugalo Jan 3, 2024
4fb3c9a
Fix IllegalStateException: Not allowed to start service NotificationR…
andrews-moc Jan 5, 2024
313be15
Temporary file cleanup after use during camera capture
Pelkar Jan 8, 2024
fe4c1df
Added Visitor Info screen
AndriiHorishniiMOC Jan 8, 2024
73bb7ea
Update screen sharing request dialog strings
gugalo Jan 10, 2024
ed3e21e
Prevent 'IllegalStateException: Not allowed to start service ChatHead…
andrews-moc Jan 8, 2024
5c8c90a
Fix Confirmation Dialog overlaps with Overlay Dialog
DavDo Jan 12, 2024
93fd3c0
Do not mute visitor audio when operator puts engagement on Hold
andrews-moc Jan 11, 2024
6909086
Improved chat start timer conditions to match call controller
Pelkar Jan 12, 2024
47d1500
Improve LO popup feature flags
gugalo Jan 16, 2024
af3cb9a
Added snapshot tests for visitor code dialog
AndriiHorishniiMOC Jan 16, 2024
d37f6d4
Increment project version to 2.3.0
Jan 19, 2024
f9743f0
Increment Core SDK version to 1.2.0
Jan 19, 2024
0b5824a
Increment project version to 2.3.1
Jan 22, 2024
ccb2cf3
Remove deprecated functions which are older than 1 year
andrews-moc Jan 17, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
9 changes: 9 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Contributing to android-sdk-widgets

We currently do not accept any contributions from external sources.

The code is still open source and if you wish to add any changes, feel free to fork it and add changes to your fork.

Issues for any security-related bugs found are still welcome, but we offer no guarantees on whether or when they will be acted upon.

For any exceptional cases, please contact us at [email protected].
7 changes: 0 additions & 7 deletions app/src/main/java/com/glia/exampleapp/ChatFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import androidx.navigation.fragment.NavHostFragment;
import androidx.preference.PreferenceManager;

import com.glia.widgets.GliaWidgets;
import com.glia.widgets.UiTheme;
import com.glia.widgets.chat.ChatView;

Expand Down Expand Up @@ -59,10 +58,4 @@ public void onDestroyView() {
chatView.onDestroyView();
super.onDestroyView();
}

@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
GliaWidgets.onRequestPermissionsResult(requestCode, permissions, grantResults);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ object ExampleAppConfigManager {
val bounded = context.getString(R.string.screen_sharing_mode_app_bounded)
val unbounded = context.getString(R.string.screen_sharing_mode_unbounded)
val screenSharingMode = if (
preferences.getString(context.getString(R.string.pref_screen_sharing_mode), unbounded) == bounded
preferences.getString(context.getString(R.string.pref_screen_sharing_mode), bounded) == bounded
) {
ScreenSharing.Mode.APP_BOUNDED
} else {
Expand Down
34 changes: 24 additions & 10 deletions app/src/main/java/com/glia/exampleapp/MainFragment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import com.glia.widgets.chat.ChatActivity
import com.glia.widgets.chat.ChatType
import com.glia.widgets.core.configuration.GliaSdkConfiguration
import com.glia.widgets.messagecenter.MessageCenterActivity
import com.google.android.material.appbar.MaterialToolbar
import kotlin.concurrent.thread

class MainFragment : Fragment() {
Expand Down Expand Up @@ -86,6 +87,8 @@ class MainFragment : Fragment() {
.setOnClickListener { navigateToMessageCenter() }
view.findViewById<View>(R.id.end_engagement_button)
.setOnClickListener { GliaWidgets.endEngagement() }
view.findViewById<View>(R.id.visitor_info_button)
.setOnClickListener { navController.navigate(R.id.visitor_info) }
view.findViewById<View>(R.id.initGliaWidgetsButton).setOnClickListener {
thread { initGliaWidgets() }
}
Expand All @@ -102,6 +105,25 @@ class MainFragment : Fragment() {
showVisitorCode()
}
}

view.findViewById<MaterialToolbar>(R.id.top_app_bar).menu.apply {
val pause = findItem(R.id.lo_pause)
val resume = findItem(R.id.lo_resume)

pause.setOnMenuItemClickListener {
it.isVisible = false
resume.isVisible = true
Glia.getLiveObservation().pause()
true
}
resume.setOnMenuItemClickListener {
it.isVisible = false
pause.isVisible = true
Glia.getLiveObservation().resume()
true
}
}

handleOpensFromPushNotification()
}

Expand Down Expand Up @@ -139,29 +161,21 @@ class MainFragment : Fragment() {
}
}

@Deprecated("Deprecated in Java")
override fun onRequestPermissionsResult(
requestCode: Int,
permissions: Array<String>,
grantResults: IntArray
) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults)
GliaWidgets.onRequestPermissionsResult(requestCode, permissions, grantResults)
}

private fun setupAuthButtonsVisibility() {
if (activity == null || containerView == null) return
if (!Glia.isInitialized()) {
requireActivity().runOnUiThread {
containerView!!.findViewById<View>(R.id.initGliaWidgetsButton).visibility = View.VISIBLE
containerView!!.findViewById<View>(R.id.authenticationButton).visibility = View.GONE
containerView!!.findViewById<View>(R.id.deauthenticationButton).visibility = View.GONE
containerView!!.findViewById<View>(R.id.visitor_info_button).visibility = View.GONE
containerView!!.findViewById<View>(R.id.visitor_code_button).visibility = View.GONE
containerView!!.findViewById<View>(R.id.visitor_code_switch_container).visibility = View.GONE
}
return
}
requireActivity().runOnUiThread {
containerView!!.findViewById<View>(R.id.visitor_info_button).visibility = View.VISIBLE
containerView!!.findViewById<View>(R.id.visitor_code_button).visibility = View.VISIBLE
containerView!!.findViewById<View>(R.id.visitor_code_switch_container).visibility = View.VISIBLE
}
Expand Down
241 changes: 241 additions & 0 deletions app/src/main/java/com/glia/exampleapp/VisitorInfoFragment.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,241 @@
package com.glia.exampleapp

import android.os.Bundle
import android.text.Editable
import android.text.TextWatcher
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.Button
import android.widget.EditText
import android.widget.TextView
import android.widget.Toast
import androidx.appcompat.widget.SwitchCompat
import androidx.fragment.app.Fragment
import androidx.recyclerview.widget.RecyclerView
import com.glia.androidsdk.Glia
import com.glia.androidsdk.GliaException
import com.glia.androidsdk.visitor.VisitorInfo
import com.glia.androidsdk.visitor.VisitorInfoUpdateRequest
import com.glia.widgets.helper.SimpleTextWatcher
import java.util.UUID

class VisitorInfoFragment : Fragment() {

private lateinit var generatedNameTextView: TextView
private lateinit var nameEditText: EditText
private lateinit var emailEditText: EditText
private lateinit var phoneEditText: EditText
private lateinit var noteEditText: EditText
private lateinit var noteModeSwitch: SwitchCompat
private lateinit var customAttributesModeSwitch: SwitchCompat
private lateinit var saveButton: Button

private val customAttributesAdapter = CustomAttributesAdapter()

override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? = inflater.inflate(R.layout.visitor_info_fragment, container, false)

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)

generatedNameTextView = view.findViewById(R.id.generated_name_text_view)
nameEditText = view.findViewById(R.id.name_edit_text)
emailEditText = view.findViewById(R.id.email_edit_text)
phoneEditText = view.findViewById(R.id.phone_edit_text)
noteEditText = view.findViewById(R.id.note_edit_text)
noteModeSwitch = view.findViewById(R.id.note_mode_switch)
customAttributesModeSwitch = view.findViewById(R.id.custom_attributes_mode_switch)

view.findViewById<RecyclerView>(R.id.custom_attributes_recycler_view).apply {
adapter = customAttributesAdapter
isNestedScrollingEnabled = false
}

view.findViewById<View>(R.id.add_attribute_button).setOnClickListener {
customAttributesAdapter.addAttribute()
}

view.findViewById<Button>(R.id.save_button).apply {
saveButton = this
setOnClickListener {
saveVisitorInfo(obtainVisitorInfoUpdateRequest())
}
}

getVisitorInfo()
}

private fun showVisitorInfo(visitorInfo: VisitorInfo) {
generatedNameTextView.text = visitorInfo.generatedName
nameEditText.setText(visitorInfo.name)
emailEditText.setText(visitorInfo.email)
phoneEditText.setText(visitorInfo.phone)
noteEditText.setText(visitorInfo.note)
customAttributesAdapter.setAttributes(visitorInfo.customAttributesMap)
}

private fun showError(exception: GliaException) {
Toast.makeText(context, exception.message ?: exception.debugMessage, Toast.LENGTH_LONG).show()
}

private fun obtainVisitorInfoUpdateRequest(): VisitorInfoUpdateRequest {
return VisitorInfoUpdateRequest.Builder()
.setName(nameEditText.text.toString())
.setEmail(emailEditText.text.toString())
.setPhone(phoneEditText.text.toString())
.setNote(noteEditText.text.toString())
.setCustomAttributes(obtainCustomAttributes())
.setCustomAttrsUpdateMethod(obtainCustomAttributesUpdateMethod())
.setNoteUpdateMethod(obtainNoteUpdateMethod())
.build()
}

private fun obtainNoteUpdateMethod() = if (noteModeSwitch.isChecked) {
VisitorInfoUpdateRequest.NoteUpdateMethod.REPLACE
} else {
VisitorInfoUpdateRequest.NoteUpdateMethod.APPEND
}

private fun obtainCustomAttributesUpdateMethod() = if (customAttributesModeSwitch.isChecked) {
VisitorInfoUpdateRequest.CustomAttributesUpdateMethod.REPLACE
} else {
VisitorInfoUpdateRequest.CustomAttributesUpdateMethod.MERGE
}

private fun obtainCustomAttributes(): Map<String, String> {
return customAttributesAdapter.getAttributes()
}

private fun getVisitorInfo() {
saveButton.text = getString(R.string.visitor_info_loading)
Glia.getVisitorInfo { visitorInfo, error ->
view?.post {
saveButton.text = getString(R.string.visitor_info_save)
visitorInfo?.let { showVisitorInfo(it) }
error?.let { showError(it) }
}
}
}

private fun saveVisitorInfo(visitorInfo: VisitorInfoUpdateRequest) {
saveButton.text = getString(R.string.visitor_info_saving)
Glia.updateVisitorInfo(visitorInfo) { error ->
view?.post {
saveButton.text = getString(R.string.visitor_info_save)
error?.let { showError(it) }
getVisitorInfo()
}
}
}
}

private class CustomAttributesAdapter: RecyclerView.Adapter<CustomAttributesAdapter.CustomAttributeViewHolder>() {
private val attributes = mutableListOf<Attribute>()

fun setAttributes(attributes: Map<String, String>) {
this.attributes.clear()
this.attributes.addAll(attributes.entries.map { Attribute(id = it.key, key = it.key, value = it.value) })
notifyDataSetChanged()
}

fun getAttributes(): Map<String, String> {
return attributes.associate { Pair(it.key, it.value) }
}

fun addAttribute() {
val uniqueKey = generateNewUniqueKey()
if (attributes.add(Attribute(id = uniqueKey, key = uniqueKey))) {
notifyItemInserted(attributes.size - 1)
}
}

private fun generateNewUniqueKey(): String {
val ids = attributes.map { it.id }
var keyIndex = 1
var newKey: String
do {
newKey = "key$keyIndex"
keyIndex += 1
} while (ids.contains(newKey))
return newKey
}

class CustomAttributeViewHolder(
itemView: View,
val keyEditText: EditText,
val valueEditText: EditText,
val deleteButton: Button
): RecyclerView.ViewHolder(itemView) {
private var onTextChanged: (() -> Unit)? = null

init {
val textWatcher: TextWatcher = object : SimpleTextWatcher() {
override fun afterTextChanged(editable: Editable) {
onTextChanged?.let { it() }
}
}
keyEditText.addTextChangedListener(textWatcher)
valueEditText.addTextChangedListener(textWatcher)
}

fun bind(
attribute: Attribute,
onItemChanged: ((Attribute) -> Unit),
onItemRemove: ((Attribute) -> Unit)
) {
onTextChanged = null
keyEditText.setText(attribute.key)
valueEditText.setText(attribute.value)
deleteButton.setOnClickListener { onItemRemove(attribute) }
onTextChanged = {
val key = keyEditText.text.toString()
val value = valueEditText.text.toString()
if (key != attribute.key || value != attribute.value) {
onItemChanged(attribute.copy(key = key, value = value))
}
}

itemView.contentDescription = attribute.id
}
}

override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): CustomAttributeViewHolder {
val layoutInflater = LayoutInflater.from(parent.context)
val itemView = layoutInflater.inflate(R.layout.custom_attribute_item, parent, false)
return CustomAttributeViewHolder(
itemView,
itemView.findViewById(R.id.key_edit_text),
itemView.findViewById(R.id.value_edit_text),
itemView.findViewById(R.id.delete_button)
)
}

override fun getItemCount(): Int {
return attributes.count()
}

override fun onBindViewHolder(holder: CustomAttributeViewHolder, position: Int) {
holder.bind(attributes[position],
{ attribute ->
val index = attributes.indexOfFirst { it.id == attribute.id }
if (index < 0) return@bind
attributes.add(index, attribute)
attributes.removeAt(index + 1)
}, { attribute ->
val index = attributes.indexOfFirst { it.id == attribute.id }
if (index < 0) return@bind
attributes.removeAt(index)
notifyItemRemoved(index)
})
}

data class Attribute(
val id: String = UUID.randomUUID().toString(),
val key: String = "",
val value: String = ""
)
}
Loading