1+ package io.snabble.sdk
2+
3+ import android.content.Context
4+ import io.snabble.sdk.utils.GsonHolder
5+ import org.apache.commons.io.IOUtils
6+ import java.io.File
7+ import java.io.FileInputStream
8+ import java.io.FileOutputStream
9+ import java.nio.charset.Charset
10+ import java.util.concurrent.TimeUnit
11+ import javax.net.ssl.SSLSocketFactory
12+ import javax.net.ssl.X509TrustManager
13+
14+ data class Config (
15+ /* *
16+ * The endpoint url of the snabble backend. For example "https://api.snabble.io" for the Production environment.
17+ */
18+ @JvmField
19+ var endpointBaseUrl : String = Environment .PRODUCTION .baseUrl,
20+
21+ /* *
22+ * The project identifier, which is used in the communication with the backend.
23+ */
24+ @JvmField
25+ var appId : String? = null ,
26+
27+ /* *
28+ * The secret needed for Totp token generation
29+ */
30+ @JvmField
31+ var secret : String? = null ,
32+
33+ /* *
34+ * Relative path from the assets folder which points to a bundled file which contains the metadata
35+ *
36+ *
37+ * This file gets initially used to initialize the sdk before network requests are made,
38+ * or be able to use the sdk in the case of no network connection.
39+ *
40+ * Optional. If no file is specified every time the sdk is initialized we wait for a network response
41+ * from the backend.
42+ *
43+ * It is HIGHLY recommended to provide bundled metadata to allow the sdk to function
44+ * without having a network connection.
45+ */
46+ @JvmField
47+ var bundledMetadataAssetPath : String? = null ,
48+
49+ /* *
50+ * Optional. Used to override the versionName appended to the metadata url.
51+ *
52+ * Defaults to the versionName in the app package.
53+ *
54+ * Must be in the format %d.%d
55+ */
56+ @JvmField
57+ var versionName : String? = null ,
58+
59+ /* *
60+ * If set to true, creates an full text index to support searching in the product database
61+ * using findByName or searchByName.
62+ *
63+ * Note that this increases setup time of the ProductDatabase, and it may not be
64+ * immediately available offline.
65+ */
66+ @JvmField
67+ var generateSearchIndex : Boolean = false ,
68+
69+ /* *
70+ * The time that the database is allowed to be out of date. After the specified time in
71+ * milliseconds the database only uses online requests for asynchronous requests.
72+ *
73+ * Successfully calling [ProductDatabase.update] resets the timer.
74+ *
75+ * The time is specified in milliseconds.
76+ *
77+ * The default value is 1 hour.
78+ */
79+ @JvmField
80+ var maxProductDatabaseAge : Long = TimeUnit .HOURS .toMillis(1),
81+
82+ /* *
83+ * The time that the shopping cart is allowed to be alive after the last modification.
84+ *
85+ * The time is specified in milliseconds.
86+ *
87+ * The default value is 4 hours.
88+ */
89+ @JvmField
90+ var maxShoppingCartAge : Long = TimeUnit .HOURS .toMillis(4),
91+
92+ /* * If set to true, disables certificate pinning */
93+ @JvmField
94+ var disableCertificatePinning : Boolean = false ,
95+
96+ /* * SQL queries that will get executed in order on the product database */
97+ @JvmField
98+ var initialSQL : List <String > = emptyList(),
99+
100+ /* * Vibrate while adding a product to the cart, by default false */
101+ @JvmField
102+ var vibrateToConfirmCartFilled : Boolean = false ,
103+
104+ /* * Set to true, to load shops that are marked as pre launch
105+ * and are not part of the original metadata in the backend
106+ * (for example for testing shops in production before a go-live) */
107+ @JvmField
108+ var loadActiveShops : Boolean = false ,
109+
110+ /* *
111+ * The radius in which the CheckInManager tries to check in a shop.
112+ *
113+ * In meters.
114+ */
115+ @JvmField
116+ var checkInRadius : Float = 500.0f ,
117+
118+ /* *
119+ * The radius in which the CheckInManager tries to stay in a shop, if already in it.
120+ * If outside of this radius and the lastSeenThreshold, you will be checked out.
121+ */
122+ @JvmField
123+ var checkOutRadius : Float = 1000.0f ,
124+
125+ /* *
126+ * The time in milliseconds which we keep you checked in at a shop.
127+ *
128+ * The timer will be refreshed while you are still inside the shop
129+ * and only begins to run if you are not inside the checkOutRadius anymore.
130+ */
131+ @JvmField
132+ var lastSeenThreshold : Long = TimeUnit .MINUTES .toMillis(15),
133+ )
0 commit comments