国内WASDK Apple实现层
hank
2016-12-13 330f2fd1b83d2fdc7a5df1a3029f8c1990d46126
提交苹果抽象层库
16 files added
482 ■■■■■ changed files
WAApImpl_CN.podspec 25 ●●●●● patch | view | raw | blame | history
config/wa_sdk_impl_config_apple.xml 15 ●●●●● patch | view | raw | blame | history
frameworks/WAApImpl.framework/Headers/APConstants.h 21 ●●●●● patch | view | raw | blame | history
frameworks/WAApImpl.framework/Headers/StoreManager.h 93 ●●●●● patch | view | raw | blame | history
frameworks/WAApImpl.framework/Headers/StoreObserver.h 102 ●●●●● patch | view | raw | blame | history
frameworks/WAApImpl.framework/Headers/WAAPIapSingleton.h 72 ●●●●● patch | view | raw | blame | history
frameworks/WAApImpl.framework/Headers/WAAPLogin.h 22 ●●●●● patch | view | raw | blame | history
frameworks/WAApImpl.framework/Headers/WAAPLoginInfo.h 16 ●●●●● patch | view | raw | blame | history
frameworks/WAApImpl.framework/Headers/WAAPPay.h 13 ●●●●● patch | view | raw | blame | history
frameworks/WAApImpl.framework/Headers/WAAPPaymentTransaction.h 14 ●●●●● patch | view | raw | blame | history
frameworks/WAApImpl.framework/Headers/WAAPPaymentTransactionHandler.h 47 ●●●●● patch | view | raw | blame | history
frameworks/WAApImpl.framework/Headers/WAAPUser.h 14 ●●●●● patch | view | raw | blame | history
frameworks/WAApImpl.framework/Headers/WAApImpl.h 22 ●●●●● patch | view | raw | blame | history
frameworks/WAApImpl.framework/Info.plist patch | view | raw | blame | history
frameworks/WAApImpl.framework/Modules/module.modulemap 6 ●●●●● patch | view | raw | blame | history
frameworks/WAApImpl.framework/WAApImpl patch | view | raw | blame | history
WAApImpl_CN.podspec
New file
@@ -0,0 +1,25 @@
#
#  Be sure to run `pod spec lint WAApImpl_CN.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 = 'WAApImpl_CN'
s.version = '1.1.0'
s.summary = 'WASDK Apple'
s.license = 'MIT'
s.author = { "Hank" => "hank.zhang@gamehollywood.com" }
s.homepage = 'http://repo.wingsdk.cn:8082/summary/WAApImpl_CN.git'
s.source = { :git => "http://admin@repo.wingsdk.cn:8082/r/WAApImpl_CN.git" , :tag => s.version}
s.platform = :ios
s.ios.deployment_target = "7.0"
s.vendored_frameworks = 'frameworks/WAApImpl.framework'
s.resources = ['config/*.xml']
s.dependency 'WASdkIntf_CN', '~> 1.1.0'   #
s.dependency 'WASdkImpl_CN', '~> 1.1.0'
s.requires_arc = true
end
config/wa_sdk_impl_config_apple.xml
New file
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<config>
    <version val="AP1.1.0"/>
    <comps>
        <!-- 用户模块 -->
        <comp module="USR" plaf="APPLE" mandatory="YES" value="WAAPUser" desc="APPLE用户账户"/>
        <!-- 支付模块 -->
        <comp module="PAY" plaf="APPLE" mandatory="YES" value="WAAPPay" desc="APPLE支付"/>
    </comps>
    <ops>
        <op type="copy" category="res" isFile="NO" from="frameworks" to="wasdk/ap/frameworks" />
        <op type="ref" category="res" isFile="NO" from="System/Library/Frameworks/StoreKit.framework"/>
    </ops>
