mirror of
https://github.com/nextcloud/android.git
synced 2024-11-24 06:05:42 +03:00
Merge master
Signed-off-by: alperozturk <alper_ozturk@proton.me>
This commit is contained in:
commit
8ef57210d4
2 changed files with 37 additions and 40 deletions
|
@ -1,40 +0,0 @@
|
|||
package com.owncloud.android.authentication;
|
||||
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.nextcloud.client.di.Injectable;
|
||||
import com.owncloud.android.R;
|
||||
|
||||
public class DeepLinkLoginActivity extends AuthenticatorActivity implements Injectable {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
if (!getResources().getBoolean(R.bool.multiaccount_support) &&
|
||||
accountManager.getAccounts().length == 1) {
|
||||
Toast.makeText(this, R.string.no_mutliple_accounts_allowed, Toast.LENGTH_LONG).show();
|
||||
return;
|
||||
}
|
||||
|
||||
setContentView(R.layout.deep_link_login);
|
||||
|
||||
Uri data = getIntent().getData();
|
||||
|
||||
if (data != null) {
|
||||
try {
|
||||
String prefix = getString(R.string.login_data_own_scheme) + PROTOCOL_SUFFIX + "login/";
|
||||
LoginUrlInfo loginUrlInfo = parseLoginDataUrl(prefix, data.toString());
|
||||
|
||||
TextView loginText = findViewById(R.id.loginInfo);
|
||||
loginText.setText(String.format(getString(R.string.direct_login_text), loginUrlInfo.username,
|
||||
loginUrlInfo.serverAddress));
|
||||
} catch (IllegalArgumentException e) {
|
||||
Toast.makeText(this, R.string.direct_login_failed, Toast.LENGTH_LONG).show();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
package com.owncloud.android.authentication
|
||||
|
||||
import android.os.Bundle
|
||||
import android.widget.TextView
|
||||
import android.widget.Toast
|
||||
import com.nextcloud.client.di.Injectable
|
||||
import com.owncloud.android.R
|
||||
|
||||
class DeepLinkLoginActivity : AuthenticatorActivity(), Injectable {
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
if (!resources.getBoolean(R.bool.multiaccount_support) &&
|
||||
accountManager.accounts.size == 1
|
||||
) {
|
||||
Toast.makeText(this, R.string.no_mutliple_accounts_allowed, Toast.LENGTH_LONG).show()
|
||||
return
|
||||
}
|
||||
|
||||
setContentView(R.layout.deep_link_login)
|
||||
|
||||
intent.data?.let {
|
||||
try {
|
||||
val prefix = getString(R.string.login_data_own_scheme) + PROTOCOL_SUFFIX + "login/"
|
||||
val loginUrlInfo = parseLoginDataUrl(prefix, it.toString())
|
||||
val loginText = findViewById<TextView>(R.id.loginInfo)
|
||||
loginText.text = String.format(
|
||||
getString(R.string.direct_login_text), loginUrlInfo.username,
|
||||
loginUrlInfo.serverAddress
|
||||
)
|
||||
} catch (e: IllegalArgumentException) {
|
||||
Toast.makeText(this, R.string.direct_login_failed, Toast.LENGTH_LONG).show()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue