VISA Concierge Android SDK

  • Version: 1.4.1

  • Min Android SDK: 21 (build version), 24 (supported version)

  • Theme: light, dark

  • Orientations: portrait, landscape

  • Languages: en, ru, kk

Configure dependency

To get the dependency, you first need to configure access to our repository.

  1. Install AWS CLI using this guide.

  2. Configure AWS CLI using the credentials provided by us. To do this, run the following command in your terminal.

aws configure

# After executing the command, you will be prompted to enter the following information
AWS Access Key ID [None]: <YOUR_ACCESS_KEY>
AWS Secret Access Key [None]: <YOUR_SECRET_KEY>
Default region name [None]: eu-central-1
Default output format [None]: json
  1. Add this configuration into the repositories block in your project's build.gradle|settings.gradle file.

maven {
  url = "https://infocus-346627266603.d.codeartifact.eu-central-1.amazonaws.com/maven/concierge-sdk/"
  credentials {
    username = "aws"
    // This script will obtain the authorization token using AWS CLI
    def command = "aws codeartifact get-authorization-token --domain infocus --domain-owner 346627266603 --region eu-central-1 --query authorizationToken --output text"
    def process = command.execute()
    process.waitFor()
    def token = process.text.trim()
    password = token
  }
}
  1. Add the dependency on the SDK to the project's build.gradle file in the dependencies block.

implementation("com.visa.concierge:concierge-android-sdk:<preferred_version>")
  1. The SDK uses some Java 8 APIs that are not available in Android SDK 24, so to enable devices with lower Android versions to u SDKse the, desugaring must be enabled. More detaist can be found here https://developer.android.com/studio/write/java8-support#library-desugaring

    android {
       ...
        compileOptions {
           ...
           isCoreLibraryDesugaringEnabled = true
        }
    }
    
    dependencies {
    	...
    	coreLibraryDesugaring("com.android.tools:desugar_jdk_libs:<latest_version>")
    }

Auth

The SDK is available only to authenticated users.

To start the authorization process, you need to implement the functional interface com.visa.concierge.auth.CredentialsProvider. The output of the implementation method of this interface should be a class implementing the interface com.visa.concierge.auth.Credentials. Currently, only one authentication method is available - using the client token. To obtain this token, your backend must have the appropriate API. In the implementation of the functional interface, you need to implement the logic for retrieving this token from your backend and passing it to the SDK in the appropriate format. To provide this token, you need to use the class com.visa.concierge.auth.ClientCredentials.

com.visa.concierge.auth.ClientCredentials has 2 parameters in the constructor:

  1. token - user token

  2. needRequestUserPhone - a flag indicating the necessity to request the user's phone number on the first SDK launch. If the flag is true - on first launch SDK will open an activation flow to request and activate the user's phone number, iffalse - it won't (by default, in the constructor with one parameter, this flag is false).

