Appearance
Mini Program Information Management
This module is mainly to get some Api introduction of mini program information.
1. Search mini program
To search for mini programs, two steps are required:
- ensure that this server information is configured when the SDK is initialized.
- call the api to search for mini programs
objective-c
/// Search for mini programs
/// @param request Search for request
/// @param completion Search results
- (void)searchAppletsWithRequest:(FATSearchAppletRequest *)request
completion:(void (^)(NSDictionary *result, FATError *aError))completion;
Example code:
objective-c
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 mini program object information
objective-c
/// Gets the currently running mini program object
- (FATAppletInfo *)currentApplet;
3. Get the current WebView information of the mini program
3.1 Get the URL of the current webView
If the current page is not loading an H5, nil is returned; if it is loading an H5, the NSURL corresponding to the H5 is returned.
objective-c
/**
Gets the URL where H5 is currently loaded
If the mini program is not currently loaded with H5, nil is returned
*/
- (NSURL *)getCurrentWebViewURL;
3.2 Get the UserAgent of the current webView
objective-c
/**
Gets the userAgent of the webView of the current page of the Mini Program
*/
- (void)getCurrentWebViewUserAgentWithCompletion:(void (^)(NSString *userAgent, NSError * error))completionHandler;
4. Get a screenshot of the mini program page
Note: The screenshot generated here has an aspect ratio of 5:4 and is drawn from below the navigation bar (0, 0).
objective-c
/**
Generate a screenshot of the current page
*/
- (UIImage*)getCurrentAppletImage;
5. Get the list of used mini programs
Get the list of all opened mini programs, deleted mini programs are not included.
objective-c
/**
Get the local mini programs
@return An array of <FATAppletInfo> mini programss
*/
- (NSArray *)getAppletsFromLocalCache;
6. Convert WeChat mini program QR code information to FinClip mini program
objective-c
/// Parse the QR code of WeChat Mini Program to get the information of Fantai Mini Program
/// @param qrCode WeChat QR code
/// @param apiServer Resolve the server URL
/// @param completion Result callback
- (void)parseAppletInfoFromWXQrCode:(NSString *)qrCode apiServer:(NSString *)apiServer completion:(void (^)(FATAppletSimpleInfo *appInfo, FATError *aError))completion;
The usage scenario of this API is that when an mini program is up on both WeChat and FinClip services, it can be associated with the mini program on WeChat on the FinClip platform. The online version of the QR code on the FinClip platform can be opened either by scanning the code with WeChat, or by scanning the code with Vantan Assistant or other APPs integrated with the FinClip mini program SDK.
The process is to scan the QR code first, get the QR code content, then call the interface to get the FinClip mini program id, and finally call the API to open the mini program.