</config>
frameworks/WAApImpl.framework/Headers/APConstants.h
New file
@@ -0,0 +1,21 @@
//
//  APConstants.h
//  WAApImplUI
//
//  Created by wuyx on 16/3/7.
//  Copyright © 2016年 GHW-T-01. All rights reserved.
//
#import <Foundation/Foundation.h>
#ifndef AP_APConstants_h
#define AP_APConstants_h
extern NSString *const AP_LOGIN_PUBLIC_KEY_URL;
extern NSString *const AP_LOGIN_SIGNATURE;
extern NSString *const AP_LOGIN_SALT;
extern NSString *const AP_LOGIN_TIMESTAMP;
extern NSString *const AP_LOGIN_FLAG;
extern NSString *const AP_LOGIN_PLAYER_ID;
extern NSString *const AP_LOGIN_BUNDLE_ID;
#endif
frameworks/WAApImpl.framework/Headers/StoreManager.h
New file
@@ -0,0 +1,93 @@
/*
     File: StoreManager.h
 Abstract: Retrieves product information from the App Store using SKRequestDelegate,
           SKProductsRequestDelegate,SKProductsResponse, and SKProductsRequest.
           Notifies its observer with a list of products available for sale along with
           a list of invalid product identifiers. Logs an error message if the product request failed.
  Version: 1.0
 Disclaimer: IMPORTANT:  This Apple software is supplied to you by Apple
 Inc. ("Apple") in consideration of your agreement to the following
 terms, and your use, installation, modification or redistribution of
 this Apple software constitutes acceptance of these terms.  If you do
 not agree with these terms, please do not use, install, modify or
 redistribute this Apple software.
 In consideration of your agreement to abide by the following terms, and
 subject to these terms, Apple grants you a personal, non-exclusive
 license, under Apple's copyrights in this original Apple software (the
 "Apple Software"), to use, reproduce, modify and redistribute the Apple
 Software, with or without modifications, in source and/or binary forms;
 provided that if you redistribute the Apple Software in its entirety and
 without modifications, you must retain this notice and the following
 text and disclaimers in all such redistributions of the Apple Software.
 Neither the name, trademarks, service marks or logos of Apple Inc. may
 be used to endorse or promote products derived from the Apple Software
 without specific prior written permission from Apple.  Except as
 expressly stated in this notice, no other rights or licenses, express or
 implied, are granted by Apple herein, including but not limited to any
 patent rights that may be infringed by your derivative works or by other
 works in which the Apple Software may be incorporated.
 The Apple Software is provided by Apple on an "AS IS" basis.  APPLE
 MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
 THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
 FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
 OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
 IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
 OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION,
 MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED
 AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
 STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
 POSSIBILITY OF SUCH DAMAGE.
 Copyright (C) 2014 Apple Inc. All Rights Reserved.
 */
