# Mini-Program Information Management
This module primarily introduces APIs for obtaining Mini-Program information.
# 1. Search for Mini-Programs
Supported App Types
Mini-Program✅ Mini-Game✅ H5 Application✅
To search for Mini-Programs, two steps are required:
- Ensure the server information is configured during SDK initialization;
- Call this API to search for Mini-Programs.
/// Search for Mini-Programs
/// @param request The search request
/// @param completion The search result
- (void)searchAppletsWithRequest:(FATSearchAppletRequest *)request
completion:(void (^)(NSDictionary *result, FATError *aError))completion;
Example code:
FATSearchAppletRequest *searchRequest = [[FATSearchAppletRequest alloc] init];
searchRequest.apiServer = @"https://api.finclip.com";
searchRequest.text = @"Mini-Program";
[[FATClient sharedClient] searchAppletsWithRequest:searchRequest completion:^(NSDictionary *result, FATError *aError) {
NSLog(@"");
}];
# 2. Get Bound Mini-Program List
Supported App Types
Mini-Program✅ Mini-Game✅ H5 Application✅
Use this interface to query the list of Mini-Programs bound to the application with different parameters.
- (void)getBindAppletsWithRequest:(FATFetchBindAppletRequest *)request completion:(void (^)(FATFetchBindAppletResponse *response, FATError *aError))completion
FATFetchBindAppletRequest
| Property Name | Type | Description |
|---|---|---|
| apiServer | NSString | The server to which the Mini-Program belongs, required |
| appClass | NSString | The category of the Mini-Program, default is '' |
| appStatus | FATAppStatus | Mini-Program status type, enumeration value. 0: All; 1: Listed; 2: Unlisted; 3: Delisted |
| containForbiddenApp | BOOL | Whether the query result includes forbidden Mini-Programs, default is NO |
| pageNo | NSUInteger | Page number for paginated query, default is 1 |
| pageSize | NSUInteger | Page size for paginated query, default is 20 |
Return Value
FATFetchBindAppletResponse
| Property Name | Type | Description |
|---|---|---|
| items | NSArray<FATFetchBindApplet *> | List of Mini-Program objects |
| total | NSInteger | Total number of Mini-Programs meeting the criteria |
FATFetchBindApplet
| Property Name | Type | Description |
|---|---|---|
| apiServer | NSString | The server to which the Mini-Program belongs |
| miniAppId | NSString | Mini-Program ID |
| name | NSString | Mini-Program name |
| logo | NSString | Mini-Program logo |
| appClass | NSString | The category of the Mini-Program |
| displayStatus | FATAppStatus | Mini-Program status type, enumeration value. 0: All; 1: Listed; 2: Unlisted; 3: Delisted |
| isForbidden | BOOL | Whether the Mini-Program is forbidden |
| desc | NSString | Mini-Program introduction |
| detailDesc | NSString | Mini-Program detailed description |
Example code:
FATFetchBindAppletRequest *request = [[FATFetchBindAppletRequest alloc] init];
request.apiServer = @"https://api.finclip.com";
request.appClass = @"Finance";
request.pageNo = 0;
request.pageSize = 20;
request.appStatus = FATAppStatusListed;
[[FATClient sharedClient] getBindAppletsWithRequest:request completion:^(FATFetchBindAppletResponse *response, FATError *aError) {
NSLog(@"Get app associated Mini-Program list: %@--error:%@", response, aError);
}];
# 3. Get Mini-Program Object Information
Supported App Types
Mini-Program✅ Mini-Game✅ H5 Application✅
# 3.1 Get Currently Running Mini-Program Object Information
Get the currently running Mini-Program object information. Returns nil if no Mini-Program is in memory.
/// Get the currently running Mini-Program object
- (FATAppletInfo *)currentApplet;
Example code:
FATAppletInfo *appInfo = [[FATClient sharedClient] currentApplet];
# 3.2 Get Mini-Program Information
Supported App Types
Mini-Program✅ Mini-Game✅ H5 Application✅
Get Mini-Program information. First searches for the Mini-Program object information in memory; if not found, searches in local disk; returns nil if still not found.
/**
Get Mini-Program information by appletId
@param appletId Mini-Program id
@return Mini-Program information
*/
- (FATAppletInfo *)getAppletInfo:(NSString *)appletId;
Example code:
FATAppletInfo *appInfo = [[FATClient sharedClient] getAppletInfo:@"##appId##"];
# 4. Get Current WebView Information of Mini-Program
Supported App Types
Mini-Program✅ Mini-Game🚫 H5 Application🚫
# 4.1 Get Current webView URL
Returns nil if the current page is not loading H5; returns the NSURL corresponding to the H5 if it is loading H5.
/**
Get the URL of the currently loaded H5
Returns nil if the current Mini-Program page is not loading H5
*/
- (NSURL *)getCurrentWebViewURL;
# 4.2 Get Current webView UserAgent
/**
Get the userAgent of the current page's webView in the Mini-Program
*/
- (void)getCurrentWebViewUserAgentWithCompletion:(void (^)(NSString *userAgent, NSError * error))completionHandler;
# 4.3 Refresh Currently Loaded Web Page
/**
Refresh the currently loaded H5 page
Returns YES if the current Mini-Program page is loading H5 and the refresh is successful
Returns NO in other cases
*/
- (BOOL)reloadCurrentWebView;
# 5. Get Mini-Program Page Screenshot
Supported App Types
Mini-Program✅ Mini-Game🚫 H5 Application🚫
# 5.1 Get Mini-Program Cover Screenshot
Note: The screenshot for displaying the Mini-Program cover has an aspect ratio of 5:4. Captures starting from the position below the navigation bar (0, 0).
/**
Generate a screenshot of the current page
*/
- (UIImage*)getCurrentAppletImage;
# 5.2 Get Screenshot of Mini-Program Page with Specified Height
/**
Generate a screenshot of the current page with the specified height
*/
- (UIImage *)getDefaultCurrentAppletImage:(CGFloat)height;
# 6. Get List of Used Mini-Programs
Supported App Types
Mini-Program✅ Mini-Game✅ H5 Application✅
Get the list of all opened Mini-Programs. Deleted Mini-Programs are not included.
/**
Get local Mini-Programs
@return Mini-Program array <FATAppletInfo>
*/
- (NSArray *)getAppletsFromLocalCache;
# 7. Convert WeChat Mini-Program QR Code Information to FinClip Mini-Program
Supported App Types
Mini-Program✅ Mini-Game✅ H5 Application🚫
/// Parse WeChat Mini-Program QR code to get FinClip Mini-Program information
/// @param qrCode WeChat QR code
/// @param apiServer Parsing server URL
/// @param completion Result callback
- (void)parseAppletInfoFromWXQrCode:(NSString *)qrCode apiServer:(NSString *)apiServer completion:(void (^)(FATAppletSimpleInfo *appInfo, FATError *aError))completion;
The usage scenario for this API is when a Mini-Program is listed on both WeChat and FinClip services, it can be associated with the WeChat Mini-Program on the FinClip platform. At this time, the online QR code on the FinClip platform can be scanned and opened with WeChat, or scanned and opened with the FinClip App or other APPs integrated with the FinClip Mini-Program SDK.
The process is to first scan the QR code to get the QR code content, then call this interface to get the FinClip Mini-Program id, and finally call the API to open the Mini-Program.
# 8. Personal Information and Permission Management Page
Display the personal information and permissions used by the opened Mini-Programs (After version 2.40.3, this method can also be called via the [FATClient sharedClient].authApiManager object)
/// Open the Personal Information and Permission Management page
/// @param parentViewController The parent view controller; the Personal Information and Permission Management page will be modally presented on the parent controller
- (void)openPrivacyManage:(UIViewController *)parentViewController;
# 9. Get Mini-Program Favorite List
Supported App Types
Mini-Program✅ Mini-Game✅ H5 Application✅
/**
@brief Get Mini-Program favorite list
@param apiServer Server address
@param pageNo Page number (pass 0 to get all favorite Mini-Programs)
@param pageSize Page size (pass 0 to get all favorite Mini-Programs)
@param completion Callback for getting the Mini-Program favorite list
*/
- (void)getAppletFavoriteListWithApiServer:(NSString *)apiServer pageNo:(int)pageNo pageSize:(int)pageSize completion:(void (^)(NSDictionary *resultDict, FATError *error))completion;