Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/clear comments and logs #283

Merged
merged 3 commits into from
Dec 26, 2023
Merged
Show file tree
Hide file tree
Changes from 2 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
Expand Up @@ -10,9 +10,7 @@ import ru.practicum.android.diploma.common.data.dto.IndustriesDto
import ru.practicum.android.diploma.common.data.dto.VacancyItemDto
import ru.practicum.android.diploma.common.data.network.response.HHSearchResponse

// todo реализовать передачу токена
interface HHService {

@Headers(
"Authorization: Bearer ${BuildConfig.HH_ACCESS_TOKEN}",
"HH-User-Agent: Practicum HH Client/1.0 ([email protected])"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package ru.practicum.android.diploma.common.data.network.response
import ru.practicum.android.diploma.common.data.dto.ContactsDto
import ru.practicum.android.diploma.common.data.dto.Response

// Todo передалать класс когда будет доступен ключ приложения
data class HHContactsResponse(
val contacts: ContactsDto
) : Response()
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import com.google.android.material.snackbar.Snackbar


/**
вызывается так binding.root.showCustomSnackbar(text)
* Вызывается так binding.root.showCustomSnackbar(text)
*/
fun View.showCustomSnackbar(text: String, duration: Int = Snackbar.LENGTH_SHORT) {
val snackbar = Snackbar.make(this, text, duration)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class IndustryFragment : BaseFragment<FragmentIndustryBinding, IndustryViewModel
binding.btnSelect.visibility = View.GONE
}

IndustryScreenState.goAway -> findNavController().popBackStack()
IndustryScreenState.Hide -> findNavController().popBackStack()
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package ru.practicum.android.diploma.filter.ui.fragment

import android.util.Log
import androidx.core.view.isVisible
import androidx.fragment.app.activityViewModels
import androidx.lifecycle.lifecycleScope
Expand Down Expand Up @@ -92,7 +91,6 @@ class WorkPlaceFragment : BaseFragment<FragmentWorkPlaceBinding, WorkPlaceViewMo
private fun onPressedButton() {
binding.btnSelect.setOnClickListener {
val region = viewModel.getFilterArea()
Log.i("WorkPlaceFragmentMyLog", "region = $region")
if (region != null) {
viewModel.saveRegionToPrefs(region)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ class FilterViewModel @Inject constructor(private val interactor: FilterSettings

viewModelScope.launch {
interactor.getFilterUISettings()
// нашедшему причину задвоенного возвращения состояния
// префов от меня приз. А. Поляков.
// ? нашедшему причину задвоенного возвращения состояния
// ? префов от меня приз. А. Поляков.
.distinctUntilChanged()
.collect {
if (!areSettingsSettled(it)) {
Expand Down Expand Up @@ -135,5 +135,4 @@ class FilterViewModel @Inject constructor(private val interactor: FilterSettings
}
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class IndustryViewModel @Inject constructor(
selectedIndustry?.let { data ->
viewModelScope.launch {
filterInteractor.setIndustry(data.id, data.name)
_state.value = IndustryScreenState.goAway
_state.value = IndustryScreenState.Hide
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ sealed class IndustryScreenState {
val data: List<Industry>,
val currentIndustry: String? = null
) : IndustryScreenState()
object goAway : IndustryScreenState()
data object Hide : IndustryScreenState()
data object Error : IndustryScreenState()
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ class SearchInteractorImpl(
converter.mapSearchResponce(result)
}


override fun searchSimilarVacancies(vacancyId: Int, page: Int): Flow<Resource<VacanciesSearchResult>> =
repository.getSimilarVacancies(
id = vacancyId,
Expand All @@ -41,7 +40,6 @@ class SearchInteractorImpl(
converter.mapSearchResponce(result)
}


override fun getIndustries(): Flow<Resource<List<Industry>>> =
repository.getIndustries().map { result ->
converter.mapIndustriesResponse(result)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,5 +107,3 @@ class SearchResultConverterImpl : SearchResultConverter {
}
}
}


Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,6 @@ class SearchFragment : BaseFragment<FragmentSearchBinding, SearchViewModel>(Frag
)
}


companion object {
private const val CLICK_DEBOUNCE_DELAY = 500L
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ class VacancyDiffCallback(

override fun areContentsTheSame(oldItemPosition: Int, newItemPosition: Int): Boolean {
if (oldList.size != newList.size && oldItemPosition == oldList.lastIndex) {
// Всегда обновляет последний элемент старого списка, если размеры различаются
return false
return false // Всегда обновляет последний элемент старого списка, если размеры различаются
}
return oldList[oldItemPosition] == newList[newItemPosition]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ open class SearchViewModel @Inject constructor(
)
checkState()
}

}

private fun checkState() {
Expand Down Expand Up @@ -177,8 +176,6 @@ open class SearchViewModel @Inject constructor(

fun handleInteraction(interaction: ViewModelInteractionState) {
var newSearchSettings = searchSettings
// переменная костыль, чтобы обработать setQuery при возвращении на фрагмент
GoetzDeBouville marked this conversation as resolved.
Show resolved Hide resolved
// в таких случаях нам надо восстановить всё как было.
val t = isLastUpdatePage; isLastUpdatePage = false
when (interaction) {
is ViewModelInteractionState.setRegion -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,6 @@ class SingleVacancyInteractorImpl(
override suspend fun getVacancy(id: Int): Flow<Resource<DetailedVacancyItem>> {
val isFavorite = isVacancyFavorite(id)

// todo забрать этот код в интерактор избранного

// return db.vacancyEmployerReferenceDao().getVacancyWithEmployer(id).map {
// it.let {
// it?.let { vacancyConverter.map(it, isFavorite) }
// ?: Resource.Error(NetworkErrors.UnknownError)
// }
// }
// }
return repository.getVacancy(id).map {
currentVacancy = it.data?.vacancy
vacancyConverter.map(it, isFavorite) }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
package ru.practicum.android.diploma.vacancy.domain.models

// PAIR — phone - first, comment - second
GoetzDeBouville marked this conversation as resolved.
Show resolved Hide resolved
typealias phone = String
typealias comment = String

data class Contacts(
val name: String? = null,
val phones: List<Pair<String, String>>? = null,
val phones: List<Pair<comment, phone>>? = null,
val email: String? = null,
)
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package ru.practicum.android.diploma.vacancy.domain.models

import android.util.Log

@Suppress("Detekt.DataClassContainsFunctions")
data class DetailedVacancyItem(
val id: Int,
Expand Down Expand Up @@ -44,7 +42,6 @@ data class DetailedVacancyItem(
private fun configureHTMLContacts(builder: StringBuilder): StringBuilder {
if (!contacts?.name.isNullOrEmpty()) {
contacts?.let {
Log.i("DetailedVacancyMyLog", "contacts = $contacts")
builder.append("$OPEN_SPAN_STR\"title margin\">Контакты</span>")
builder.append("$DIV_MARGIN<span class=\"contact-info\">Контактное лицо</span><br>")
builder.append(it.name)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,3 @@ class KeySkillsAdapter(private val keySkills: List<String>) :

override fun getItemCount() = keySkills.size
}