#import <Foundation/Foundation.h>
#import <StoreKit/StoreKit.h>
@protocol StoreManagerDelegate <NSObject>
- (void)queryAppleProductsDidCompleteWithResult:(NSArray<SKProduct *>*)appleProducts;
- (void)queryAppleProductsDidError:(NSError *)error;
@end
@interface StoreManager : NSObject
typedef NS_ENUM(NSInteger, IAPProductRequestStatus)
{
    IAPProductsFound,// Indicate that there are some valid products
    IAPIdentifiersNotFound, // indicate that are some invalid product identifiers
    IAPRequestFailed // Indicate that the product request failed
};
@property (nonatomic, strong) id<StoreManagerDelegate> delegate;
// Provide the status of the product request
@property (nonatomic) IAPProductRequestStatus status;
// Keep track of all valid products. These products are available for sale in the App Store
@property (nonatomic, strong) NSMutableArray *availableProducts;
// Keep track of all invalid product identifiers
@property (nonatomic, strong) NSMutableArray *invalidProductIds;
// Indicate the cause of the product request failure
@property (nonatomic, copy) NSString *errorMessage;
+ (StoreManager *)sharedInstance;
// Query the App Store about the given product identifiers
-(void)fetchProductInformationForIds:(NSArray *)productIds;
// Return the product's title matching a given product identifier
-(NSString *)titleMatchingProductIdentifier:(NSString *)identifier;
@end
frameworks/WAApImpl.framework/Headers/StoreObserver.h
New file
@@ -0,0 +1,102 @@
/*
     File: StoreObserver.h
 Abstract: Implements the SKPaymentTransactionObserver protocol. Handles purchasing and restoring products as well as
           downloading hosted content using paymentQueue:updatedTransactions: and paymentQueue:updatedDownloads:, respectively.
           Provides download progress information using SKDownload's progres. Logs the location of the downloaded file using SKDownload's contentURL property.
  Version: 1.0
 Disclaimer: IMPORTANT:  This Apple software is supplied to you by Apple
 Inc. ("Apple") in consideration of your agreement to the following
 terms, and your use, installation, modification or redistribution of
 this Apple software constitutes acceptance of these terms.  If you do
 not agree with these terms, please do not use, install, modify or
 redistribute this Apple software.
 In consideration of your agreement to abide by the following terms, and
 subject to these terms, Apple grants you a personal, non-exclusive
 license, under Apple's copyrights in this original Apple software (the
 "Apple Software"), to use, reproduce, modify and redistribute the Apple
 Software, with or without modifications, in source and/or binary forms;
 provided that if you redistribute the Apple Software in its entirety and
 without modifications, you must retain this notice and the following
 text and disclaimers in all such redistributions of the Apple Software.
 Neither the name, trademarks, service marks or logos of Apple Inc. may
 be used to endorse or promote products derived from the Apple Software
 without specific prior written permission from Apple.  Except as
 expressly stated in this notice, no other rights or licenses, express or
 implied, are granted by Apple herein, including but not limited to any
 patent rights that may be infringed by your derivative works or by other
 works in which the Apple Software may be incorporated.
 The Apple Software is provided by Apple on an "AS IS" basis.  APPLE
 MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
 THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
 FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
 OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
 IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
 OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION,
 MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED
 AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
 STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
 POSSIBILITY OF SUCH DAMAGE.
 Copyright (C) 2014 Apple Inc. All Rights Reserved.
 */
#import <Foundation/Foundation.h>
#import <StoreKit/StoreKit.h>
extern NSString * const IAPPurchaseNotification;
@interface StoreObserver : NSObject <SKPaymentTransactionObserver>
typedef NS_ENUM(NSInteger, IAPPurchaseNotificationStatus)
{
    IAPPurchaseFailed,
    IAPPurchaseSucceeded,
    IAPRestoredFailed,
    IAPRestoredSucceeded,
    IAPDownloadStarted,
    IAPDownloadInProgress,
    IAPDownloadFailed,
    IAPDownloadSucceeded
};
@property (nonatomic) IAPPurchaseNotificationStatus status;
// Keep track of all purchases
@property (nonatomic, strong) NSMutableArray *productsPurchased;
// Keep track of all restored purchases
@property (nonatomic, strong) NSMutableArray *productsRestored;
@property (nonatomic, copy) NSString *message;
@property(nonatomic) float downloadProgress;
// Keep track of the purchased/restored product's identifier
@property (nonatomic, copy) NSString *purchasedID;
-(BOOL)hasPurchasedProducts;
-(BOOL)hasRestoredProducts;
+ (StoreObserver *)sharedInstance;
// Implement the purchase of a product
-(void)buy:(SKProduct *)product withOrderDict:(NSDictionary*)orderDict;
// Implement the restoration of previously completed purchases
-(void)restore;
/**
 *  发送支付结果给后台
 *
 *  @param skPaymentTransaction
 *  @param pStatus
 */
