mirror of
https://github.com/nextcloud/talk-android.git
synced 2024-11-21 12:35:30 +03:00
Handle incoming intent with server and userId as payload
Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>
This commit is contained in:
parent
263edbc1d0
commit
6784c08ef4
2 changed files with 25 additions and 0 deletions
|
@ -133,6 +133,12 @@
|
|||
<data android:scheme="content" />
|
||||
<data android:scheme="file" />
|
||||
</intent-filter>
|
||||
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<data android:mimeType="text/text" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
|
|
|
@ -64,6 +64,7 @@ import io.reactivex.android.schedulers.AndroidSchedulers
|
|||
import io.reactivex.disposables.Disposable
|
||||
import io.reactivex.schedulers.Schedulers
|
||||
import org.parceler.Parcels
|
||||
import java.net.URI
|
||||
import javax.inject.Inject
|
||||
|
||||
@AutoInjector(NextcloudTalkApplication::class)
|
||||
|
@ -245,6 +246,24 @@ class MainActivity : BaseActivity(), ActionBarProvider {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (intent.action == Intent.ACTION_VIEW &&
|
||||
intent.extras?.get("server") != null &&
|
||||
intent.extras?.get("userId") != null
|
||||
) {
|
||||
val baseUrl = intent.extras?.get("server") as URI // intent.extras.getString("server") is empty?!
|
||||
val user = intent.extras?.get("userId") as String
|
||||
|
||||
if (userUtils.currentUser?.baseUrl?.endsWith(baseUrl.toString()) == true && user.isNotEmpty()) {
|
||||
startConversation(user)
|
||||
} else {
|
||||
Snackbar.make(
|
||||
binding.controllerContainer,
|
||||
R.string.nc_phone_book_integration_account_not_found,
|
||||
Snackbar.LENGTH_LONG
|
||||
).show()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun startConversation(userId: String) {
|
||||
|
|
Loading…
Reference in a new issue