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
2025-03-17 13:50:36 +0200
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
306f908ead673d5e8a60eb684bf2dd81d4f21845
306f908e
1 parent
3dd3de2b
add language, darkmode
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
15 deletions
SwiftWarplyFramework/SwiftWarplyFramework/CampaignViewController.swift
SwiftWarplyFramework/SwiftWarplyFramework/swiftApi.swift
SwiftWarplyFramework/SwiftWarplyFramework/CampaignViewController.swift
View file @
306f908
...
...
@@ -557,7 +557,7 @@ var timer2: DispatchSourceTimer?
// func getProfileCallback (_ profileData: swiftApi.ProfileModel?) -> Void {
// if (profileData != nil) {
// DispatchQueue.main.async {
// swiftApi().getCampaignsAsyncNew(language:
"en"
, filters: [String : Any](), getCampaignsCallback, failureCallback: {errorCode in })
// swiftApi().getCampaignsAsyncNew(language:
swiftApi().getApplicationLocale()
, filters: [String : Any](), getCampaignsCallback, failureCallback: {errorCode in })
// func getCampaignsCallback (_ campaignsData: Array<swiftApi.CampaignItemModel>?) -> Void {
// if (campaignsData != nil) {
...
...
@@ -589,7 +589,7 @@ var timer2: DispatchSourceTimer?
SwiftEventBus
.
post
(
"coupon_retrieved"
,
sender
:
couponEvent
)
swiftApi
()
.
getCouponsAsync
(
getCouponsCallback
,
failureCallback
:
{
errorCode
in
})
swiftApi
()
.
getCampaignsAsyncNew
(
language
:
"en"
,
filters
:
[
String
:
Any
](),
getCampaignsCallback
,
failureCallback
:
{
errorCode
in
})
swiftApi
()
.
getCampaignsAsyncNew
(
language
:
swiftApi
()
.
getApplicationLocale
()
,
filters
:
[
String
:
Any
](),
getCampaignsCallback
,
failureCallback
:
{
errorCode
in
})
func
getCouponsCallback
(
_
couponsData
:
Array
<
swiftApi
.
CouponItemModel
>
?)
->
Void
{
if
(
couponsData
!=
nil
)
{
...
...
@@ -882,7 +882,7 @@ var timer2: DispatchSourceTimer?
}
}
swiftApi
()
.
getCampaignsAsyncNew
(
language
:
"en"
,
filters
:
[
String
:
Any
](),
getCampaignsCallback
,
failureCallback
:
{
errorCode
in
})
swiftApi
()
.
getCampaignsAsyncNew
(
language
:
swiftApi
()
.
getApplicationLocale
()
,
filters
:
[
String
:
Any
](),
getCampaignsCallback
,
failureCallback
:
{
errorCode
in
})
func
getCampaignsCallback
(
_
campaignsData
:
Array
<
swiftApi
.
CampaignItemModel
>
?)
->
Void
{
if
(
campaignsData
!=
nil
)
{
...
...
SwiftWarplyFramework/SwiftWarplyFramework/swiftApi.swift
View file @
306f908
...
...
@@ -57,12 +57,30 @@ public class swiftApi {
UserDefaults
.
standard
.
set
(
newValue
,
forKey
:
"merchantIdUD"
)
}
public
func
get
Languag
e
()
->
String
{
return
UserDefaults
.
standard
.
string
(
forKey
:
"languageUD"
)
??
""
public
func
get
ApplicationLocal
e
()
->
String
{
return
UserDefaults
.
standard
.
string
(
forKey
:
"languageUD"
)
??
"
el
"
}
public
func
setLanguage
(
_
newLang
:
String
)
->
Void
{
UserDefaults
.
standard
.
set
(
newLang
,
forKey
:
"languageUD"
)
public
func
setApplicationLocale
(
_
newLang
:
String
)
->
Void
{
// newLang: "GR" / "EN"
var
tempLang
:
String
=
""
if
(
newLang
==
"EN"
||
newLang
==
"en"
)
{
tempLang
=
"en"
}
else
{
tempLang
=
"el"
}
UserDefaults
.
standard
.
set
(
tempLang
,
forKey
:
"languageUD"
)
let
instanceOfMyApi
=
MyApi
()
instanceOfMyApi
.
setLang
(
tempLang
)
}
public
func
getIsDarkModeEnabled
()
->
Bool
{
return
UserDefaults
.
standard
.
bool
(
forKey
:
"isDarkModeEnabledUD"
)
}
public
func
setIsDarkModeEnabled
(
_
newValue
:
Bool
)
->
Void
{
UserDefaults
.
standard
.
set
(
newValue
,
forKey
:
"isDarkModeEnabledUD"
)
}
...
...
@@ -662,7 +680,7 @@ public class swiftApi {
}
}
swiftApi
()
.
getCouponsUniversalAsync
(
language
:
"el"
,
getCouponsCallback
,
failureCallback
:
failureCallback
)
swiftApi
()
.
getCouponsUniversalAsync
(
language
:
swiftApi
()
.
getApplicationLocale
()
,
getCouponsCallback
,
failureCallback
:
failureCallback
)
instanceOfMyApi
.
getCouponsetsAsync
(
true
,
andVisible
:
true
,
andUuids
:
nil
,
couponSetsCallback
,
failureBlock
:
couponSetsFailureCallback
)
...
...
@@ -2240,7 +2258,9 @@ public class swiftApi {
"access_token"
:
(
campaignInfo
?[
"access_token"
]
as!
String
),
"refresh_token"
:
(
campaignInfo
?[
"refresh_token"
]
as!
String
),
"client_id"
:
(
campaignInfo
?[
"client_id"
]
as!
String
),
"client_secret"
:
(
campaignInfo
?[
"client_secret"
]
as!
String
)
"client_secret"
:
(
campaignInfo
?[
"client_secret"
]
as!
String
),
"lan"
:
swiftApi
()
.
getApplicationLocale
(),
"dark"
:
(
swiftApi
()
.
getIsDarkModeEnabled
()
?
"true"
:
"false"
)
]
let
encoder
=
JSONEncoder
()
...
...
@@ -2277,7 +2297,9 @@ public class swiftApi {
"refresh_token"
:
(
campaignInfo
?[
"refresh_token"
]
as!
String
),
"client_id"
:
(
campaignInfo
?[
"client_id"
]
as!
String
),
"client_secret"
:
(
campaignInfo
?[
"client_secret"
]
as!
String
),
"map"
:
(
isMap
?
"true"
:
"false"
)
"map"
:
(
isMap
?
"true"
:
"false"
),
"lan"
:
swiftApi
()
.
getApplicationLocale
(),
"dark"
:
(
swiftApi
()
.
getIsDarkModeEnabled
()
?
"true"
:
"false"
)
]
let
encoder
=
JSONEncoder
()
...
...
@@ -2314,7 +2336,9 @@ public class swiftApi {
"refresh_token"
:
(
campaignInfo
?[
"refresh_token"
]
as!
String
),
"client_id"
:
(
campaignInfo
?[
"client_id"
]
as!
String
),
"client_secret"
:
(
campaignInfo
?[
"client_secret"
]
as!
String
),
"from_widget"
:
(
from_widget
?
"true"
:
"false"
)
"from_widget"
:
(
from_widget
?
"true"
:
"false"
),
"lan"
:
swiftApi
()
.
getApplicationLocale
(),
"dark"
:
(
swiftApi
()
.
getIsDarkModeEnabled
()
?
"true"
:
"false"
)
]
let
encoder
=
JSONEncoder
()
...
...
@@ -3539,7 +3563,7 @@ public class swiftApi {
}
else
{
let
appUuid
=
swiftApi
()
.
getAppUuid
()
let
merchantId
=
swiftApi
()
.
getMerchantId
()
instanceOfMyApi
.
initialize
(
withCallback
:
nil
,
uuid
:
appUuid
,
merchantId
:
merchantId
,
lang
:
"el"
,
successBlock
:
initializeCallback
,
failureBlock
:
initializeFailureCallback
)
instanceOfMyApi
.
initialize
(
withCallback
:
nil
,
uuid
:
appUuid
,
merchantId
:
merchantId
,
lang
:
swiftApi
()
.
getApplicationLocale
()
,
successBlock
:
initializeCallback
,
failureBlock
:
initializeFailureCallback
)
}
func
initializeCallback
(
_
initializeData
:
[
AnyHashable
:
Any
]?)
->
Void
{
...
...
@@ -3642,7 +3666,7 @@ public class swiftApi {
}
else
{
let
appUuid
=
swiftApi
()
.
getAppUuid
()
let
merchantId
=
swiftApi
()
.
getMerchantId
()
instanceOfMyApi
.
initialize
(
withCallback
:
nil
,
uuid
:
appUuid
,
merchantId
:
merchantId
,
lang
:
"el"
,
successBlock
:
initializeCallback
,
failureBlock
:
initializeFailureCallback
)
instanceOfMyApi
.
initialize
(
withCallback
:
nil
,
uuid
:
appUuid
,
merchantId
:
merchantId
,
lang
:
swiftApi
()
.
getApplicationLocale
()
,
successBlock
:
initializeCallback
,
failureBlock
:
initializeFailureCallback
)
}
...
...
@@ -3695,7 +3719,7 @@ public class swiftApi {
func
getSingleCampaignAsyncCallback
(
_
getSingleCampaignData
:
[
AnyHashable
:
Any
]?)
->
Void
{
// swiftApi().getCampaignsAsyncNew(language:
"en"
, filters: [String : Any](), getCampaignsCallback, failureCallback: {errorCode in })
// swiftApi().getCampaignsAsyncNew(language:
swiftApi().getApplicationLocale()
, filters: [String : Any](), getCampaignsCallback, failureCallback: {errorCode in })
// func getCampaignsCallback (_ campaignsData: Array<swiftApi.CampaignItemModel>?) -> Void {
// if (campaignsData != nil) {
...
...
@@ -3735,7 +3759,7 @@ public class swiftApi {
func
getSingleCampaignFailureCallback
(
_
error
:
Error
?)
->
Void
{
// swiftApi().getCampaignsAsyncNew(language:
"en"
, filters: [String : Any](), getCampaignsCallback, failureCallback: {errorCode in })
// swiftApi().getCampaignsAsyncNew(language:
swiftApi().getApplicationLocale()
, filters: [String : Any](), getCampaignsCallback, failureCallback: {errorCode in })
// func getCampaignsCallback (_ campaignsData: Array<swiftApi.CampaignItemModel>?) -> Void {
// if (campaignsData != nil) {
...
...
Please
register
or
login
to post a comment