MiniApp
public class MiniApp : NSObject
Mini App Public API methods
-
Undocumented
Declaration
Swift
public static let version: String -
Undocumented
Declaration
Swift
public static var MAOrientationLock: UIInterfaceOrientationMask -
Starts configuration and makes sure to load analytics Should be called in AppDelegate didLoad when the app starts
Declaration
Swift
public static func configure() -
Instance of MiniApp which uses the default config settings as defined in Info.plist. A MiniAppSdkConfig object can be provided to override this configuration
Declaration
Swift
public class func shared(with settings: MiniAppSdkConfig? = nil, navigationSettings: MiniAppNavigationConfig? = nil) -> MiniAppParameters
settingsA MiniAppSdkConfig object containing values to override default config settings.
-
Fetch the List of [MiniAppInfo] information. Error information will be returned if any problem while fetching from the backed
Declaration
Swift
public func list(completionHandler: @escaping (Result<[MiniAppInfo], MASDKError>) -> Void)Parameters
completionHandlerA block to be called when list of [MiniAppInfo] information is fetched. Completion blocks receives the following parameters
- [MiniAppInfo]: List of [MiniAppInfo] information.
- MASDKError: MASDKError details if fetching is failed.
-
Fetch the MiniAppInfo information for a given MiniApp id.
Declaration
Swift
public func info(miniAppId: String, miniAppVersion: String? = nil, completionHandler: @escaping (Result<MiniAppInfo, MASDKError>) -> Void)Parameters
miniAppIdthe identifier string of the Mini App you want information
completionHandlerA block to be called when MiniAppInfo information is fetched. Completion blocks receives the following parameters
- MiniAppInfo: MiniAppInfo information.
- MASDKError: MASDKError details if fetching is failed.
-
Create a Mini App for the given mini appId, Mini app will be downloaded and cached in local.
Declaration
Swift
@available(*, deprecated, message: "Use `MiniAppView` instead") public func create(appId: String, version: String? = nil, queryParams: String? = nil, completionHandler: @escaping (Result<MiniAppDisplayDelegate, MASDKError>) -> Void, messageInterface: MiniAppMessageDelegate, adsDisplayer: MiniAppAdDisplayer? = nil, fromCache: Bool? = false)Parameters
appIdMini AppId String value
versionoptional Mini App version String value. If omitted the most recent one is picked
queryParamsOptional Query parameters that the host app would like to share while creating a mini app
completionHandlerA block to be called on successful creation of [MiniAppView] or throws errors if any. Completion blocks receives the following parameters
- MiniAppDisplayProtocol: Protocol that helps the hosting application to communicate with the displayer module of the mini app. More like an interface for host app to interact with View component of mini app.
- MASDKError: MASDKError details if Mini App View creating is failed
messageInterfaceProtocol implemented by the user that helps to communicate between Mini App and native application
adsDisplayera MiniAppAdDisplayer that will handle Miniapp ads requests
-
Cache the Custom permissions status for a given MiniApp ID
Declaration
Swift
public func setCustomPermissions(forMiniApp appId: String, permissionList: [MASDKCustomPermissionModel])Parameters
appIdMini AppId String value
permissionListList of MASDKCustomPermissionModel class that contains the MiniAppCustomPermissionType and MiniAppCustomPermissionGrantedStatus
-
Get the list of supported Custom permissions and its status for a given Mini app ID
Declaration
Swift
public func getCustomPermissions(forMiniApp appId: String) -> [MASDKCustomPermissionModel]Parameters
appIdMini AppId String value
Return Value
List of MASDKCustomPermissionModel that contains the details of every custom permission type, status and description.
-
Gets the list of downloaded Mini apps info and associated custom permissions status
Declaration
Swift
@available(*, deprecated, message: "This will not be available from next major version") public func listDownloadedWithCustomPermissions() -> [(MiniAppInfo, [MASDKCustomPermissionModel])]Return Value
Dictionary of MiniAppInfo and respective custom permissions info
-
Creates a Mini App for the given mini app info object, Mini app will be downloaded and cached in local. This method should only be used in “Preview Mode”.
Declaration
Swift
@available(*, deprecated, message: "Use `MiniAppView` instead") public func create(appInfo: MiniAppInfo, queryParams: String? = nil, completionHandler: @escaping (Result<MiniAppDisplayDelegate, MASDKError>) -> Void, messageInterface: MiniAppMessageDelegate, adsDisplayer: MiniAppAdDisplayer? = nil, fromCache: Bool? = false)Parameters
appInfoMini App info object
queryParamsOptional Query parameters that the host app would like to share while creating a mini app
completionHandlerA block to be called on successful creation of [MiniAppView] or throws errors if any. Completion blocks receives the following parameters
- MiniAppDisplayProtocol: Protocol that helps the hosting application to communicate with the displayer module of the mini app. More like an interface for host app to interact with View component of mini app.
- MASDKError: MASDKError details if Mini App View creating is failed
messageInterfaceProtocol implemented by the user that helps to communicate between Mini App and native application
adsDisplayera MiniAppAdDisplayer that will handle Miniapp ads requests
-
Method to return the meta-data information of a mini-app
Declaration
Swift
public func getMiniAppManifest(miniAppId: String, miniAppVersion: String, languageCode: String? = nil, completionHandler: @escaping (Result<MiniAppManifest, MASDKError>) -> Void)Parameters
miniAppIdMini AppId String value
miniAppVersionMini VersionId String value
completionHandlerA block to be called on successful retrieval of mini-app meta data MiniAppManifest or throws errors if any
-
Method to return the cached meta-data information of a mini-app
Declaration
Swift
public func getDownloadedManifest(miniAppId: String) -> MiniAppManifest?Parameters
miniAppIdMini AppId String value
Return Value
MiniAppManifest object info from the cache, Returns nil, if the mini-app is not downloaded already.
-
Method to return the Preview MiniAppInfo
Declaration
Swift
public func getMiniAppPreviewInfo(using token: String, completionHandler: @escaping (Result<PreviewMiniAppInfo, MASDKError>) -> Void)Parameters
tokenPreview Token that is received after scanning QR code
completionHandlerCompletion handler that returns PreviewMiniAppInfo on successful retrieval or Error
-
Method to call when the Keyboard is shown
Declaration
Swift
public func keyboardShown(navigationBarHeight: CGFloat, screenHeight: CGFloat, keyboardheight: CGFloat)Parameters
navigationBarHeightNavigation Bar height
screenHeightTotal Height of the screen
keyboardheightKeyboard Height
-
Method to call when the Keyboard is hidden
Declaration
Swift
public func keyboardHidden(navigationBarHeight: CGFloat, screenHeight: CGFloat = 0, keyboardheight: CGFloat = 0)Parameters
navigationBarHeightNavigation Bar height
screenHeightTotal Height of the screen
keyboardheightKeyboard Height
-
Method which will delete/clears the Secure storage files for all the mini-apps that is downloaded
Declaration
Swift
public func clearAllSecureStorage() -
Method which will delete/clear secure storage for a specific MiniAppID
Declaration
Swift
public func clearSecureStorage(for miniAppId: String)Parameters
miniAppIdMiniApp ID
-
Unzip the provided archive file from bundle.
Declaration
Swift
public static func unzipMiniApp(fileName: String, miniAppId: String, versionId: String, completionHandler: ((Result<Bool, MASDKError>) -> Void)? = nil)Parameters
fileNameFile name of the Bundle that you want to extract in MiniApp folder
miniAppIdMiniApp ID
versionIdVersion ID
completionHandlerStatus of the Unzip feature
-
Download a specific MiniApp from the Platform, please note that the MiniApp should be available before start downloading
Declaration
Swift
public func downloadMiniApp(appId: String, versionId: String, completionHandler: @escaping (Result<Bool, MASDKError>) -> Void)Parameters
appIdMiniApp ID
versionIdVersionID of the MiniApp
completionHandlerCompletion handler that tells the status of the download
-
Check and return TRUE if the MiniApp is available for a given MiniAppID and VersionID. This method not only checks if the folder is available, but also checks if index.html is available.
Declaration
Swift
public static func isMiniAppCacheAvailable(appId: String, versionId: String) -> BoolParameters
appIdMiniApp ID
versionIdVersionID of the MiniApp
Return Value
TRUE if MiniApp is available
-
Declaration
Swift
@available(*, deprecated, message: "Use `MiniAppView` instead") func create(url: URL, queryParams: String? = nil, errorHandler: @escaping (MASDKError) -> Void, messageInterface: MiniAppMessageDelegate, adsDisplayer: MiniAppAdDisplayer? = nil) -> MiniAppDisplayDelegateReturn Value
MiniAppDisplayProtocol: Protocol that helps the hosting application to communicate with the displayer module of the mini app. More like an interface for host app to interact with View component of mini app.
MiniApp Class Reference