Appearance
Mini Program More Menu Style Config
1. Effect show
Click on the "..." in the top right capsule This brings up the following more menu pages
2. Block the "Forward" button in the More menu
2.1 Coverage
This setting is implemented by the App, once set, all the mini programs in the App will be implemented according to this effect
2.2 iOS setup method
When initializing the SDK, the configuration is done through the UI configuration items as follows:
objective-c
FATUIConfig *uiConfig = [[FATUIConfig alloc] init];
//Block the "Forward" button in the More menu
uiConfig.hideForwardMenu = YES;
3. Block the "Settings" button in the More menu
3.1 Coverage
This setting is implemented by the App, once set, all the mini programs in the App will be implemented according to this effect
3.2 iOS setup method
When initializing the SDK, the configuration is done through the UI configuration items as follows.
objective-c
FATUIConfig *uiConfig = [[FATUIConfig alloc] init];
//Block the "Forward" button in the More menu
uiConfig.hideSettingMenu = YES;
4. Block the "Back to Home" button in the More menu
4.1 Coverage
This setting is implemented by the App, once set, all the mini programs in the App will be implemented according to this effect
4.2 iOS setup method
When initializing the SDK, the configuration is done through the UI configuration items as follows.
objective-c
FATUIConfig *uiConfig = [[FATUIConfig alloc] init];
//Block the "Back to Home" button in the More menu
uiConfig.hideBackToHome = YES;
5. Block the "Feedback & Complaints" button in the More menu
5.1 Coverage
This setting is implemented by the App, once set, all the mini programs in the App will be implemented according to this effect
5.2 iOS setup method
When initializing the SDK, the configuration is done through the UI configuration items as follows:
objective-c
FATUIConfig *uiConfig = [[FATUIConfig alloc] init];
//Block the "Feedback & Complaints" button in the More menu
uiConfig.hideFeedbackMenu = YES;
6.Block the "Re-enter" button in the More menu
6.1 Coverage
This setting is implemented by the App, once set, all the mini programs in the App will be implemented according to this effect
6.2 iOS setup method
When initializing the SDK, the configuration is done through the UI configuration items as follows:
objective-c
FATUIConfig *uiConfig = [[FATUIConfig alloc] init];
//Block the "Re-enter" button in the More menu
uiConfig.hideRefreshMenu = YES;
7. Implement more panels on your own
If you don't want to use the more panels provided by the SDK and want to customize the implementation of a more panel, you can do so as follows.
7.1 Coverage
This setting is implemented by the App, which can achieve different more panel effects for different mini program ids. The more panel is designed and implemented by the App, and the view style and menu items can be controlled by the App.
7.2 iOS setup method
Just implement appletInfo:didClickMoreBtnAtPath:
in FATAppletDelegate
.
First, customize a FATClientHelper
class that implements the FATAppletDelegate
protocol.
objective-c
#import <Foundation/Foundation.h>
#import <FinApplet/FinApplet.h>
@interface FATClientHelper : NSObject<FATAppletDelegate>
+ (instancetype)shareInstance;
@end
Then, after successful initialization of the SDK, set the SDK's proxy to the FATClientHelper
object.
Sample Code
objective-c
[[FATClient sharedClient] initWithConfig:config error:nil];
[FATClient sharedClient].delegate = [FATClientHelper shareInstance];
objective-c
- (BOOL)appletInfo:(FATAppletInfo *)appletInfo didClickMoreBtnAtPath:(NSString *)path
{
// If you need to customize more panels, write the logic to show more panels here and return YES.
// If you don't need to customize more panels, you can leave the method out or return NO.
return NO;
}
8. Self-injecting menu items in the More panel
The current SDK supports adding custom menu items to more panels, and menu items are classified by type as common and onMiniProgram types.
- common: This type does not require additional processing by the mini program
- onMiniProgram: This type gets data from the mini program when the menu is clicked to provide business processing to the app.
Tips
- Custom menu items can be configured by the admin backend to be displayed or not, and the menu ID configured by the admin backend should correspond to the custom menu ID. If the admin background is not configured, it will not affect the menu injected in the App side. 2.
- onMiniProgram type menu, if you want to display it, you must implement on{MenuId}ButtonHandler(id is initial capitalization) in the current page, for example, if the menu ID is ShareDingDing, the method name to implement is onShareDingDingButtonHandler. 3.
- the menu items displayed in the final more panel are taken from the intersection of the menu items returned by the admin backend, the menu items injected by the app, and the menu items implemented in the current page of the mini program.
As an example: If the set of menu item events implemented on the current page of the mini program is A;
A collection of menu items injected by App as B, containing collection B1 for menus of type common and collection B2 for menus of type onMiniProgram;
The collection of menus configured by the administration backend is C;
The final result of the custom menu collection displayed, in two cases:
1)If C is empty (null for Android, nil for iOS), then
A and B2 take the intersection to obtain D;
D and B1 are combined to obtain E;
The final result is E.
2)If C is not null (not null for Android, not nil for iOS), then:
A and B2 take the intersection to obtain D;
D and B1 are combined to obtain E;
E and C take the intersection to obtain F;
The final result is F.
Tips
- If C is [], it means that all custom menus are not displayed.
- For the work to be done on the mini program side, refer to mini program-API-custom menu
- Why take the intersection? Since the behavior of the custom menu needs to be implemented by the App, if it is only configured by the backend, it will result in a situation where the menu is displayed and the click is not responsive.
8.1 Coverage
This setting is implemented by the App and can be used to inject different custom menu items in the more panel of the SDK for different mini program ids.
8.2 iOS Setting method
Just implement customMenusInApplet:atPath:
and customMenu:inApplet:didClickAtPath:
in FATAppletDelegate
.
First, customize a FATClientHelper
class that implements the FATAppletDelegate
protocol.
objective-c
#import <Foundation/Foundation.h>
#import <FinApplet/FinApplet.h>
@interface FATClientHelper : NSObject<FATAppletDelegate>
+ (instancetype)shareInstance;
@end
Then, after successful initialization of the SDK, set the SDK's proxy to the FATClientHelper
object.
Sample Code
objective-c
[[FATClient sharedClient] initWithConfig:config error:nil];
[FATClient sharedClient].delegate = [FATClientHelper shareInstance];
Then, to implement the custom menu Model, you need to implement the FATAppletMenuProtocol
protocol.
objective-c
@interface FATCustomMenuModel : NSObject<FATAppletMenuProtocol>
@end
objective-c
// Returns the menu object to be injected, the menu object must implement the FATAppletMenuProtocol protocol
// Menu objects are of two types (Common by default):
// 1.Common type: Configuration then display
// 2.OnMiniProgram type: need background configuration + mini program configuration, take the same menuId collection display
// PS: Here is compatible with the old version, if the backend is not upgraded version, or the backend is not configured after upgrading the version, you only need to adapt the menuId of the menu object to NSString type
- (NSArray<id<FATAppletMenuProtocol>> *)customMenusInApplet:(FATAppletInfo *)appletInfo atPath:(NSString *)path
{
FATCustomMenuModel *favModel1 = [[FATCustomMenuModel alloc] init];
favModel1.menuId = @"WXShareAPPFriends";
favModel1.menuTitle = @"WeChat Friends";
favModel1.menuIconImage = [UIImage imageNamed:@"mini_menu_chat"];
favModel1.menuType = FATAppletMenuStyleOnMiniProgram;//For menu types that need to interact with the mini program, such as the share mini program button, when you click the button to share the mini program, you may need to get some data of the mini program
// Default is normal menu type, no need to have interaction with the mini program
FATCustomMenuModel *favModel2 = [[FATCustomMenuModel alloc] init];
favModel2.menuId = @"1002";
favModel2.menuTitle = @"WeChat Friend Circle";
favModel2.menuIconImage = [UIImage imageNamed:@"mini_menu_timeline"];
return @[favModel1, favModel2];
}
// Event when custom menu is clicked (old version, used when backend is not upgraded or menu is not configured after upgrade)
- (void)customMenu:(id<FATAppletMenuProtocol>)customMenu inApplet:(FATAppletInfo *)appletInfo didClickAtPath:(NSString *)path
{
NSLog(@"Clicked%@",customMenu.menuTitle);
NSLog(@"path = %@",path);
}
// Events when clicking on custom menus (new version, used when backend is configured with mini programs)
- (void)clickCustomItemMenuWithInfo:(NSDictionary *)contentInfo completion:(void (^)(FATExtensionCode, NSDictionary *))completion
{
/**
contentInfo contains
{
@"title": @"title",
@"description": @"description",
@"imageUrl": @"image path",
@"path": @"Path to mini program page when clicked"",
@"menuId": @"Clicked menu button identifier",
@"params": self.params // raw parameter data, provided by the mini program
}
*/
// mini program callback call to notify mini program click event processing
completion(FATExtensionCodeSuccess, contentInfo);
}