utils/utils library
Exports for the utilities, new utils should be added here and this is the file that should be imported instead of the specific util file.
Functions
-
brighten(
Color c, [int percent = 10]) → Color - These are internal tools to birghten the color, used for tuning colors.
-
darken(
Color c, [int percent = 10]) → Color - These are internal tools to darken the color, used for tuning colors.
-
getConversationDetails(
PapercupsProps p, Conversation conversation, PapercupsCustomer customer, Function sc, {Client? client}) → Future< Conversation> - This function will get the conversation details that we need in order to join the room. The most important detail is the ID, and this will return a new conversation.
-
getCustomerDetails(
PapercupsProps p, PapercupsCustomer? c, Function? sc, {Client? client}) → Future< PapercupsCustomer> -
getCustomerDetailsFromMetadata(
PapercupsProps p, PapercupsCustomer? c, Function sc, {Client? client}) → Future< PapercupsCustomer> - This funtction is used to get the customer details from Papercups. This is the function responsible for finding the Customer's ID.
-
getCustomerHistory(
{required PapercupsProps props, PapercupsCustomer? c, required Function setCustomer, List< PapercupsMessage> ? messages, PhoenixChannel? conversationChannel, Function? setConversationChannel, Function? rebuild, PhoenixSocket? socket}) → Future<bool> - This function is used to get the history. It also initializes the necessary funtions if the customer is known.
-
getPastCustomerMessages(
PapercupsProps p, PapercupsCustomer c, {Client? client}) → Future< Map< String, dynamic> > - This function is used to get the past messages from the customer.
-
initChannels(
bool connected, PhoenixSocket socket, PhoenixChannel? channel, PapercupsProps props, bool canJoinConversation, Function setState) → dynamic - This function creates the necessary channels, sockets and rooms for papercups to communicate.
-
joinConversationAndListen(
{List< PapercupsMessage> ? messages, required String convId, required PhoenixChannel? conversation, required PhoenixSocket socket, required Function? setState, required Function setChannel}) → PhoenixChannel? - This function will join the channel and listen to new messages.
-
parseDateFromUTC(
String? time) → DateTime? - This function converts a sting in ISO8601 format into a DateTime object which is in UTC and then converts in into the local timezone. Used to convert times from the Papercups API. It assumes all times provided are in UTC or it will force them bo be.