Skip to content

Commit

Permalink
Pull request #80: Ffortes MCA-3945 realTimeChatCustomisation
Browse files Browse the repository at this point in the history
Merge in MML/infobip-mobile-messaging-flutter from ffortes-MCA-3945-realTimeChatCustomisation to main

Squashed commit of the following:

commit 5d8b488c9be622d330183958ab068525b1d741f8
Author: Jakub Dzubak <[email protected]>
Date:   Tue Oct 8 08:27:15 2024 +0200

    MCA-4155 InfobipMobilemessagingPlugin class structure reorganisation

commit 7f0b5352b7cf3e4a017675dd0a6b90bec9a223e3
Merge: 8c006aa cd96e11
Author: Matuš Tokar <[email protected]>
Date:   Mon Oct 7 15:15:43 2024 +0200

    Merge remote-tracking branch 'origin/ffortes-MCA-3945-realTimeChatCustomisation' into ffortes-MCA-3945-realTimeChatCustomisation

commit 8c006aa17fb0941b7d243c6c5e8e1edad32e4dcc
Author: Matuš Tokar <[email protected]>
Date:   Mon Oct 7 15:15:33 2024 +0200

    setWidgetTheme

commit cd96e112b61c88ff8201115a266d89d41033ab6c
Author: Francisco Fortes <[email protected]>
Date:   Mon Oct 7 15:03:54 2024 +0200

    Podfile avoiding code signing

commit 1cd553a9aedb8d8b97b2c544abd46a92e83db740
Author: Francisco Fortes <[email protected]>
Date:   Fri Oct 4 15:48:14 2024 +0200

    iOS native target increased

commit 19e5a7039bb9f9c825e30fe133f442469136da71
Author: Matuš Tokar <[email protected]>
Date:   Fri Oct 4 15:33:27 2024 +0200

    android review fixes

commit d4470e0873cc9251b05386f87b45de3c9335f2c0
Author: Francisco Fortes <[email protected]>
Date:   Thu Oct 3 16:27:53 2024 +0200

    added static setWidgetTheme

commit de0ee7cda4c2115a09da8af21b80a648e373f39a
Author: Matuš Tokar <[email protected]>
Date:   Wed Oct 2 16:10:07 2024 +0200

    indent

commit a9701398b7dc50fb56a56e03992d388d75664fac
Author: Matuš Tokar <[email protected]>
Date:   Wed Oct 2 15:16:32 2024 +0200

    review fixes

commit 7b78cf720e4ed0d613ef14438df867bdb20899d3
Author: Francisco Fortes <[email protected]>
Date:   Tue Oct 1 13:19:56 2024 +0200

    removed obsolete customTheme

commit 19030675dbfe090c459e6cf7e78d560edb81da32
Author: Francisco Fortes <[email protected]>
Date:   Tue Oct 1 11:08:53 2024 +0200

    review changes

commit 280b56bb5211e726587d985b8487fec4330ed761
Author: Jakub Dzubak <[email protected]>
Date:   Tue Oct 1 07:54:40 2024 +0200

    MCA-4155 raw msg event

commit f05d8fe4326d7f0b71234cde1eac970fd0578ea0
Merge: f076c05 9bf095e
Author: Matuš Tokar <[email protected]>
Date:   Mon Sep 30 15:58:23 2024 +0200

    Merge remote-tracking branch 'origin/ffortes-MCA-3945-realTimeChatCustomisation' into ffortes-MCA-3945-realTimeChatCustomisation

commit f076c0524fab25499e46d4911866fe4bcd39213b
Author: Matuš Tokar <[email protected]>
Date:   Mon Sep 30 15:57:52 2024 +0200

    new android version

commit 9bf095e60b6d526ae38dcd1db7032102a3ac9b26
Author: Francisco Fortes <[email protected]>
Date:   Mon Sep 30 09:22:39 2024 +0200

    cleanup

commit 77e9b9b9ca13c8c5208a037d84b171b570d53157
Author: Matuš Tokar <[email protected]>
Date:   Thu Sep 26 16:25:41 2024 +0200

    replace activity for context

commit e0521e7a4c5e2787ece8b963e1522b0b8cfcc01c
Author: Matuš Tokar <[email protected]>
Date:   Thu Sep 26 13:55:33 2024 +0200

    android part wip

