mirror of
https://github.com/nextcloud/android.git
synced 2024-11-22 05:05:31 +03:00
add showIntro configs to the MDM
Signed-off-by: alperozturk <alper_ozturk@proton.me>
This commit is contained in:
parent
e0ad34c472
commit
90902f5194
5 changed files with 18 additions and 28 deletions
|
@ -24,7 +24,7 @@ import com.nextcloud.client.account.UserAccountManager
|
|||
import com.nextcloud.client.appinfo.AppInfo
|
||||
import com.nextcloud.client.di.Injectable
|
||||
import com.nextcloud.client.preferences.AppPreferences
|
||||
import com.nextcloud.utils.extensions.getRestriction
|
||||
import com.nextcloud.utils.mdm.MDMConfig
|
||||
import com.owncloud.android.BuildConfig
|
||||
import com.owncloud.android.R
|
||||
import com.owncloud.android.authentication.AuthenticatorActivity
|
||||
|
@ -34,7 +34,6 @@ import com.owncloud.android.ui.activity.BaseActivity
|
|||
import com.owncloud.android.ui.activity.FileDisplayActivity
|
||||
import com.owncloud.android.ui.adapter.FeaturesViewAdapter
|
||||
import com.owncloud.android.utils.DisplayUtils
|
||||
import com.owncloud.android.utils.appConfig.AppConfigKeys
|
||||
import com.owncloud.android.utils.theme.ViewThemeUtils
|
||||
import javax.inject.Inject
|
||||
|
||||
|
@ -78,14 +77,12 @@ class FirstRunActivity : BaseActivity(), Injectable {
|
|||
binding = FirstRunActivityBinding.inflate(layoutInflater)
|
||||
setContentView(binding.root)
|
||||
|
||||
val disableIntroViaMDM = getRestriction(AppConfigKeys.DisableIntro, resources.getBoolean(R.bool.disable_intro))
|
||||
val isProviderOrOwnInstallationVisible = resources.getBoolean(R.bool.show_provider_or_own_installation)
|
||||
setSlideshowSize(resources.configuration.orientation == Configuration.ORIENTATION_LANDSCAPE)
|
||||
|
||||
registerActivityResult()
|
||||
setupLoginButton()
|
||||
setupSignupButton(isProviderOrOwnInstallationVisible && !disableIntroViaMDM)
|
||||
setupHostOwnServerTextView(isProviderOrOwnInstallationVisible && !disableIntroViaMDM)
|
||||
setupSignupButton(MDMConfig.showIntro(this))
|
||||
setupHostOwnServerTextView(MDMConfig.showIntro(this))
|
||||
deleteAccountAtFirstLaunch()
|
||||
setupFeaturesViewAdapter()
|
||||
handleOnBackPressed()
|
||||
|
@ -210,10 +207,9 @@ class FirstRunActivity : BaseActivity(), Injectable {
|
|||
}
|
||||
|
||||
private fun setSlideshowSize(isLandscape: Boolean) {
|
||||
val isProviderOrOwnInstallationVisible = resources.getBoolean(R.bool.show_provider_or_own_installation)
|
||||
binding.buttonLayout.orientation = if (isLandscape) LinearLayout.HORIZONTAL else LinearLayout.VERTICAL
|
||||
|
||||
val layoutParams: LinearLayout.LayoutParams = if (isProviderOrOwnInstallationVisible) {
|
||||
val layoutParams: LinearLayout.LayoutParams = if (MDMConfig.showIntro(this)) {
|
||||
LinearLayout.LayoutParams(
|
||||
ViewGroup.LayoutParams.MATCH_PARENT,
|
||||
ViewGroup.LayoutParams.WRAP_CONTENT
|
||||
|
|
|
@ -13,13 +13,12 @@ import android.content.Intent
|
|||
import android.content.res.Resources
|
||||
import com.nextcloud.client.account.CurrentAccountProvider
|
||||
import com.nextcloud.client.preferences.AppPreferences
|
||||
import com.nextcloud.utils.extensions.getRestriction
|
||||
import com.nextcloud.utils.mdm.MDMConfig
|
||||
import com.owncloud.android.BuildConfig
|
||||
import com.owncloud.android.R
|
||||
import com.owncloud.android.authentication.AuthenticatorActivity
|
||||
import com.owncloud.android.features.FeatureItem
|
||||
import com.owncloud.android.ui.activity.PassCodeActivity
|
||||
import com.owncloud.android.utils.appConfig.AppConfigKeys
|
||||
|
||||
internal class OnboardingServiceImpl(
|
||||
private val resources: Resources,
|
||||
|
@ -63,10 +62,8 @@ internal class OnboardingServiceImpl(
|
|||
}
|
||||
|
||||
override fun launchFirstRunIfNeeded(activity: Activity): Boolean {
|
||||
val disableIntroViaMDM = activity.getRestriction(AppConfigKeys.DisableIntro, resources.getBoolean(R.bool.disable_intro))
|
||||
val isProviderOrOwnInstallationVisible = resources.getBoolean(R.bool.show_provider_or_own_installation)
|
||||
val canLaunch = isProviderOrOwnInstallationVisible && isFirstRun && activity is AuthenticatorActivity
|
||||
if (canLaunch && !disableIntroViaMDM) {
|
||||
val canLaunch = MDMConfig.showIntro(activity) && isFirstRun && activity is AuthenticatorActivity
|
||||
if (canLaunch) {
|
||||
val intent = Intent(activity, FirstRunActivity::class.java)
|
||||
activity.startActivityForResult(intent, AuthenticatorActivity.REQUEST_CODE_FIRST_RUN)
|
||||
}
|
||||
|
|
|
@ -65,4 +65,12 @@ object MDMConfig {
|
|||
|
||||
return showExternalLinks && !disableMoreExternalSiteViaMDM
|
||||
}
|
||||
|
||||
fun showIntro(context: Context): Boolean {
|
||||
val disableIntroViaMDM =
|
||||
context.getRestriction(AppConfigKeys.DisableIntro, context.resources.getBoolean(R.bool.disable_intro))
|
||||
val isProviderOrOwnInstallationVisible = context.resources.getBoolean(R.bool.show_provider_or_own_installation)
|
||||
|
||||
return isProviderOrOwnInstallationVisible && !disableIntroViaMDM
|
||||
}
|
||||
}
|
||||
|
|
|
@ -59,7 +59,6 @@ import com.nextcloud.common.NextcloudClient;
|
|||
import com.nextcloud.ui.ChooseAccountDialogFragment;
|
||||
import com.nextcloud.ui.composeActivity.ComposeActivity;
|
||||
import com.nextcloud.ui.composeActivity.ComposeDestination;
|
||||
import com.nextcloud.utils.extensions.ContextExtensionsKt;
|
||||
import com.nextcloud.utils.mdm.MDMConfig;
|
||||
import com.owncloud.android.MainApp;
|
||||
import com.owncloud.android.R;
|
||||
|
@ -97,7 +96,6 @@ import com.owncloud.android.utils.BitmapUtils;
|
|||
import com.owncloud.android.utils.DisplayUtils;
|
||||
import com.owncloud.android.utils.DrawerMenuUtil;
|
||||
import com.owncloud.android.utils.FilesSyncHelper;
|
||||
import com.owncloud.android.utils.appConfig.AppConfigKeys;
|
||||
import com.owncloud.android.utils.svg.MenuSimpleTarget;
|
||||
import com.owncloud.android.utils.svg.SVGorImage;
|
||||
import com.owncloud.android.utils.svg.SvgOrImageBitmapTranscoder;
|
||||
|
@ -605,11 +603,7 @@ public abstract class DrawerActivity extends ToolbarActivity
|
|||
}
|
||||
|
||||
public void openAddAccount() {
|
||||
boolean disableIntroViaMDM = ContextExtensionsKt.getRestriction(this, AppConfigKeys.DisableIntro, getResources().getBoolean(R.bool.disable_intro));
|
||||
boolean isProviderOrOwnInstallationVisible = getResources()
|
||||
.getBoolean(R.bool.show_provider_or_own_installation);
|
||||
|
||||
if (isProviderOrOwnInstallationVisible && !disableIntroViaMDM) {
|
||||
if (MDMConfig.INSTANCE.showIntro(this)) {
|
||||
Intent firstRunIntent = new Intent(getApplicationContext(), FirstRunActivity.class);
|
||||
firstRunIntent.putExtra(FirstRunActivity.EXTRA_ALLOW_CLOSE, true);
|
||||
startActivity(firstRunIntent);
|
||||
|
|
|
@ -22,14 +22,13 @@ import android.widget.ImageView;
|
|||
|
||||
import com.nextcloud.client.account.User;
|
||||
import com.nextcloud.client.account.UserAccountManager;
|
||||
import com.nextcloud.utils.extensions.ContextExtensionsKt;
|
||||
import com.nextcloud.utils.mdm.MDMConfig;
|
||||
import com.owncloud.android.R;
|
||||
import com.owncloud.android.databinding.AccountActionBinding;
|
||||
import com.owncloud.android.databinding.AccountItemBinding;
|
||||
import com.owncloud.android.lib.common.OwnCloudAccount;
|
||||
import com.owncloud.android.lib.common.utils.Log_OC;
|
||||
import com.owncloud.android.utils.DisplayUtils;
|
||||
import com.owncloud.android.utils.appConfig.AppConfigKeys;
|
||||
import com.owncloud.android.utils.theme.ViewThemeUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -320,11 +319,7 @@ public class UserListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolde
|
|||
* @param accountListAdapterListener {@link Listener}
|
||||
*/
|
||||
private void bind(Listener accountListAdapterListener) {
|
||||
boolean disableIntroViaMDM = ContextExtensionsKt.getRestriction(context, AppConfigKeys.DisableIntro, context.getResources().getBoolean(R.bool.disable_intro));
|
||||
boolean isProviderOrOwnInstallationVisible = itemView.getContext().getResources()
|
||||
.getBoolean(R.bool.show_provider_or_own_installation);
|
||||
|
||||
if (isProviderOrOwnInstallationVisible && !disableIntroViaMDM) {
|
||||
if (MDMConfig.INSTANCE.showIntro(context)) {
|
||||
itemView.setOnClickListener(v -> accountListAdapterListener.showFirstRunActivity());
|
||||
} else {
|
||||
itemView.setOnClickListener(v -> accountListAdapterListener.startAccountCreation());
|
||||
|
|
Loading…
Reference in a new issue