Toggle navigation
Toggle navigation
This project
Loading...
Sign in
open-source
/
warply_sdk_framework
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Graphs
Network
Create a new issue
Commits
Issue Boards
Authored by
Manos Chorianopoulos
2023-04-06 14:42:45 +0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
7f4c4a1e53dbeb33d3261ccb45651be86c9f64cc
7f4c4a1e
1 parent
bfe49486
market History fixes v2
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
100 additions
and
20 deletions
SwiftWarplyFramework/SwiftWarplyFramework/AnalysisItemViewCell.swift
SwiftWarplyFramework/SwiftWarplyFramework/MarketSharingHistoryViewController.swift
SwiftWarplyFramework/SwiftWarplyFramework/MyApi.h
SwiftWarplyFramework/SwiftWarplyFramework/MyApi.m
SwiftWarplyFramework/SwiftWarplyFramework/SharingHistoryViewController.swift
SwiftWarplyFramework/SwiftWarplyFramework/Warply/Warply.h
SwiftWarplyFramework/SwiftWarplyFramework/Warply/Warply.m
SwiftWarplyFramework/SwiftWarplyFramework/swiftApi.swift
SwiftWarplyFramework/SwiftWarplyFramework/AnalysisItemViewCell.swift
View file @
7f4c4a1
...
...
@@ -125,22 +125,22 @@ extension AnalysisItemViewCell {
// COUPON: coupon, expiration, discount, status
// MERCHANT: _img_preview,_admin_name
//
let merchantList:Array<swiftApi.MerchantModel> = swiftApi().getMerchantList()
let
merchantList
:
Array
<
swiftApi
.
MerchantModel
>
=
swiftApi
()
.
getMerchantList
()
// let couponSetData: swiftApi.CouponSetItemModel? = item.couponset_data
//
// titleLabel.text = ""
//
// for merchant in merchantList {
// if (merchant._uuid == couponSetData?.merchant_uuid) {
// // itemImage.load(link: merchant._img_preview, placeholder: UIImage(), cache: URLCache())
// self.postImageURL = merchant._img_preview
// titleLabel.text = merchant._admin_name
// break;
// }
// }
titleLabel
.
text
=
item
.
name
self
.
postImageURL
=
item
.
image
titleLabel
.
text
=
""
for
merchant
in
merchantList
{
if
(
merchant
.
_uuid
==
item
.
merchant_uuid
)
{
// itemImage.load(link: merchant._img_preview, placeholder: UIImage(), cache: URLCache())
self
.
postImageURL
=
merchant
.
_img_preview
titleLabel
.
text
=
merchant
.
_admin_name
break
;
}
}
// titleLabel.text = item.name
// self.postImageURL = item.image
dateLabel
.
text
=
item
.
redeemed
??
""
...
...
SwiftWarplyFramework/SwiftWarplyFramework/MarketSharingHistoryViewController.swift
View file @
7f4c4a1
...
...
@@ -40,7 +40,7 @@ class MarketSharingHistoryViewController: AnalysisChildViewController {
showLoading
()
swiftApi
()
.
getSharingHistoryAsync
(
responseCallback
,
failureCallback
:
{
errorCode
in
})
swiftApi
()
.
getSharingHistoryAsync
(
isMarketHistory
:
true
,
getSharingHistoryCallback
:
responseCallback
,
failureCallback
:
{
errorCode
in
})
}
private
func
showLoading
()
{
...
...
SwiftWarplyFramework/SwiftWarplyFramework/MyApi.h
View file @
7f4c4a1
...
...
@@ -99,6 +99,7 @@
-
(
void
)
getCampaignsAsyncNew
:(
NSString
*
)
language
:
(
NSDictionary
*
)
filters
:
(
void
(
^
)(
NSDictionary
*
response
))
success
failureBlock
:
(
void
(
^
)(
NSError
*
error
))
failure
;
-
(
void
)
getCampaignsPersonalizedAsync
:(
NSString
*
)
language
:
(
NSDictionary
*
)
filters
:
(
void
(
^
)(
NSDictionary
*
response
))
success
failureBlock
:
(
void
(
^
)(
NSError
*
error
))
failure
;
-
(
void
)
getSharingHistoryAsync
:(
void
(
^
)(
NSDictionary
*
response
))
success
failureBlock
:(
void
(
^
)(
NSError
*
error
))
failure
;
-
(
void
)
getMarketSharingHistoryAsync
:(
void
(
^
)(
NSDictionary
*
response
))
success
failureBlock
:(
void
(
^
)(
NSError
*
error
))
failure
;
-
(
void
)
getMultilingualMerchantsAsync
:(
NSArray
*
)
categories
andDefaultShown
:(
NSNumber
*
)
defaultShown
andCenter
:(
NSNumber
*
)
center
andTags
:(
NSArray
*
)
tags
andUuid
:(
NSString
*
)
uuid
andDistance
:(
NSNumber
*
)
distance
parent_uuids
:(
NSArray
*
)
parent_uuids
:
(
void
(
^
)(
NSDictionary
*
response
))
success
failureBlock
:
(
void
(
^
)(
NSError
*
error
))
failure
;
// - (void)didReceiveNotification:(NSDictionary *)userInfo whileAppWasInState:(WLApplicationState)state;
-
(
void
)
didReceiveNotification
:(
NSDictionary
*
)
payload
;
...
...
SwiftWarplyFramework/SwiftWarplyFramework/MyApi.m
View file @
7f4c4a1
...
...
@@ -1690,6 +1690,19 @@ NSString *VERIFY_URL = @"/partners/cosmote/verify";
}];
}
-
(
void
)
getMarketSharingHistoryAsync
:
(
void
(
^
)(
NSDictionary
*
response
))
success
failureBlock
:
(
void
(
^
)(
NSError
*
error
))
failure
{
[[
Warply
sharedService
]
getMarketSharingHistoryWithSuccessBlock
:
^
(
NSDictionary
*
response
)
{
if
(
success
)
{
success
(
response
);
}
}
failureBlock
:
^
(
NSError
*
error
)
{
if
(
failure
)
{
failure
(
error
);
}
}];
}
-
(
void
)
getMultilingualMerchantsAsync
:
(
NSArray
*
)
categories
andDefaultShown
:
(
NSNumber
*
)
defaultShown
andCenter
:
(
NSNumber
*
)
center
andTags
:
(
NSArray
*
)
tags
andUuid
:
(
NSString
*
)
uuid
andDistance
:
(
NSNumber
*
)
distance
parent_uuids
:
(
NSArray
*
)
parent_uuids
:
(
void
(
^
)(
NSDictionary
*
response
))
success
failureBlock
:
(
void
(
^
)(
NSError
*
error
))
failure
{
[[
Warply
sharedService
]
retrieveMultilingualMerchantsWithCategoriesWithSuccessBlock
:
categories
andDefaultShown
:
defaultShown
andCenter
:
center
andTags
:
tags
andUuid
:
uuid
andDistance
:
distance
parent_uuids
:
parent_uuids
:^
(
NSDictionary
*
response
)
{
...
...
SwiftWarplyFramework/SwiftWarplyFramework/SharingHistoryViewController.swift
View file @
7f4c4a1
...
...
@@ -40,7 +40,7 @@ class SharingHistoryViewController: AnalysisChildViewController {
showLoading
()
swiftApi
()
.
getSharingHistoryAsync
(
responseCallback
,
failureCallback
:
{
errorCode
in
})
swiftApi
()
.
getSharingHistoryAsync
(
isMarketHistory
:
false
,
getSharingHistoryCallback
:
responseCallback
,
failureCallback
:
{
errorCode
in
})
}
private
func
showLoading
()
{
...
...
SwiftWarplyFramework/SwiftWarplyFramework/Warply/Warply.h
View file @
7f4c4a1
...
...
@@ -377,6 +377,8 @@ WL_VERSION_INTERFACE()
-
(
void
)
getSharingHistoryWithSuccessBlock
:(
void
(
^
)(
NSDictionary
*
response
))
success
failureBlock
:(
void
(
^
)(
NSError
*
error
))
failure
;
-
(
void
)
getMarketSharingHistoryWithSuccessBlock
:(
void
(
^
)(
NSDictionary
*
response
))
success
failureBlock
:(
void
(
^
)(
NSError
*
error
))
failure
;
-
(
void
)
verifyTicketWithSuccessBlock
:(
NSString
*
)
guid
:
(
NSString
*
)
ticket
:
(
void
(
^
)(
NSDictionary
*
response
))
success
failureBlock
:
(
void
(
^
)(
NSError
*
error
))
failure
;
-
(
void
)
getCosmoteUserWithSuccessBlock
:(
NSString
*
)
guid
:
(
void
(
^
)(
NSDictionary
*
response
))
success
failureBlock
:
(
void
(
^
)(
NSError
*
error
))
failure
;
...
...
SwiftWarplyFramework/SwiftWarplyFramework/Warply/Warply.m
View file @
7f4c4a1
...
...
@@ -2720,7 +2720,58 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION)
-
(
void
)
getSharingHistoryWithSuccessBlock
:
(
void
(
^
)(
NSDictionary
*
response
))
success
failureBlock
:
(
void
(
^
)(
NSError
*
error
))
failure
{
NSDictionary
*
postDictionary
=
@{
@"coupon"
:
@{
@"action"
:
@"sharing_history"
}};
NSDictionary
*
postDictionary
=
@{
@"coupon"
:
@{
@"action"
:
@"sharing_history"
,
@"exclude"
:
@[
@{
@"field"
:
@"couponset_type"
,
@"value"
:
@[
@"supermarket"
]
}
]}};
NSData
*
jsonData
=
[
NSJSONSerialization
dataWithJSONObject
:
postDictionary
options
:
0
error
:
NULL
];
[
self
sendContext8
:
jsonData
successBlock
:
^
(
NSDictionary
*
contextResponse
)
{
if
(
success
)
{
success
(
contextResponse
);
}
NSLog
(
@"**************** WARPLY Response *****************"
);
NSLog
(
@"%@"
,
contextResponse
);
}
failureBlock
:^
(
NSError
*
error
)
{
if
(
failure
)
{
NSDictionary
*
dict
=
[
NSDictionary
alloc
];
dict
=
[
error
userInfo
];
NSString
*
errorCode
=
[
dict
objectForKey
:
@"NSLocalizedDescription"
];
if
([
errorCode
isEqual
:
@"Request failed: unauthorized (401)"
])
{
// NSString* errorDomain = [error domain];
// NSError *errorToken = [NSError errorWithDomain:errorDomain code:401 userInfo:dict];
//
// if (failure) {
// failure(errorToken);
// }
[
self
refreshToken
:
^
(
NSDictionary
*
response
)
{
[
self
sendContext8
:
jsonData
successBlock
:
^
(
NSDictionary
*
contextResponse
)
{
if
(
success
)
{
success
(
contextResponse
);
}
NSLog
(
@"**************** WARPLY Response *****************"
);
NSLog
(
@"%@"
,
contextResponse
);
}
failureBlock
:^
(
NSError
*
error
)
{
if
(
failure
)
{
failure
(
error
);
}
}];
}
failureBlock
:
^
(
NSError
*
error
)
{
if
(
failure
)
{
// [_db executeUpdate:@"DROP TABLE requestVariables"];
failure
(
error
);
}
NSLog
(
@"Error at token %@"
,
error
);
}];
}
else
{
NSLog
(
@"Error at get Sharing History %@"
,
error
);
failure
(
error
);
}
}
}];
}
-
(
void
)
getMarketSharingHistoryWithSuccessBlock
:
(
void
(
^
)(
NSDictionary
*
response
))
success
failureBlock
:
(
void
(
^
)(
NSError
*
error
))
failure
{
NSDictionary
*
postDictionary
=
@{
@"coupon"
:
@{
@"action"
:
@"sharing_history"
,
@"couponset_types"
:
@[
@"supermarket"
]}};
NSData
*
jsonData
=
[
NSJSONSerialization
dataWithJSONObject
:
postDictionary
options
:
0
error
:
NULL
];
[
self
sendContext8
:
jsonData
successBlock
:
^
(
NSDictionary
*
contextResponse
)
{
if
(
success
)
{
...
...
@@ -3251,6 +3302,7 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION)
if
(
uuids
&&
[
uuids
count
]
>
0
)
{
[
data
setValue
:
uuids
forKey
:
@"uuids"
];
}
[
data
setValue
:@[
@{
@"field"
:
@"couponset_type"
,
@"value"
:
@[
@"supermarket"
]
}
]
forKey
:
@"exclude"
];
NSMutableDictionary
*
dataCoupons
=
[[
NSMutableDictionary
alloc
]
init
];
[
dataCoupons
setValue
:
data
forKey
:
@"coupon"
];
NSData
*
jsonData
=
[
NSJSONSerialization
dataWithJSONObject
:
dataCoupons
options
:
0
error
:
NULL
];
...
...
SwiftWarplyFramework/SwiftWarplyFramework/swiftApi.swift
View file @
7f4c4a1
...
...
@@ -607,6 +607,11 @@ public class swiftApi {
public
let
redeemed
:
String
?
public
var
couponset_data
:
CouponSetItemModel
?
// Market Coupon
public
let
inner_text
:
String
?
public
let
merchant_uuid
:
String
?
public
init
(
dictionary
:
[
String
:
Any
])
{
self
.
couponset_uuid
=
dictionary
[
"couponset_uuid"
]
as?
String
?
??
""
self
.
name
=
dictionary
[
"name"
]
as?
String
?
??
""
...
...
@@ -617,6 +622,10 @@ public class swiftApi {
self
.
category
=
dictionary
[
"category"
]
as?
String
?
??
""
self
.
barcode
=
dictionary
[
"barcode"
]
as?
String
?
??
""
self
.
status
=
dictionary
[
"status"
]
as?
Int
?
??
nil
// Market Coupon
self
.
inner_text
=
dictionary
[
"inner_text"
]
as?
String
?
??
""
self
.
merchant_uuid
=
dictionary
[
"merchant_uuid"
]
as?
String
?
??
""
if
let
couponSetData
=
dictionary
[
"couponset_data"
]
as?
[
String
:
Any
]?
??
[
""
:
""
]
{
...
...
@@ -5536,10 +5545,13 @@ public class swiftApi {
}
public
func
getSharingHistoryAsync
(
_
getSharingHistoryCallback
:
@escaping
(
_
sharingHistoryData
:
Array
<
SharingCouponModel
>
?)
->
Void
,
failureCallback
:
@escaping
(
_
errorCode
:
Int
)
->
Void
)
->
Void
{
public
func
getSharingHistoryAsync
(
isMarketHistory
:
Bool
,
getSharingHistoryCallback
:
@escaping
(
_
sharingHistoryData
:
Array
<
SharingCouponModel
>
?)
->
Void
,
failureCallback
:
@escaping
(
_
errorCode
:
Int
)
->
Void
)
->
Void
{
let
instanceOfMyApi
=
MyApi
()
instanceOfMyApi
.
getSharingHistoryAsync
(
requestCallback
,
failureBlock
:
requestFailureCallback
)
if
(
isMarketHistory
==
true
)
{
instanceOfMyApi
.
getMarketSharingHistoryAsync
(
requestCallback
,
failureBlock
:
requestFailureCallback
)
}
else
{
instanceOfMyApi
.
getSharingHistoryAsync
(
requestCallback
,
failureBlock
:
requestFailureCallback
)
}
func
requestCallback
(
_
sharingHistoryData
:
[
AnyHashable
:
Any
]?)
->
Void
{
var
historyArray
:
Array
<
SharingCouponModel
>
=
[]
...
...
Please
register
or
login
to post a comment