Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* Nextcloud - Android Client
*
* SPDX-FileCopyrightText: 2023 TSI-mc
* SPDX-FileCopyrightText: 2023-2024 TSI-mc <surinder.kumar@t-systems.com>
* SPDX-FileCopyrightText: 2019 Chris Narkiewicz <hello@ezaquarii.com>
* SPDX-License-Identifier: AGPL-3.0-or-later OR GPL-2.0-only
*/
Expand All @@ -19,8 +19,10 @@
import android.preference.PreferenceManager;
import android.text.TextUtils;

import com.nextcloud.client.onboarding.FirstRunActivity;
import com.nextcloud.common.NextcloudClient;
import com.nextcloud.utils.extensions.AccountExtensionsKt;
import com.nmc.android.ui.LauncherActivity;
import com.owncloud.android.MainApp;
import com.owncloud.android.R;
import com.owncloud.android.authentication.AuthenticatorActivity;
Expand Down Expand Up @@ -397,6 +399,10 @@ private String getAccountType() {

@Override
public void startAccountCreation(final Activity activity) {

// skipping AuthenticatorActivity redirection when user is on Launcher or FirstRun Activity
if (activity instanceof LauncherActivity || activity instanceof FirstRunActivity) return;

Intent intent = new Intent(context, AuthenticatorActivity.class);

intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
* Nextcloud - Android Client
*
* SPDX-FileCopyrightText: 2019 Chris Narkiewicz <hello@ezaquarii.com>
* SPDX-FileCopyrightText: 2024 TSI-mc <surinder.kumar@t-systems.com>
* SPDX-License-Identifier: AGPL-3.0-or-later OR GPL-2.0-only
*/
package com.nextcloud.client.onboarding
Expand Down Expand Up @@ -42,7 +43,7 @@ internal class OnboardingServiceImpl constructor(

override val isFirstRun: Boolean
get() {
return accountProvider.currentAccount == null
return accountProvider.user.isAnonymous
}

override fun shouldShowWhatsNew(callingContext: Context): Boolean {
Expand Down
5 changes: 4 additions & 1 deletion app/src/main/java/com/nmc/android/ui/LauncherActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*
* SPDX-FileCopyrightText: 2023 Alper Ozturk <alper.ozturk@nextcloud.com>
* SPDX-FileCopyrightText: 2023 Andy Scherzinger <info@andy-scherzinger.de>
* SPDX-FileCopyrightText: 2023 TSI-mc
* SPDX-FileCopyrightText: 2023-2024 TSI-mc <surinder.kumar@t-systems.com>
* SPDX-License-Identifier: AGPL-3.0-or-later OR GPL-2.0-only
*/
package com.nmc.android.ui
Expand All @@ -18,6 +18,7 @@ import androidx.annotation.VisibleForTesting
import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen
import com.nextcloud.client.preferences.AppPreferences
import com.owncloud.android.R
import com.owncloud.android.authentication.AuthenticatorActivity
import com.owncloud.android.databinding.ActivitySplashBinding
import com.owncloud.android.ui.activity.BaseActivity
import com.owncloud.android.ui.activity.FileDisplayActivity
Expand Down Expand Up @@ -65,6 +66,8 @@ class LauncherActivity : BaseActivity() {
Handler(Looper.getMainLooper()).postDelayed({
if (user.isPresent) {
startActivity(Intent(this, FileDisplayActivity::class.java))
} else {
startActivity(Intent(this, AuthenticatorActivity::class.java))
}
finish()
}, SPLASH_DURATION)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* Nextcloud - Android Client
*
* SPDX-FileCopyrightText: 2023 TSI-mc
* SPDX-FileCopyrightText: 2023-2024 TSI-mc <surinder.kumar@t-systems.com>
* SPDX-FileCopyrightText: 2019-2021 Tobias Kaminsky <tobias@kaminsky.me>
* SPDX-FileCopyrightText: 2018 Andy Scherzinger <info@andy-scherzinger>
* SPDX-FileCopyrightText: 2017 Mario Danic <mario@lovelyhq.com>
Expand Down Expand Up @@ -1364,14 +1364,13 @@ public void onAuthenticatorTaskCallback(RemoteOperationResult<UserInfo> result)
}

private void endSuccess() {
if (onlyAdd) {
finish();
} else {
if (!onlyAdd) {
Intent i = new Intent(this, FileDisplayActivity.class);
i.setAction(FileDisplayActivity.RESTART);
i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(i);
}
finish();
}

private void getUserCapabilitiesAndFinish() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
* Nextcloud - Android Client
*
* SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2024 TSI-mc <surinder.kumar@t-systems.com>
* SPDX-License-Identifier: AGPL-3.0-or-later OR GPL-2.0-only
*/
package com.owncloud.android.ui.activity;
Expand Down Expand Up @@ -115,7 +116,9 @@ protected void onNewIntent(Intent intent) {
protected void onRestart() {
Log_OC.v(TAG, "onRestart() start");
super.onRestart();
mixinRegistry.onRestart();
if (enableAccountHandling) {
mixinRegistry.onRestart();
}
}

private void onThemeSettingsModeChanged() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ private void setupSyncCategory() {
viewThemeUtils.files.themePreferenceCategory(preferenceCategorySync);

setupAutoUploadPreference(preferenceCategorySync);
setupInternalTwoWaySyncPreference(preferenceCategorySync);
setupInternalTwoWaySyncPreference();
}

private void setupMoreCategory() {
Expand Down Expand Up @@ -567,7 +567,7 @@ private void setupAutoUploadPreference(PreferenceCategory preferenceCategoryMore
}
}

private void setupInternalTwoWaySyncPreference(PreferenceCategory preferenceCategorySync) {
private void setupInternalTwoWaySyncPreference() {
Preference twoWaySync = findPreference("internal_two_way_sync");

twoWaySync.setOnPreferenceClickListener(preference -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@
* Nextcloud - Android Client
*
* SPDX-FileCopyrightText: 2019 Chris Narkiewicz <hello@ezaquarii.com>
* SPDX-FileCopyrightText: 2024 TSI-mc <surinder.kumar@t-systems.com>
* SPDX-License-Identifier: AGPL-3.0-or-later OR GPL-2.0-only
*/
package com.nextcloud.client.onboarding

import android.accounts.Account
import android.content.res.Resources
import com.nextcloud.client.account.AnonymousUser
import com.nextcloud.client.account.CurrentAccountProvider
import com.nextcloud.client.account.User
import com.nextcloud.client.preferences.AppPreferences
import org.junit.Assert.assertFalse
import org.junit.Assert.assertTrue
Expand All @@ -30,7 +32,7 @@ class OnboardingServiceTest {
private lateinit var currentAccountProvider: CurrentAccountProvider

@Mock
private lateinit var account: Account
private lateinit var user: User

private lateinit var onboardingService: OnboardingServiceImpl

Expand All @@ -43,13 +45,16 @@ class OnboardingServiceTest {
@Test
fun `first run flag toggles with current current account`() {
// GIVEN
// current account is not set
// current account is anonymous
whenever(currentAccountProvider.user).thenReturn(AnonymousUser("dummy"))

// THEN
// first run flag is true
assertTrue(onboardingService.isFirstRun)

// WHEN
// current account is set
whenever(currentAccountProvider.currentAccount).thenReturn(account)
whenever(currentAccountProvider.user).thenReturn(user)

// THEN
// first run flag toggles
Expand Down