Woka support scrolling issue resolved
Completed UserProfileActivity.kt with api integration Completed whole flow of add child from guardian app with all api integration of child registration Deactivate account api integration. Flow changes in user log in
This commit is contained in:
24
app/src/main/java/com/woka/userdata/UserApiService.kt
Normal file
24
app/src/main/java/com/woka/userdata/UserApiService.kt
Normal file
@@ -0,0 +1,24 @@
|
||||
package com.woka.userdata
|
||||
|
||||
import com.woka.userdata.userDataModels.UserDataResponse
|
||||
import com.woka.networking.ApiResponse
|
||||
import okhttp3.FormBody
|
||||
import retrofit2.Response
|
||||
import retrofit2.http.Body
|
||||
import retrofit2.http.GET
|
||||
import retrofit2.http.POST
|
||||
|
||||
interface UserApiService {
|
||||
|
||||
@GET("get_user_data")
|
||||
suspend fun getUserData(): Response<ApiResponse<UserDataResponse>>
|
||||
|
||||
@GET("user_logout")
|
||||
suspend fun logout(): Response<ApiResponse<Any>>
|
||||
|
||||
@POST("update_profile")
|
||||
suspend fun updateProfile(@Body formBody: FormBody): Response<ApiResponse<Any>>
|
||||
|
||||
@GET("user_deactivate_account")
|
||||
suspend fun deActivateAccount(): Response<ApiResponse<Any>>
|
||||
}
|
||||
42
app/src/main/java/com/woka/userdata/UserRepository.kt
Normal file
42
app/src/main/java/com/woka/userdata/UserRepository.kt
Normal file
@@ -0,0 +1,42 @@
|
||||
package com.woka.userdata
|
||||
|
||||
import com.woka.userdata.userDataModels.UserDataResponse
|
||||
import com.woka.networking.ApiResult
|
||||
import com.woka.networking.RetrofitHelper
|
||||
import com.woka.networking.RetrofitHelper.handleApiCall
|
||||
import okhttp3.FormBody
|
||||
|
||||
object UserRepository {
|
||||
|
||||
private val userApiService = RetrofitHelper.getRetrofit().create(UserApiService::class.java)
|
||||
|
||||
suspend fun getUserData(): ApiResult<UserDataResponse>{
|
||||
return handleApiCall{
|
||||
userApiService.getUserData()
|
||||
}
|
||||
}
|
||||
|
||||
suspend fun logout(): ApiResult<Any>{
|
||||
return handleApiCall {
|
||||
userApiService.logout()
|
||||
}
|
||||
}
|
||||
|
||||
suspend fun updateProfile(name: String, email: String, gender: String): ApiResult<Any>{
|
||||
return handleApiCall {
|
||||
userApiService.updateProfile(
|
||||
FormBody.Builder()
|
||||
.add("fullname", name)
|
||||
.add("email", email)
|
||||
.add("gender", gender)
|
||||
.build()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
suspend fun deActivateAccount(): ApiResult<Any>{
|
||||
return handleApiCall {
|
||||
userApiService.deActivateAccount()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.woka.userdata.userDataModels
|
||||
|
||||
data class ChildDetail(
|
||||
val avatar_name: String?,
|
||||
val id: Int?,
|
||||
val interest_topic: List<InterestTopic?>?,
|
||||
val user_id: Int?
|
||||
)
|
||||
@@ -0,0 +1,6 @@
|
||||
package com.woka.userdata.userDataModels
|
||||
|
||||
data class Gender(
|
||||
val gender_name: String?,
|
||||
val id: Int?
|
||||
)
|
||||
@@ -0,0 +1,6 @@
|
||||
package com.woka.userdata.userDataModels
|
||||
|
||||
data class InterestTopic(
|
||||
val id: Int?,
|
||||
val topic_name: String?
|
||||
)
|
||||
@@ -0,0 +1,6 @@
|
||||
package com.woka.userdata.userDataModels
|
||||
|
||||
data class Language(
|
||||
val id: Int?,
|
||||
val language_name: String?
|
||||
)
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.woka.userdata.userDataModels
|
||||
|
||||
data class UserData(
|
||||
val already_logged_in: Boolean,
|
||||
val is_deactive: Boolean,
|
||||
val avtar: String?,
|
||||
val birthdate: String?,
|
||||
val child_detail: ChildDetail?,
|
||||
val email: String?,
|
||||
val fullname: String?,
|
||||
// val gender: Gender?,
|
||||
val id: Int?,
|
||||
val is_active: String?,
|
||||
val language: Language?,
|
||||
val language_master_id: Int?,
|
||||
val last_login: String?,
|
||||
val remember_token: String?,
|
||||
val user_type: Int?,
|
||||
val username: String?
|
||||
)
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.woka.userdata.userDataModels
|
||||
|
||||
data class UserDataResponse(
|
||||
val result: UserData?,
|
||||
// val userNotificationData: UserNotificationData?,
|
||||
val userNotificationsCount: Int?
|
||||
)
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.woka.userdata.userDataModels
|
||||
|
||||
data class UserNotificationData(
|
||||
val created_at: String?,
|
||||
val description: String?,
|
||||
val image_url: String?,
|
||||
val is_home_notification_read: Int?,
|
||||
val is_read: Int?,
|
||||
val is_specific_time_notification: Int?,
|
||||
val link: Any?,
|
||||
val post_type: Int?,
|
||||
val title: String?,
|
||||
val type: String?,
|
||||
val user_id: Int?
|
||||
)
|
||||
Reference in New Issue
Block a user