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-07-18 15:50:14 +0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
d8fdd5877de4152d012610fe6b7f6e2eb5e8cd99
d8fdd587
1 parent
18f5a108
fix environment handling
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
8 deletions
NETWORK_TESTING_AUTHORIZATION.md
SwiftWarplyFramework/SwiftWarplyFramework/Core/WarplySDK.swift
NETWORK_TESTING_AUTHORIZATION.md
View file @
d8fdd58
This diff is collapsed. Click to expand it.
SwiftWarplyFramework/SwiftWarplyFramework/Core/WarplySDK.swift
View file @
d8fdd58
...
...
@@ -210,6 +210,9 @@ final class UserDefaultsStore {
@UserDefault(key: "isDarkModeEnabledUD", defaultValue: false)
var
isDarkModeEnabled
:
Bool
@UserDefault(key: "environmentUD", defaultValue: "production")
var
environment
:
String
}
// MARK: - SDK State Management
...
...
@@ -299,6 +302,9 @@ public final class WarplySDK {
* ```
*/
public
func
configure
(
appUuid
:
String
,
merchantId
:
String
,
environment
:
Configuration
.
Environment
=
.
production
,
language
:
String
=
"el"
)
{
// Store environment for later use
storage
.
environment
=
environment
==
.
development
?
"development"
:
"production"
Configuration
.
baseURL
=
environment
.
baseURL
Configuration
.
host
=
environment
.
host
Configuration
.
errorDomain
=
environment
.
host
...
...
@@ -308,6 +314,8 @@ public final class WarplySDK {
storage
.
appUuid
=
appUuid
storage
.
merchantId
=
merchantId
storage
.
applicationLocale
=
language
print
(
"✅ [WarplySDK] Environment configured:
\(
storage
.
environment
)
"
)
}
/// Set environment (development/production)
...
...
@@ -378,13 +386,15 @@ public final class WarplySDK {
return
}
// Set up configuration based on appUuid
Configuration
.
baseURL
=
storage
.
appUuid
==
"f83dfde1145e4c2da69793abb2f579af"
?
Configuration
.
Environment
.
development
.
baseURL
:
Configuration
.
Environment
.
production
.
baseURL
Configuration
.
host
=
storage
.
appUuid
==
"f83dfde1145e4c2da69793abb2f579af"
?
Configuration
.
Environment
.
development
.
host
:
Configuration
.
Environment
.
production
.
host
// Set up configuration based on stored environment
let
currentEnvironment
=
storage
.
environment
==
"development"
?
Configuration
.
Environment
.
development
:
Configuration
.
Environment
.
production
Configuration
.
baseURL
=
currentEnvironment
.
baseURL
Configuration
.
host
=
currentEnvironment
.
host
print
(
"✅ [WarplySDK] Using stored environment:
\(
storage
.
environment
)
"
)
// Store appUuid in UserDefaults for NetworkService access
UserDefaults
.
standard
.
set
(
storage
.
appUuid
,
forKey
:
"appUuidUD"
)
...
...
@@ -831,6 +841,23 @@ public final class WarplySDK {
set
{
storage
.
isDarkModeEnabled
=
newValue
}
}
// MARK: - Environment Access
/// Get current environment
public
var
currentEnvironment
:
Configuration
.
Environment
{
return
storage
.
environment
==
"development"
?
.
development
:
.
production
}
/// Check if currently in production environment
public
func
isProductionEnvironment
()
->
Bool
{
return
storage
.
environment
==
"production"
}
/// Check if currently in development environment
public
func
isDevelopmentEnvironment
()
->
Bool
{
return
storage
.
environment
==
"development"
}
// MARK: - Authentication
/// Register device with Warply platform
...
...
@@ -2874,7 +2901,7 @@ public final class WarplySDK {
/// Get market pass map URL
public
func
getMarketPassMapUrl
()
->
String
{
if
storage
.
appUuid
==
"f83dfde1145e4c2da69793abb2f579af
"
{
if
storage
.
environment
==
"development
"
{
return
"https://magenta-dev.supermarketdeals.eu/map?map=true"
}
else
{
return
"https://magenta.supermarketdeals.eu/map?map=true"
...
...
Please
register
or
login
to post a comment