mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2025-02-17 04:20:00 +03:00
ktlint
This commit is contained in:
parent
d0953b8406
commit
4510aff00a
18 changed files with 23 additions and 30 deletions
|
@ -39,11 +39,9 @@ import im.vector.matrix.android.api.session.securestorage.SharedSecretStorageSer
|
|||
import im.vector.matrix.android.internal.crypto.secrets.DefaultSharedSecretStorageService
|
||||
import im.vector.matrix.android.internal.crypto.verification.VerificationMessageLiveObserver
|
||||
import im.vector.matrix.android.internal.database.LiveEntityObserver
|
||||
import im.vector.matrix.android.internal.database.RealmKeysUtils
|
||||
import im.vector.matrix.android.internal.database.SessionRealmConfigurationFactory
|
||||
import im.vector.matrix.android.internal.di.Authenticated
|
||||
import im.vector.matrix.android.internal.di.DeviceId
|
||||
import im.vector.matrix.android.internal.di.IdentityDatabase
|
||||
import im.vector.matrix.android.internal.di.SessionCacheDirectory
|
||||
import im.vector.matrix.android.internal.di.SessionDatabase
|
||||
import im.vector.matrix.android.internal.di.SessionFilesDirectory
|
||||
|
@ -64,7 +62,6 @@ import im.vector.matrix.android.internal.network.token.AccessTokenProvider
|
|||
import im.vector.matrix.android.internal.network.token.HomeserverAccessTokenProvider
|
||||
import im.vector.matrix.android.internal.session.group.GroupSummaryUpdater
|
||||
import im.vector.matrix.android.internal.session.homeserver.DefaultHomeServerCapabilitiesService
|
||||
import im.vector.matrix.android.internal.session.identity.db.IdentityRealmModule
|
||||
import im.vector.matrix.android.internal.session.room.EventRelationsAggregationUpdater
|
||||
import im.vector.matrix.android.internal.session.room.create.RoomCreateEventLiveObserver
|
||||
import im.vector.matrix.android.internal.session.room.prune.EventsPruner
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
package im.vector.matrix.android.internal.session.identity.db
|
||||
|
||||
import im.vector.matrix.android.api.session.identity.ThreePid
|
||||
import im.vector.matrix.android.api.session.identity.toMedium
|
||||
import im.vector.matrix.android.internal.di.IdentityDatabase
|
||||
import im.vector.matrix.android.internal.session.SessionScope
|
||||
import im.vector.matrix.android.internal.session.identity.model.IdentityHashDetailResponse
|
||||
|
|
|
@ -27,4 +27,3 @@ internal data class IdentityAccountResponse(
|
|||
@Json(name = "user_id")
|
||||
val userId: String
|
||||
)
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ internal data class IdentityHashDetailResponse(
|
|||
@Json(name = "algorithms")
|
||||
val algorithms: List<String>
|
||||
) {
|
||||
companion object{
|
||||
companion object {
|
||||
const val ALGORITHM_SHA256 = "sha256"
|
||||
const val ALGORITHM_NONE = "none"
|
||||
}
|
||||
|
|
|
@ -25,4 +25,4 @@ import com.squareup.moshi.JsonClass
|
|||
internal data class AccountThreePidsResponse(
|
||||
@Json(name = "threepids")
|
||||
val threePids: List<ThirdPartyIdentifier>? = null
|
||||
)
|
||||
)
|
||||
|
|
|
@ -36,7 +36,8 @@ internal class DefaultUnbindThreePidsTask @Inject constructor(private val profil
|
|||
private val identityServiceStore: IdentityServiceStore,
|
||||
private val eventBus: EventBus) : UnbindThreePidsTask() {
|
||||
override suspend fun execute(params: Params): Boolean {
|
||||
val identityServerUrlWithoutProtocol = identityServiceStore.getIdentityServerUrlWithoutProtocol() ?: throw IdentityServiceError.NoIdentityServerConfigured
|
||||
val identityServerUrlWithoutProtocol = identityServiceStore.getIdentityServerUrlWithoutProtocol()
|
||||
?: throw IdentityServiceError.NoIdentityServerConfigured
|
||||
|
||||
return executeRequest<UnbindThreePidResponse>(eventBus) {
|
||||
apiCall = profileAPI.unbindThreePid(
|
||||
|
|
|
@ -88,9 +88,9 @@ internal class DefaultTermsService @Inject constructor(
|
|||
apiCall = termsAPI.agreeToTerms("${url}terms", AcceptTermsBody(agreedUrls), "Bearer $tokenToUse")
|
||||
}
|
||||
|
||||
//client SHOULD update this account data section adding any the URLs
|
||||
// client SHOULD update this account data section adding any the URLs
|
||||
// of any additional documents that the user agreed to this list.
|
||||
//Get current m.accepted_terms append new ones and update account data
|
||||
// Get current m.accepted_terms append new ones and update account data
|
||||
val listOfAcceptedTerms = getAlreadyAcceptedTermUrlsFromAccountData()
|
||||
|
||||
val newList = listOfAcceptedTerms.toMutableSet().apply { addAll(agreedUrls) }.toList()
|
||||
|
|
|
@ -53,4 +53,3 @@ data class TermsResponse(
|
|||
const val URL = "url"
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -339,7 +339,7 @@ class DiscoverySettingsController @Inject constructor(
|
|||
val errorText = if (pidInfo.finalRequest is Fail) {
|
||||
val error = pidInfo.finalRequest.error
|
||||
// Deal with error 500
|
||||
//Ref: https://github.com/matrix-org/sydent/issues/292
|
||||
// Ref: https://github.com/matrix-org/sydent/issues/292
|
||||
if (error is Failure.ServerError
|
||||
&& error.httpCode == HttpsURLConnection.HTTP_INTERNAL_ERROR /* 500 */) {
|
||||
stringProvider.getString(R.string.settings_text_message_sent_wrong_code)
|
||||
|
@ -410,4 +410,3 @@ class DiscoverySettingsController @Inject constructor(
|
|||
fun onTapRetryToRetrieveBindings()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -87,7 +87,7 @@ class DiscoverySettingsFragment @Inject constructor(
|
|||
super.onResume()
|
||||
(activity as? VectorBaseActivity)?.supportActionBar?.setTitle(R.string.settings_discovery_category)
|
||||
|
||||
//If some 3pids are pending, we can try to check if they have been verified here
|
||||
// If some 3pids are pending, we can try to check if they have been verified here
|
||||
viewModel.handle(DiscoverySettingsAction.Refresh)
|
||||
}
|
||||
|
||||
|
@ -96,7 +96,7 @@ class DiscoverySettingsFragment @Inject constructor(
|
|||
if (Activity.RESULT_OK == resultCode) {
|
||||
viewModel.handle(DiscoverySettingsAction.RetrieveBinding)
|
||||
} else {
|
||||
//add some error?
|
||||
// add some error?
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -135,12 +135,12 @@ class DiscoverySettingsFragment @Inject constructor(
|
|||
}
|
||||
|
||||
override fun onTapChangeIdentityServer() = withState(viewModel) { state ->
|
||||
//we should prompt if there are bound items with current is
|
||||
// we should prompt if there are bound items with current is
|
||||
val pidList = state.emailList().orEmpty() + state.phoneNumbersList().orEmpty()
|
||||
val hasBoundIds = pidList.any { it.isShared() == SharedState.SHARED }
|
||||
|
||||
if (hasBoundIds) {
|
||||
//we should prompt
|
||||
// we should prompt
|
||||
AlertDialog.Builder(requireActivity())
|
||||
.setTitle(R.string.change_identity_server)
|
||||
.setMessage(getString(R.string.settings_discovery_disconnect_with_bound_pid, state.identityServer(), state.identityServer()))
|
||||
|
@ -154,13 +154,13 @@ class DiscoverySettingsFragment @Inject constructor(
|
|||
}
|
||||
|
||||
override fun onTapDisconnectIdentityServer() {
|
||||
//we should prompt if there are bound items with current is
|
||||
// we should prompt if there are bound items with current is
|
||||
withState(viewModel) { state ->
|
||||
val pidList = state.emailList().orEmpty() + state.phoneNumbersList().orEmpty()
|
||||
val hasBoundIds = pidList.any { it.isShared() == SharedState.SHARED }
|
||||
|
||||
if (hasBoundIds) {
|
||||
//we should prompt
|
||||
// we should prompt
|
||||
AlertDialog.Builder(requireActivity())
|
||||
.setTitle(R.string.disconnect_identity_server)
|
||||
.setMessage(getString(R.string.settings_discovery_disconnect_with_bound_pid, state.identityServer(), state.identityServer()))
|
||||
|
|
|
@ -402,7 +402,6 @@ class DiscoverySettingsViewModel @AssistedInject constructor(
|
|||
}
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
private fun refreshPendingEmailBindings() = withState { state ->
|
||||
|
|
|
@ -41,7 +41,6 @@ abstract class SettingsEditTextItem : EpoxyModelWithHolder<SettingsEditTextItem.
|
|||
super.bind(holder)
|
||||
holder.textView.setTextOrHide(descriptionText)
|
||||
|
||||
|
||||
holder.editText.isEnabled = !inProgress
|
||||
|
||||
if (errorText.isNullOrBlank()) {
|
||||
|
|
|
@ -48,7 +48,6 @@ abstract class SettingsItem : EpoxyModelWithHolder<SettingsItem.Holder>() {
|
|||
var itemClickListener: View.OnClickListener? = null
|
||||
|
||||
override fun bind(holder: Holder) {
|
||||
|
||||
if (titleResId != null) {
|
||||
holder.titleText.setText(titleResId!!)
|
||||
} else {
|
||||
|
|
|
@ -128,7 +128,7 @@ abstract class SettingsTextButtonSingleLineItem : EpoxyModelWithHolder<SettingsT
|
|||
ButtonType.SWITCH -> {
|
||||
holder.mainButton.isVisible = false
|
||||
holder.switchButton.isVisible = true
|
||||
//set to null before changing the state
|
||||
// set to null before changing the state
|
||||
holder.switchButton.setOnCheckedChangeListener(null)
|
||||
checked?.let { holder.switchButton.isChecked = it }
|
||||
holder.switchButton.setOnCheckedChangeListener(switchChangeListener)
|
||||
|
@ -136,7 +136,6 @@ abstract class SettingsTextButtonSingleLineItem : EpoxyModelWithHolder<SettingsT
|
|||
}.exhaustive
|
||||
}
|
||||
|
||||
|
||||
when (iconMode) {
|
||||
IconMode.NONE -> {
|
||||
holder.textView.setCompoundDrawables(null, null, null, null)
|
||||
|
|
|
@ -106,7 +106,6 @@ class SetIdentityServerFragment @Inject constructor(
|
|||
return@setOnEditorActionListener false
|
||||
}
|
||||
|
||||
|
||||
viewModel.observeViewEvents {
|
||||
when (it) {
|
||||
is SetIdentityServerViewEvents.NoTerms -> {
|
||||
|
@ -140,7 +139,7 @@ class SetIdentityServerFragment @Inject constructor(
|
|||
if (Activity.RESULT_OK == resultCode) {
|
||||
processIdentityServerChange()
|
||||
} else {
|
||||
//add some error?
|
||||
// add some error?
|
||||
}
|
||||
}
|
||||
super.onActivityResult(requestCode, resultCode, data)
|
||||
|
|
|
@ -115,14 +115,14 @@ class SetIdentityServerViewModel @AssistedInject constructor(
|
|||
baseUrl,
|
||||
object : MatrixCallback<GetTermsResponse> {
|
||||
override fun onSuccess(data: GetTermsResponse) {
|
||||
//has all been accepted?
|
||||
// has all been accepted?
|
||||
setState {
|
||||
copy(isVerifyingServer = false)
|
||||
}
|
||||
val resp = data.serverResponse
|
||||
val tos = resp.getLocalizedTerms(userLanguage)
|
||||
if (tos.isEmpty()) {
|
||||
//prompt do not define policy
|
||||
// prompt do not define policy
|
||||
_viewEvents.post(SetIdentityServerViewEvents.NoTerms)
|
||||
} else {
|
||||
val shouldPrompt = tos.any { !data.alreadyAcceptedTermUrls.contains(it.localizedUrl) }
|
||||
|
|
|
@ -71,5 +71,9 @@ interface Navigator {
|
|||
|
||||
fun openBigImageViewer(activity: Activity, sharedElement: View?, matrixItem: MatrixItem)
|
||||
|
||||
fun openTerms(fragment: Fragment,serviceType: TermsService.ServiceType, baseUrl: String, token: String?, requestCode : Int = ReviewTermsActivity.TERMS_REQUEST_CODE)
|
||||
fun openTerms(fragment: Fragment,
|
||||
serviceType: TermsService.ServiceType,
|
||||
baseUrl: String,
|
||||
token: String?,
|
||||
requestCode: Int = ReviewTermsActivity.TERMS_REQUEST_CODE)
|
||||
}
|
||||
|
|
|
@ -46,7 +46,7 @@ class TermsController @Inject constructor() : TypedEpoxyController<List<Term>>()
|
|||
}
|
||||
}
|
||||
}
|
||||
//TODO error mgmt
|
||||
// TODO error mgmt
|
||||
}
|
||||
|
||||
interface Listener {
|
||||
|
|
Loading…
Add table
Reference in a new issue