mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
Merge pull request #1295 from omnivore-app/chore/android-pspdfkey
Android Keys
This commit is contained in:
commit
df8be3c6c5
5 changed files with 38 additions and 3 deletions
3
Makefile
3
Makefile
|
|
@ -8,6 +8,9 @@ apple_extension_gen:
|
|||
$(MAKE) -C apple extension_gen
|
||||
|
||||
droid:
|
||||
@if ! [ -e android/Omnivore/app/src/main/res/values/secrets.xml ]; then \
|
||||
cp android/Omnivore/secrets.xml android/Omnivore/app/src/main/res/values/secrets.xml; \
|
||||
fi
|
||||
studio android/Omnivore
|
||||
|
||||
webview_gen:
|
||||
|
|
|
|||
11
android/Omnivore/README.md
Normal file
11
android/Omnivore/README.md
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
# Omnivore - Android
|
||||
|
||||
## Setup
|
||||
|
||||
From the root directory run the following command:
|
||||
|
||||
`make droid`
|
||||
|
||||
This will copy a secrets.xml file into the strings directory.
|
||||
If you have a PSPDF license key then paste that value into the
|
||||
`pspdfkit_license_key` entry in that file.
|
||||
3
android/Omnivore/app/.gitignore
vendored
3
android/Omnivore/app/.gitignore
vendored
|
|
@ -1,3 +1,4 @@
|
|||
/build
|
||||
keystore.properties
|
||||
*.keystore
|
||||
*.keystore
|
||||
src/main/res/values/secrets.xml
|
||||
|
|
@ -10,16 +10,20 @@ import androidx.compose.foundation.layout.Box
|
|||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import app.omnivore.omnivore.ui.theme.OmnivoreTheme
|
||||
import androidx.core.view.ViewCompat
|
||||
import androidx.core.view.WindowCompat
|
||||
import androidx.core.view.WindowInsetsCompat
|
||||
import app.omnivore.omnivore.ui.auth.LoginViewModel
|
||||
import app.omnivore.omnivore.ui.home.HomeViewModel
|
||||
import app.omnivore.omnivore.ui.reader.PDFReaderViewModel
|
||||
import app.omnivore.omnivore.ui.reader.WebReaderViewModel
|
||||
import app.omnivore.omnivore.ui.root.RootView
|
||||
import app.omnivore.omnivore.ui.theme.OmnivoreTheme
|
||||
import com.pspdfkit.PSPDFKit
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.GlobalScope
|
||||
import kotlinx.coroutines.launch
|
||||
|
||||
|
||||
@AndroidEntryPoint
|
||||
class MainActivity : ComponentActivity() {
|
||||
|
|
@ -30,6 +34,18 @@ class MainActivity : ComponentActivity() {
|
|||
val homeViewModel: HomeViewModel by viewModels()
|
||||
val webReaderViewModel: WebReaderViewModel by viewModels()
|
||||
|
||||
val context = this
|
||||
|
||||
GlobalScope.launch(Dispatchers.IO) {
|
||||
val licenseKey = getString(R.string.pspdfkit_license_key)
|
||||
|
||||
if (licenseKey.length > 30) {
|
||||
PSPDFKit.initialize(context, licenseKey)
|
||||
} else {
|
||||
PSPDFKit.initialize(context, null)
|
||||
}
|
||||
}
|
||||
|
||||
setContent {
|
||||
OmnivoreTheme {
|
||||
Box(
|
||||
|
|
|
|||
4
android/Omnivore/secrets.xml
Normal file
4
android/Omnivore/secrets.xml
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="pspdfkit_license_key">unset</string>
|
||||
</resources>
|
||||
Loading…
Reference in a new issue