Skip to content

Commit

Permalink
Update api calls to receive null avatars if the users have not set any
Browse files Browse the repository at this point in the history
  • Loading branch information
LunarX committed Feb 28, 2024
1 parent 010dfd5 commit 6360ec2
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
8 changes: 4 additions & 4 deletions app/src/main/java/com/infomaniak/drive/data/api/ApiRoutes.kt
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ object ApiRoutes {

/** V1 */
//region V1
fun getAllDrivesData() = "${DRIVE_API_V1}init?with=drives,users,teams,ips,categories"
fun getAllDrivesData() = "${DRIVE_API_V1}init?no_avatar_default=1&with=drives,users,teams,ips,categories"
//endregion

/** Archive */
Expand Down Expand Up @@ -86,12 +86,12 @@ object ApiRoutes {
"&actions[]=comment_create"

fun getLastActivities(driveId: Int) =
"${filesURL(driveId)}/activities?$activitiesWithQuery,user&depth=unlimited&$activitiesActions"
"${filesURL(driveId)}/activities?$activitiesWithQuery,user&depth=unlimited&$activitiesActions&no_avatar_default=1"

fun getFileActivities(file: File) = "${fileURL(file)}/activities"
fun getFileActivities(file: File) = "${fileURL(file)}/activities?no_avatar_default=1"

fun getFileActivities(driveId: Int, fileIds: String, fromDate: Long) =
"${filesURL(driveId)}/activities/batch?$activitiesWithQuery&file_ids=$fileIds&from_date=$fromDate" +
"${filesURL(driveId)}/activities/batch?no_avatar_default=1&$activitiesWithQuery&file_ids=$fileIds&from_date=$fromDate" +
"&actions[]=file_rename" +
"&actions[]=file_update"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,10 @@ class LoginActivity : AppCompatActivity() {
return getErrorResponse(R.string.errorUserAlreadyPresent)
} ?: run {
InfomaniakCore.bearerToken = apiToken.accessToken
val userProfileResponse = ApiRepository.getUserProfile(HttpClient.okHttpClientNoTokenInterceptor)
val userProfileResponse = ApiRepository.getUserProfile(
HttpClient.okHttpClientNoTokenInterceptor,
ignoreDefaultAvatar = true,
)
if (userProfileResponse.result == ApiResponseStatus.ERROR) {
return userProfileResponse
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ object AccountUtils : CredentialManager() {
okHttpClient: OkHttpClient = HttpClient.okHttpClient,
) = withContext(Dispatchers.IO) {

val (userResult, user) = with(ApiRepository.getUserProfile(okHttpClient)) {
val (userResult, user) = with(ApiRepository.getUserProfile(okHttpClient, ignoreDefaultAvatar = true)) {
result to (data ?: return@withContext)
}

Expand Down

0 comments on commit 6360ec2

Please sign in to comment.