Package com.subaio.fintechbridge
Class BridgeManager
java.lang.Object
com.subaio.fintechbridge.BridgeManager
Singleton-class for managing global setup of BridgeViews. Before creating
views, `BridgeManager.getInstance().configure` and `BridgeManager.getInstance().setLanguage should
be invoked.
The manager automatically maintains a valid token and requests new ones using
the `TokenHandler.onTokenRequired` callback whenever necessary.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interface
final class
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
configure
(String baseUrl, String language, BridgeManager.TokenHandler tokenHandler, RequestHandler requestHandler, Map<String, String> customConfig, boolean allowExternalUrls, boolean allowShare, boolean allowDialogs, int initializationTimeoutMillis) Configure Subaio Manager to use specified configuration object.int
static BridgeManager
Shared instance of the Subaio Manager.boolean
Current language as a BCP-47 string.com.subaio.fintechbridge.TemplateHelper
getToken()
Token to be used by Subaio for all calls to Subaio backend.void
prewarm
(android.content.Context context) Read currently cached base-HTML/placeholder images.void
Force a refresh of the token.void
setCustomConfig
(Map<String, String> customConfig) void
setLanguage
(String language) Language to be used by all Subaio views as a BCP-47 string.void
setTokenHandler
(BridgeManager.TokenHandler tokenHandler) Start configuration flow with fluid interface.
-
Constructor Details
-
BridgeManager
public BridgeManager()
-
-
Method Details
-
getInstance
Shared instance of the Subaio Manager. Use this to set token and configure Subaio.- Returns:
- BridgeManager
-
configure
public void configure(@NonNull String baseUrl, @NonNull String language, @NonNull BridgeManager.TokenHandler tokenHandler, @NonNull RequestHandler requestHandler, Map<String, String> customConfig, boolean allowExternalUrls, boolean allowShare, boolean allowDialogs, int initializationTimeoutMillis) throws MalformedURLExceptionConfigure Subaio Manager to use specified configuration object. It is recommended to use the fluent interface accessible by calling startConfiguration instead of calling configure manually.- Parameters:
baseUrl
- URL pointing to root of Subaio template, e.g. if template is at `https://www.bar.foo/template`, then baseUrl should be `https://www.bar.foo`language
- BCP-47 language tagtokenHandler
- Handle requests for authentication tokensrequestHandler
- Request handler used for SSL pinning requestscustomConfig
- Custom named values (such as customizable colors) sent to the views.allowExternalUrls
- Allow opening of external urlsallowShare
- Allow sharing eventsallowDialogs
- Allow opening dialogs- Throws:
MalformedURLException
-
startConfiguration
Start configuration flow with fluid interface. Call .apply() to finish configuration. You must call setBaseUrl, setLanguage, setTokenHandler and setRequestHandler as part of the configuration. -
setLanguage
Language to be used by all Subaio views as a BCP-47 string. Assigning `language` automatically updates all views and triggers a token refetch if configure has already been called. If it is set to nil or not set, views will never exit their loading-state.- Parameters:
language
- Language code.
-
setCustomConfig
-
getLanguage
Current language as a BCP-47 string.- Returns:
- language code.
-
getCustomConfig
-
getToken
Token to be used by Subaio for all calls to Subaio backend. -
getTemplateHelper
public com.subaio.fintechbridge.TemplateHelper getTemplateHelper() -
setTokenHandler
-
getIsConfigured
public boolean getIsConfigured() -
getInitializationTimeoutMillis
public int getInitializationTimeoutMillis() -
refreshToken
public void refreshToken()Force a refresh of the token. This is necessary if the user changes authentication status (user logs out, user logs in, user is changed) to ensure that the token (or lack thereof) is correct. Only works after configure and setLanguage has been called. -
prewarm
public void prewarm(@NonNull android.content.Context context) Read currently cached base-HTML/placeholder images. If no cache exists, it is fetched asynchronously. Optionally call to avoid a flash of white when creating the very first BridgeView. If not called, this is automatically handled as part of view creation.
-