Skip to content

Commit

Permalink
[chore] Prepare for release 2.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
pavelreiter committed Nov 6, 2024
1 parent f76df8c commit 454dc42
Show file tree
Hide file tree
Showing 351 changed files with 5,531 additions and 4,189 deletions.
30 changes: 29 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,33 @@
<a name="unreleased"></a>
## [Unreleased]

<a name="2.2.0"></a>
## [2.2.0]

### Bug Fixes
- Allow reconnect in offline state
- Fix ProGuard/R8 issues
- Updated consumer-rules.pro to prevent minification of several problematic methods
- Added rules to the internal SDK minification
- SDK awaits for authorization
- [!NOTE]
Event sending may be delayed until server confirms user authorization to use Chat service,
sending of events prior to this could lead to loss of such events.
### Dependency Change
- Bump kotlin from 2.0.0 to 2.0.10
- Replace GSON with kotlinx.serialization
- Removed unused dependencies from the utilities module
### Features
- Enable application LargeHeap for attachment upload
- This allows upload of larger attachments on devices with sufficient RAM
- Enhance AuthorizeCustomer event
- Mobile SDK sends new headers for internal analytics
- Deprecate inContactId and emailAddress from Agent
- Values for these fields are now always empty
- Update agent model
- Added nickName field
- imageUrl field now provides the public image url

<a name="2.1.1"></a>
## [2.1.1]
### Bug Fixes
Expand Down Expand Up @@ -244,7 +271,8 @@
- failure
- typing start/end

[Unreleased]: https://github.com/nice-devone/nice-cxone-mobile-sdk-android/compare/2.1.1...HEAD
[Unreleased]: https://github.com/nice-devone/nice-cxone-mobile-sdk-android/compare/2.2.0...HEAD
[2.2.0]: https://github.com/nice-devone/nice-cxone-mobile-sdk-android/compare/2.1.1...2.2.0
[2.1.1]: https://github.com/nice-devone/nice-cxone-mobile-sdk-android/compare/2.1.0...2.1.1
[2.1.0]: https://github.com/nice-devone/nice-cxone-mobile-sdk-android/compare/2.0.0...2.1.0
[2.0.0]: https://github.com/nice-devone/nice-cxone-mobile-sdk-android/compare/1.3.1...2.0.0
Expand Down
5 changes: 0 additions & 5 deletions NOTICE
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,6 @@ This product includes software from The Android Open Source Project, Androidx pr
* Licensed under the Apache Apache License 2.0
* https://github.com/androidx/androidx/blob/androidx-main/LICENSE.txt

This product includes software from the Google Inc. Gson project
* Copyright 2008 Google Inc.
* Licensed under the Apache License, Version 2.0
* https://github.com/google/gson/blob/main/LICENSE

This product includes software from the Square, Inc. Retrofit project
* Copyright 2013 Square, Inc.
* Licensed under the Apache Apache License 2.0
Expand Down
4 changes: 3 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,12 @@ plugins {
alias(libs.plugins.firebase.crashlytics) apply false
alias(libs.plugins.ksp) apply false
alias(libs.plugins.metalava) apply false
alias(libs.plugins.compose.compiler) apply false
alias(libs.plugins.kotlin.serialization) apply false
}

group = GROUP
version = "2.1.1" // Fallback version
version = "2.2.0" // Fallback version

