CNBBASMShareImpl.m
2.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
//
// CNBBASMShareImpl.m
// CNLiveNetAdd
//
// Created by CNLive on 2021/10/16.
// Copyright © 2021 cnlive. All rights reserved.
//
#import "CNBBASMShareImpl.h"
#import <CNLiveEnvironment/CNLiveEnvironment.h>
#import "CNBBASMJumpService.h"
#import <CNLiveBusinessTools/CNLiveEscpTools.h>
static NSString * const CNShareVideoImplementKeyVideoPath = @"videoPath";
static NSString * const CNShareVideoImplementFrameKeyTitle = @"title";
static NSString * const CNShareVideoImplementFrameKeyAppId = @"appId";
@implementation CNBBASMShareImpl
#pragma mark - Protocol Method
RegisterBBASMAdapter()
+ (void)shareContent:(NSDictionary *)content
callback:(void (^)(NSString * _Nonnull, NSString * _Nonnull))callback {
// 1.先获取分享的相关内容
// 分享标题
NSString *title = content[@"title"];
// 分享内容
NSString *sharecontent = content[@"content"];
// 分享图标
NSString *iconUrl = content[@"iconUrl"];
// 小程序页面链接
NSString *path = content[@"linkUrl"];
NSDictionary *appInfo = content[@"appInfo"];
path = [NSString stringWithFormat:@"%@/smartappLandingpage.html?title=%@&content=%@&imageUrl=%@&swanId=%@&type=smartapp",WjjH5_Host,title,sharecontent,iconUrl,[CNLiveEscpTools esp:[NSString stringWithFormat:@"%@/%@",appInfo[@"appID"],content[@"path"]]]];
NSString *mediaType = content[@"mediaType"];
NSDictionary *params = nil;
if (mediaType) {
params = @{
@"title":title,
@"shareDesc":sharecontent,
@"shareUrl":[path stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]],
@"shareImage":iconUrl,
@"shareType":mediaType,
};
}else{
params = @{
@"title":title,
@"shareDesc":sharecontent,
@"shareUrl":[path stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]],
@"shareImage":iconUrl,
};
}
[CNBBASMJumpService shareBBASMWithParams:params];
}
+ (void)shareGameVideoWithDict:(NSDictionary *)dict
completion:(void (^)(NSDictionary * _Nonnull, BBASMShareResult resultType))completion {
// 处理参数
// NSString *videoPath = [dict bba_stringValueForKey:CNShareVideoImplementKeyVideoPath];
// NSString *title = [dict bba_stringValueForKey:CNShareVideoImplementFrameKeyTitle];
// NSString *appId = [dict bba_stringValueForKey:CNShareVideoImplementFrameKeyAppId];
}
@end