mirror of
https://github.com/nextcloud/talk-android.git
synced 2024-11-22 13:05:31 +03:00
Add branding support for
- hide provider - hide auth - multi account support - enforce domain Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>
This commit is contained in:
parent
0a49c9dc40
commit
d7400c3f76
4 changed files with 91 additions and 41 deletions
|
@ -25,6 +25,7 @@ import android.content.Context
|
|||
import android.content.Intent
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.text.TextUtils
|
||||
import android.view.ViewGroup
|
||||
import androidx.annotation.RequiresApi
|
||||
import autodagger.AutoInjector
|
||||
|
@ -38,10 +39,7 @@ import com.bluelinelabs.conductor.changehandler.VerticalChangeHandler
|
|||
import com.google.android.material.appbar.MaterialToolbar
|
||||
import com.nextcloud.talk.R
|
||||
import com.nextcloud.talk.application.NextcloudTalkApplication
|
||||
import com.nextcloud.talk.controllers.CallNotificationController
|
||||
import com.nextcloud.talk.controllers.ConversationsListController
|
||||
import com.nextcloud.talk.controllers.LockedController
|
||||
import com.nextcloud.talk.controllers.ServerSelectionController
|
||||
import com.nextcloud.talk.controllers.*
|
||||
import com.nextcloud.talk.controllers.base.providers.ActionBarProvider
|
||||
import com.nextcloud.talk.utils.ConductorRemapping
|
||||
import com.nextcloud.talk.utils.SecurityUtils
|
||||
|
@ -102,16 +100,29 @@ class MainActivity : BaseActivity(), ActionBarProvider {
|
|||
router!!.setRoot(RouterTransaction.with(ConversationsListController())
|
||||
.pushChangeHandler(HorizontalChangeHandler())
|
||||
.popChangeHandler(HorizontalChangeHandler()))
|
||||
} else {
|
||||
if (!TextUtils.isEmpty(resources.getString(R.string.weblogin_url))) {
|
||||
router!!.pushController(RouterTransaction.with(
|
||||
WebViewLoginController(resources.getString(R.string.weblogin_url), false))
|
||||
.pushChangeHandler(HorizontalChangeHandler())
|
||||
.popChangeHandler(HorizontalChangeHandler()))
|
||||
} else {
|
||||
router!!.setRoot(RouterTransaction.with(ServerSelectionController())
|
||||
.pushChangeHandler(HorizontalChangeHandler())
|
||||
.popChangeHandler(HorizontalChangeHandler()))
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (!TextUtils.isEmpty(resources.getString(R.string.weblogin_url))) {
|
||||
router!!.pushController(RouterTransaction.with(
|
||||
WebViewLoginController(resources.getString(R.string.weblogin_url), false))
|
||||
.pushChangeHandler(HorizontalChangeHandler())
|
||||
.popChangeHandler(HorizontalChangeHandler()))
|
||||
} else {
|
||||
router!!.setRoot(RouterTransaction.with(ServerSelectionController())
|
||||
.pushChangeHandler(HorizontalChangeHandler())
|
||||
.popChangeHandler(HorizontalChangeHandler()))
|
||||
}
|
||||
} else {
|
||||
router!!.setRoot(RouterTransaction.with(ServerSelectionController())
|
||||
.pushChangeHandler(HorizontalChangeHandler())
|
||||
.popChangeHandler(HorizontalChangeHandler()))
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,10 +35,7 @@ import android.view.ViewGroup;
|
|||
import android.view.inputmethod.EditorInfo;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
import androidx.annotation.NonNull;
|
||||
import autodagger.AutoInjector;
|
||||
import butterknife.BindView;
|
||||
import butterknife.OnClick;
|
||||
|
||||
import com.bluelinelabs.conductor.RouterTransaction;
|
||||
import com.bluelinelabs.conductor.changehandler.HorizontalChangeHandler;
|
||||
import com.nextcloud.talk.R;
|
||||
|
@ -51,15 +48,21 @@ import com.nextcloud.talk.utils.bundle.BundleKeys;
|
|||
import com.nextcloud.talk.utils.database.user.UserUtils;
|
||||
import com.nextcloud.talk.utils.preferences.AppPreferences;
|
||||
import com.nextcloud.talk.utils.singletons.ApplicationWideMessageHolder;
|
||||
|
||||
import java.security.cert.CertificateException;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import autodagger.AutoInjector;
|
||||
import butterknife.BindView;
|
||||
import butterknife.OnClick;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
import studio.carbonylgroup.textfieldboxes.ExtendedEditText;
|
||||
import studio.carbonylgroup.textfieldboxes.TextFieldBoxes;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.security.cert.CertificateException;
|
||||
|
||||
@AutoInjector(NextcloudTalkApplication.class)
|
||||
public class ServerSelectionController extends BaseController {
|
||||
|
||||
|
@ -128,8 +131,13 @@ public class ServerSelectionController extends BaseController {
|
|||
textFieldBoxes.getEndIconImageButton().setVisibility(View.VISIBLE);
|
||||
textFieldBoxes.getEndIconImageButton().setOnClickListener(view1 -> checkServerAndProceed());
|
||||
|
||||
if (TextUtils.isEmpty(getResources().getString(R.string.nc_providers_url)) && (TextUtils.isEmpty(getResources
|
||||
().getString(R.string.nc_import_account_type)))) {
|
||||
if (getResources().getBoolean(R.bool.hide_auth_cert)) {
|
||||
certTextView.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
if (getResources().getBoolean(R.bool.hide_provider) ||
|
||||
TextUtils.isEmpty(getResources().getString(R.string.nc_providers_url)) &&
|
||||
(TextUtils.isEmpty(getResources().getString(R.string.nc_import_account_type)))) {
|
||||
providersTextView.setVisibility(View.INVISIBLE);
|
||||
} else {
|
||||
if ((TextUtils.isEmpty(getResources
|
||||
|
@ -178,6 +186,11 @@ public class ServerSelectionController extends BaseController {
|
|||
}
|
||||
|
||||
serverEntry.requestFocus();
|
||||
|
||||
if (!TextUtils.isEmpty(getResources().getString(R.string.weblogin_url))) {
|
||||
serverEntry.setText(getResources().getString(R.string.weblogin_url));
|
||||
checkServerAndProceed();
|
||||
}
|
||||
|
||||
serverEntry.addTextChangedListener(new TextWatcher() {
|
||||
@Override
|
||||
|
|
|
@ -37,15 +37,7 @@ import android.view.ViewGroup;
|
|||
import android.view.WindowManager;
|
||||
import android.widget.Checkable;
|
||||
import android.widget.TextView;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.core.view.ViewCompat;
|
||||
import androidx.emoji.widget.EmojiTextView;
|
||||
import androidx.work.OneTimeWorkRequest;
|
||||
import androidx.work.WorkManager;
|
||||
import autodagger.AutoInjector;
|
||||
import butterknife.BindView;
|
||||
import butterknife.OnClick;
|
||||
|
||||
import com.bluelinelabs.conductor.RouterTransaction;
|
||||
import com.bluelinelabs.conductor.changehandler.HorizontalChangeHandler;
|
||||
import com.bluelinelabs.conductor.changehandler.VerticalChangeHandler;
|
||||
|
@ -61,7 +53,11 @@ import com.nextcloud.talk.controllers.base.BaseController;
|
|||
import com.nextcloud.talk.jobs.AccountRemovalWorker;
|
||||
import com.nextcloud.talk.models.RingtoneSettings;
|
||||
import com.nextcloud.talk.models.database.UserEntity;
|
||||
import com.nextcloud.talk.utils.*;
|
||||
import com.nextcloud.talk.utils.ApiUtils;
|
||||
import com.nextcloud.talk.utils.DisplayUtils;
|
||||
import com.nextcloud.talk.utils.DoNotDisturbUtils;
|
||||
import com.nextcloud.talk.utils.LoggingUtils;
|
||||
import com.nextcloud.talk.utils.SecurityUtils;
|
||||
import com.nextcloud.talk.utils.bundle.BundleKeys;
|
||||
import com.nextcloud.talk.utils.database.user.UserUtils;
|
||||
import com.nextcloud.talk.utils.preferences.AppPreferences;
|
||||
|
@ -69,18 +65,38 @@ import com.nextcloud.talk.utils.preferences.MagicUserInputModule;
|
|||
import com.nextcloud.talk.utils.singletons.ApplicationWideMessageHolder;
|
||||
import com.yarolegovich.lovelydialog.LovelySaveStateHandler;
|
||||
import com.yarolegovich.lovelydialog.LovelyStandardDialog;
|
||||
import com.yarolegovich.mp.*;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
import net.orange_box.storebox.listeners.OnPreferenceValueChangedListener;
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import com.yarolegovich.mp.MaterialChoicePreference;
|
||||
import com.yarolegovich.mp.MaterialEditTextPreference;
|
||||
import com.yarolegovich.mp.MaterialPreferenceCategory;
|
||||
import com.yarolegovich.mp.MaterialPreferenceScreen;
|
||||
import com.yarolegovich.mp.MaterialStandardPreference;
|
||||
import com.yarolegovich.mp.MaterialSwitchPreference;
|
||||
|
||||
import net.orange_box.storebox.listeners.OnPreferenceValueChangedListener;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.io.IOException;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Objects;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.core.view.ViewCompat;
|
||||
import androidx.emoji.widget.EmojiTextView;
|
||||
import androidx.work.OneTimeWorkRequest;
|
||||
import androidx.work.WorkManager;
|
||||
import autodagger.AutoInjector;
|
||||
import butterknife.BindView;
|
||||
import butterknife.OnClick;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
|
||||
@AutoInjector(NextcloudTalkApplication.class)
|
||||
public class SettingsController extends BaseController {
|
||||
|
@ -264,11 +280,15 @@ public class SettingsController extends BaseController {
|
|||
.popChangeHandler(new HorizontalChangeHandler()));
|
||||
});
|
||||
|
||||
addAccountButton.addPreferenceClickListener(view15 -> {
|
||||
getRouter().pushController(RouterTransaction.with(new
|
||||
ServerSelectionController()).pushChangeHandler(new VerticalChangeHandler())
|
||||
.popChangeHandler(new VerticalChangeHandler()));
|
||||
});
|
||||
if (getResources().getBoolean(R.bool.multiaccount_support)) {
|
||||
addAccountButton.addPreferenceClickListener(view15 -> {
|
||||
getRouter().pushController(RouterTransaction.with(new
|
||||
ServerSelectionController()).pushChangeHandler(new VerticalChangeHandler())
|
||||
.popChangeHandler(new VerticalChangeHandler()));
|
||||
});
|
||||
} else {
|
||||
addAccountButton.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
switchAccountButton.addPreferenceClickListener(view16 -> {
|
||||
getRouter().pushController(RouterTransaction.with(new
|
||||
|
|
|
@ -30,6 +30,12 @@
|
|||
|
||||
<string name="nc_push_server_url" translatable="false">https://push-notifications.nextcloud.com</string>
|
||||
|
||||
<!-- Branding -->
|
||||
<bool name="hide_provider">false</bool>
|
||||
<bool name="hide_auth_cert">false</bool>
|
||||
<bool name="multiaccount_support">true</bool>
|
||||
<string name="weblogin_url" translatable="false"></string>
|
||||
|
||||
<!-- Will not be shown if empty -->
|
||||
<string name="nc_privacy_url" translatable="false">https://nextcloud.com/privacy/</string>
|
||||
<string name="nc_gpl3_url" translatable="false">https://www.gnu.org/licenses/gpl-3.0.en.html</string>
|
||||
|
|
Loading…
Reference in a new issue