|
12 | 12 |
|
13 | 13 | import androidx.annotation.NonNull; |
14 | 14 |
|
15 | | -import io.kommunicate.devkit.Applozic; |
16 | | -import io.kommunicate.devkit.ApplozicClient; |
| 15 | +import io.kommunicate.devkit.KommunicateSettings; |
| 16 | +import io.kommunicate.devkit.SettingsSharedPreference; |
17 | 17 | import io.kommunicate.devkit.api.MobiComKitClientService; |
18 | 18 | import io.kommunicate.devkit.api.account.register.RegistrationResponse; |
19 | 19 | import io.kommunicate.devkit.api.account.user.MobiComUserPreference; |
20 | | -import io.kommunicate.devkit.api.conversation.ApplozicConversation; |
| 20 | +import io.kommunicate.devkit.api.conversation.ConversationHelper; |
21 | 21 | import io.kommunicate.devkit.api.conversation.Message; |
22 | 22 | import io.kommunicate.devkit.api.people.ChannelInfo; |
23 | 23 | import io.kommunicate.commons.commons.core.utils.Utils; |
@@ -83,7 +83,7 @@ public static void openConversation(final Context context, final boolean skipCon |
83 | 83 | } |
84 | 84 |
|
85 | 85 | if (conversationId == null) { |
86 | | - ApplozicConversation.getLatestMessageList( |
| 86 | + ConversationHelper.getLatestMessageList( |
87 | 87 | context, |
88 | 88 | false, |
89 | 89 | new TaskListener<List<Message>>() { |
@@ -196,7 +196,7 @@ public static void launchChat(final KmChatBuilder launchChat, final KmCallback c |
196 | 196 | if (!TextUtils.isEmpty(launchChat.getApplicationId())) { |
197 | 197 | Kommunicate.init(launchChat.getContext(), launchChat.getApplicationId(), KmAppSettingPreferences.isRootDetectionEnabled()); |
198 | 198 | } else { |
199 | | - if (TextUtils.isEmpty(Applozic.getInstance(launchChat.getContext()).getApplicationKey())) { |
| 199 | + if (TextUtils.isEmpty(KommunicateSettings.getInstance(launchChat.getContext()).getApplicationKey())) { |
200 | 200 | if (callback != null) { |
201 | 201 | callback.onFailure(Utils.getString(launchChat.getContext(), R.string.km_app_id_cannot_be_null)); |
202 | 202 | } |
@@ -293,7 +293,7 @@ public static void createChat(final KmChatBuilder launchChat, final KmCallback c |
293 | 293 | if (!TextUtils.isEmpty(launchChat.getApplicationId())) { |
294 | 294 | Kommunicate.init(launchChat.getContext(), launchChat.getApplicationId(), KmAppSettingPreferences.isRootDetectionEnabled()); |
295 | 295 | } else { |
296 | | - if (TextUtils.isEmpty(Applozic.getInstance(launchChat.getContext()).getApplicationKey())) { |
| 296 | + if (TextUtils.isEmpty(KommunicateSettings.getInstance(launchChat.getContext()).getApplicationKey())) { |
297 | 297 | if (callback != null) { |
298 | 298 | Utils.printLog(null, TAG, Utils.getString(null, R.string.km_app_id_cannot_be_null)); |
299 | 299 | callback.onFailure(Utils.getString(launchChat.getContext(), R.string.km_app_id_cannot_be_null)); |
@@ -392,7 +392,7 @@ public void onSuccess(Channel channel, Context context) { |
392 | 392 | resultReceiver.send(KmConstants.PRECHAT_RESULT_CODE, null); |
393 | 393 | } |
394 | 394 | if (isSkipChatList) { |
395 | | - ApplozicClient.getInstance(context).hideChatListOnNotification(); |
| 395 | + SettingsSharedPreference.getInstance(context).hideChatListOnNotification(); |
396 | 396 | } |
397 | 397 | if (callback != null) { |
398 | 398 | if (launchChat) { |
@@ -437,7 +437,7 @@ public void onSuccess(RegistrationResponse registrationResponse, Context context |
437 | 437 | } |
438 | 438 |
|
439 | 439 | if (launchChat.getMetadata() != null) { |
440 | | - ApplozicClient.getInstance(context).setMessageMetaData(launchChat.getMetadata()); |
| 440 | + SettingsSharedPreference.getInstance(context).setMessageMetaData(launchChat.getMetadata()); |
441 | 441 | } |
442 | 442 |
|
443 | 443 | try { |
@@ -525,7 +525,7 @@ public static void createOrLaunchConversation(final KmConversationBuilder conver |
525 | 525 | if (!TextUtils.isEmpty(conversationBuilder.getAppId())) { |
526 | 526 | Kommunicate.init(conversationBuilder.getContext(), conversationBuilder.getAppId(), KmAppSettingPreferences.isRootDetectionEnabled()); |
527 | 527 | } else { |
528 | | - if (TextUtils.isEmpty(Applozic.getInstance(conversationBuilder.getContext()).getApplicationKey())) { |
| 528 | + if (TextUtils.isEmpty(KommunicateSettings.getInstance(conversationBuilder.getContext()).getApplicationKey())) { |
529 | 529 | if (callback != null) { |
530 | 530 | Utils.printLog(null, TAG, Utils.getString(null, R.string.km_app_id_cannot_be_null)); |
531 | 531 | callback.onFailure(Utils.getString(conversationBuilder.getContext(), R.string.km_app_id_cannot_be_null)); |
@@ -605,7 +605,7 @@ public static void launchAndCreateIfEmpty(final KmConversationBuilder conversati |
605 | 605 | } |
606 | 606 |
|
607 | 607 | KmAppSettingPreferences.setInAppNotificationEnable(conversationBuilder.getInAppNotificationEnable()); |
608 | | - ApplozicConversation.getLatestMessageList( |
| 608 | + ConversationHelper.getLatestMessageList( |
609 | 609 | conversationBuilder.getContext(), |
610 | 610 | false, |
611 | 611 | new TaskListener<List<Message>>() { |
@@ -645,7 +645,7 @@ public void onSuccess(Channel channel, Context context) { |
645 | 645 | resultReceiver.send(KmConstants.PRECHAT_RESULT_CODE, null); |
646 | 646 | } |
647 | 647 | if (isSkipConversationList) { |
648 | | - ApplozicClient.getInstance(context).hideChatListOnNotification(); |
| 648 | + SettingsSharedPreference.getInstance(context).hideChatListOnNotification(); |
649 | 649 | } |
650 | 650 | if (callback != null) { |
651 | 651 | if (launchConversation) { |
@@ -689,7 +689,7 @@ public void onSuccess(RegistrationResponse registrationResponse, Context context |
689 | 689 | } |
690 | 690 |
|
691 | 691 | if (conversationBuilder.getMessageMetadata() != null) { |
692 | | - ApplozicClient.getInstance(context).setMessageMetaData(conversationBuilder.getMessageMetadata()); |
| 692 | + SettingsSharedPreference.getInstance(context).setMessageMetaData(conversationBuilder.getMessageMetadata()); |
693 | 693 | } |
694 | 694 |
|
695 | 695 | try { |
@@ -792,7 +792,7 @@ private static void createConversation(KmConversationBuilder conversationBuilder |
792 | 792 | String label = ANDROID + appName; |
793 | 793 | metadata.put(GROUP_CREATION_URL, label); |
794 | 794 | } else { |
795 | | - String label = ANDROID + Applozic.getInstance(conversationBuilder.getContext()).getApplicationKey(); |
| 795 | + String label = ANDROID + KommunicateSettings.getInstance(conversationBuilder.getContext()).getApplicationKey(); |
796 | 796 | metadata.put(GROUP_CREATION_URL, label); |
797 | 797 | } |
798 | 798 | String languageCode = PrefSettings.getInstance(conversationBuilder.getContext()).getDeviceDefaultLanguageToBot(); |
@@ -831,8 +831,8 @@ private static void createConversation(KmConversationBuilder conversationBuilder |
831 | 831 | metadata.put(KmSettings.KM_CONVERSATION_METADATA, GsonUtils.getJsonFromObject(conversationBuilder.getConversationInfo(), Map.class)); |
832 | 832 | } |
833 | 833 |
|
834 | | - if (!TextUtils.isEmpty(ApplozicClient.getInstance(conversationBuilder.getContext()).getMessageMetaData())) { |
835 | | - Map<String, String> defaultMetadata = (Map<String, String>) GsonUtils.getObjectFromJson(ApplozicClient.getInstance(conversationBuilder.getContext()).getMessageMetaData(), Map.class); |
| 834 | + if (!TextUtils.isEmpty(SettingsSharedPreference.getInstance(conversationBuilder.getContext()).getMessageMetaData())) { |
| 835 | + Map<String, String> defaultMetadata = (Map<String, String>) GsonUtils.getObjectFromJson(SettingsSharedPreference.getInstance(conversationBuilder.getContext()).getMessageMetaData(), Map.class); |
836 | 836 | if (defaultMetadata != null) { |
837 | 837 | metadata.putAll(defaultMetadata); |
838 | 838 | } |
|
0 commit comments