add 转发示例、自定义更多菜单示例、设置灰度信息示例

master
wanghualei 2020-12-18 09:28:26 +08:00
parent e24fbd2d04
commit 59902cdf56
13 changed files with 233 additions and 5 deletions

View File

@ -7,13 +7,15 @@
objects = { objects = {
/* Begin PBXBuildFile section */ /* Begin PBXBuildFile section */
8A8D5069EEC4CE9564C7B391 /* libPods-demo.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 28A582EE796CD12C1FF4F5DB /* libPods-demo.a */; };
9DD565BE23EC45080011FC4A /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 9DD565BD23EC45080011FC4A /* AppDelegate.m */; }; 9DD565BE23EC45080011FC4A /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 9DD565BD23EC45080011FC4A /* AppDelegate.m */; };
9DD565C423EC45080011FC4A /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9DD565C323EC45080011FC4A /* ViewController.m */; }; 9DD565C423EC45080011FC4A /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9DD565C323EC45080011FC4A /* ViewController.m */; };
9DD565C923EC450A0011FC4A /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 9DD565C823EC450A0011FC4A /* Assets.xcassets */; }; 9DD565C923EC450A0011FC4A /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 9DD565C823EC450A0011FC4A /* Assets.xcassets */; };
9DD565CC23EC450A0011FC4A /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 9DD565CA23EC450A0011FC4A /* LaunchScreen.storyboard */; }; 9DD565CC23EC450A0011FC4A /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 9DD565CA23EC450A0011FC4A /* LaunchScreen.storyboard */; };
9DD565CF23EC450A0011FC4A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 9DD565CE23EC450A0011FC4A /* main.m */; }; 9DD565CF23EC450A0011FC4A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 9DD565CE23EC450A0011FC4A /* main.m */; };
A823321F258C3B7000C1B2D5 /* FINDemoClientHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = A823321D258C3B7000C1B2D5 /* FINDemoClientHelper.m */; };
A863B745257A09A300959AA1 /* FINExtensionHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = A863B744257A09A300959AA1 /* FINExtensionHelper.m */; }; A863B745257A09A300959AA1 /* FINExtensionHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = A863B744257A09A300959AA1 /* FINExtensionHelper.m */; };
A8BC097A258BA095001289A3 /* FINCustomMenuModel.m in Sources */ = {isa = PBXBuildFile; fileRef = A8BC0979258BA095001289A3 /* FINCustomMenuModel.m */; };
FBF7F422A6EA50C856DB84F7 /* libPods-demo.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 28A582EE796CD12C1FF4F5DB /* libPods-demo.a */; };
/* End PBXBuildFile section */ /* End PBXBuildFile section */
/* Begin PBXFileReference section */ /* Begin PBXFileReference section */
@ -28,8 +30,12 @@
9DD565CB23EC450A0011FC4A /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; }; 9DD565CB23EC450A0011FC4A /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
9DD565CD23EC450A0011FC4A /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; }; 9DD565CD23EC450A0011FC4A /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
9DD565CE23EC450A0011FC4A /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; }; 9DD565CE23EC450A0011FC4A /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
A823321D258C3B7000C1B2D5 /* FINDemoClientHelper.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FINDemoClientHelper.m; sourceTree = "<group>"; };
A823321E258C3B7000C1B2D5 /* FINDemoClientHelper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FINDemoClientHelper.h; sourceTree = "<group>"; };
A863B743257A09A200959AA1 /* FINExtensionHelper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FINExtensionHelper.h; sourceTree = "<group>"; }; A863B743257A09A200959AA1 /* FINExtensionHelper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FINExtensionHelper.h; sourceTree = "<group>"; };
A863B744257A09A300959AA1 /* FINExtensionHelper.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FINExtensionHelper.m; sourceTree = "<group>"; }; A863B744257A09A300959AA1 /* FINExtensionHelper.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FINExtensionHelper.m; sourceTree = "<group>"; };
A8BC0978258BA095001289A3 /* FINCustomMenuModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FINCustomMenuModel.h; sourceTree = "<group>"; };
A8BC0979258BA095001289A3 /* FINCustomMenuModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FINCustomMenuModel.m; sourceTree = "<group>"; };
FBEBA7E73B95B66C846E76FF /* Pods-demo.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-demo.debug.xcconfig"; path = "Target Support Files/Pods-demo/Pods-demo.debug.xcconfig"; sourceTree = "<group>"; }; FBEBA7E73B95B66C846E76FF /* Pods-demo.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-demo.debug.xcconfig"; path = "Target Support Files/Pods-demo/Pods-demo.debug.xcconfig"; sourceTree = "<group>"; };
/* End PBXFileReference section */ /* End PBXFileReference section */
@ -38,7 +44,7 @@
isa = PBXFrameworksBuildPhase; isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
8A8D5069EEC4CE9564C7B391 /* libPods-demo.a in Frameworks */, FBF7F422A6EA50C856DB84F7 /* libPods-demo.a in Frameworks */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
@ -68,8 +74,12 @@
children = ( children = (
9DD565BC23EC45080011FC4A /* AppDelegate.h */, 9DD565BC23EC45080011FC4A /* AppDelegate.h */,
9DD565BD23EC45080011FC4A /* AppDelegate.m */, 9DD565BD23EC45080011FC4A /* AppDelegate.m */,
A823321E258C3B7000C1B2D5 /* FINDemoClientHelper.h */,
A823321D258C3B7000C1B2D5 /* FINDemoClientHelper.m */,
A863B743257A09A200959AA1 /* FINExtensionHelper.h */, A863B743257A09A200959AA1 /* FINExtensionHelper.h */,
A863B744257A09A300959AA1 /* FINExtensionHelper.m */, A863B744257A09A300959AA1 /* FINExtensionHelper.m */,
A8BC0978258BA095001289A3 /* FINCustomMenuModel.h */,
A8BC0979258BA095001289A3 /* FINCustomMenuModel.m */,
9DD565C223EC45080011FC4A /* ViewController.h */, 9DD565C223EC45080011FC4A /* ViewController.h */,
9DD565C323EC45080011FC4A /* ViewController.m */, 9DD565C323EC45080011FC4A /* ViewController.m */,
9DD565C823EC450A0011FC4A /* Assets.xcassets */, 9DD565C823EC450A0011FC4A /* Assets.xcassets */,
@ -211,6 +221,8 @@
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
9DD565C423EC45080011FC4A /* ViewController.m in Sources */, 9DD565C423EC45080011FC4A /* ViewController.m in Sources */,
A823321F258C3B7000C1B2D5 /* FINDemoClientHelper.m in Sources */,
A8BC097A258BA095001289A3 /* FINCustomMenuModel.m in Sources */,
A863B745257A09A300959AA1 /* FINExtensionHelper.m in Sources */, A863B745257A09A300959AA1 /* FINExtensionHelper.m in Sources */,
9DD565BE23EC45080011FC4A /* AppDelegate.m in Sources */, 9DD565BE23EC45080011FC4A /* AppDelegate.m in Sources */,
9DD565CF23EC450A0011FC4A /* main.m in Sources */, 9DD565CF23EC450A0011FC4A /* main.m in Sources */,
@ -347,6 +359,8 @@
buildSettings = { buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = 9QCKYFU5M4;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = demo/Info.plist; INFOPLIST_FILE = demo/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 9.0; IPHONEOS_DEPLOYMENT_TARGET = 9.0;
LD_RUNPATH_SEARCH_PATHS = ( LD_RUNPATH_SEARCH_PATHS = (
@ -365,6 +379,8 @@
buildSettings = { buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = 9QCKYFU5M4;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = demo/Info.plist; INFOPLIST_FILE = demo/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 9.0; IPHONEOS_DEPLOYMENT_TARGET = 9.0;
LD_RUNPATH_SEARCH_PATHS = ( LD_RUNPATH_SEARCH_PATHS = (

View File

@ -9,6 +9,7 @@
#import "AppDelegate.h" #import "AppDelegate.h"
#import "ViewController.h" #import "ViewController.h"
#import "FINExtensionHelper.h" #import "FINExtensionHelper.h"
#import "FINDemoClientHelper.h"
#import <FinApplet/FinApplet.h> #import <FinApplet/FinApplet.h>
@ -29,6 +30,8 @@
[[FATClient sharedClient] initWithConfig:config error:nil]; [[FATClient sharedClient] initWithConfig:config error:nil];
[FATClient sharedClient].delegate = [FINDemoClientHelper sharedHelper];
[FINExtensionHelper registerCustomApis]; [FINExtensionHelper registerCustomApis];
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];

View File

@ -1,6 +1,6 @@
{ {
"info" : { "info" : {
"version" : 1, "author" : "xcode",
"author" : "xcode" "version" : 1
} }
} }

View File

@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "minipro_list_collect@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "minipro_list_collect@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

View File

@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "minipro_list_service@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "minipro_list_service@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

View File

@ -0,0 +1,18 @@
//
// FINCustomMenuModel.h
// demo
//
// Created by Haley on 2020/12/17.
// Copyright © 2020 finogeeks. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <FinApplet/FinApplet.h>
NS_ASSUME_NONNULL_BEGIN
@interface FINCustomMenuModel : NSObject<FATAppletMenuProtocol>
@end
NS_ASSUME_NONNULL_END

View File

@ -0,0 +1,24 @@
//
// FINCustomMenuModel.m
// demo
//
// Created by Haley on 2020/12/17.
// Copyright © 2020 finogeeks. All rights reserved.
//
#import "FINCustomMenuModel.h"
@implementation FINCustomMenuModel
@synthesize menuId, menuIconImage, menuTitle;
- (id)copyWithZone:(NSZone *)zone
{
FINCustomMenuModel *model = [[FINCustomMenuModel allocWithZone:zone] init];
model.menuId = self.menuId;
model.menuIconImage = self.menuIconImage;
model.menuTitle = self.menuTitle;
return model;
}
@end

View File

@ -0,0 +1,17 @@
//
// FINClientHelper.h
// demo
//
// Created by Haley on 2020/12/17.
// Copyright © 2020 finogeeks. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <FinApplet/FinApplet.h>
@interface FINDemoClientHelper : NSObject<FATAppletDelegate>
+ (instancetype)sharedHelper;
@end

View File

@ -0,0 +1,106 @@
//
// FINClientHelper.m
// demo
//
// Created by Haley on 2020/12/17.
// Copyright © 2020 finogeeks. All rights reserved.
//
#import "FINDemoClientHelper.h"
#import "FINCustomMenuModel.h"
static FINDemoClientHelper *instance = nil;
@implementation FINDemoClientHelper
+ (instancetype)sharedHelper
{
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
instance = [[[self class] alloc] init];
});
return instance;
}
#pragma mark - FATAppletDelegate
- (void)forwardAppletWithInfo:(NSDictionary *)contentInfo completion:(void (^)(FATExtensionCode, NSDictionary *))completion
{
NSLog(@"小程序信息:%@", contentInfo);
// 1.appcontentInfoIM
// 2.appcontentInfo
}
///
/// @param appletId id
- (NSDictionary *)grayExtensionWithAppletId:(NSString *)appletId
{
if ([appletId isEqualToString:@"5facb3a52dcbff00017469bd"]) {
return @{@"phone":@(1234567890)};
}
if ([appletId isEqualToString:@"5fa214a29a6a7900019b5cc1"]) {
return @{@"token":@"xxxxxtoken"};
}
return @{@"key1":@"value1"};
}
#pragma mark - more menu
/// api
/// @param appletInfo
/// @param path
- (NSArray<id<FATAppletMenuProtocol>> *)customMenusInApplet:(FATAppletInfo *)appletInfo atPath:(NSString *)path
{
NSString *appletId = appletInfo.appId;
if ([appletId isEqualToString:@"5facb3a52dcbff00017469bd"]) {
FINCustomMenuModel *favModel1 = [[FINCustomMenuModel alloc] init];
favModel1.menuId = 1001;
favModel1.menuTitle = @"客服";
favModel1.menuIconImage = [UIImage imageNamed:@"minipro_list_service"];
return @[favModel1];
}
if ([appletId isEqualToString:@"5fa214a29a6a7900019b5cc1"]) {
FINCustomMenuModel *favModel2 = [[FINCustomMenuModel alloc] init];
favModel2.menuId = 1002;
favModel2.menuTitle = @"收藏";
favModel2.menuIconImage = [UIImage imageNamed:@"minipro_list_collect"];
return @[favModel2];
}
FINCustomMenuModel *favModel1 = [[FINCustomMenuModel alloc] init];
favModel1.menuId = 1001;
favModel1.menuTitle = @"客服";
favModel1.menuIconImage = [UIImage imageNamed:@"minipro_list_service"];
FINCustomMenuModel *favModel2 = [[FINCustomMenuModel alloc] init];
favModel2.menuId = 1002;
favModel2.menuTitle = @"收藏";
favModel2.menuIconImage = [UIImage imageNamed:@"minipro_list_collect"];
return @[favModel1, favModel2];
}
///
/// @param customMenu
/// @param appletInfo
/// @param path
- (void)customMenu:(id<FATAppletMenuProtocol>)customMenu inApplet:(FATAppletInfo *)appletInfo didClickAtPath:(NSString *)path
{
NSLog(@"自定义按钮被点击");
if (customMenu.menuId == 1001) {
NSLog(@"客服按钮被点击");
return;
}
if (customMenu.menuId == 1002) {
NSLog(@"收藏按钮被点击");
return;
}
}
@end