-
Notifications
You must be signed in to change notification settings - Fork 0
APPS-55 Persist used project + improve initialization and view behavior #18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
31 commits
Select commit
Hold shift + click to select a range
c07ed1c
[wip] persistent project and initialization
ajungg c758eba
Rename .java to .kt
ajungg cad8177
convert Snabble to kotlin
ajungg 8826770
make every fragment depend on BaseFragment
ajungg cca817d
persist config and project
ajungg faa9b1f
fix crash
ajungg f0bfc67
wait for initialization state in CheckoutActivity
ajungg 6a0794d
remove config persistence
ajungg 2ed52a9
Rename .java to .kt
ajungg ae8393b
persist shop, bugfixes and cleanup of initialization
ajungg 7c03646
cleanup and bugfixes
ajungg 8ae1182
only log keyguard error when it actually removed keys
ajungg 9e5c8cc
fix self scanning view
ajungg de7efa6
Merge branch 'master' into persistance_and_initialization
ajungg d1d4136
use object for Snabble and fix tests
ajungg be1c4b1
more refactoring and cleanup
ajungg c78b1b0
do not inherit from Sample HomeFragment from BaseFragment, syntax imp…
ajungg ce75cfb
expand cases
ajungg 1105e30
allow direct layout inflation of BaseFragment and add if project is r…
ajungg fc960b8
prevent overriding of baseclass methods
ajungg 4c50c19
cleanup
ajungg 86d952e
small fixes and clean up
ajungg 18aec78
fix lint
ajungg 4eb386c
compatibility fixes
ajungg fb69fde
fix repeated setup calls cleaning up properly
ajungg 214e398
improve null safety
ajungg 4fd2564
Fix imports and rarely formatting
rekire 257ccea
Eliminate usage of Snabble.getInstance() in Kotlin code
rekire d99d0e1
Optimize imports and small formatting issues
rekire e1e52c1
Fix lint warnings
rekire 85d112d
Ignore generated documentation
rekire File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,133 @@ | ||
| package io.snabble.sdk | ||
|
|
||
| import android.content.Context | ||
| import io.snabble.sdk.utils.GsonHolder | ||
| import org.apache.commons.io.IOUtils | ||
| import java.io.File | ||
| import java.io.FileInputStream | ||
| import java.io.FileOutputStream | ||
| import java.nio.charset.Charset | ||
| import java.util.concurrent.TimeUnit | ||
| import javax.net.ssl.SSLSocketFactory | ||
| import javax.net.ssl.X509TrustManager | ||
|
|
||
| data class Config ( | ||
| /** | ||
| * The endpoint url of the snabble backend. For example "https://api.snabble.io" for the Production environment. | ||
| */ | ||
| @JvmField | ||
| var endpointBaseUrl: String = Environment.PRODUCTION.baseUrl, | ||
|
|
||
| /** | ||
| * The project identifier, which is used in the communication with the backend. | ||
| */ | ||
| @JvmField | ||
| var appId: String? = null, | ||
|
|
||
| /** | ||
| * The secret needed for Totp token generation | ||
| */ | ||
| @JvmField | ||
| var secret: String? = null, | ||
|
|
||
| /** | ||
| * Relative path from the assets folder which points to a bundled file which contains the metadata | ||
| * | ||
| * | ||
| * This file gets initially used to initialize the sdk before network requests are made, | ||
| * or be able to use the sdk in the case of no network connection. | ||
| * | ||
| * Optional. If no file is specified every time the sdk is initialized we wait for a network response | ||
| * from the backend. | ||
| * | ||
| * It is HIGHLY recommended to provide bundled metadata to allow the sdk to function | ||
| * without having a network connection. | ||
| */ | ||
| @JvmField | ||
| var bundledMetadataAssetPath: String? = null, | ||
|
|
||
| /** | ||
| * Optional. Used to override the versionName appended to the metadata url. | ||
| * | ||
| * Defaults to the versionName in the app package. | ||
| * | ||
| * Must be in the format %d.%d | ||
| */ | ||
| @JvmField | ||
| var versionName: String? = null, | ||
|
|
||
| /** | ||
| * If set to true, creates an full text index to support searching in the product database | ||
| * using findByName or searchByName. | ||
| * | ||
| * Note that this increases setup time of the ProductDatabase, and it may not be | ||
| * immediately available offline. | ||
| */ | ||
| @JvmField | ||
| var generateSearchIndex: Boolean = false, | ||
|
|
||
| /** | ||
| * The time that the database is allowed to be out of date. After the specified time in | ||
| * milliseconds the database only uses online requests for asynchronous requests. | ||
| * | ||
| * Successfully calling [ProductDatabase.update] resets the timer. | ||
| * | ||
| * The time is specified in milliseconds. | ||
| * | ||
| * The default value is 1 hour. | ||
| */ | ||
| @JvmField | ||
| var maxProductDatabaseAge: Long = TimeUnit.HOURS.toMillis(1), | ||
|
|
||
| /** | ||
| * The time that the shopping cart is allowed to be alive after the last modification. | ||
| * | ||
| * The time is specified in milliseconds. | ||
| * | ||
| * The default value is 4 hours. | ||
| */ | ||
| @JvmField | ||
| var maxShoppingCartAge: Long = TimeUnit.HOURS.toMillis(4), | ||
|
|
||
| /** If set to true, disables certificate pinning */ | ||
| @JvmField | ||
| var disableCertificatePinning: Boolean = false, | ||
|
|
||
| /** SQL queries that will get executed in order on the product database */ | ||
| @JvmField | ||
| var initialSQL: List<String> = emptyList(), | ||
|
|
||
| /** Vibrate while adding a product to the cart, by default false */ | ||
| @JvmField | ||
| var vibrateToConfirmCartFilled: Boolean = false, | ||
|
|
||
| /** Set to true, to load shops that are marked as pre launch | ||
| * and are not part of the original metadata in the backend | ||
| * (for example for testing shops in production before a go-live) */ | ||
| @JvmField | ||
| var loadActiveShops: Boolean = false, | ||
|
|
||
| /** | ||
| * The radius in which the CheckInManager tries to check in a shop. | ||
| * | ||
| * In meters. | ||
| */ | ||
| @JvmField | ||
| var checkInRadius: Float = 500.0f, | ||
|
|
||
| /** | ||
| * The radius in which the CheckInManager tries to stay in a shop, if already in it. | ||
| * If outside of this radius and the lastSeenThreshold, you will be checked out. | ||
| */ | ||
| @JvmField | ||
| var checkOutRadius: Float = 1000.0f, | ||
|
|
||
| /** | ||
| * The time in milliseconds which we keep you checked in at a shop. | ||
| * | ||
| * The timer will be refreshed while you are still inside the shop | ||
| * and only begins to run if you are not inside the checkOutRadius anymore. | ||
| */ | ||
| @JvmField | ||
| var lastSeenThreshold: Long = TimeUnit.MINUTES.toMillis(15), | ||
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| package io.snabble.sdk | ||
|
|
||
| enum class InitializationState { | ||
| INITIALIZING, | ||
| INITIALIZED, | ||
| ERROR, | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.