Vasilis
......@@ -7,7 +7,7 @@
<key>Pods-WarplySDKFrameworkIOS.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
<integer>1</integer>
</dict>
</dict>
</dict>
......
......@@ -7,7 +7,7 @@
<key>WarplySDKFrameworkIOS.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>1</integer>
<integer>0</integer>
</dict>
</dict>
</dict>
......
......@@ -77,6 +77,7 @@
- (NSDictionary*)loginCosmoteWithGuid:(NSString*)guid andAppUuid:(NSString*)appUuid andTicket:(NSString*)ticket;
- (void)getCouponsWithSuccessBlock:(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure;
- (void)getCouponsetsAsync:(NSNumber*) active andVisible:(NSNumber*) visible andUuids:(NSArray*) uuids :(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure;
- (void)getInboxAsync:(void (^)(NSArray *list))success failureBlock:(void (^)(NSError *error))failure;
@end
#endif /* MyApi_h */
......
......@@ -1284,4 +1284,17 @@ CMPedometer *pedometer;
}
}];
}
- (void)getInboxAsync:(void (^)(NSArray *list))success failureBlock:(void (^)(NSError *error))failure
{
[[Warply sharedService] getInbox2WithSuccessBlock :^(NSArray *inbox) {
if (success) {
success(inbox);
}
} failureBlock:^(NSError *error) {
if (failure) {
failure(error);
}
}];
}
@end
......
......@@ -120,30 +120,51 @@ public class swiftApi {
public class CouponSetsDataModel {
var data: Array<CouponSetItemModel> = []
init() { //initializer method
init() {
}
var getData: Array<CouponSetItemModel> {
get { // getter
return data
}
}
func getCouponSetsData(_ getCouponSetsCallback: @escaping (_ couponSetsData: Array<CouponSetItemModel>?) -> Void) -> Void {
let instanceOfMyApi = MyApi()
let couponSets = instanceOfMyApi.getCouponSets(withActive: true, andVisible: true, andUuids: nil)
var couponSets: [AnyHashable : Any]?
var couponSetsArray:Array<CouponSetItemModel> = []
if let myCouponsSetsDictionary = couponSets as? [String : AnyObject] {
let couponSetsData = (myCouponsSetsDictionary["MAPP_COUPON"] as! NSArray)
instanceOfMyApi.getCouponsetsAsync(true, andVisible: true, andUuids: nil, couponSetsCallback, failureBlock: couponSetsFailureCallback)
func couponSetsCallback(_ couponSetsData: [AnyHashable : Any]?) -> Void {
couponSets = couponSetsData ?? ["":""]
for couponset in couponSetsData {
let tempCouponset = CouponSetItemModel(dictionary: couponset as! [String : Any])
couponSetsArray.append(tempCouponset)
if let myCouponsSetsDictionary = couponSets as? [String : AnyObject] {
let couponSetsData = (myCouponsSetsDictionary["MAPP_COUPON"] as! NSArray)
for couponset in couponSetsData {
let tempCouponset = CouponSetItemModel(dictionary: couponset as! [String : Any])
couponSetsArray.append(tempCouponset)
}
}
getCouponSetsCallback(couponSetsArray)
}
self.data = couponSetsArray
}
var getData: Array<CouponSetItemModel> {
get { // getter
return data
func couponSetsFailureCallback(_ error: Error?) -> Void {
print("getCouponSets error: ")
getCouponSetsCallback(nil)
}
}
}
public func getCouponSetsAsync(_ getCouponSetsCallback: @escaping (_ couponSetsData: Array<CouponSetItemModel>?) -> Void) -> Void {
CouponSetsDataModel().getCouponSetsData(getCouponSetsCallback)
}
public func getCouponSets() -> Array<CouponSetItemModel> {
return CouponSetsDataModel().getData
......@@ -391,27 +412,42 @@ public class swiftApi {
public class CampaignDataModel {
var data: Array<CampaignItemModel> = []
init() { //initializer method
init() {
}
var getData: Array<CampaignItemModel> {
get { // getter
return data
}
}
func getCampaignsData(_ getCampaignsCallback: @escaping (_ campaignsData: Array<CampaignItemModel>?) -> Void) -> Void {
let instanceOfMyApi = MyApi()
let products = instanceOfMyApi.getInbox() as NSMutableArray?
instanceOfMyApi.getInboxAsync(campaignsCallback, failureBlock: campaignsFailureCallback)
var giftsArray:Array<CampaignItemModel> = []
for gift in products ?? [] {
let tempGift = CampaignItemModel(dictionary: gift as! [String : Any])
giftsArray.append(tempGift)
func campaignsCallback(_ campaignsData: [Any]?) -> Void {
var campaignsArray:Array<CampaignItemModel> = []
for item in campaignsData ?? [] {
let tempCampaign = CampaignItemModel(dictionary: item as! [String : Any])
campaignsArray.append(tempCampaign)
}
getCampaignsCallback(campaignsArray);
}
self.data = giftsArray;
func campaignsFailureCallback(_ error: Error?) -> Void {
print("getCampaigns error: ")
getCampaignsCallback(nil)
}
}
}
var getData: Array<CampaignItemModel> {
get { // getter
return data
}
}
public func getCampaignsAsync(_ getCampaignsCallback: @escaping (_ campaignsData: Array<CampaignItemModel>?) -> Void) -> Void {
CampaignDataModel().getCampaignsData(getCampaignsCallback)
}
public func getCampaigns() -> Array<CampaignItemModel> {
......