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) -> MiniApp
Parameters
settings
A 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
completionHandler
A 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
miniAppId
the identifier string of the Mini App you want information
completionHandler
A 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
appId
Mini AppId String value
version
optional Mini App version String value. If omitted the most recent one is picked
queryParams
Optional Query parameters that the host app would like to share while creating a mini app
completionHandler
A 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
messageInterface
Protocol implemented by the user that helps to communicate between Mini App and native application
adsDisplayer
a 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
appId
Mini AppId String value
permissionList
List 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
appId
Mini 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
appInfo
Mini App info object
queryParams
Optional Query parameters that the host app would like to share while creating a mini app
completionHandler
A 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
messageInterface
Protocol implemented by the user that helps to communicate between Mini App and native application
adsDisplayer
a 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
miniAppId
Mini AppId String value
miniAppVersion
Mini VersionId String value
completionHandler
A 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
miniAppId
Mini 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
token
Preview Token that is received after scanning QR code
completionHandler
Completion 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
navigationBarHeight
Navigation Bar height
screenHeight
Total Height of the screen
keyboardheight
Keyboard Height
-
Method to call when the Keyboard is hidden
Declaration
Swift
public func keyboardHidden(navigationBarHeight: CGFloat, screenHeight: CGFloat = 0, keyboardheight: CGFloat = 0)
Parameters
navigationBarHeight
Navigation Bar height
screenHeight
Total Height of the screen
keyboardheight
Keyboard 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
miniAppId
MiniApp 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
fileName
File name of the Bundle that you want to extract in MiniApp folder
miniAppId
MiniApp ID
versionId
Version ID
completionHandler
Status 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
appId
MiniApp ID
versionId
VersionID of the MiniApp
completionHandler
Completion 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) -> Bool
Parameters
appId
MiniApp ID
versionId
VersionID 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) -> MiniAppDisplayDelegate
Return 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.