Localizza errori API, sistema layout mobile e documenta allineamento iOS.
Gli header Accept-Language dalle app e i fix di padding/menu sul web chiudono il giro password-policy; il doc guida il lavoro su Mac. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -2,6 +2,7 @@ package com.matchlivetv.match_live_tv.data
|
||||
|
||||
import android.content.Context
|
||||
import com.matchlivetv.match_live_tv.core.AppConfig
|
||||
import com.matchlivetv.match_live_tv.core.AppLocale
|
||||
import com.matchlivetv.match_live_tv.core.TokenStore
|
||||
import com.matchlivetv.match_live_tv.data.api.MatchLiveApi
|
||||
import com.matchlivetv.match_live_tv.data.cable.SessionCableService
|
||||
@@ -37,10 +38,20 @@ class AppContainer(context: Context) {
|
||||
accessToken?.let { header("Authorization", "Bearer $it") }
|
||||
header("Accept", "application/json")
|
||||
header("Content-Type", "application/json")
|
||||
header("Accept-Language", apiLanguageTag())
|
||||
}.build()
|
||||
chain.proceed(request)
|
||||
}
|
||||
|
||||
private fun apiLanguageTag(): String {
|
||||
val tag = AppLocale.currentTag(appContext)
|
||||
return if (tag.isBlank()) {
|
||||
java.util.Locale.getDefault().language.ifBlank { "it" }
|
||||
} else {
|
||||
tag
|
||||
}
|
||||
}
|
||||
|
||||
private val okHttp = OkHttpClient.Builder()
|
||||
.connectTimeout(30, TimeUnit.SECONDS)
|
||||
.readTimeout(60, TimeUnit.SECONDS)
|
||||
|
||||
@@ -240,6 +240,7 @@ final class MatchLiveAPI: @unchecked Sendable {
|
||||
request.httpMethod = "PATCH"
|
||||
request.setValue("multipart/form-data; boundary=\(boundary)", forHTTPHeaderField: "Content-Type")
|
||||
request.setValue("application/json", forHTTPHeaderField: "Accept")
|
||||
request.setValue(AppLanguage.resolvedCode, forHTTPHeaderField: "Accept-Language")
|
||||
if let accessToken { request.setValue("Bearer \(accessToken)", forHTTPHeaderField: "Authorization") }
|
||||
request.httpBody = MultipartBuilder.build(fields: fields, boundary: boundary)
|
||||
return try await execute(request)
|
||||
@@ -253,6 +254,7 @@ final class MatchLiveAPI: @unchecked Sendable {
|
||||
var request = URLRequest(url: baseURL.appendingPathComponent(path))
|
||||
request.httpMethod = method
|
||||
request.setValue("application/json", forHTTPHeaderField: "Accept")
|
||||
request.setValue(AppLanguage.resolvedCode, forHTTPHeaderField: "Accept-Language")
|
||||
if body != nil {
|
||||
request.setValue("application/json", forHTTPHeaderField: "Content-Type")
|
||||
request.httpBody = try ApiInstant.encoder.encode(body)
|
||||
|
||||
Reference in New Issue
Block a user