2018-10-09 17:35:33 +00:00
|
|
|
package eu.siacs.conversations.utils;
|
|
|
|
|
|
|
|
import android.app.Activity;
|
|
|
|
import android.content.Intent;
|
2018-10-18 19:02:04 +00:00
|
|
|
import android.util.Log;
|
2018-10-09 17:35:33 +00:00
|
|
|
|
2018-10-18 19:02:04 +00:00
|
|
|
import eu.siacs.conversations.Config;
|
2018-10-20 14:37:59 +00:00
|
|
|
import eu.siacs.conversations.entities.Account;
|
2018-10-09 17:35:33 +00:00
|
|
|
import eu.siacs.conversations.ui.ConversationsActivity;
|
2018-10-18 19:02:04 +00:00
|
|
|
import eu.siacs.conversations.ui.EnterPhoneNumberActivity;
|
2018-10-20 14:37:59 +00:00
|
|
|
import eu.siacs.conversations.ui.StartConversationActivity;
|
|
|
|
import eu.siacs.conversations.ui.VerifyActivity;
|
2018-10-09 17:35:33 +00:00
|
|
|
|
|
|
|
public class SignupUtils {
|
|
|
|
|
|
|
|
public static Intent getSignUpIntent(Activity activity) {
|
2018-10-18 19:02:04 +00:00
|
|
|
final Intent intent = new Intent(activity, EnterPhoneNumberActivity.class);
|
|
|
|
return intent;
|
2018-10-09 17:35:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public static Intent getRedirectionIntent(ConversationsActivity activity) {
|
2018-10-20 14:37:59 +00:00
|
|
|
final Intent intent;
|
|
|
|
final Account account = AccountUtils.getFirst(activity.xmppConnectionService);
|
|
|
|
if (account != null) {
|
|
|
|
if (account.isOptionSet(Account.OPTION_UNVERIFIED)) {
|
|
|
|
intent = new Intent(activity, VerifyActivity.class);
|
|
|
|
} else {
|
|
|
|
intent = new Intent(activity, StartConversationActivity.class);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
intent = getSignUpIntent(activity);
|
|
|
|
|
|
|
|
}
|
2018-10-18 19:02:04 +00:00
|
|
|
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
|
|
|
|
return intent;
|
2018-10-09 17:35:33 +00:00
|
|
|
}
|
|
|
|
}
|