commit 9e22eed022e8cc2d2d99cc8c2c962bfffefaad3a
Author: Matuš Tokar <[email protected]>
Date:   Wed Sep 25 17:29:33 2024 +0200

    android part wip

commit 2db19e97108caa26cd5c8e6e2996f91d4e901559
Author: Matuš Tokar <[email protected]>
Date:   Wed Sep 25 14:06:39 2024 +0200

    remove chatInputPlaceholderColor

commit 6ddaa64e248e6762abf9584e05ccdf65c69577d6
Author: Francisco Fortes <[email protected]>
Date:   Wed Sep 25 13:17:18 2024 +0200

    fixed chatStatusBarIconsColorMode

... and 8 more commits
  • Loading branch information
fortesdev authored and Matuš Tokar committed Oct 8, 2024
1 parent 65c349c commit bd55e20
Show file tree
Hide file tree
Showing 22 changed files with 1,236 additions and 422 deletions.
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ android {
def withWebRTCUI = getRootProjectProperty('withWebRTCUI', false)

dependencies {
def mmVersion = '12.10.0'
def mmVersion = '12.12.1'
//flutter and mm dependencies clash
implementation ("org.jetbrains.kotlin:kotlin-stdlib-jdk8") {
version {
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,11 @@ private void isMultithread(final MethodChannel.Result result) {
private InAppChatFragment.EventsListener createEventsListener() {
return new InAppChatFragment.EventsListener() {

@Override
public void onChatRawMessageReceived(@NonNull String rawMessage) {
eventHandler.sendEvent(ChatViewEvent.EVENT_CHAT_RAW_MESSAGE_RECEIVED, rawMessage);
}

@Override
public void onChatWidgetThemeChanged(@NonNull String widgetThemeName) {
eventHandler.sendEvent(ChatViewEvent.EVENT_WIDGET_THEME_CHANGED, widgetThemeName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@ public class ChatViewEvent {
public static final String EVENT_CHAT_DISCONNECTED = "chatView.chatDisconnected";
public static final String EVENT_CHAT_RECONNECTED = "chatView.chatReconnected";
public static final String EVENT_EXIT_CHAT_PRESSED = "chatView.exitChatPressed";
public static final String EVENT_CHAT_RAW_MESSAGE_RECEIVED = "chatView.chatRawMessageReceived";

}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ public enum ErrorCodes {
CONTEXTUAL_METADATA_ERROR("CONTEXTUAL_METADATA_ERROR"),
WEBRTCUI_ERROR("WEBRTCUI_ERROR"),
INBOX_ERROR("INBOX_ERROR"),
CHAT_VIEW_ERROR("CHAT_VIEW_ERROR");
CHAT_VIEW_ERROR("CHAT_VIEW_ERROR"),
SET_WIDGET_THEME_ERROR("SET_WIDGET_THEME_ERROR");

private final String code;

Expand Down

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions example/ios/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ post_install do |installer|
xcconfig = File.read(xcconfig_path)
xcconfig_mod = xcconfig.gsub(/DT_TOOLCHAIN_DIR/, "TOOLCHAIN_DIR")
File.open(xcconfig_path, "w") { |file| file << xcconfig_mod }
config.build_settings['CODE_SIGNING_ALLOWED'] = 'NO'

end

end
Expand Down
105 changes: 54 additions & 51 deletions example/lib/chat_customization.dart
Original file line number Diff line number Diff line change
@@ -1,55 +1,58 @@
library chat_customization;
import 'package:infobip_mobilemessaging/models/configuration.dart' as mmconfiguration;

Object customTheme = mmconfiguration.InAppChatCustomization(
//toolbar
toolbarTitle: 'Chat',
toolbarTitleColor: '#FFFFFF',
toolbarTintColor: '#FF33F3',
toolbarBackgroundColor: '#673AB7',
//chat
widgetTheme: 'dark',
chatBackgroundColor: '#D1C4E9',
noConnectionAlertTextColor: '#FFFFFF',
noConnectionAlertBackgroundColor: '#212121',
//input
chatInputSeparatorVisible: true,
attachmentButtonIcon: 'assets/ic_add_circle.png',
sendButtonIcon: 'assets/ic_send.png',
sendButtonTintColor: '#9E9E9E',
chatInputPlaceholderColor: '#757575',
chatInputCursorColor: '#9E9E9E',
chatInputBackgroundColor: '#D1C4E9',
android: mmconfiguration.AndroidInAppChatCustomization(
//status bar
chatStatusBarColorLight: true,
chatStatusBarBackgroundColor: '#673AB7',
//toolbar
chatNavigationIcon: 'assets/ic_back.png',
chatNavigationIconTint: '#FFFFFF',
chatSubtitleText: '#1',
chatSubtitleTextColor: '#FFFFFF',
chatSubtitleTextAppearanceRes: 'TextAppearance_AppCompat_Subtitle',
chatSubtitleCentered: true,
chatTitleTextAppearanceRes: 'TextAppearance_AppCompat_Title',
chatTitleCentered: true,
chatMenuItemsIconTint: '#FFFFFF',
chatMenuItemSaveAttachmentIcon: 'assets/ic_download.png',
//chat
chatProgressBarColor: '#9E9E9E',
chatNetworkConnectionErrorText: 'Offline',
chatNetworkConnectionErrorTextAppearanceRes: 'TextAppearance_AppCompat_Small',
//input
chatInputSeparatorLineColor: '#BDBDBD',
chatInputHintText: 'Message',
chatInputTextColor: '#212121',
chatInputTextAppearance: 'TextAppearance_AppCompat',
chatInputAttachmentIconTint: '#9E9E9E',
chatInputAttachmentBackgroundColor: '#673AB7',
chatInputAttachmentBackgroundDrawable: 'assets/ic_circle.png',
chatInputSendIconTint: '#9E9E9E',
chatInputSendBackgroundColor: '#673AB7',
chatInputSendBackgroundDrawable: 'assets/ic_circle.png',
),
ios: mmconfiguration.IOSInAppChatCustomization(initialHeight: 50)
Object customBranding = mmconfiguration.ChatCustomization(
chatStatusBarBackgroundColor: "#673AB7",
chatStatusBarIconsColorMode: "dark",
chatToolbar: mmconfiguration.ToolbarCustomization(
titleTextAppearance: 'TextAppearance_AppCompat_Title',
titleTextColor: '#FFFFFF',
titleText: 'Some new title',
titleCentered: true,
backgroundColor: '#673AB7',
navigationIcon: 'assets/ic_back.png',
navigationIconTint: '#FFFFFF',
subtitleTextAppearance: 'TextAppearance_AppCompat_Subtitle',
subtitleTextColor: '#FFFFFF',
subtitleText: '#1',
subtitleCentered: true,
),
attachmentPreviewToolbar: mmconfiguration.ToolbarCustomization(
titleTextAppearance: 'TextAppearance_AppCompat_Title',
titleTextColor: '#212121',
titleText: 'Attachment preview',
titleCentered: true,
backgroundColor: '#673AB7',
navigationIcon: 'assets/ic_back.png',
navigationIconTint: '#FFFFFF',
subtitleTextAppearance: 'TextAppearance_AppCompat_Subtitle',
subtitleTextColor: '#FFFFFF',
subtitleText: 'Attachment preview subtitle',
subtitleCentered: false,
),
attachmentPreviewToolbarSaveMenuItemIcon: 'assets/ic_download.png',
attachmentPreviewToolbarMenuItemsIconTint: '#9E9E9E',

networkErrorText: 'Network error',
networkErrorTextColor: '#FFFFFF',
networkErrorLabelBackgroundColor: '#212121',

chatBackgroundColor: '#FFFFFF',
chatProgressBarColor: '#9E9E9E',
chatInputTextAppearance: 'TextAppearance_AppCompat',
chatInputTextColor: '#212121',
chatInputBackgroundColor: '#D1C4E9',
chatInputHintText: 'Input Message',
chatInputHintTextColor: '#212121',
chatInputAttachmentIcon: 'assets/ic_add_circle.png',
chatInputAttachmentIconTint: '#9E9E9E',
chatInputAttachmentBackgroundDrawable: 'assets/ic_circle.png',
chatInputAttachmentBackgroundColor: '#673AB7',
chatInputSendIcon: 'assets/ic_send.png',
chatInputSendIconTint: '#9E9E9E',
chatInputSendBackgroundDrawable: 'assets/ic_circle.png',
chatInputSendBackgroundColor: '#673AB7',
chatInputSeparatorLineColor: '#BDBDBD',
chatInputSeparatorLineVisible: true,
chatInputCursorColor: '#9E9E9E',
);
10 changes: 0 additions & 10 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import 'package:flutter/material.dart';
import 'package:infobip_mobilemessaging/infobip_mobilemessaging.dart';
import 'package:infobip_mobilemessaging/models/configuration.dart'
as mmconfiguration;
import 'package:infobip_mobilemessaging/models/ios_chat_settings.dart';

import 'screens/homepage.dart';
import 'widgets/page.dart';
Expand Down Expand Up @@ -46,8 +45,6 @@ class _MyAppState extends State<MyApp> {
withoutRegisteringForRemoteNotifications: false),
webRTCUI: mmconfiguration.WebRTCUI(
configurationId: 'Your WEBRTC push configuration id'),
// Comment out to apply In-app chat customization
//inAppChatCustomization: chatCustomization.customTheme,
));
// Comment out to automatically enable WebRTC
// try {
Expand All @@ -56,13 +53,6 @@ class _MyAppState extends State<MyApp> {
// } catch (err) {
// print('Calls enable error: $err');
// }
InfobipMobilemessaging.setupiOSChatSettings(IOSChatSettings(
title: 'Flutter Example Chat',
sendButtonColor: '#ff5722',
navigationBarItemsColor: '#8DFF33',
navigationBarColor: '#c41c00',
navigationBarTitleColor: '#000000',
));
}

@override
Expand Down
10 changes: 10 additions & 0 deletions example/lib/screens/homepage.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import 'package:infobip_mobilemessaging/models/library_event.dart';
import 'package:infobip_mobilemessaging/models/message.dart';
import 'package:infobip_mobilemessaging/models/user_data.dart';

import '../chat_customization.dart' as chatCustomization;

import '../main.dart';
import '../utils/language.dart';
import '../widgets/demo_tile.dart';
Expand Down Expand Up @@ -358,6 +360,14 @@ class _HomePageState extends State<HomePage> {
InfobipMobilemessaging.showChat();
},
),
ListTile(
title: const Text('Show chat screen customized'),
onTap: () {
InfobipMobilemessaging.setChatCustomization(chatCustomization.customBranding);
InfobipMobilemessaging.setWidgetTheme('dark');
InfobipMobilemessaging.showChat();
},
),
ListTile(
title: const Text('Send Contextual Data and Show chat screen'),
onTap: () {
Expand Down
2 changes: 1 addition & 1 deletion example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ packages:
path: ".."
relative: true
source: path
version: "6.4.0"
version: "6.4.1"
intl:
dependency: "direct main"
description:
Expand Down
14 changes: 7 additions & 7 deletions ios/Classes/Configuration.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class Configuration {
static let withoutRegisteringForRemoteNotifications = "withoutRegisteringForRemoteNotifications"
static let webRTCUI = "webRTCUI"
static let configurationId = "configurationId"
static let customisation = "inAppChatCustomization"
static let customization = "inAppChatCustomization"
}

let appCode: String
Expand All @@ -49,23 +49,23 @@ class Configuration {
let categories: [MMNotificationCategory]?
let webViewSettings: [String: AnyObject]?
let withoutRegisteringForRemoteNotifications: Bool
let customisation: Customisation?
let customization: Customization?

init?(rawConfig: [String: AnyObject]) {
guard let appCode = rawConfig[Configuration.Keys.applicationCode] as? String,
let ios = rawConfig["iosSettings"] as? [String: AnyObject] else
{
return nil
}

if let rawConfig = rawConfig[Configuration.Keys.customisation] as? [String: Any],
if let rawConfig = rawConfig[Configuration.Keys.customization] as? [String: Any],
let jsonObject = try? JSONSerialization.data(
withJSONObject: rawConfig
),
let customisation = try? JSONDecoder().decode(Customisation.self, from: jsonObject) {
self.customisation = customisation
let customization = try? JSONDecoder().decode(Customization.self, from: jsonObject) {
self.customization = customization
} else {
self.customisation = nil
self.customization = nil
}

self.webRTCUI = rawConfig[Configuration.Keys.webRTCUI] as? [String: Any]
Expand Down
127 changes: 0 additions & 127 deletions ios/Classes/CustomisationUtils.swift

This file was deleted.

Loading

0 comments on commit bd55e20

Please sign in to comment.