diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 3b6101cb9..50ab34d78 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -13,7 +13,7 @@ plugins { android { defaultConfig { - val buildVersion = 178 + val buildVersion = 179 applicationId = "com.crisiscleanup" versionCode = buildVersion versionName = "0.9.${buildVersion - 168}" diff --git a/core/model/src/main/java/com/crisiscleanup/core/model/data/IncidentOrganization.kt b/core/model/src/main/java/com/crisiscleanup/core/model/data/IncidentOrganization.kt index 869691ac5..67012b013 100644 --- a/core/model/src/main/java/com/crisiscleanup/core/model/data/IncidentOrganization.kt +++ b/core/model/src/main/java/com/crisiscleanup/core/model/data/IncidentOrganization.kt @@ -5,7 +5,18 @@ data class IncidentOrganization( val name: String, val primaryContacts: List, val affiliateIds: Set, -) +) { + override fun equals(other: Any?): Boolean { + (other as? IncidentOrganization)?.let { + return id == it.id + } + return false + } + + override fun hashCode(): Int { + return id.hashCode() + } +} data class OrganizationIdName( val id: Long, diff --git a/core/model/src/main/java/com/crisiscleanup/core/model/data/Worksite.kt b/core/model/src/main/java/com/crisiscleanup/core/model/data/Worksite.kt index bf3b2d310..e2cfaae31 100644 --- a/core/model/src/main/java/com/crisiscleanup/core/model/data/Worksite.kt +++ b/core/model/src/main/java/com/crisiscleanup/core/model/data/Worksite.kt @@ -11,7 +11,7 @@ enum class AutoContactFrequency(val literal: String) { } private val autoContactFrequencyMap = - AutoContactFrequency.values().map { it.literal to it }.toMap() + AutoContactFrequency.entries.associateBy { it.literal } data class Worksite( val id: Long, diff --git a/core/network/src/main/java/com/crisiscleanup/core/network/retrofit/DataApiClient.kt b/core/network/src/main/java/com/crisiscleanup/core/network/retrofit/DataApiClient.kt index 5897525e3..31ee97dce 100644 --- a/core/network/src/main/java/com/crisiscleanup/core/network/retrofit/DataApiClient.kt +++ b/core/network/src/main/java/com/crisiscleanup/core/network/retrofit/DataApiClient.kt @@ -17,6 +17,13 @@ private interface DataSourceApi { @GET("users/me") suspend fun getProfile(): NetworkAccountProfileResult + @Headers("Cookie: ") + @GET("users/me") + suspend fun getProfile( + @Header("Authorization") + accessToken: String, + ): NetworkUserProfile + @TokenAuthenticationHeader @GET("organizations") suspend fun getOrganizations( @@ -199,13 +206,6 @@ private interface DataSourceApi { suspend fun searchOrganizations( @Query("search") q: String, ): NetworkOrganizationsSearchResult - - @Headers("Cookie: ") - @GET("/users/me") - suspend fun getProfile( - @Header("Authorization") - accessToken: String, - ): NetworkUserProfile } private val worksiteCoreDataFields = listOf( diff --git a/core/network/src/main/java/com/crisiscleanup/core/network/retrofit/RegisterApiClient.kt b/core/network/src/main/java/com/crisiscleanup/core/network/retrofit/RegisterApiClient.kt index ee94a9b05..58b8c8d6d 100644 --- a/core/network/src/main/java/com/crisiscleanup/core/network/retrofit/RegisterApiClient.kt +++ b/core/network/src/main/java/com/crisiscleanup/core/network/retrofit/RegisterApiClient.kt @@ -30,6 +30,7 @@ import com.crisiscleanup.core.network.model.profilePictureUrl import retrofit2.Retrofit import retrofit2.http.Body import retrofit2.http.GET +import retrofit2.http.Headers import retrofit2.http.POST import retrofit2.http.Path import java.net.URL @@ -54,11 +55,13 @@ private interface RegisterApi { @Path("code") inviteCode: String, ): NetworkPersistentInvitationResult + @Headers("Cookie: ") @GET("users/{user}") suspend fun noAuthUser( @Path("user") userId: Long, ): NetworkUser + @Headers("Cookie: ") @GET("organizations/{organization}") suspend fun noAuthOrganization( @Path("organization") organizationId: Long,