anotherim/src/quicksy/java/eu/siacs/conversations/utils/SignupUtils.java

37 lines
1.3 KiB
Java
Raw Normal View History

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-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;
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;
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;
}
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;
}
}