-
Notifications
You must be signed in to change notification settings - Fork 130
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10680 from woocommerce/issue/10630-location-selec…
…tion Blaze: Target location selection
- Loading branch information
Showing
15 changed files
with
778 additions
and
131 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
...ommerce/android/ui/blaze/creation/targets/BlazeCampaignTargetLocationSelectionFragment.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package com.woocommerce.android.ui.blaze.creation.targets | ||
|
||
import android.os.Bundle | ||
import android.view.LayoutInflater | ||
import android.view.View | ||
import android.view.ViewGroup | ||
import androidx.fragment.app.viewModels | ||
import androidx.navigation.fragment.findNavController | ||
import com.woocommerce.android.extensions.navigateBackWithResult | ||
import com.woocommerce.android.ui.base.BaseFragment | ||
import com.woocommerce.android.ui.compose.composeView | ||
import com.woocommerce.android.ui.main.AppBarStatus | ||
import com.woocommerce.android.viewmodel.MultiLiveEvent | ||
import com.woocommerce.android.viewmodel.MultiLiveEvent.Event.ExitWithResult | ||
import dagger.hilt.android.AndroidEntryPoint | ||
|
||
@AndroidEntryPoint | ||
class BlazeCampaignTargetLocationSelectionFragment : BaseFragment() { | ||
companion object { | ||
const val BLAZE_TARGET_LOCATION_RESULT = "blaze_target_location_result" | ||
} | ||
|
||
override val activityAppBarStatus: AppBarStatus | ||
get() = AppBarStatus.Hidden | ||
|
||
val viewModel: BlazeCampaignTargetLocationSelectionViewModel by viewModels() | ||
|
||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View { | ||
return composeView { | ||
BlazeCampaignTargetSelectionScreen(viewModel) | ||
} | ||
} | ||
|
||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | ||
super.onViewCreated(view, savedInstanceState) | ||
setupObservers() | ||
} | ||
|
||
private fun setupObservers() { | ||
viewModel.event.observe(viewLifecycleOwner) { event -> | ||
when (event) { | ||
is MultiLiveEvent.Event.Exit -> findNavController().popBackStack() | ||
is ExitWithResult<*> -> navigateBackWithResult(BLAZE_TARGET_LOCATION_RESULT, event.data) | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.