Applet Information Management
This module is mainly to get some Api introduction of applet information.
1. Search Applet
To search for applets, two steps are required:
- ensure that this server information is configured when the SDK is initialized.
- call the api to search for applets
/// Search for applets
/// @param request Search for request
/// @param completion Search results
- (void)searchAppletsWithRequest:(FATSearchAppletRequest *)request
completion:(void (^)(NSDictionary *result, FATError *aError))completion;Example code:
FATSearchAppletRequest *searchRequest = [[FATSearchAppletRequest alloc] init];
searchRequest.apiServer = @"https://api.PhizClip.com";
searchRequest.text = @"phizclip";
[[FATClient sharedClient] searchAppletsWithRequest:searchRequest completion:^(NSDictionary *result, FATError *aError) {
NSLog(@"");
}];2. Get applet object information
/// Gets the currently running applet object
- (FATAppletInfo *)currentApplet;3. Get the current WebView information of the applet
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.
/**
Gets the URL where H5 is currently loaded
If the applet is not currently loaded with H5, nil is returned
*/
- (NSURL *)getCurrentWebViewURL;3.2 Get the UserAgent of the current webView
/**
Gets the userAgent of the webView of the current page of the phizclip
*/
- (void)getCurrentWebViewUserAgentWithCompletion:(void (^)(NSString *userAgent, NSError * error))completionHandler;4. Get a screenshot of the applet page
Note: The screenshot generated here has an aspect ratio of 5:4 and is drawn from below the navigation bar (0, 0).
/**
Generate a screenshot of the current page
*/
- (UIImage*)getCurrentAppletImage;5. Get the list of used applets
Get the list of all opened applets, deleted applets are not included.
/**
Get the local applet
@return An array of <FATAppletInfo>applets
*/
- (NSArray *)getAppletsFromLocalCache;6. Convert Phiz applet QR code information to PhizClip applet
/// Parse the QR code of Phiz phizclip to get the information of Fantai phizclip
/// @param qrCode Phiz 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 applet is up on both Phiz and PhizClip services, it can be associated with the applet on Phiz on the PhizClip platform. The online version of the QR code on the PhizClip platform can be opened either by scanning the code with Phiz, or by scanning the code with Vantan Assistant or other APPs integrated with the PhizClip applet SDK.
The process is to scan the QR code first, get the QR code content, then call the interface to get the PhizClip applet id, and finally call the API to open the applet.