allprojects {
group = rootProject.group
Expand Down
5 changes: 0 additions & 5 deletions buildSrc/src/main/groovy/android-ui-conventions.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,6 @@ android {
defaultConfig {
vectorDrawables.useSupportLibrary = true
}

buildFeatures {
viewBinding true
}
}

dependencies {
Expand All @@ -36,7 +32,6 @@ dependencies {
implementation libs.kotlin.coroutines

//Navigation
implementation libs.androidx.navigation.fragment
implementation libs.androidx.navigation.ui
implementation libs.androidx.navigation.runtime
implementation libs.androidx.navigation.compose
Expand Down
6 changes: 5 additions & 1 deletion buildSrc/src/main/groovy/ui-compose-conventions.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
* FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND TITLE.
*/

plugins {
id "org.jetbrains.kotlin.plugin.compose"
}

android {
buildFeatures {
compose true
Expand All @@ -28,7 +32,7 @@ dependencies {
implementation libs.androidx.constraintlayout.compose
implementation platform(libs.androidx.compose.bom)
implementation libs.androidx.compose.activity
implementation libs.androidx.material
implementation libs.androidx.material3
implementation libs.androidx.material.icons.extended
implementation libs.androidx.lifecycle.runtime.compose
implementation libs.androidx.compose.ui
Expand Down
23 changes: 9 additions & 14 deletions chat-sdk-core/api.txt
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ package com.nice.cxonechat {
}

@com.nice.cxonechat.Public public interface ChatEventHandler {
method public void trigger(com.nice.cxonechat.event.ChatEvent event, optional com.nice.cxonechat.ChatEventHandler.OnEventSentListener? listener, optional com.nice.cxonechat.ChatEventHandler.OnEventErrorListener? errorListener);
method public void trigger(com.nice.cxonechat.event.ChatEvent<?> event, optional com.nice.cxonechat.ChatEventHandler.OnEventSentListener? listener, optional com.nice.cxonechat.ChatEventHandler.OnEventErrorListener? errorListener);
}

@com.nice.cxonechat.Public public static fun interface ChatEventHandler.OnEventErrorListener {
Expand Down Expand Up @@ -412,15 +412,7 @@ package com.nice.cxonechat.enums {

package com.nice.cxonechat.event {

@com.nice.cxonechat.Public public abstract sealed class ChatEvent {
}

@Deprecated @com.nice.cxonechat.Public public final class CustomVisitorEvent extends com.nice.cxonechat.event.ChatEvent {
ctor @Deprecated public CustomVisitorEvent(Object data);
}

@Deprecated @com.nice.cxonechat.Public public final class TriggerEvent extends com.nice.cxonechat.event.ChatEvent {
ctor @Deprecated public TriggerEvent(java.util.UUID id);
@com.nice.cxonechat.Public public abstract sealed class ChatEvent<T> {
}

}
Expand Down Expand Up @@ -646,11 +638,13 @@ package com.nice.cxonechat.message {
method public abstract String? getImageUrl();
method public abstract String getLastName();
method public final String getName();
method public String? getNickname();
property public abstract String firstName;
property public abstract String id;
property public abstract String? imageUrl;
property public abstract String lastName;
property public final String name;
property public String? nickname;
}

@com.nice.cxonechat.Public public enum MessageDirection {
Expand Down Expand Up @@ -911,23 +905,23 @@ package com.nice.cxonechat.thread {

@com.nice.cxonechat.Public public abstract class Agent {
ctor public Agent();
method public abstract String? getEmailAddress();
method @Deprecated public abstract String? getEmailAddress();
method public abstract String getFirstName();
method public final String getFullName();
method public abstract int getId();
method public abstract String getImageUrl();
method public abstract java.util.UUID? getInContactId();
method @Deprecated public abstract java.util.UUID? getInContactId();
method public abstract String getLastName();
method public abstract String? getNickname();
method public abstract boolean isBotUser();
method public abstract boolean isSurveyUser();
method public abstract boolean isTyping();
property public abstract String? emailAddress;
property @Deprecated public abstract String? emailAddress;
property public abstract String firstName;
property public final String fullName;
property public abstract int id;
property public abstract String imageUrl;
property public abstract java.util.UUID? inContactId;
property @Deprecated public abstract java.util.UUID? inContactId;
property public abstract boolean isBotUser;
property public abstract boolean isSurveyUser;
property public abstract boolean isTyping;
Expand Down Expand Up @@ -980,3 +974,4 @@ package com.nice.cxonechat.thread {
}

}

7 changes: 5 additions & 2 deletions chat-sdk-core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ plugins {
id "android-library-style-conventions"
id "publish-conventions"
id "api-conventions"
id "org.jetbrains.kotlin.plugin.serialization"
}
metalava {
hiddenPackages = ["com.nice.cxonechat.internal"]
Expand Down Expand Up @@ -75,12 +76,14 @@ mavenPublishing {
dependencies {
implementation libs.androidx.ktx
implementation libs.security.crypto
implementation libs.gson
implementation libs.kotlinx.serialization.json
implementation libs.retrofit
implementation libs.retrofit.gson
implementation libs.retrofit.kotlinx.serialization
implementation libs.okhttp
implementation project(':utilities')
api project(':logger')
implementation project(':logger-android')
testImplementation libs.kotest.assertions.core
testImplementation libs.kotlin.reflect
testImplementation libs.gson
}
22 changes: 15 additions & 7 deletions chat-sdk-core/consumer-rules.pro
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
## === GSON ===
## Prevent R8 to replace instances of types that are never instantiated with null
## https://r8.googlesource.com/r8/+/refs/heads/master/compatibility-faq.md#troubleshooting-gson
-keep,allowobfuscation,allowoptimization class *, **, **$**, **$**$**, **$**$**, **$**$**$** {
<init>(...);
@com.google.gson.annotations.SerializedName <fields>;
@com.google.gson.annotations.SerializedName <methods>;
# Prevent false-positive unused method removal by the R8 in full mode
-keepclassmembers, allowoptimization, allowobfuscation class
com.nice.cxonechat.SocketFactoryConfiguration$Companion,
com.nice.cxonechat.ChatBuilder$Companion,
com.nice.cxonechat.message.OutboundMessage$Companion
{
public *;
}

-keepclassmembers, allowoptimization, allowobfuscation interface
com.nice.cxonechat.SocketFactoryConfiguration,
com.nice.cxonechat.ChatBuilder,
com.nice.cxonechat.message.OutboundMessage
{
public static *;
}
19 changes: 15 additions & 4 deletions chat-sdk-core/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,8 @@
-keepclasseswithmembers,allowoptimization class **, **$**, **$**$**, **$**$**, **$**$**$** {
@com.nice.cxonechat.Public public <methods>;
}
-keep,allowobfuscation,allowoptimization class **, **$**, **$**$**, **$**$**, **$**$**$** {
<init>(...);
@com.google.gson.annotations.SerializedName <fields>;
@com.google.gson.annotations.SerializedName <methods>;
-keepclasseswithmembernames class com.nice.cxonechat.ChatInstanceProvider$Listener {
public <methods>;
}

## === Intrinsics ===
Expand All @@ -50,3 +48,16 @@

## === Suppression ===
-dontwarn java.lang.invoke.StringConcatFactory

## === Serialization ===
## Kotlinx.serialization rules are not effective if the classes are not used with R8 in fullmode
-keepclassmembers class com.nice.cxonechat.internal.model.**$**, com.nice.cxonechat.api.model.**$** {
kotlinx.serialization.KSerializer serializer();
}
-keep class com.nice.cxonechat.internal.model.**, com.nice.cxonechat.api.model.** {
public static <1> INSTANCE;
kotlinx.serialization.KSerializer serializer(...);
}
-keepclassmembers public class **$$serializer {
*;
}
4 changes: 3 additions & 1 deletion chat-sdk-core/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,7 @@

<uses-permission android:name="android.permission.INTERNET" />

<application android:fullBackupContent="@xml/backup_rules" />
<application
android:fullBackupContent="@xml/backup_rules"
android:largeHeap="true" />
</manifest>
10 changes: 10 additions & 0 deletions chat-sdk-core/src/main/java/com/nice/cxonechat/ChatBuilder.kt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ package com.nice.cxonechat

import android.content.Context
import androidx.annotation.CheckResult
import com.nice.cxonechat.core.BuildConfig
import com.nice.cxonechat.internal.ChatBuilderDefault
import com.nice.cxonechat.internal.ChatBuilderLogging
import com.nice.cxonechat.internal.ChatBuilderThreading
Expand Down Expand Up @@ -171,6 +172,15 @@ interface ChatBuilder {
): ChatBuilder {
val sharedClient = OkHttpClient()
.newBuilder()
.addInterceptor { chain ->
chain.proceed(
chain.request()
.newBuilder()
.addHeader("x-sdk-platform", "android")
.addHeader("x-sdk-version", BuildConfig.VERSION_NAME)
.build()
)
}
.socketFactory(TaggingSocketFactory)
.build()
val factory = SocketFactoryDefault(config, sharedClient)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

package com.nice.cxonechat

import com.google.gson.JsonIOException
import com.nice.cxonechat.event.ChatEvent
import com.nice.cxonechat.exceptions.CXOneException
import com.nice.cxonechat.exceptions.MissingCustomerId
Expand All @@ -39,7 +38,7 @@ interface ChatEventHandler {
* @param listener nullable listener if the client wants to know when it was sent.
* @param errorListener An optional listener for errors encountered when handling the event.
*/
fun trigger(event: ChatEvent, listener: OnEventSentListener? = null, errorListener: OnEventErrorListener? = null)
fun trigger(event: ChatEvent<*>, listener: OnEventSentListener? = null, errorListener: OnEventErrorListener? = null)

/**
* Listener to be notified when the triggered event is considered sent.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import com.nice.cxonechat.event.ProactiveActionFailureEvent
import com.nice.cxonechat.event.ProactiveActionSuccessEvent
import com.nice.cxonechat.event.RefreshToken
import com.nice.cxonechat.event.TriggerEvent
import com.nice.cxonechat.internal.model.network.ProactiveActionInfo
import java.util.Date
import java.util.UUID

Expand Down Expand Up @@ -262,7 +263,7 @@ object ChatEventHandlerActions {
date: Date = Date(),
listener: OnEventSentListener? = null,
errorListener: OnEventErrorListener? = null,
) = trigger(ProactiveActionSuccessEvent(data, date), listener, errorListener)
) = trigger(ProactiveActionSuccessEvent(ProactiveActionInfo(data), date), listener, errorListener)

/**
* Refresh the authentication token associated with the chat.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,17 @@ class ChatInstanceProvider private constructor(
return@scope
}

assertState({ setOf(Prepared, ConnectionLost).contains(it) }) {
/*
* Offline state is a special case where we allow doConnect to be called since
* the live chat implementation of Chat will re-check the availability of the chat,
* if the cached availability information is expired and will fetch a fresh version,
* if it is required.
* In case that the availability information will allow it the connection attempt will be made.
*
* Independent on the state of the availability information the instance provider
* will be notified via the onReady callback once the procedure is finished.
*/
assertState({ setOf(Prepared, ConnectionLost, Offline).contains(it) }) {
"ChatInstanceProvider.connect called in invalid state ($chatState). " +
"It is only allowed when the connection is either PREPARED, LOST_CONNECTION, or OFFLINE."
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@

package com.nice.cxonechat.api.model

import com.google.gson.annotations.SerializedName
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

@Serializable
internal data class AttachmentUploadResponse(
@SerializedName("fileUrl")
@SerialName("fileUrl")
val fileUrl: String? = null,
)
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,19 @@

package com.nice.cxonechat.enums

import com.google.gson.annotations.SerializedName
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

/**
* The different types of WebSocket actions.
*/
@Serializable
internal enum class ActionType(val value: String) {
/** An action for welcome message. */
@SerializedName("WelcomeMessage")
@SerialName("WelcomeMessage")
WelcomeMessage("WelcomeMessage"),

/** An action for custom popup box. */
@SerializedName("CustomPopupBox")
@SerialName("CustomPopupBox")
CustomPopupBox("CustomPopupBox")
}
Loading

0 comments on commit 454dc42

Please sign in to comment.