Skip to content

Commit

Permalink
[feat/backstack_after_register]: 맛집 등록 후 백스택 정리
Browse files Browse the repository at this point in the history
  • Loading branch information
soopeach committed Sep 23, 2023
1 parent b7c2655 commit 922a45b
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 24 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package org.gdsc.presentation.view.restaurantregistration

import android.content.Intent
import android.os.Bundle
import android.view.KeyEvent
import android.view.LayoutInflater
Expand Down Expand Up @@ -34,7 +33,6 @@ import org.gdsc.presentation.utils.animateShrinkWidth
import org.gdsc.presentation.utils.checkMediaPermissions
import org.gdsc.presentation.view.MainActivity
import org.gdsc.presentation.view.WEB_BASE_URL
import org.gdsc.presentation.view.WebViewActivity
import org.gdsc.presentation.view.custom.FoodCategoryBottomSheetDialog
import org.gdsc.presentation.view.restaurantregistration.adapter.RegisterRestaurantAdapter
import org.gdsc.presentation.view.restaurantregistration.viewmodel.RegisterRestaurantViewModel
Expand Down Expand Up @@ -224,24 +222,24 @@ class RegisterRestaurantFragment : BaseFragment() {

sUri.toUri()
.getCompressedBitmapFromUri(context)
?.saveBitmapToFile(context, "$index.jpg")?.let { imageFile ->
?.saveBitmapToFile(context, "$index.jpg")?.let { imageFile ->

val requestFile =
RequestBody.create(
MediaType.parse("image/png"),
imageFile
)
val requestFile =
RequestBody.create(
MediaType.parse("image/png"),
imageFile
)

val body =
MultipartBody.Part.createFormData(
"pictures",
imageFile.name,
requestFile
)
val body =
MultipartBody.Part.createFormData(
"pictures",
imageFile.name,
requestFile
)

pictures.add(body)
pictures.add(body)

}
}

}

Expand All @@ -251,15 +249,12 @@ class RegisterRestaurantFragment : BaseFragment() {
navArgs.restaurantLocationInfo ?: throw Exception()
) { restaurantId ->

val intent =
Intent(requireContext(), WebViewActivity::class.java)

// 주소는 변경 되어야 함, 현재는 Lucy LocalHost 테스트
intent.putExtra(
"url",
"${WEB_BASE_URL}detail/$restaurantId"
findNavController().navigate(
RegisterRestaurantFragmentDirections
.actionRegisterRestaurantFragmentToSpecificWebViewFragment(
"${WEB_BASE_URL}detail/$restaurantId"
)
)
startActivity(intent)
}
}
} else {
Expand Down
12 changes: 12 additions & 0 deletions presentation/src/main/res/navigation/main_nav_graph.xml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@
<action
android:id="@+id/action_registerRestaurantFragment_to_multiImagePickerFragment"
app:destination="@id/multiImagePicker_fragment"/>
<action
android:id="@+id/action_registerRestaurant_fragment_to_specificWebViewFragment"
app:destination="@id/specificWebViewFragment"
app:popUpTo="@id/home_fragment"/>

</fragment>
<fragment
Expand Down Expand Up @@ -135,5 +139,13 @@
tools:layout="@layout/fragment_account_management">

</fragment>
<fragment
android:id="@+id/specificWebViewFragment"
android:name="org.gdsc.presentation.view.webview.SpecificWebViewFragment"
android:label="SpecificWebViewFragment">
<argument
android:name="url"
app:argType="string" />
</fragment>

</navigation>

0 comments on commit 922a45b

Please sign in to comment.