How to use the SDK to create applications based on Yelm Media.
Thanks to our development you can create a commercial application and manage it through a panel at beta.yelm.io
Use the start method and pass your platform and user position. The platform is your internal application identifier, the position is passed in the form of coordinates to determine the availability of goods and this or that position.
ServerAPI.start(platform: "5fd33466e17963.29052139", position: position) {
(result) in
// result - Returns a Bool - if everything was successful
}
Transmit the position strictly in parameter format - as shown in the example
let position = UserDefaults.standard.string(forKey: "SELECTED_SHOP_POINTS") ?? "lat=0&lon=0"
To work with the SDK during testing - we recommend using debug - toggle its state and you can see what sends
ServerAPI.settings.debug = false
To get the application settings - initialize the get_settings method after a successful SDK start
ServerAPI.settings.get_settings {
(load) in
if (load) {
// Here you can use the resulting settings
}
}
What settings do we have ?
public var theme : String = "" // HEX color of app
public var foreground : String = "" // HEX color for the text on top of the theme
public var symbol : String = "" // Currency sign for your region
public var currency : String = "" // Currency code for your region
public var debug : Bool = false // You know.
To register a user, use the registration method. This method will give you a unique user each time you access it - save his login for future accesses.
ServerAPI.user.registration {
(load, user) in
if (load) {
// user
UserDefaults.standard.set(user, forKey: "USER")
}
}
For the rest of the data, see wiki page
Send to the server information about the user action to display statistics
ServerAPI.settings.log(action: "open_news_notification", about: "\(object.id)")
open_item
share_item
share_news
open_item_search
open_story
open_news
open_item_from_news
open_item_subcategory
open_item_chat
open_order_history
open_app
close_app
open_load