mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
Fix web URLs in Android app
This commit is contained in:
parent
31c13cb00e
commit
5cb2ee1715
4 changed files with 9 additions and 4 deletions
|
|
@ -45,12 +45,14 @@ android {
|
|||
debug{
|
||||
signingConfig signingConfigs.debug
|
||||
buildConfigField("String", "OMNIVORE_API_URL", "\"https://api-demo.omnivore.app\"")
|
||||
buildConfigField("String", "OMNIVORE_WEB_URL", "\"https://demo.omnivore.app\"")
|
||||
buildConfigField("String", "OMNIVORE_GAUTH_SERVER_CLIENT_ID", "\"267918240109-eu2ar09unac3lqqigluknhk7t0021b54.apps.googleusercontent.com\"")
|
||||
}
|
||||
release {
|
||||
minifyEnabled false
|
||||
signingConfig signingConfigs.release
|
||||
buildConfigField("String", "OMNIVORE_API_URL", "\"https://api-prod.omnivore.app\"")
|
||||
buildConfigField("String", "OMNIVORE_WEB_URL", "\"https://omnivore.app\"")
|
||||
buildConfigField("String", "OMNIVORE_GAUTH_SERVER_CLIENT_ID", "\"687911924401-lq8j1e97n0sv3khhb8g8n368lk4dqkbp.apps.googleusercontent.com\"")
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package app.omnivore.omnivore
|
|||
|
||||
object Constants {
|
||||
const val apiURL = BuildConfig.OMNIVORE_API_URL
|
||||
const val webURL = BuildConfig.OMNIVORE_WEB_URL
|
||||
const val dataStoreName = "omnivore-datastore"
|
||||
}
|
||||
|
||||
|
|
@ -12,7 +13,7 @@ object DatastoreKeys {
|
|||
|
||||
object AppleConstants {
|
||||
const val clientId = "app.omnivore"
|
||||
const val redirectURI = "https%3A%2F%2Fapi-demo.omnivore.app%2Fapi%2Fmobile-auth%2Fandroid-apple-redirect"
|
||||
const val redirectURI = BuildConfig.OMNIVORE_API_URL + "/api/mobile-auth/android-apple-redirect"
|
||||
const val scope = "name%20email"
|
||||
const val authUrl = "https://appleid.apple.com/auth/authorize"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ import androidx.compose.ui.viewinterop.AndroidView
|
|||
import androidx.compose.ui.window.Dialog
|
||||
import app.omnivore.omnivore.AppleConstants
|
||||
import app.omnivore.omnivore.R
|
||||
import java.net.URLEncoder
|
||||
import java.util.*
|
||||
|
||||
@Composable
|
||||
|
|
@ -62,7 +63,7 @@ fun AppleAuthDialog(onDismiss: (String?) -> Unit) {
|
|||
fun AppleAuthWebView(onDismiss: (String?) -> Unit) {
|
||||
val url = AppleConstants.authUrl +
|
||||
"?client_id=" + AppleConstants.clientId +
|
||||
"&redirect_uri=" + AppleConstants.redirectURI +
|
||||
"&redirect_uri=" + URLEncoder.encode(AppleConstants.redirectURI, "utf8") +
|
||||
"&response_type=code%20id_token" +
|
||||
"&scope=" + AppleConstants.scope +
|
||||
"&response_mode=form_post" +
|
||||
|
|
|
|||
|
|
@ -8,13 +8,14 @@ import android.webkit.WebViewClient
|
|||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.viewinterop.AndroidView
|
||||
import app.omnivore.omnivore.BuildConfig
|
||||
|
||||
@SuppressLint("SetJavaScriptEnabled")
|
||||
@Composable
|
||||
fun ArticleWebView(slug: String, authCookieString: String) {
|
||||
WebView.setWebContentsDebuggingEnabled(true)
|
||||
|
||||
val url = "https://demo.omnivore.app/app/me/$slug"
|
||||
val url = BuildConfig.OMNIVORE_WEB_URL + "/app/me/$slug"
|
||||
|
||||
AndroidView(factory = {
|
||||
WebView(it).apply {
|
||||
|
|
@ -33,7 +34,7 @@ fun ArticleWebView(slug: String, authCookieString: String) {
|
|||
|
||||
CookieManager.getInstance().setAcceptThirdPartyCookies(this, true)
|
||||
CookieManager.getInstance().setAcceptCookie(true)
|
||||
CookieManager.getInstance().setCookie("https://api-demo.omnivore.app", authCookieString) {
|
||||
CookieManager.getInstance().setCookie(BuildConfig.OMNIVORE_WEB_URL, authCookieString) {
|
||||
loadUrl(url)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue