-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #33 from youzan/feature/upgrade_demo
upgrade demo
- Loading branch information
Showing
39 changed files
with
2,380 additions
and
175 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# | ||
# Be sure to run `pod spec lint YZOpenSDK.podspec' to ensure this is a | ||
# valid spec and to remove all comments including this before submitting the spec. | ||
# | ||
# To learn more about Podspec attributes see http://docs.cocoapods.org/specification.html | ||
# To see working Podspecs in the CocoaPods repo see https://github.com/CocoaPods/Specs/ | ||
# | ||
|
||
Pod::Spec.new do |s| | ||
|
||
s.name = "YZAppSDK" | ||
s.version = "7.2.62" | ||
s.summary = "An AppSDK for Youzanyun." | ||
s.description = 'There are praise cloud AppSDK is for mobile applications to build the electricity trading system' \ | ||
'through an SDK will be able to integrate in the APP to provide the entire transaction services.' | ||
s.homepage = "https://www.youzanyun.com/" | ||
s.license = "MIT" | ||
s.author = { "pansheng" => "[email protected]" } | ||
s.source = { :path => "./Release" } | ||
|
||
s.frameworks = 'WebKit', 'UIKit', 'Foundation' | ||
s.requires_arc = true | ||
|
||
s.ios.deployment_target = "11.0" | ||
s.default_subspec = 'Base' | ||
|
||
s.pod_target_xcconfig = { | ||
'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64' | ||
} | ||
s.user_target_xcconfig = { 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64' } | ||
|
||
s.subspec 'Core' do |core| | ||
core.ios.vendored_framework = 'YZSDKCore.framework' | ||
end | ||
|
||
s.subspec 'Base' do |base| | ||
base.ios.vendored_framework = 'YZBaseSDK.framework' | ||
base.dependency 'YZAppSDK/Core' | ||
|
||
end | ||
|
||
end | ||
|
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// | ||
// YZBaseSDK.h | ||
// YZBaseSDK | ||
// | ||
// Created by Pan on 2017/10/26. | ||
// Copyright © 2017年 Youzan. All rights reserved. | ||
// | ||
|
||
#import <UIKit/UIKit.h> | ||
|
||
//! Project version number for YZBase. | ||
FOUNDATION_EXPORT double YZBaseSDKVersionNumber; | ||
|
||
//! Project version string for YZBase. | ||
FOUNDATION_EXPORT const unsigned char YZBaseSDKVersionString[]; | ||
|
||
// In this header, you should import all the public headers of your framework using statements like #import <YZBase/PublicHeader.h> | ||
|
||
#import <YZBaseSDK/YZSDK.h> | ||
#import <YZBaseSDK/YZConfig.h> | ||
#import <YZBaseSDK/YZWebView.h> | ||
#import <YZBaseSDK/YZNotice.h> | ||
#import <YZBaseSDK/YZWebViewProtocol.h> | ||
#import <YZBaseSDK/YZIMWebViewController.h> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// | ||
// YZSDKConfig.h | ||
// YZBaseSDK | ||
// | ||
// Created by Pan on 2017/11/2. | ||
// Copyright © 2017年 Youzan. All rights reserved. | ||
// | ||
|
||
#import <UIKit/UIKit.h> | ||
|
||
|
||
NS_ASSUME_NONNULL_BEGIN | ||
|
||
/** | ||
SDK 配置类,包含对 SDK 的所有配置。 | ||
*/ | ||
@interface YZConfig : NSObject | ||
|
||
@property (nonatomic, readonly) NSString *clientId;/** 从有赞云申请的 clientId */ | ||
@property (nonatomic, readonly) NSString *appKey; /** 从有赞云申请的 appKey */ | ||
@property (nonatomic, copy, nullable) NSString *scheme;/**< App 的 Scheme, 设置后调用 h5 微信支付才能跳转回您的 App. 例如: wechat */ | ||
@property (nonatomic, assign) BOOL enableLog; /**< 是否开启控制台日志输出,默认为NO。仅在 DEBUG 模式下有效*/ | ||
@property (nonatomic, assign) BOOL hideTopBar; /** 是否隐藏TopBar,默认 NO**/ | ||
@property (nonatomic, assign) BOOL enableSocket; /** 是否开启应用内消息透传功能。 **/ | ||
@property (nonatomic, assign) BOOL disableDefaultLoading; /** 是否关闭默认加载动画,默认为NO */ | ||
@property (nonatomic, assign) BOOL dismissLoadingViewInDomReady; /**前端readyState == interactive 时机隐藏loading,否则默认页面加载完成时隐藏loading */ | ||
@property (nonatomic, strong) NSArray *customerLoadingImages; /** 默认加载动画替换,传入动图所有帧图片数组,建议 100*100 */ | ||
@property (nonatomic, assign) NSTimeInterval customerLoadingImagesInteval; /** 加载动画时间间隔调整,默认0.35s每帧 */ | ||
|
||
@property (nonatomic, strong) UIView *customLoadingView; /** 自定义loading view */ | ||
|
||
@property (nonatomic, assign) BOOL useWechatSDK; /// 是否接入了微信SDK | ||
|
||
|
||
|
||
/** | ||
初始化并返回一个配置。 | ||
@param clientId 从有赞云申请的 client_id | ||
@param appKey 从有赞云申请的 appKey | ||
@return 一个配置。 | ||
*/ | ||
- (instancetype)initWithClientId:(NSString *)clientId andAppKey:(NSString *)appKey NS_DESIGNATED_INITIALIZER; | ||
|
||
@end | ||
|
||
NS_ASSUME_NONNULL_END |
34 changes: 34 additions & 0 deletions
34
Release/YZBaseSDK.framework/Headers/YZIMWebViewController.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// | ||
// YZIMWebViewController.h | ||
// YZBaseSDK | ||
// | ||
// Created by 宫城 on 2018/6/28. | ||
// Copyright © 2018 Youzan. All rights reserved. | ||
// | ||
|
||
#import <UIKit/UIKit.h> | ||
|
||
NS_ASSUME_NONNULL_BEGIN | ||
|
||
@interface YZIMWebViewController : UIViewController | ||
|
||
/** | ||
使用 H5 IM 之前,务必先登录 | ||
*/ | ||
@property (nonatomic, copy) void(^loginHanlder)(void); | ||
|
||
/** | ||
取消登录或者登录失败回调 | ||
*/ | ||
@property (nonatomic, copy) void(^loginFailedHanlder)(void); | ||
|
||
/** | ||
初始化聊天 H5 页面 | ||
@param shopID 店铺 ID | ||
*/ | ||
- (instancetype)initWithShopID:(NSUInteger)shopID; | ||
|
||
@end | ||
|
||
NS_ASSUME_NONNULL_END |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// | ||
// YZNotice.h | ||
// YZBaseSDK | ||
// | ||
// Created by Pan on 2017/11/1. | ||
// Copyright © 2017年 Youzan. All rights reserved. | ||
// | ||
|
||
#import <Foundation/Foundation.h> | ||
NS_ASSUME_NONNULL_BEGIN | ||
|
||
// Notice 的类型 | ||
typedef NS_ENUM(NSUInteger, YZNoticeType) { | ||
YZNoticeTypeOther = 0, // 其他通知,用户无需关心 | ||
YZNoticeTypeLogin, // 登录通知 | ||
YZNoticeTypeShare, // 接收到分享请求的结果回调 | ||
YZNoticeTypeReady, // Web页面已准备好,分享接口可用。 | ||
YZNoticeTypeAddToCart, // 添加购物车 | ||
YZNoticeTypeBuyNow, // 立即购买 | ||
YZNoticeTypeAfterCreateOrder, // 订单创建回调 | ||
YZNoticeTypeAddUp, // 点击结算时回调 | ||
YZNoticeTypePaymentFinished, // 付款完成时,回调 | ||
YZNoticeTypeAuthorizationSucceed, // 授权成功 | ||
YZNoticeTypeAuthorizationFailed, // 授权失败,response 中获取 code 及 message | ||
YZNoticeTypeInvokeDisagreeProtocol, // 不同意协议并退出 | ||
YZNoticeTypeAccountCancellationSucceed, // 账号注销成功 | ||
YZNoticeTypeAccountCancellationFailed, // 账号注销失败 | ||
YZGoCashier, //拉起三方收银台 | ||
YZGoToWechatMiniProgram, // 拉起微信小程序 | ||
YZNoticeCustomAction, // 自定义事件 | ||
}; | ||
|
||
@interface YZNotice : NSObject | ||
|
||
// nil 说明该 url 并不是有赞的 notice | ||
- (nullable instancetype)initWithURL:(NSURL *)url NS_DESIGNATED_INITIALIZER; | ||
|
||
@property (assign, nonatomic) YZNoticeType type; /**< notice 类型*/ | ||
@property (nullable, strong, nonatomic) id response; /**< 附带的数据*/ | ||
|
||
@end | ||
|
||
NS_ASSUME_NONNULL_END |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
// | ||
// YZSDK.h | ||
// YZBaseSDK | ||
// | ||
// Created by Pan on 2017/10/26. | ||
// Copyright © 2017年 Youzan. All rights reserved. | ||
// | ||
|
||
#import <Foundation/Foundation.h> | ||
|
||
@class YZConfig, YZSDK; | ||
|
||
NS_ASSUME_NONNULL_BEGIN | ||
|
||
@protocol YZSDKDelegate <NSObject> | ||
|
||
@optional | ||
/// SDK安全校验成功或失败通知 | ||
- (void)yzsdkSecurityCheckSucceed:(YZSDK *)sdk; | ||
- (void)yzsdkSecurityCheckFaild:(YZSDK *)sdk; | ||
|
||
@end | ||
|
||
typedef void(^YZSDKLoginCompletionHandler)(BOOL isSuccess, NSString * _Nullable yzOpenId); | ||
typedef void(^YZSDKLogoutCompletionHandler)(void); | ||
|
||
/*! | ||
有赞云 AppSDK 通用信息管理。以及 cookie 和 token 的设置。 | ||
*/ | ||
@interface YZSDK : NSObject | ||
|
||
@property (class, readonly, strong) YZSDK *shared;/**< 使用单例访问接口*/ | ||
@property (nonatomic, weak) id<YZSDKDelegate> delegate; | ||
|
||
@property (nonatomic, readonly, nullable) NSString *accessToken; /**< 正在使用的 access_token */ | ||
@property (nonatomic, readonly) YZConfig *config; /**< SDK 的配置*/ | ||
@property (nonatomic, readonly) NSString *version;/**< SDK 版本号*/ | ||
|
||
@property (nonatomic, readonly, assign) NSInteger connectState; /** -1为未连接,0为连接中,1为已连接 **/ | ||
|
||
/** | ||
初始化 SDK. | ||
使用 SDK 前必须先初始化 SDK. | ||
@param config 初始化配置。 | ||
@see YZSDKConfig | ||
*/ | ||
- (void)initializeSDKWithConfig:(YZConfig *)config; | ||
|
||
/// 用户登录 | ||
/// @param openUserId 必传,开发者自身系统的用户ID,是三方App账号在有赞的唯一标识符,如更换将导致原用户数据丢失 | ||
/// @param avatar 非必传,用户头像,建议传https的url | ||
/// @param extra 非必传,用户的额外信息 | ||
/// @param nickName 非必传,用户昵称 | ||
/// @param gender 非必传,性别 0(保密)、1(男)、2(女) | ||
/// @param completion 登录完成回调,isSuccess 登录是否成功,yzOpenId 成功后返回的有赞openId | ||
- (void)loginWithOpenUserId:(NSString *)openUserId | ||
avatar:(NSString * _Nullable)avatar | ||
extra:(NSString * _Nullable)extra | ||
nickName:(NSString * _Nullable)nickName | ||
gender:(NSInteger)gender | ||
andCompletion:(YZSDKLoginCompletionHandler)completion; | ||
|
||
/** | ||
App用户登出,清除token、cookie等 | ||
*/ | ||
- (void)logout; | ||
|
||
/** | ||
App用户登出,清除token及cookie等 | ||
@param completion 清除token的成功回调,一般推荐在completion里执行webview的刷新操作 | ||
*/ | ||
- (void)logoutWithCompletion:(YZSDKLogoutCompletionHandler)completion; | ||
|
||
/*! | ||
预加载 html、 资源文件等,优化首屏打开时间。需要在初始化 SDK 后调用。 | ||
此功能已废弃 | ||
@param urls 希望预加载的页面 | ||
*/ | ||
- (void)preloadURLs:(NSArray<NSURL *> *)urls __attribute__((deprecated)); | ||
|
||
/** | ||
清除 YZWebView 中自定义域名的相关cookie | ||
此方法只适用于定制域名客户,需在用户登出时调用 | ||
@param domain 自定义域名,例如 www.youzan.com 只需要输入 youzan 即可 | ||
*/ | ||
- (void)clearCookiesOfDomain:(NSString *)domain; | ||
|
||
/// 重试安全校验 | ||
- (void)securityCheck; | ||
|
||
@end | ||
|
||
NS_ASSUME_NONNULL_END |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// | ||
// YZWebView.h | ||
// YZBaseSDK | ||
// | ||
// Created by Pan on 2017/10/26. | ||
// Copyright © 2017年 Youzan. All rights reserved. | ||
// | ||
|
||
|
||
#import "YZWebViewBase.h" | ||
|
||
NS_ASSUME_NONNULL_BEGIN | ||
|
||
@class YZNotice; | ||
|
||
@protocol YZWebViewNoticeDelegate <NSObject> | ||
|
||
- (void)webView:(id<YZWebView>)webView didReceiveNotice:(YZNotice *)notice; | ||
|
||
@end | ||
|
||
/** | ||
提供了 WebView 的所有能力,对有赞商城体系的页面做了优化。 | ||
*/ | ||
@interface YZWebView : YZWebViewBase <YZWebView> | ||
|
||
@property (nonatomic, weak) id<YZWebViewNoticeDelegate> noticeDelegate; | ||
|
||
/** | ||
分享当前页。分享相关的数据会在 webView:didReceiveNotice: 中返回。 | ||
返回的数据结构: | ||
@{ | ||
@"title": @"", // 标题 | ||
@"link": @"", // 链接 | ||
@"img_url": @"", // 图片的 url (可选,有些页面该字段为空) | ||
} | ||
*/ | ||
- (void)share; | ||
@end | ||
|
||
NS_ASSUME_NONNULL_END |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// | ||
// YZWebViewBase.h | ||
// YZWebViewFramework | ||
// | ||
// Created by Pan on 2018/1/9. | ||
// Copyright © 2017年 Youzan. All rights reserved. | ||
// | ||
|
||
#import "YZWebViewProtocol.h" | ||
|
||
NS_ASSUME_NONNULL_BEGIN | ||
|
||
/** | ||
YZWebView 支持的类型 | ||
*/ | ||
typedef NS_ENUM(NSUInteger, YZWebViewType) { | ||
YZWebViewTypeWKWebView | ||
}; | ||
|
||
/** | ||
提供了 WebView 的所有能力,对有赞体系的页面做了优化。 | ||
*/ | ||
@interface YZWebViewBase : UIView <YZWebView, YZWebViewDelegate> | ||
|
||
/** | ||
初始化并返回一个 YZWebView. | ||
@param type YZWebView 所使用的 WebView 类型,只支持 WKWebView 内核。 | ||
@return 一个 YZWebView 的实例。 | ||
*/ | ||
- (instancetype)initWithWebViewType:(YZWebViewType)type; | ||
|
||
@end | ||
|
||
NS_ASSUME_NONNULL_END |
Oops, something went wrong.