Skip to content

Commit

Permalink
Merge pull request #94 from Team-Walkie/feat/fix_icon_ui
Browse files Browse the repository at this point in the history
러닝, 커뮤니티 상단 ui 수정
  • Loading branch information
yonghanJu authored Dec 5, 2024
2 parents 062bc5c + efa64cb commit 0b76059
Show file tree
Hide file tree
Showing 32 changed files with 296 additions and 63 deletions.
2 changes: 1 addition & 1 deletion app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ android {
minSdk = 26
targetSdk = 33
versionCode = 1
versionName = "1.0.16"
versionName = "1.0.17"

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
Expand Down
Binary file added app/src/main/ic_launcher-playstore.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions app/src/main/java/com/whyranoid/walkie/KoinModules.kt
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ val viewModelModule =
viewModel { AddPostViewModel(get()) }
viewModel { SearchFriendViewModel(get(), get(), get()) }
viewModel { DialogViewModel(get(), get(), get(), get(), get(), get()) }
viewModel { CommunityScreenViewModel(get(), get(), get(), get(), get()) }
viewModel { CommunityScreenViewModel(get(), get(), get(), get(), get(), get(), get()) }
viewModel { FollowingViewModel(get(), get(), get(), get(), get(), get()) }
viewModel { SettingViewModel(get(), get()) }
viewModel { TotalBadgeViewModel(get(), get()) }
Expand All @@ -172,7 +172,7 @@ val dataSourceModule =
single<ChallengeDataSource> { ChallengeDataSourceImpl(get()) }
single<PostDataSource> { PostDataSourceImpl(get()) }
single<UserDataSource> { UserDataSourceImpl(get()) }
single<AccountDataSource> { AccountDataSourceImpl(get()) }
single<AccountDataSource> { AccountDataSourceImpl(get(),get()) }
single<FollowDataSource> { FollowDataSourceImpl(get()) }
single<RunningControlDataSource> { RunningControlDataSourceImpl(get()) }
single<CommunityDataSource> { CommunityDataSourceImpl(get()) }
Expand Down
74 changes: 74 additions & 0 deletions app/src/main/res/drawable/ic_launcher_background.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
<?xml version="1.0" encoding="utf-8"?>
<vector
android:height="108dp"
android:width="108dp"
android:viewportHeight="108"
android:viewportWidth="108"
xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#3DDC84"
android:pathData="M0,0h108v108h-108z"/>
<path android:fillColor="#00000000" android:pathData="M9,0L9,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M19,0L19,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M29,0L29,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M39,0L39,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M49,0L49,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M59,0L59,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M69,0L69,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M79,0L79,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M89,0L89,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M99,0L99,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,9L108,9"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,19L108,19"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,29L108,29"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,39L108,39"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,49L108,49"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,59L108,59"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,69L108,69"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,79L108,79"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,89L108,89"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,99L108,99"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M19,29L89,29"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M19,39L89,39"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M19,49L89,49"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M19,59L89,59"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M19,69L89,69"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M19,79L89,79"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M29,19L29,89"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M39,19L39,89"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M49,19L49,89"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M59,19L59,89"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M69,19L69,89"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M79,19L79,89"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
</vector>
4 changes: 2 additions & 2 deletions app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
<background android:drawable="@drawable/ic_launcher_background"/>
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
</adaptive-icon>
4 changes: 2 additions & 2 deletions app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
<background android:drawable="@drawable/ic_launcher_background"/>
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
</adaptive-icon>
6 changes: 0 additions & 6 deletions app/src/main/res/mipmap-anydpi-v33/ic_launcher.xml

This file was deleted.

Binary file modified app/src/main/res/mipmap-hdpi/ic_launcher.webp
Binary file not shown.
Binary file not shown.
Binary file modified app/src/main/res/mipmap-hdpi/ic_launcher_round.webp
Binary file not shown.
Binary file modified app/src/main/res/mipmap-mdpi/ic_launcher.webp
Binary file not shown.
Binary file not shown.
Binary file modified app/src/main/res/mipmap-mdpi/ic_launcher_round.webp
Binary file not shown.
Binary file modified app/src/main/res/mipmap-xhdpi/ic_launcher.webp
Binary file not shown.
Binary file not shown.
Binary file modified app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp
Binary file not shown.
Binary file modified app/src/main/res/mipmap-xxhdpi/ic_launcher.webp
Binary file not shown.
Binary file not shown.
Binary file modified app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp
Binary file not shown.
Binary file modified app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp
Binary file not shown.
Binary file not shown.
Binary file modified app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,18 +1,30 @@
package com.whyranoid.data.datasource.account

import android.content.Context
import android.graphics.Bitmap
import android.graphics.BitmapFactory
import androidx.annotation.DrawableRes
import com.whyranoid.data.R
import com.whyranoid.data.getResult
import com.whyranoid.data.model.account.SignUpRequest
import com.whyranoid.data.model.account.toLoginData
import com.whyranoid.data.model.account.toUserInfo
import com.whyranoid.domain.datasource.AccountDataSource
import com.whyranoid.domain.model.account.LoginData
import com.whyranoid.domain.model.account.UserInfo
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext
import okhttp3.MediaType
import okhttp3.MultipartBody
import okhttp3.RequestBody
import java.io.File
import java.io.FileOutputStream
import java.net.URL
import java.util.Locale

class AccountDataSourceImpl(private val accountService: AccountService) : AccountDataSource {
class AccountDataSourceImpl(
private val accountService: AccountService,
private val context: Context,
) : AccountDataSource {
override suspend fun signUp(
name: String,
nickName: String,
Expand All @@ -21,22 +33,35 @@ class AccountDataSourceImpl(private val accountService: AccountService) : Accoun
agreeGps: Boolean,
agreeMarketing: Boolean,
): Result<Long> {
val userNameBody = RequestBody.create(MediaType.parse("text/plain"), nickName)
val nameBody = RequestBody.create(MediaType.parse("text/plain"), name)
val authIdBody = RequestBody.create(MediaType.parse("text/plain"), authId)
val agreeGpsBody = RequestBody.create(
MediaType.parse("text/plain"),
agreeGps.toString().lowercase(Locale.ROOT)
)
val agreeSubscriptionBody = RequestBody.create(
MediaType.parse("text/plain"),
agreeMarketing.toString().lowercase(Locale.ROOT)
)
val profileImageBody = uploadImageFromUrl(profileUrl, "profileImg")

return kotlin.runCatching {
val request = SignUpRequest(
userName = nickName,
name = name,
profileImg = profileUrl ?: "",
authId = authId,
agreeGps = agreeGps,
agreeSubscription = agreeMarketing,
val response = accountService.signUp(
userNameBody,
nameBody,
profileImageBody,
authIdBody,
agreeGpsBody,
agreeSubscriptionBody
)

val response = accountService.signUp(request)

if (response.isSuccessful.not()) {
throw Exception(response.errorBody().toString())
} else if (response.body() == null) throw Exception(response.message())
requireNotNull(response.body()?.walkieId?.toLong() ?: throw Exception("empty response"))
}.onFailure {
it.printStackTrace()
}
}

Expand All @@ -59,7 +84,11 @@ class AccountDataSourceImpl(private val accountService: AccountService) : Accoun
}
}

override suspend fun changeMyInfo(walkieId: Long, nickName: String, profileUrl: String?): Result<Boolean> {
override suspend fun changeMyInfo(
walkieId: Long,
nickName: String,
profileUrl: String?
): Result<Boolean> {
return kotlin.runCatching {
var imagePart: MultipartBody.Part? = null

Expand Down Expand Up @@ -90,7 +119,77 @@ class AccountDataSourceImpl(private val accountService: AccountService) : Accoun

override suspend fun leave(walkieId: Long): Result<Unit> {
return kotlin.runCatching {
accountService.leave(walkieId).getResult{ }
accountService.leave(walkieId).getResult { }
}
}

private suspend fun uploadImageFromUrl(
imageUrl: String?,
partName: String
): MultipartBody.Part {
return withContext(Dispatchers.IO) {
imageUrl?.let { url ->
makePartFromUrl(url, partName)
} ?: kotlin.run {
makePartFromRes(R.drawable.ic_walkie_logo, partName)
}
}
}

private fun makePartFromRes(
@DrawableRes resId: Int,
partName: String
): MultipartBody.Part {
val bitmap = BitmapFactory.decodeResource(context.resources, resId)

// 임시 파일 생성
val tempFile = File.createTempFile("drawable", ".png", context.cacheDir)
tempFile.deleteOnExit()

// 비트맵을 PNG 파일로 저장
val outputStream = FileOutputStream(tempFile)
bitmap.compress(Bitmap.CompressFormat.PNG, 100, outputStream)
outputStream.close()

// MultipartBody.Part 생성
val requestBody = RequestBody.create(
MediaType.parse("image/png"),
tempFile
)

return MultipartBody.Part.createFormData(
partName, // 서버에서 받을 파라미터 이름
tempFile.name,
requestBody
)
}

private fun makePartFromUrl(url: String, partName: String): MultipartBody.Part {
// URL로부터 이미지 다운로드
val connection = URL(url).openConnection()
val inputStream = connection.getInputStream()

// 임시 파일 생성
val tempFile = File.createTempFile("downloaded_image", ".jpg")
tempFile.deleteOnExit()

// 입력 스트림을 파일로 저장
inputStream.use { input ->
tempFile.outputStream().use { output ->
input.copyTo(output)
}
}

// MultipartBody.Part 생성
val requestBody = RequestBody.create(
MediaType.parse("image/jpg"),
tempFile
)

return MultipartBody.Part.createFormData(
partName, // 서버에서 받을 파라미터 이름
tempFile.name,
requestBody
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ import com.whyranoid.data.model.account.ChangeMyInfoResponse
import com.whyranoid.data.model.account.LeaveResponse
import com.whyranoid.data.model.account.LoginDataResponse
import com.whyranoid.data.model.account.NickCheckResponse
import com.whyranoid.data.model.account.SignUpRequest
import com.whyranoid.data.model.account.SignUpResponse
import com.whyranoid.data.model.account.UserInfoResponse
import okhttp3.MultipartBody
import okhttp3.RequestBody
import retrofit2.Response
import retrofit2.http.Body
import retrofit2.http.DELETE
import retrofit2.http.GET
import retrofit2.http.Multipart
import retrofit2.http.POST
import retrofit2.http.Part
import retrofit2.http.Query
Expand All @@ -23,9 +23,15 @@ interface AccountService {
@Query("userName") nickName: String,
): Response<NickCheckResponse>

@Multipart
@POST(API.SIGN_UP)
suspend fun signUp(
@Body signUpRequest: SignUpRequest,
@Part("userName") userName: RequestBody,
@Part("name") name: RequestBody,
@Part profileImg: MultipartBody.Part,
@Part("authId") authId: RequestBody,
@Part("agreeGps") agreeGps: RequestBody,
@Part("agreeSubscription") agreeSubscription: RequestBody,
): Response<SignUpResponse>

@GET(API.LOGIN)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ class PostDataSourceImpl(private val postService: PostService) : PostDataSource

override suspend fun getEveryPost(uid: Long): Result<List<Post>> {
return kotlin.runCatching {
val posts = requireNotNull(postService.getPosts(uid).body())
val posts = requireNotNull(postService.getEveryPosts(uid).body())
posts.map { it.toPost(uid) }
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class PostRepositoryImpl(
}

override suspend fun getEveryPost(uid: Long): Result<List<Post>> {
return postDataSource.getMyFollowingsPost(uid)
return postDataSource.getEveryPost(uid)
}

override suspend fun getComments(postId: Long): Result<List<Comment>> {
Expand Down
Binary file added data/src/main/res/drawable/ic_walkie_logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import androidx.compose.ui.unit.sp
import androidx.navigation.NavController
import com.whyranoid.presentation.component.bar.WalkieTopBar
import com.whyranoid.presentation.component.community.PostItem
import com.whyranoid.presentation.component.community.RunningFollowerItem
import com.whyranoid.presentation.component.running.RunningFollowerItemWithLikable
import com.whyranoid.presentation.theme.WalkieColor
import com.whyranoid.presentation.theme.WalkieTypography
Expand Down Expand Up @@ -119,6 +120,16 @@ fun CommunityScreen(navController: NavController) {
modifier = Modifier.padding(it)
) {
LazyRow {
state.myThumbnailState.getDataOrNull()?.let { myInfo ->
item {
RunningFollowerItem(
user = myInfo,
onClickProfile = {
navController.navigate(Screen.MyPage.route)
},
)
}
}
state.runningFollowerState.getDataOrNull()?.let { (running, notRunning) ->
items(running.size) {
RunningFollowerItemWithLikable(
Expand Down
Loading

0 comments on commit 0b76059

Please sign in to comment.