邀请保存图片
@@ -403,6 +403,7 @@
|
||||
23E9EB312A85E5D100B792F2 /* pi_app_logo_new_bg.png in Resources */ = {isa = PBXBuildFile; fileRef = 23E9EB302A85E5D100B792F2 /* pi_app_logo_new_bg.png */; };
|
||||
23E9EB332A85E97C00B792F2 /* pi_login_new_logo.png in Resources */ = {isa = PBXBuildFile; fileRef = 23E9EB322A85E97B00B792F2 /* pi_login_new_logo.png */; };
|
||||
23EE96F22B9FF6BE00475D69 /* pi_crazy_zoo.svga in Resources */ = {isa = PBXBuildFile; fileRef = 23EE96F12B9FF6BE00475D69 /* pi_crazy_zoo.svga */; };
|
||||
23EE970A2BA2D39C00475D69 /* PIWebViewSavePhotoView.m in Sources */ = {isa = PBXBuildFile; fileRef = 23EE97092BA2D39C00475D69 /* PIWebViewSavePhotoView.m */; };
|
||||
23FF255B2AB956D50064E904 /* pi_home_new_pk.svga in Resources */ = {isa = PBXBuildFile; fileRef = 23FF255A2AB956D50064E904 /* pi_home_new_pk.svga */; };
|
||||
23FF25622ABAE6310064E904 /* pi_room_game_fine_love.svga in Resources */ = {isa = PBXBuildFile; fileRef = 23FF25612ABAE6310064E904 /* pi_room_game_fine_love.svga */; };
|
||||
23FF25652ABC3B3C0064E904 /* XPHomeGameView.m in Sources */ = {isa = PBXBuildFile; fileRef = 23FF25642ABC3B3B0064E904 /* XPHomeGameView.m */; };
|
||||
@@ -2260,6 +2261,8 @@
|
||||
23E9EB302A85E5D100B792F2 /* pi_app_logo_new_bg.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = pi_app_logo_new_bg.png; sourceTree = "<group>"; };
|
||||
23E9EB322A85E97B00B792F2 /* pi_login_new_logo.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = pi_login_new_logo.png; sourceTree = "<group>"; };
|
||||
23EE96F12B9FF6BE00475D69 /* pi_crazy_zoo.svga */ = {isa = PBXFileReference; lastKnownFileType = file; path = pi_crazy_zoo.svga; sourceTree = "<group>"; };
|
||||
23EE97082BA2D39C00475D69 /* PIWebViewSavePhotoView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PIWebViewSavePhotoView.h; sourceTree = "<group>"; };
|
||||
23EE97092BA2D39C00475D69 /* PIWebViewSavePhotoView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PIWebViewSavePhotoView.m; sourceTree = "<group>"; };
|
||||
23FF255A2AB956D50064E904 /* pi_home_new_pk.svga */ = {isa = PBXFileReference; lastKnownFileType = file; path = pi_home_new_pk.svga; sourceTree = "<group>"; };
|
||||
23FF25612ABAE6310064E904 /* pi_room_game_fine_love.svga */ = {isa = PBXFileReference; lastKnownFileType = file; path = pi_room_game_fine_love.svga; sourceTree = "<group>"; };
|
||||
23FF25632ABC3B3B0064E904 /* XPHomeGameView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XPHomeGameView.h; sourceTree = "<group>"; };
|
||||
@@ -4359,6 +4362,8 @@
|
||||
E80E09AC2A41336500CD2BE7 /* XPWebViewNavView.m */,
|
||||
18E7B33026F317A20064BC9B /* XPWebViewController.h */,
|
||||
18E7B33126F317A20064BC9B /* XPWebViewController.m */,
|
||||
23EE97082BA2D39C00475D69 /* PIWebViewSavePhotoView.h */,
|
||||
23EE97092BA2D39C00475D69 /* PIWebViewSavePhotoView.m */,
|
||||
);
|
||||
path = YMWeb;
|
||||
sourceTree = "<group>";
|
||||
@@ -11275,6 +11280,7 @@
|
||||
1464C5F329A4C18000AF7C94 /* XPIAPRechargeViewController.m in Sources */,
|
||||
E85E7B662A4EC35A00B6D00A /* XPIncomeRecordGoldDetailsModel.m in Sources */,
|
||||
9B2EA7CC2804245500ED17BF /* XPAnchorPKPanelUserView.m in Sources */,
|
||||
23EE970A2BA2D39C00475D69 /* PIWebViewSavePhotoView.m in Sources */,
|
||||
2331C1B42A60F32D00E1D940 /* XPCandyTreeRankTableViewCell.m in Sources */,
|
||||
9B85B6DA279FDC5200A0A1AC /* XPUserCardSkillCollectionViewCell.m in Sources */,
|
||||
E85E7B0D2A4EB0D200B6D00A /* GuildSuperAdminInfoModel.m in Sources */,
|
||||
|
6
YuMi/Assets.xcassets/webView/Contents.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
22
YuMi/Assets.xcassets/webView/pi_webView_code_bottom.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "pi_webView_code_bottom@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "pi_webView_code_bottom@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
BIN
YuMi/Assets.xcassets/webView/pi_webView_code_bottom.imageset/pi_webView_code_bottom@2x.png
vendored
Normal file
After Width: | Height: | Size: 16 KiB |
BIN
YuMi/Assets.xcassets/webView/pi_webView_code_bottom.imageset/pi_webView_code_bottom@3x.png
vendored
Normal file
After Width: | Height: | Size: 27 KiB |
22
YuMi/Assets.xcassets/webView/pi_webView_code_btn_bg.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "pi_webView_code_btn_bg@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "pi_webView_code_btn_bg@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
BIN
YuMi/Assets.xcassets/webView/pi_webView_code_btn_bg.imageset/pi_webView_code_btn_bg@2x.png
vendored
Normal file
After Width: | Height: | Size: 3.2 KiB |
BIN
YuMi/Assets.xcassets/webView/pi_webView_code_btn_bg.imageset/pi_webView_code_btn_bg@3x.png
vendored
Normal file
After Width: | Height: | Size: 6.9 KiB |
22
YuMi/Assets.xcassets/webView/pi_webView_code_code_text.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "pi_webView_code_code_text@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "pi_webView_code_code_text@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
BIN
YuMi/Assets.xcassets/webView/pi_webView_code_code_text.imageset/pi_webView_code_code_text@2x.png
vendored
Normal file
After Width: | Height: | Size: 1.4 KiB |
BIN
YuMi/Assets.xcassets/webView/pi_webView_code_code_text.imageset/pi_webView_code_code_text@3x.png
vendored
Normal file
After Width: | Height: | Size: 3.1 KiB |
22
YuMi/Assets.xcassets/webView/pi_webView_code_top.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "pi_webView_code_top@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "pi_webView_code_top@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
BIN
YuMi/Assets.xcassets/webView/pi_webView_code_top.imageset/pi_webView_code_top@2x.png
vendored
Normal file
After Width: | Height: | Size: 67 KiB |
BIN
YuMi/Assets.xcassets/webView/pi_webView_code_top.imageset/pi_webView_code_top@3x.png
vendored
Normal file
After Width: | Height: | Size: 138 KiB |
22
YuMi/Assets.xcassets/webView/pi_webView_code_top_text.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "pi_webView_code_top_text@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "pi_webView_code_top_text@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
BIN
YuMi/Assets.xcassets/webView/pi_webView_code_top_text.imageset/pi_webView_code_top_text@2x.png
vendored
Normal file
After Width: | Height: | Size: 3.6 KiB |
BIN
YuMi/Assets.xcassets/webView/pi_webView_code_top_text.imageset/pi_webView_code_top_text@3x.png
vendored
Normal file
After Width: | Height: | Size: 5.9 KiB |
22
YuMi/Assets.xcassets/webView/share_save_icon.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "share_save_icon@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "share_save_icon@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
BIN
YuMi/Assets.xcassets/webView/share_save_icon.imageset/share_save_icon@2x.png
vendored
Normal file
After Width: | Height: | Size: 665 B |
BIN
YuMi/Assets.xcassets/webView/share_save_icon.imageset/share_save_icon@3x.png
vendored
Normal file
After Width: | Height: | Size: 1.1 KiB |
@@ -26,6 +26,8 @@ typedef enum : NSUInteger {
|
||||
XPShareItemTagCopyLink,
|
||||
///应用好友
|
||||
XPShareItemTagAppFriends,
|
||||
///保存到相册
|
||||
XPShareItemTagAppSaveAlbum,
|
||||
} XPShareItemTag;
|
||||
|
||||
@interface XPShareItem : NSObject
|
||||
|
@@ -12,6 +12,8 @@
|
||||
|
||||
@class XPShareView;
|
||||
@protocol XCShareViewDelegate <NSObject>
|
||||
///点击保存图片到相册
|
||||
- (void)shareView:(XPShareView *)shareView savePhoto:(XPShareInfoModel *)shareInfo;
|
||||
///点了取消分享
|
||||
- (void)shareViewDidClickCancel:(XPShareView *)shareView;
|
||||
///分享成功
|
||||
|
@@ -143,6 +143,13 @@
|
||||
[TTPopup dismiss];
|
||||
return;
|
||||
};
|
||||
if (item.type == XPShareItemTagAppSaveAlbum){
|
||||
[TTPopup dismiss];
|
||||
if (self.delegate && [self.delegate respondsToSelector:@selector(shareView:savePhoto:)]){
|
||||
[self.delegate shareView:self savePhoto:self.shareInfo];
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (item.type == XPShareItemTagAppFriends) {
|
||||
[TTPopup dismiss];
|
||||
XPMineShareViewController * shareVC = [[XPMineShareViewController alloc] init];
|
||||
@@ -187,15 +194,8 @@
|
||||
if (self.delegate && [self.delegate respondsToSelector:@selector(shareView:didSuccess:)]) {
|
||||
[self.delegate shareView:self didSuccess:self.shareInfo];
|
||||
}
|
||||
return;
|
||||
|
||||
// FBtype = PlatformOfLine;
|
||||
// [shareParams SSDKSetupLineParamsByText:encodedUrl image:nil type:SSDKContentTypeAuto];
|
||||
} else {
|
||||
title = YMLocalizedString(@"XPShareView3");
|
||||
platformType = SSDKPlatformTypeFacebook;
|
||||
FBtype = PlatformOfFB;
|
||||
content = YMLocalizedString(@"XPShareView4");
|
||||
[shareParams SSDKSetupFacebookParamsByText:title image:@"https://pic.lecheng163.com/ananLogo256.png" url:[NSURL URLWithString:urlString] urlTitle:@"title" urlName:@"name" attachementUrl:nil hashtag:@"#Piko" quote:@"Piko" shareType:SSDKFacebookShareTypeNative type:SSDKContentTypeWebPage];
|
||||
}
|
||||
if(item.type == XPShareItemTagFaceBook){
|
||||
FBSDKShareLinkContent*linkContent = [[FBSDKShareLinkContent alloc]init];
|
||||
|
@@ -52,5 +52,5 @@ typedef NS_ENUM(NSUInteger, GradientType) {
|
||||
|
||||
-(UIImage *)compressWithMaxLength:(NSUInteger)maxLength;
|
||||
- (UIImage *)roundedImageWithCornerRadius:(CGFloat)cornerRadius size:(CGSize)size;
|
||||
|
||||
+(UIImage *)getImageFromView:(UIView *)view;
|
||||
@end
|
||||
|
@@ -432,4 +432,23 @@
|
||||
UIGraphicsEndImageContext();
|
||||
return roundedImage;
|
||||
}
|
||||
+(UIImage *)getImageFromView:(UIView *)view {
|
||||
// 1. 创建一个新的图像上下文,大小与view的bounds相匹配
|
||||
UIGraphicsBeginImageContextWithOptions(view.bounds.size, view.opaque, 0.0);
|
||||
|
||||
// 2. 获取当前图像上下文
|
||||
CGContextRef context = UIGraphicsGetCurrentContext();
|
||||
|
||||
// 3. 将view的层级渲染到上下文中
|
||||
[view.layer renderInContext:context];
|
||||
|
||||
// 4. 从上下文中获取生成的图片
|
||||
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
|
||||
|
||||
// 5. 结束图像上下文
|
||||
UIGraphicsEndImageContext();
|
||||
|
||||
// 6. 返回生成的图片
|
||||
return image;
|
||||
}
|
||||
@end
|
||||
|
18
YuMi/Modules/YMWeb/PIWebViewSavePhotoView.h
Normal file
@@ -0,0 +1,18 @@
|
||||
//
|
||||
// PIWebViewSavePhotoView.h
|
||||
// YuMi
|
||||
//
|
||||
// Created by duoban on 2024/3/14.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface PIWebViewSavePhotoView : UIView
|
||||
@property(nonatomic,copy) NSString *text;
|
||||
@property(nonatomic,copy) UIImage *image;
|
||||
@property(nonatomic,copy) NSString *code;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
179
YuMi/Modules/YMWeb/PIWebViewSavePhotoView.m
Normal file
@@ -0,0 +1,179 @@
|
||||
//
|
||||
// PIWebViewSavePhotoView.m
|
||||
// YuMi
|
||||
//
|
||||
// Created by duoban on 2024/3/14.
|
||||
//
|
||||
|
||||
#import "PIWebViewSavePhotoView.h"
|
||||
@interface PIWebViewSavePhotoView()
|
||||
@property(nonatomic,strong) UIImageView *topView;
|
||||
@property(nonatomic,strong) UIImageView *bottomView;
|
||||
@property(nonatomic,strong) UIImageView *topTextImageView;
|
||||
@property(nonatomic,strong) UIView *bgCodeView;
|
||||
@property(nonatomic,strong) UIImageView *bgCodeText;
|
||||
@property(nonatomic,strong) UILabel *codeText;
|
||||
@property(nonatomic,strong) NetImageView *codeView;
|
||||
@property(nonatomic,strong) UILabel *tipView;
|
||||
@property(nonatomic,strong) UIButton *codeBtn;
|
||||
@end
|
||||
@implementation PIWebViewSavePhotoView
|
||||
|
||||
-(instancetype)initWithFrame:(CGRect)frame{
|
||||
self = [super initWithFrame:frame];
|
||||
if(self){
|
||||
[self installUI];
|
||||
[self installConstraints];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
-(void)installUI{
|
||||
[self addSubview:self.topView];
|
||||
[self addSubview:self.bottomView];
|
||||
[self addSubview:self.topTextImageView];
|
||||
[self addSubview:self.bgCodeView];
|
||||
[self.bgCodeView addSubview:self.bgCodeText];
|
||||
[self.bgCodeText addSubview:self.codeText];
|
||||
|
||||
[self.bgCodeView addSubview:self.codeView];
|
||||
[self.bgCodeView addSubview:self.tipView];
|
||||
|
||||
[self.bgCodeView addSubview:self.codeBtn];
|
||||
|
||||
}
|
||||
-(void)installConstraints{
|
||||
[self.topView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.leading.trailing.mas_equalTo(0);
|
||||
make.height.mas_equalTo(kGetScaleWidth(326));
|
||||
}];
|
||||
[self.bottomView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.leading.trailing.equalTo(self);
|
||||
make.top.mas_equalTo(kGetScaleWidth(303));
|
||||
make.height.mas_equalTo(kGetScaleWidth(509));
|
||||
}];
|
||||
[self.topTextImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.mas_equalTo(kGetScaleWidth(132));
|
||||
make.width.mas_equalTo(kGetScaleWidth(297));
|
||||
make.height.mas_equalTo(kGetScaleWidth(32.5));
|
||||
make.centerX.equalTo(self);
|
||||
}];
|
||||
[self.bgCodeView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.width.mas_equalTo(kGetScaleWidth(345));
|
||||
make.height.mas_equalTo(kGetScaleWidth(431));
|
||||
make.top.equalTo(self.topTextImageView.mas_bottom).mas_offset(kGetScaleWidth(186.5));
|
||||
make.centerX.equalTo(self);
|
||||
}];
|
||||
[self.bgCodeText mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.centerX.equalTo(self.bgCodeView);
|
||||
make.width.mas_equalTo(kGetScaleWidth(290));
|
||||
make.height.mas_equalTo(kGetScaleWidth(43));
|
||||
}];
|
||||
[self.codeText mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.mas_equalTo(kGetScaleWidth(3));
|
||||
make.bottom.mas_equalTo(-kGetScaleWidth(3));
|
||||
make.leading.trailing.equalTo(self.bgCodeText).inset(kGetScaleWidth(10));
|
||||
}];
|
||||
[self.codeView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.width.height.mas_equalTo(kGetScaleWidth(200));
|
||||
make.centerX.equalTo(self.bgCodeView);
|
||||
make.top.mas_equalTo(kGetScaleWidth(96));
|
||||
}];
|
||||
[self.tipView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.mas_equalTo(kGetScaleWidth(321));
|
||||
make.height.mas_equalTo(kGetScaleWidth(14));
|
||||
make.centerX.equalTo(self.bgCodeView);
|
||||
}];
|
||||
[self.codeBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.mas_equalTo(kGetScaleWidth(355));
|
||||
make.width.mas_equalTo(kGetScaleWidth(241));
|
||||
make.height.mas_equalTo(kGetScaleWidth(46));
|
||||
make.centerX.equalTo(self.bgCodeView);
|
||||
}];
|
||||
}
|
||||
-(void)setText:(NSString *)text{
|
||||
_text = text;
|
||||
_codeText.text = text;
|
||||
|
||||
}
|
||||
-(void)setImage:(UIImage *)image{
|
||||
_image = image;
|
||||
_codeView.image = _image;
|
||||
}
|
||||
|
||||
- (void)setCode:(NSString *)code{
|
||||
_code = code;
|
||||
NSString *text = [NSString stringWithFormat:@"%@%@",YMLocalizedString(@"PIWebViewSavePhotoView1"),_code];
|
||||
[_codeBtn setTitle:text forState:UIControlStateNormal];
|
||||
}
|
||||
#pragma mark - 懒加载
|
||||
- (UIImageView *)topView{
|
||||
if(!_topView){
|
||||
_topView = [UIImageView new];
|
||||
_topView.image = kImage(@"pi_webView_code_top");
|
||||
}
|
||||
return _topView;
|
||||
}
|
||||
|
||||
- (UIImageView *)bottomView{
|
||||
if(!_bottomView){
|
||||
_bottomView = [UIImageView new];
|
||||
_bottomView.image = kImage(@"pi_webView_code_bottom");
|
||||
}
|
||||
return _bottomView;
|
||||
}
|
||||
- (UIImageView *)topTextImageView{
|
||||
if(!_topTextImageView){
|
||||
_topTextImageView = [UIImageView new];
|
||||
_topTextImageView.image = kImage(@"pi_webView_code_top_text");
|
||||
}
|
||||
return _topTextImageView;
|
||||
}
|
||||
- (UIImageView *)bgCodeText{
|
||||
if(!_bgCodeText){
|
||||
_bgCodeText = [UIImageView new];
|
||||
_bgCodeText.image = kImage(@"pi_webView_code_code_text");
|
||||
}
|
||||
return _bgCodeText;
|
||||
}
|
||||
- (UIView *)bgCodeView{
|
||||
if(!_bgCodeView){
|
||||
_bgCodeView = [UIView new];
|
||||
_bgCodeView.layer.cornerRadius = kGetScaleWidth(20);
|
||||
_bgCodeView.layer.masksToBounds = YES;
|
||||
_bgCodeView.backgroundColor = [UIColor whiteColor];
|
||||
}
|
||||
return _bgCodeView;
|
||||
}
|
||||
- (UILabel *)codeText{
|
||||
if(!_codeText){
|
||||
_codeText = [UILabel labelInitWithText:@"掃碼下載PiKO並填寫我的邀請碼\n立得1000钻石" font:kFontRegular(12) textColor:[UIColor whiteColor]];
|
||||
_codeText.textAlignment = NSTextAlignmentCenter;
|
||||
_codeText.numberOfLines = 0;
|
||||
}
|
||||
return _codeText;
|
||||
}
|
||||
|
||||
- (UILabel *)tipView{
|
||||
if(!_tipView){
|
||||
_tipView = [UILabel labelInitWithText:YMLocalizedString(@"PIWebViewSavePhotoView0") font:kFontRegular(10) textColor:UIColorFromRGB(0x999999)];
|
||||
}
|
||||
return _tipView;
|
||||
}
|
||||
- (UIButton *)codeBtn{
|
||||
if(!_codeBtn){
|
||||
_codeBtn = [UIButton new];
|
||||
NSString *text = [NSString stringWithFormat:@"%@GHT32",YMLocalizedString(@"PIWebViewSavePhotoView1")];
|
||||
[_codeBtn setTitle:text forState:UIControlStateNormal];
|
||||
_codeBtn.titleLabel.font = kFontRegular(16);
|
||||
[_codeBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
|
||||
[_codeBtn setBackgroundImage:kImage(@"pi_webView_code_btn_bg") forState:UIControlStateNormal];
|
||||
}
|
||||
return _codeBtn;
|
||||
}
|
||||
- (NetImageView *)codeView{
|
||||
if(!_codeView){
|
||||
_codeView = [NetImageView new];
|
||||
}
|
||||
return _codeView;
|
||||
}
|
||||
@end
|
@@ -30,6 +30,9 @@
|
||||
#import "XPIAPRechargeViewController.h"
|
||||
#import "SessionViewController.h"
|
||||
#import "XPMonentTopicContainerViewController.h"
|
||||
|
||||
#import "PIWebViewSavePhotoView.h"
|
||||
|
||||
typedef NS_ENUM(NSUInteger, RightNavigationPushType){
|
||||
///跳转h5页面
|
||||
RightNavigationPushType_Web = 1,
|
||||
@@ -77,6 +80,9 @@ typedef NS_ENUM(NSUInteger, RightNavigationPushType){
|
||||
@property (nonatomic, strong) WKUserContentController *pi_userContentController;
|
||||
///分享的内容
|
||||
@property (nonatomic,copy) NSDictionary *shareDic;
|
||||
///分享的内容
|
||||
@property (nonatomic,copy) NSDictionary *savePhotoDic;
|
||||
|
||||
///
|
||||
@property (nonatomic,strong) XPWebViewNavView *navView;
|
||||
///
|
||||
@@ -103,7 +109,7 @@ NSString * const kJSOpenRoom = @"openRoom";
|
||||
NSString * const kJSOpenRoomForGiftId = @"openRoomForGiftId";
|
||||
NSString * const kJSOpenChatPage = @"geToChatPage";
|
||||
NSString * const kJSOpenAppConcernedChat = @"openAppConcernedChat";
|
||||
|
||||
NSString * const kJSSavePictureShare = @"savePictureShare";
|
||||
|
||||
@implementation XPWebViewController
|
||||
|
||||
@@ -130,8 +136,37 @@ NSString * const kJSOpenAppConcernedChat = @"openAppConcernedChat";
|
||||
[super viewDidLoad];
|
||||
[self initView];
|
||||
|
||||
|
||||
|
||||
}
|
||||
- (void)saveImageToPhotoAlbum:(NSDictionary *)data{
|
||||
[self showLoading];
|
||||
NSString *qrCodeUrl = data[@"qrCodeUrl"];
|
||||
NetImageView *imageView = [NetImageView new];
|
||||
[imageView loadImageWithUrl:qrCodeUrl completion:^(UIImage * _Nonnull image, NSURL * _Nonnull url) {
|
||||
[self hideHUD];
|
||||
NSString *text = data[@"text"];
|
||||
NSString *invitationCode = data[@"invitationCode"];
|
||||
PIWebViewSavePhotoView *saveView = [[PIWebViewSavePhotoView alloc]initWithFrame:CGRectMake(0, 0, KScreenWidth, KScreenHeight)];
|
||||
saveView.text = text;
|
||||
saveView.image = image;
|
||||
saveView.code = invitationCode;
|
||||
UIImage *saveImage = [UIImage getImageFromView:saveView];
|
||||
UIImageWriteToSavedPhotosAlbum(saveImage, self, @selector(image:didFinishSavingWithError:contextInfo:), NULL);
|
||||
}];
|
||||
|
||||
|
||||
}
|
||||
|
||||
//指定回调方法
|
||||
- (void)image: (UIImage *)image didFinishSavingWithError:(NSError *)error contextInfo:(void *)contextInfo{
|
||||
|
||||
NSString *msg = YMLocalizedString(@"PIWebViewSavePhotoView2");
|
||||
if(error != NULL){
|
||||
msg = YMLocalizedString(@"PIWebViewSavePhotoView3");
|
||||
}
|
||||
[self showSuccessToast:msg];
|
||||
}
|
||||
- (void)initView {
|
||||
if (self.navigationController.viewControllers.count > 1){
|
||||
UIBarButtonItem *leftBarButtonItem = [[UIBarButtonItem alloc]initWithImage:[UIImage imageNamed:@"common_nav_back"] style:UIBarButtonItemStylePlain target:self action:@selector(backButtonClick)];
|
||||
@@ -430,6 +465,18 @@ NSString * const kJSOpenAppConcernedChat = @"openAppConcernedChat";
|
||||
});
|
||||
}
|
||||
|
||||
}else if ([message.name isEqualToString:kJSSavePictureShare]){
|
||||
if ([message.body isKindOfClass:[NSDictionary class]]){
|
||||
NSDictionary *bodyDic = message.body;
|
||||
NSString *type = bodyDic[@"type"];
|
||||
if ([type isEqualToString:@"1"]){
|
||||
[self saveImageToPhotoAlbum:bodyDic];
|
||||
return;
|
||||
}
|
||||
self.savePhotoDic = bodyDic;
|
||||
[self showShareSavePhote];
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}];
|
||||
@@ -530,7 +577,31 @@ NSString * const kJSOpenAppConcernedChat = @"openAppConcernedChat";
|
||||
[self.navigationController pushViewController:webVC animated:YES];
|
||||
}
|
||||
}
|
||||
-(void)showShareSavePhote{
|
||||
if (self.savePhotoDic.allKeys.count <= 0) {
|
||||
return;
|
||||
}
|
||||
NSDictionary * dic = self.savePhotoDic;
|
||||
XPShareInfoModel * shareInfo = [[XPShareInfoModel alloc] init];
|
||||
shareInfo.shareContent = dic[@"shareText"];
|
||||
shareInfo.type = ShareType_H5;
|
||||
shareInfo.uid = [AccountInfoStorage instance].getUid;
|
||||
NSString *urlStr = ((NSString *)dic[@"toUrl"]).length > 0 ? dic[@"toUrl"] : @"";
|
||||
shareInfo.shareUrl = urlStr;
|
||||
XPShareItem *cycle = [XPShareItem itemWitTag:XPShareItemTagFaceBook title:@"FaceBook" imageName:@"share_fb" disableImageName:@"share_fb"];
|
||||
XPShareItem *wechat = [XPShareItem itemWitTag:XPShareItemTagLine title:@"Line" imageName:@"share_line" disableImageName:@"share_line"];
|
||||
XPShareItem *qq = [XPShareItem itemWitTag:XPShareItemTagCopyLink title:YMLocalizedString(@"XPWebViewNavView1") imageName:@"share_copy_link" disableImageName:@"share_copy_link"];
|
||||
XPShareItem *save = [XPShareItem itemWitTag:XPShareItemTagAppSaveAlbum title:YMLocalizedString(@"PIWebViewSavePhotoView4") imageName:@"share_save_icon" disableImageName:@"share_save_icon"];
|
||||
|
||||
NSArray * items = @[wechat,cycle, qq,save];
|
||||
CGFloat margin = 15;
|
||||
CGSize itemSize = CGSizeMake((KScreenWidth-2*margin)/4, 65);
|
||||
XPShareView *shareView = [[XPShareView alloc] initWithItems:items itemSize:itemSize shareInfo:shareInfo];
|
||||
shareView.delegate = self;
|
||||
|
||||
[TTPopup popupView:shareView style:TTPopupStyleActionSheet];
|
||||
|
||||
}
|
||||
- (void)showSharePanel {
|
||||
if (self.shareDic.allKeys.count <= 0) {
|
||||
return;
|
||||
@@ -554,7 +625,9 @@ NSString * const kJSOpenAppConcernedChat = @"openAppConcernedChat";
|
||||
XPShareItem *cycle = [XPShareItem itemWitTag:XPShareItemTagFaceBook title:@"FaceBook" imageName:@"share_fb" disableImageName:@"share_fb"];
|
||||
XPShareItem *wechat = [XPShareItem itemWitTag:XPShareItemTagLine title:@"Line" imageName:@"share_line" disableImageName:@"share_line"];
|
||||
XPShareItem *qq = [XPShareItem itemWitTag:XPShareItemTagCopyLink title:YMLocalizedString(@"XPWebViewNavView1") imageName:@"share_copy_link" disableImageName:@"share_copy_link"];
|
||||
NSArray * items = @[wechat,cycle, qq];
|
||||
XPShareItem *save = [XPShareItem itemWitTag:XPShareItemTagAppSaveAlbum title:YMLocalizedString(@"PIWebViewSavePhotoView4") imageName:@"share_save_icon" disableImageName:@"share_save_icon"];
|
||||
|
||||
NSArray * items = @[wechat,cycle, qq,save];
|
||||
CGFloat margin = 15;
|
||||
CGSize itemSize = CGSizeMake((KScreenWidth-2*margin)/4, 65);
|
||||
XPShareView *shareView = [[XPShareView alloc] initWithItems:items itemSize:itemSize shareInfo:shareInfo];
|
||||
@@ -565,6 +638,9 @@ NSString * const kJSOpenAppConcernedChat = @"openAppConcernedChat";
|
||||
}
|
||||
|
||||
#pragma mark - XCShareViewDelegate
|
||||
- (void)shareView:(XPShareView *)shareView savePhoto:(XPShareInfoModel *)shareInfo{
|
||||
[self saveImageToPhotoAlbum:self.savePhotoDic];
|
||||
}
|
||||
- (void)shareViewDidClickCancle:(XPShareView *)shareView {
|
||||
[TTPopup dismiss];
|
||||
}
|
||||
@@ -744,6 +820,8 @@ NSString * const kJSOpenAppConcernedChat = @"openAppConcernedChat";
|
||||
[_pi_userContentController addScriptMessageHandler:weakScriptMessageDelegate name:kJSOpenChatPage];
|
||||
///进入聊天并关注
|
||||
[_pi_userContentController addScriptMessageHandler:weakScriptMessageDelegate name:kJSOpenAppConcernedChat];
|
||||
///分享及保存
|
||||
[_pi_userContentController addScriptMessageHandler:weakScriptMessageDelegate name:kJSSavePictureShare];
|
||||
|
||||
}
|
||||
return _pi_userContentController;
|
||||
|
@@ -3184,6 +3184,12 @@
|
||||
"PIGuildAnchorIncomeSectionView1"="主播(钻石)";
|
||||
"PIGuildAnchorIncomeSectionView2"="房间(钻石)";
|
||||
"PIGuildAnchorIncomeSectionView3"="直播时长";
|
||||
///PIWebViewSavePhotoView
|
||||
"PIWebViewSavePhotoView0"="记得注册时填写邀请码哦~";
|
||||
"PIWebViewSavePhotoView1"="邀请码:";
|
||||
"PIWebViewSavePhotoView2"="保存图片成功";
|
||||
"PIWebViewSavePhotoView3"="保存图片失败";
|
||||
"PIWebViewSavePhotoView4"="保存邀请图片";
|
||||
///不能脚本生成的
|
||||
"App_Common_And" = "和";
|
||||
"App_Common_Male" = "男";
|
||||
|
@@ -3182,6 +3182,12 @@
|
||||
"PIGuildAnchorIncomeSectionView1"="主播(鉆石)";
|
||||
"PIGuildAnchorIncomeSectionView2"="房間(鉆石)";
|
||||
"PIGuildAnchorIncomeSectionView3"="直播時長";
|
||||
///PIWebViewSavePhotoView
|
||||
"PIWebViewSavePhotoView0"="記得註冊時填寫邀請碼哦~";
|
||||
"PIWebViewSavePhotoView1"="邀請碼:";
|
||||
"PIWebViewSavePhotoView2"="保存圖片成功";
|
||||
"PIWebViewSavePhotoView3"="保存圖片失敗";
|
||||
"PIWebViewSavePhotoView4"="保存邀請圖片";
|
||||
///不能腳本生成的
|
||||
"App_Common_And" = "和";
|
||||
"App_Common_Male" = "男";
|
||||
|