bitfireAT / davx5-ose

DAVx⁵ is an open-source CalDAV/CardDAV suite and sync app for Android. You can also access your online files (WebDAV) with it.
https://www.davx5.com
GNU General Public License v3.0
1.3k stars 70 forks source link

Failing to open url login page via explicit intent #711

Closed rfc2822 closed 2 months ago

rfc2822 commented 2 months ago

Discussed in https://github.com/bitfireAT/davx5-ose/discussions/709

Originally posted by **Jehduend94** April 5, 2024 Hello, I'm trying to open the DavX5 app on the "Login with URL and user name" page via an explicit intent as described in the documentation [docs](https://manual.davx5.com/integration.html#explicit-intent), however, it always opens the app on the "Login with email address" page. This is what I get: ![image](https://github.com/bitfireAT/davx5-ose/assets/32623287/aa9a60f0-5353-4016-9ef2-cc04cc76b12c) I'm creating the intent from a react-native application with a kotlin module I build to invoke the intent. Callback function from react-native to invoke kotlin function: ``` const openDavX5 = async () => { try { await DavX5Module.openDavX5( 'https://example.com/path/', "my_email@example.com", "password123" ); } catch (error) { console.log(error); } }; ``` This is my kotlin module: ``` package com.testreactnative; import android.content.Intent import android.util.Log import androidx.core.content.ContextCompat.startActivity import com.facebook.react.bridge.ReactApplicationContext import com.facebook.react.bridge.ReactContextBaseJavaModule import com.facebook.react.bridge.ReactMethod class DavX5Module(reactContext: ReactApplicationContext) : ReactContextBaseJavaModule(reactContext) { override fun getName() = "DavX5Module" @ReactMethod fun openDavX5(url: String, username: String, password: String) { val intent = Intent().apply { setClassName("at.bitfire.davdroid", "at.bitfire.davdroid.ui.setup.LoginActivity") setData(null) putExtra("url", url) putExtra("username", username) putExtra("password", password) addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) } startActivity(reactApplicationContext, intent, null) } } ``` If anyone has any ideas on how to make this work correctly, I would greatly appreciate your input :)
rfc2822 commented 2 months ago

Works here with

adb shell am start --es url https://example.com/path/ --es username name --es password pwd at.bitfire.davdroid/at.bitfire.davdroid.ui.setup.LoginActivity