-(void)postPayNotifyServer:(SKPaymentTransaction*) skPaymentTransaction withStatus:(int)pStatus isRetry:(BOOL)isRetry;
@end
frameworks/WAApImpl.framework/Headers/WAAPIapSingleton.h
New file
@@ -0,0 +1,72 @@
//
//  GhwSdkIap.h
//  iOSInAppPurchases
//
//  Created by GHW-T-01 on 15/5/18.
//
//
#import <Foundation/Foundation.h>
#import <WASdkIntf/WASdkIntf.h>
extern NSString * const IAPResultNotification;
@interface WAAPIapSingleton : NSObject
@property(nonatomic,weak)id<WAInventoryDelegate>inventoryDelegate;
@property(nonatomic,weak)id<WAPaymentDelegate>paymentDelegate;
@property(nonatomic,strong) NSArray* productIds;
@property(nonatomic,strong) NSMutableArray *products;
@property(nonatomic,strong) SKProduct* currentProduct;
@property(nonatomic,strong) NSData* currentReceipt;
@property(nonatomic,strong)NSMutableArray* productList;//存放SKProduct;
@property(nonatomic,strong)NSString* productId;
@property(nonatomic,strong)NSString* extInfo;
@property(nonatomic,assign)BOOL isPaying;
@property(nonatomic,strong)NSDictionary *waProducts;
/**
 *  应用内支付初始化
 *
 */
+(void)init4Iap;
/**
 *  清理商品内购相关变量
 */
+(void)clean4Iap;
/**
 *  获取单例
 *
 *  @return 返回单例
 */
+(WAAPIapSingleton *)shareInstance;
///**
// *  获取商品列表
// */
//+(void)queryInventory:(id<WAInventoryDelegate>)delegate;
/**
 *  单个商品购买
 *
 *  @param product 对应苹果商品类
 *  @param serverId服务器id
 *  @param extInfo一些额外信息
 */
+(void)singlePurchase:(SKProduct*)product withServerId:(NSString*)serverId withExtInfo:(NSString*)extInfo;
/**
 *  单个商品购买
 *
 *  @param productId 对应苹果商品id
 *  @param extInfo一些额外信息
 */
+(void)payWithProductId:(NSString *)productId extInfo:(NSString *)extInfo delegate:(id<WAPaymentDelegate>)delegate;
+(void)fetchProductInformations:(NSDictionary *)waProducts inventoryDelegate:(id<WAInventoryDelegate>)delegate;
+(SKProduct*)getCurrentProduct;
+(NSData*)getCurrentReceipt;
@end
frameworks/WAApImpl.framework/Headers/WAAPLogin.h
New file
@@ -0,0 +1,22 @@
//
//  GHWAppleLogin.h
//  GHWSdk
//
//  Created by wuyx on 15/5/17.
//  Copyright (c) 2015年 Wuyx. All rights reserved.
//
#import <GameKit/GameKit.h>
#import <WASdkIntf/WASdkIntf.h>
#import "WAAPLoginInfo.h"
typedef enum APLoginError{
    APLoginErrorIOS7 = 30
}APLoginError;
@interface WAAPLogin : NSObject
// currentPlayerID is the value of the playerID last time GameKit authenticated.
@property (retain,readwrite) NSString* currentPlayerID;
// isGameCenterAuthenticationComplete is set after authentication, and authenticateWithCompletionHandler's completionHandler block has been run. It is unset when the applicaiton is backgrounded.
@property (readwrite, getter=isGameCenterAuthenticationComplete) BOOL gameCenterAuthenticationComplete;
+(id)shareInstance;
-(void)loginWithCompletionHandler:(void (^)(WAAPLoginInfo* loginInfo, NSError *error))completionHandler;
@end
frameworks/WAApImpl.framework/Headers/WAAPLoginInfo.h
New file
@@ -0,0 +1,16 @@
//
//  APLoginInfo.h
//  WAApImplUI
//
//  Created by wuyx on 16/3/7.
//  Copyright © 2016年 GHW-T-01. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface WAAPLoginInfo : NSObject<NSCoding,NSCopying>
@property(nonatomic,strong)NSURL* publicKeyUrl;
@property(nonatomic,strong)NSData* signature;
@property(nonatomic,strong)NSData* salt;
@property(nonatomic)uint64_t timestamp;
@end
frameworks/WAApImpl.framework/Headers/WAAPPay.h
New file
@@ -0,0 +1,13 @@
//
//  APPay.h
//  WAApImplUI
//
//  Created by wuyx on 16/3/7.
//  Copyright © 2016年 GHW-T-01. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <WASdkIntf/WASdkIntf.h>
@interface WAAPPay : WAIPay
@end
frameworks/WAApImpl.framework/Headers/WAAPPaymentTransaction.h
New file
@@ -0,0 +1,14 @@
//
//  GHWSDKPaymentTransaction.h
//  GHWSdkUI
//
//  Created by wuyx on 15/8/20.
//  Copyright (c) 2015年 GHW-T-01. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <StoreKit/StoreKit.h>
@interface WAAPPaymentTransaction : NSObject<NSCoding,NSCopying>
@property(strong,nonatomic)SKPaymentTransaction* skPaymentTransaction;
@property(nonatomic)int status;
@end
frameworks/WAApImpl.framework/Headers/WAAPPaymentTransactionHandler.h
New file
@@ -0,0 +1,47 @@
//
//  GHWSDKPaymentTransactionHandler.h
//  GHWSdkUI
//
//  Created by wuyx on 15/8/19.
//  Copyright (c) 2015年 GHW-T-01. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <StoreKit/StoreKit.h>
extern NSString *CACHE_KEY_PAYMENT_TRANSACTION;
@interface WAAPPaymentTransactionHandler : NSObject
@property(strong,nonatomic)NSMutableDictionary* unConsumeOrderList;
/**
 *  将上报失败的订单保存到缓存中
 *
 *  @param skPaymentTransaction
 *  @param status
 */
+(void)saveCacheWithPaymentTransaction:(SKPaymentTransaction*)skPaymentTransaction andStatus:(int)status;
/**
 *  通过skProduct 获取未消耗订单列表
 *
 *  @param skProduct
 *
 *  @return NSMutableArray
 */
+(NSMutableArray*)getUnconsumeOrderListWithProduct:(SKProduct*)skProduct;
/**
 *  处理未消耗订单
 *
 *  @param unComsumeList 未消耗订单列表
 */
+(void)handleWithUnComsumeList:(NSArray*)unComsumeList;
/**
 *  重试成功,移除未消耗订单
 *
 *  @param skPaymentTransaction
 */
+(void)removeUncomsumeListWithPaymentTransaction:(SKPaymentTransaction *)skPaymentTransaction;
@end
frameworks/WAApImpl.framework/Headers/WAAPUser.h
New file
@@ -0,0 +1,14 @@
//
//  APUser.h
//  WAApImplUI
//
//  Created by wuyx on 16/3/7.
//  Copyright © 2016年 GHW-T-01. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <WASdkIntf/WASdkIntf.h>
#import <WACommon/WACommon.h>
@interface WAAPUser : WAIUser
@end
frameworks/WAApImpl.framework/Headers/WAApImpl.h
New file
@@ -0,0 +1,22 @@
//
//  WAApImpl.h
//  WAApImpl
//
//  Created by GHW-T-01 on 16/3/1.
//  Copyright © 2016年 GHW-T-01. All rights reserved.
//
#import <UIKit/UIKit.h>
//! Project version number for WAApImpl.
FOUNDATION_EXPORT double WAApImplVersionNumber;
//! Project version string for WAApImpl.
FOUNDATION_EXPORT const unsigned char WAApImplVersionString[];
// In this header, you should import all the public headers of your framework using statements like #import <WAApImpl/PublicHeader.h>
#import <WAApImpl/WAAPUser.h>
#import <WAApImpl/WAAPLogin.h>
//time:2016/11/29 15:42
frameworks/WAApImpl.framework/Info.plist
Binary files differ
frameworks/WAApImpl.framework/Modules/module.modulemap
New file
@@ -0,0 +1,6 @@
framework module WAApImpl {
  umbrella header "WAApImpl.h"
  export *
  module * { export * }
}
frameworks/WAApImpl.framework/WAApImpl
Binary files differ