Customizing user information in authorization pop-up box
When a mini program requests user information, an authorization pop-up will appear. The host app can customize certain parts of this pop-up, including the profile image and username, as shown in the image below:
You can achieve this customization by overriding the fetchAppUserInfoWithScope method.
- (void)fetchAppUserInfoWithScope:(NSString *)scope block:(TMAAppFetchUserInfoBlock)block;
Sample code:
- (void)fetchAppUserInfoWithScope:(NSString *)scope block:(TMAAppFetchUserInfoBlock)block {
if (block) {
UIImage *defaultAvatar = [UIImage imageWithContentsOfFile:[[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"avatar.png"]];
UIImageView *avatarView = [[UIImageView alloc] initWithImage:defaultAvatar];
TMAAppUserInfo *userInfo = [TMAAppUserInfo new];
userInfo.avatarView = avatarView;
userInfo.nickName = @"SunWukong";
block(userInfo);
}
}
Customizing the userAgent in mini program WebView
Override the customUserAgent method to customize the user agent. Example code:
- (NSString *)customUserAgent:(NSString *)defaultUserAgent;
Customizing code scaning capability
The mini program SDK provides a default scan implementation (refer to the extension library support - Scan), and also offers an API for users to customize the scan capability.
- (void)scanCode:(NSDictionary *)scanPrams
navigationController:(UINavigationController *)navigationController
completionHandler:(MACommonCallback)completionHandler;
Monitoring mini program lifecycle
Override the lifeCycleForApp method to monitor the mini program lifecycle.
- (void)lifeCycleForApp:(TMFMiniAppInfo *)appInfo type:(TMAAppLifeCycleType)type;
Customizing base library update strategy and monitoring
Override the canUpdateJSBaseLib method to monitor the update information of the mini program's base library.
- (BOOL)canUpdateJSBaseLib:(NSDictionary *)libInfo;
Was this page helpful?