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
2022-05-09 11:52:26 +0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
45995de2decfb4d4e3fc39865b7edf64947c4237
45995de2
1 parent
736b800c
add getCouponSetsAsync, getCampaignsAsync requests
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
79 additions
and
29 deletions
WarplySDKFrameworkIOS/Pods/Pods.xcodeproj/xcuserdata/manos.xcuserdatad/xcschemes/xcschememanagement.plist
WarplySDKFrameworkIOS/WarplySDKFrameworkIOS.xcodeproj/xcuserdata/manos.xcuserdatad/xcschemes/xcschememanagement.plist
WarplySDKFrameworkIOS/WarplySDKFrameworkIOS.xcworkspace/xcuserdata/manos.xcuserdatad/UserInterfaceState.xcuserstate
WarplySDKFrameworkIOS/WarplySDKFrameworkIOS/MyApi.h
WarplySDKFrameworkIOS/WarplySDKFrameworkIOS/MyApi.m
WarplySDKFrameworkIOS/WarplySDKFrameworkIOS/swiftApi.swift
WarplySDKFrameworkIOS/Pods/Pods.xcodeproj/xcuserdata/manos.xcuserdatad/xcschemes/xcschememanagement.plist
View file @
45995de
...
...
@@ -7,7 +7,7 @@
<key>
Pods-WarplySDKFrameworkIOS.xcscheme_^#shared#^_
</key>
<dict>
<key>
orderHint
</key>
<integer>
0
</integer>
<integer>
1
</integer>
</dict>
</dict>
</dict>
...
...
WarplySDKFrameworkIOS/WarplySDKFrameworkIOS.xcodeproj/xcuserdata/manos.xcuserdatad/xcschemes/xcschememanagement.plist
View file @
45995de
...
...
@@ -7,7 +7,7 @@
<key>
WarplySDKFrameworkIOS.xcscheme_^#shared#^_
</key>
<dict>
<key>
orderHint
</key>
<integer>
1
</integer>
<integer>
0
</integer>
</dict>
</dict>
</dict>
...
...
WarplySDKFrameworkIOS/WarplySDKFrameworkIOS.xcworkspace/xcuserdata/manos.xcuserdatad/UserInterfaceState.xcuserstate
View file @
45995de
No preview for this file type
WarplySDKFrameworkIOS/WarplySDKFrameworkIOS/MyApi.h
View file @
45995de
...
...
@@ -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 */
...
...
WarplySDKFrameworkIOS/WarplySDKFrameworkIOS/MyApi.m
View file @
45995de
...
...
@@ -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
...
...
WarplySDKFrameworkIOS/WarplySDKFrameworkIOS/swiftApi.swift
View file @
45995de
...
...
@@ -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
>
{
...
...
Please
register
or
login
to post a comment