Skip to content

Other Methods

1 handleOpenURL

In the mini progmini management, when you open an mini progmini using URL Scheme, you need to call this method in the (AppDelegate or SceneDelegate) proxy event of the App in order to open the specified mini progmini.

/*objectivec
 Handle URLs
 @param URL Specific URL routing
 URL format:${scheme}://applet/appid/${appId}?path=${path}&query=${encode ever queryDict}&apiServer=${apiServer}
 For example:fatae55433be2f62915://applet/appid/617bb42f530fb30001509b27?path=/packages/d/index&query=key%3Dvalue%26name%3Dtable&apiServer=https://www.finclip.com/
 Among them, there must be scheme and appId, such as:fatae55433be2f62915://applet/appid/617bb42f530fb30001509b27
 */
- (BOOL)handleOpenURL:(NSURL *)URL;

If you want to open your mini progmini in Safari browser or other App, you need to implement - (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey, id> *)optionsmethod.

Example code:

objective-c
- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options
{
    if ([[FATClient sharedClient] handleOpenURL:url]) {
        return YES;
    }
    return YES;
}

2 handleOpenUniversalLinkURL

If you want to open the mini progmini using the Universal Link method, you need to call the method in the appropriate proxy method.

objective-c
/*
 Dealing with Universal Link
 @param URL Universal Link URL
 URL format:${UniversalLink}?appid=${appId}&path=${path}&query=${encode ever queryDict}&apiServer=${apiServer}
 For example:https://www.finclip.com/mop/scattered-page/#/mop-download?appid=xx&query=xxx&path=xxx
 Among them, there must be UniversalLink and appId, such as:https://www.finclip.com/mop/scattered-page/#/mop-download?appid=xx
 */

- (BOOL)handleOpenUniversalLinkURL:(NSURL *)URL;

As with handleOpenURL above, if you want to support universal link to open mini programs. You must also implement the- (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void(^)(NSArray<id<UIUserActivityRestoring>> * __nullable restorableObjects))restorationHandlermethod.

Example code:

objective-c
- (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void (^)(NSArray<id<UIUserActivityRestoring>> * _Nullable))restorationHandler
{
    if ([userActivity.activityType isEqualToString:NSUserActivityTypeBrowsingWeb]) {
        NSURL *url = userActivity.webpageURL;
        NSLog(@"url = %@",url.absoluteString);
        return [[FATClient sharedClient] handleOpenUniversalLinkURL:url];
    }
    return YES;
}