Note that different client tokens are used for the two different flows (with or without requesting the user's phone number).

  • Without requesting the phone number, the token obtained from /sdk/v1/user/getToken is used.

  • With requesting the phone number, the token obtained from /sdk/v1/user/getTokenById is used.

To reduce requests to your backend, the SDK caches the client token in the application memory(RAM), and in EncryptedSharedPreferences, relying on its expiration time.

EncryptedSharedPreferences are encrypted with a unique device-bound key, so they need to be excluded from automatic backups. To do this, you need to:

  1. In your AndroidManifest.xml file add attributes.

    <application ...
        android:fullBackupContent="@xml/backup_rules"
        android:dataExtractionRules="@xml/data_extraction_rules">
    </application>
  2. Create an XML file called backup_rules.xml in the res/xml/ directory with following content.

    <?xml version="1.0" encoding="utf-8"?>
    <full-backup-content>
        <exclude domain="sharedpref" path="concierge_sdk_enc_prefs.xml"/>
    </full-backup-content>
  3. Create an XML file called data_extraction_rules.xml in the res/xml/ directory with following content.

    <data-extraction-rules>
        <cloud-backup>
           <exclude domain="sharedpref" path="concierge_sdk_enc_prefs.xml"/>
        </cloud-backup>
        <device-transfer>
           <exclude domain="sharedpref" path="concierge_sdk_enc_prefs.xml"/>
        </device-transfer>
    </data-extraction-rules>

Setup and Init SDK

Sdk must be initialized before the first usage of UI components. This could be done in the Application class of your app.

Example of initialization

class MyApplicationKt : Application() {

	override fun onCreate() {
		super.onCreate()

		...

		// initialize SDK here
		ConciergeSdk.init(
			applicationContext = applicationContext,
			// functional interface for passing SDK credentials
			credentialsProvider = {
				// client token retrieval logic should be placed here
				//
				// this method will be called from background thread,
				// so you could safely perform API call here
				val response = yourBackendApi.getClientToken()
				
				ClientCredentials(token = response.clientToken)
			},
			config = conciergeConfig { configBuilder ->
				configBuilder
					// enable console logging
					.isDebugEnabled(true)
					// customize global screen background
					.backgroundTheme { bgTheme ->
						bgTheme
							.color(
								light = Color.WHITE,
								dark = Color.GRAY
							)
					}
					// customize chat theme
					.chatScreenTheme { chatTheme ->
						chatTheme
							//customize info screen theme
							.infoScreenTheme { infoTheme ->
								infoTheme
									// setup your logo icon for info screen
									.vendorLogo(
										light = R.drawable.ic_bank_logo,
										dark = R.drawable.ic_bank_logo
									)
								...
							}
							// customize client message theme
							.clientMessageTheme { messageTheme ->
								messageTheme
									.backgroundTint(
										light = applicationContext.getColor(R.color.white),
										dark = applicationContext.getColor(R.color.black)
									)
								...
							}
					}
				...
			}
		)

		...

	}

}

Configuration and Theming

All configuration and theme settings of the SDK are done using com.visa.concierge.ConciergeConfig.Builder. All themes are divided into two parts - dark and light. Switching between them occurs automatically following the dark-light mode of the operating system.

The tint of elements with dynamic colors is set using com.visa.concierge.ui.theme.TintStateList. This class has static methods that allow you to set the color for a specific state. Currently, there are 3 states:

  • normal - color in the normal state

  • disabled - color in the disabled state

  • checked - color in the selected state

Each screen, element, or group of elements can have individually customized fonts. The following parameters are available for font customization:

  • fontFamily - class that holds a list of font families

  • fontSize - font size

  • fontWeight - font weight from the specified family

  • lineHeight - paragraph height

  • letterSpacing - spacing between characters

Tip. Since typically one font family with different weights is used throughout the application, you can create a constant with com.visa.concierge.ui.theme.FontFamily and pass it to all design elements. The appropriate font from the family will be selected based on the fontWeight from the theme.

Theme elements

element
description

isDebugEnabled

enable/disable console logging

backgroundTheme

global screen background theme

topBarTheme

toolbar theme

navBarTheme

navigation bar theme

inputTheme

global input theme

progressIndicatorTheme

global progress indicator theme

ratingBarTheme

global rating bar theme

textTheme

global text theme

rippleTheme

global ripple theme

cardTheme

global card component theme

filledTextButtonTheme

global filled text button theme

outlinedTextButtonTheme

global outlined text button theme

filledIconButtonTheme

global filled icon button theme

infoDialogTheme

global info dialog theme

chatScreenTheme

chat screen theme

requestListScreenTheme

requests list screen theme

Background theme

element
description

color

background color

TopBar theme

element
description

backgroundColor

background color

buttonTint

button tint color

element
description

backgroundColor

background color

buttonTint

button tint color

indicatorColor

accent background color of selected icon

Input theme

element
description

cursorColor

cursor color

textHighlight

selected text highlight color

ProgressIndicator theme

element
description

color

indicator background color

trackColor

indicator track color

StepIndicator theme

element
description

stepTint

step color tint

doneIconColor

color of done icon for last step

RatingBar theme

element
description

selectedColor

color that represents the selected or "filled" part of the rating

unselectedColor

color that represents the unselected or "empty" part of the rating

Text theme

element
description

color

text color

Ripple theme

element
description

color

ripple color

alpha

ripple alpha

Card theme

element
description

backgroundColor

background color

contentColor

content color

Button theme

element
description

backgroundTint

background color

contentTint

content color

SingleActionDialog theme

element
description

backgroundColor

background color

confirmButtonTheme

confirm button theme

ChatScreen theme

element
description

infoScreenTheme

info screen theme

clientMessageTheme

client message theme

managerMessageTheme

manager message theme

dateSeparatorTheme

date separator theme

inputTheme

chat input theme

InfoScreen theme

element
description

logoBackground

logog background color

logoTint

logo tint color

vendorLogo

vendor logo icon resource

vendorLogoTintEnabled

enable/disable tint of vendor logo

Message theme

element
description

backgroundTint

background color

fileTheme

message file theme

textColor

text color

dateColor

date text color

avatarBackgroundTint

avatar background color

avatarContentTint

avatar content color

MessageFile theme

element
description

backgroundTint

background color

contentTint

tint of file icon/name

DateSeparator theme

element
description

backgroundTint

background color

textColor

text color

ChatInput theme

element
description

backgroundTint

background color

textTint

text color

emojiButtonTheme

emoji popup theme

sendButtonTheme

send button theme

attachButtonTheme

attach button theme

emojiPopupTheme

emoji button theme

attachDialogTheme

attach dialog theme

attachedItemTheme

attached item theme

EmojiPopup theme

element
description

backgroundTint

background color

buttonTint

button tint color

dividerTint

divider color

AttachDialog theme

element
description

backgroundTint

background color

buttonTint

button tint color

dividerTint

divider color

AttachedItem theme

element
description

backgroundTint

background color

contentTint

tint color of icon/text

cancelButtonTheme

cancell button theme

RequestListScreen theme

element
description

requestViewTheme

request card view theme

RequestView theme

element
description

backgroundColor

background color

unseenBadgeColor

unseen progress badge background color

unseenBadgeTextColor

unseen progress badge text color

titleTint

title color

dateTint

request creation date color

requestProgressTheme

request step indicator theme

Usage

There are 3 ways to integrate the SDK into your application:

  • Activity - using com.visa.concierge.ui.ConciergeActivity. This activity needs to be registered in your application's manifest.

  • Fragment - using com.visa.concierge.ui.ConciergeFragment.

  • Compose - using com.visa.concierge.ui.ConciergeEntryPoint().

For any of these methods, you will only need to define the navigation from your application to the SDK's entry point, and that's it.

Last updated