diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/eu/siacs/conversations/ui/ConversationActivity.java | 50 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/ui/startUI.java | 11 |
2 files changed, 32 insertions, 29 deletions
diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java b/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java index 4db939048..6c93a3acc 100644 --- a/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java @@ -1326,34 +1326,34 @@ public class ConversationActivity extends XmppActivity mPendingConferenceInvite = null; } + if (FirstStartTime == 0) { + Log.d(Config.LOGTAG, "First start time: " + FirstStartTime + ", restarting App"); + //write first start timestamp to file + String PREFS_NAME = "FirstStart"; + FirstStartTime = System.currentTimeMillis(); + SharedPreferences FirstStart = getApplicationContext().getSharedPreferences(PREFS_NAME, Context.MODE_PRIVATE); + SharedPreferences.Editor editor = FirstStart.edit(); + editor.putLong("FirstStart", FirstStartTime); + editor.commit(); + // restart + Intent intent = getBaseContext().getPackageManager().getLaunchIntentForPackage(getBaseContext().getPackageName()); + intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); + intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + startActivity(intent); + System.exit(0); + } + if (xmppConnectionService.getAccounts().size() == 0) { if (mRedirected.compareAndSet(false, true)) { if (Config.X509_VERIFICATION) { - startActivity(new Intent(this, ManageAccountActivity.class)); - } else if (Config.MAGIC_CREATE_DOMAIN != null) { - if (FirstStartTime == 0) { - Log.d(Config.LOGTAG, "First start time: " + FirstStartTime + ", restarting App"); - //write first start timestamp to file - String PREFS_NAME = "FirstStart"; - FirstStartTime = System.currentTimeMillis(); - SharedPreferences FirstStart = getApplicationContext().getSharedPreferences(PREFS_NAME, Context.MODE_PRIVATE); - SharedPreferences.Editor editor = FirstStart.edit(); - editor.putLong("FirstStart", FirstStartTime); - editor.commit(); - // restart - Intent intent = getBaseContext().getPackageManager().getLaunchIntentForPackage(getBaseContext().getPackageName()); - intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); - intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); - startActivity(intent); - System.exit(0); - } else { - Log.d(Config.LOGTAG, "First start time: " + FirstStartTime); - startActivity(new Intent(this, WelcomeActivity.class)); - } - } else { - startActivity(new Intent(this, EditAccountActivity.class)); - } - finish(); + startActivity(new Intent(this, ManageAccountActivity.class)); + } else if (Config.MAGIC_CREATE_DOMAIN != null) { + Log.d(Config.LOGTAG, "First start time: " + FirstStartTime); + startActivity(new Intent(this, WelcomeActivity.class)); + } else { + startActivity(new Intent(this, EditAccountActivity.class)); + } + finish(); } } else if (conversationList.size() <= 0) { if (mRedirected.compareAndSet(false, true)) { diff --git a/src/main/java/eu/siacs/conversations/ui/startUI.java b/src/main/java/eu/siacs/conversations/ui/startUI.java index 77ef20c72..e69db94aa 100644 --- a/src/main/java/eu/siacs/conversations/ui/startUI.java +++ b/src/main/java/eu/siacs/conversations/ui/startUI.java @@ -12,7 +12,6 @@ import android.support.v7.app.AlertDialog; import android.support.v7.app.AppCompatActivity; import android.util.Log; -import java.util.Arrays; import java.util.List; import eu.siacs.conversations.Config; @@ -20,9 +19,6 @@ import eu.siacs.conversations.R; import pub.devrel.easypermissions.AfterPermissionGranted; import pub.devrel.easypermissions.EasyPermissions; -/** - * Created by Christian on 10.06.2016. - */ public class startUI extends AppCompatActivity implements EasyPermissions.PermissionCallbacks { @@ -55,6 +51,13 @@ public class startUI extends AppCompatActivity startActivity(intent); finish(); } else { + // set first start to 0 if there are permissions to request + String PREFS_NAME = "FirstStart"; + long FirstStartTime = 0; + SharedPreferences FirstStart = getApplicationContext().getSharedPreferences(PREFS_NAME, Context.MODE_PRIVATE); + SharedPreferences.Editor editor = FirstStart.edit(); + editor.putLong("FirstStart", FirstStartTime); + editor.commit(); // Do not have permissions, request them now EasyPermissions.requestPermissions(this, getString(R.string.request_permissions_message), NeededPermissions, perms); |