My Application
Properties
The Room Database for the whole application. Could be initialized with Koin, but I want to do it the old way for historical/demo purposes just like I do with HomeViewModel
Read docs of preferencesDataStore
Read docs of dataStore
Functions
Given an Uri that should be a file, it is converted to a Base64 string or null on error. Note: this doesn't require permission android.permission.READ_EXTERNAL_STORAGE
because the Uri has the format of content://
which came from the SAF, Storage Access Framework, contrary to getting the file through file://
protocol.
Util function to get a camera provider, specially since the get()
operation is blocking and can throw exception (although it might be very rare) suspendCoroutine is used to treat this blocking and synchronous get()
call to an asynchronous call that can be used with coroutines
Initialize the DB tables
See docs of requestPermission