-
Notifications
You must be signed in to change notification settings - Fork 137
Issue/woomob 1307 android bookings tab #14621
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
JorgeMucientes
merged 10 commits into
trunk
from
issue/woomob-1307-android-bookings-tab
Sep 17, 2025
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
ad4c24c
Adds new Booking list top level fragment
JorgeMucientes 4e1fc16
Add new bookings tab to bottom nav bar
JorgeMucientes f64a43b
Fix crash when opening bookings fragment
JorgeMucientes 65315dc
Add logic to show hide bookings tab dynamically
JorgeMucientes 206e20d
Fix warning
JorgeMucientes a4925cf
Update placeholder text
JorgeMucientes f80a3ed
Update todo text
JorgeMucientes cbb8166
Remove TODO to fix detekt failure
JorgeMucientes dc49142
Remove unnecessary val property
JorgeMucientes 3b1c9cb
Merge branch 'trunk' into issue/woomob-1307-android-bookings-tab
JorgeMucientes File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
37 changes: 37 additions & 0 deletions
37
WooCommerce/src/main/kotlin/com/woocommerce/android/ui/bookings/BookingListFragment.kt
This file contains hidden or 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,37 @@ | ||
| package com.woocommerce.android.ui.bookings | ||
|
|
||
| import android.os.Bundle | ||
| import android.view.LayoutInflater | ||
| import android.view.View | ||
| import android.view.ViewGroup | ||
| import androidx.compose.material3.Text | ||
| import androidx.compose.ui.platform.ComposeView | ||
| import androidx.compose.ui.platform.ViewCompositionStrategy | ||
| import com.woocommerce.android.R | ||
| import com.woocommerce.android.ui.base.TopLevelFragment | ||
| import com.woocommerce.android.ui.compose.theme.WooThemeWithBackground | ||
| import com.woocommerce.android.ui.main.AppBarStatus | ||
| import dagger.hilt.android.AndroidEntryPoint | ||
|
|
||
| @AndroidEntryPoint | ||
| class BookingListFragment : TopLevelFragment() { | ||
| override val activityAppBarStatus: AppBarStatus | ||
| get() = AppBarStatus.Hidden | ||
|
|
||
| override fun getFragmentTitle() = getString(R.string.bookings_tab_title) | ||
| override fun shouldExpandToolbar(): Boolean = false | ||
| override fun scrollToTop() { | ||
| return | ||
| } | ||
|
|
||
| override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View { | ||
| return ComposeView(requireContext()).apply { | ||
| setViewCompositionStrategy(ViewCompositionStrategy.DisposeOnViewTreeLifecycleDestroyed) | ||
| setContent { | ||
| WooThemeWithBackground { | ||
| Text("Empty Booking List screen: WIP") | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } |
46 changes: 46 additions & 0 deletions
46
WooCommerce/src/main/kotlin/com/woocommerce/android/ui/bookings/tab/BookingsTabController.kt
This file contains hidden or 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,46 @@ | ||
| package com.woocommerce.android.ui.bookings.tab | ||
|
|
||
| import androidx.lifecycle.DefaultLifecycleObserver | ||
| import androidx.lifecycle.LifecycleOwner | ||
| import androidx.lifecycle.lifecycleScope | ||
| import com.woocommerce.android.R | ||
| import com.woocommerce.android.databinding.ActivityMainBinding | ||
| import com.woocommerce.android.ui.main.MainActivity | ||
| import kotlinx.coroutines.launch | ||
| import javax.inject.Inject | ||
|
|
||
| class BookingsTabController @Inject constructor( | ||
| private val showBookingsTab: ShowBookingsTab | ||
| ) : DefaultLifecycleObserver { | ||
| private lateinit var activity: MainActivity | ||
| private lateinit var binding: ActivityMainBinding | ||
|
|
||
| fun init( | ||
| activity: MainActivity, | ||
| binding: ActivityMainBinding | ||
| ) { | ||
| this.activity = activity | ||
| this.binding = binding | ||
| activity.lifecycle.addObserver(this) | ||
| } | ||
|
|
||
| override fun onResume(owner: LifecycleOwner) { | ||
| checkBookingsTabVisibility() | ||
| } | ||
|
|
||
| override fun onDestroy(owner: LifecycleOwner) { | ||
| owner.lifecycle.removeObserver(this) | ||
| } | ||
|
|
||
| private fun checkBookingsTabVisibility() { | ||
| activity.lifecycleScope.launch { | ||
| showBookingsTab() | ||
| .onSuccess { | ||
| binding.bottomNav.menu.findItem(R.id.bookings)?.isVisible = it | ||
| } | ||
| .onFailure { | ||
| // TODO log error or track errors? | ||
| } | ||
| } | ||
| } | ||
| } |
13 changes: 13 additions & 0 deletions
13
WooCommerce/src/main/kotlin/com/woocommerce/android/ui/bookings/tab/ShowBookingsTab.kt
This file contains hidden or 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,13 @@ | ||
| package com.woocommerce.android.ui.bookings.tab | ||
|
|
||
| import com.woocommerce.android.util.FeatureFlag | ||
| import kotlinx.coroutines.Dispatchers | ||
| import kotlinx.coroutines.withContext | ||
| import javax.inject.Inject | ||
|
|
||
| class ShowBookingsTab @Inject constructor() { | ||
| suspend operator fun invoke(): Result<Boolean> = withContext(Dispatchers.IO) { | ||
| // Add here: Fetch if site has any published bookable product AND if site is CIAB | ||
| return@withContext Result.success(FeatureFlag.BOOKINGS_MVP.isEnabled()) | ||
| } | ||
| } | ||
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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
23 changes: 23 additions & 0 deletions
23
WooCommerce/src/main/res/drawable/as_menu_booking_list.xml
This file contains hidden or 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,23 @@ | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
|
|
||
| <animated-selector | ||
| xmlns:android="http://schemas.android.com/apk/res/android"> | ||
|
|
||
| <item | ||
| android:state_focused="true" | ||
| android:drawable="@drawable/ic_bookings_tab"> | ||
| </item> | ||
|
|
||
| <item | ||
| android:id="@+id/selected" | ||
| android:state_selected="true" | ||
| android:drawable="@drawable/ic_bookings_tab"> | ||
| </item> | ||
|
|
||
| <item | ||
| android:id="@+id/unselected" | ||
| android:state_selected="false" | ||
| android:drawable="@drawable/ic_bookings_tab"> | ||
| </item> | ||
|
|
||
| </animated-selector> |
This file contains hidden or 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,9 @@ | ||
| <vector xmlns:android="http://schemas.android.com/apk/res/android" | ||
| android:width="18dp" | ||
| android:height="16dp" | ||
| android:viewportWidth="18" | ||
| android:viewportHeight="16"> | ||
| <path | ||
| android:pathData="M3.039,15.768C1.246,15.768 0.316,14.847 0.316,13.07V2.968C0.316,1.192 1.246,0.271 3.039,0.271H14.461C16.254,0.271 17.184,1.192 17.184,2.968V13.07C17.184,14.838 16.254,15.768 14.461,15.768H3.039ZM3.014,14.141H14.469C15.167,14.141 15.557,13.776 15.557,13.054V5.384C15.557,4.653 15.167,4.296 14.469,4.296H3.014C2.325,4.296 1.943,4.653 1.943,5.384V13.054C1.943,13.776 2.325,14.141 3.014,14.141ZM7.148,7.177C6.857,7.177 6.758,7.085 6.758,6.787V6.305C6.758,6.006 6.857,5.915 7.148,5.915H7.638C7.937,5.915 8.036,6.006 8.036,6.305V6.787C8.036,7.085 7.937,7.177 7.638,7.177H7.148ZM9.871,7.177C9.572,7.177 9.472,7.085 9.472,6.787V6.305C9.472,6.006 9.572,5.915 9.871,5.915H10.352C10.651,5.915 10.75,6.006 10.75,6.305V6.787C10.75,7.085 10.651,7.177 10.352,7.177H9.871ZM12.585,7.177C12.286,7.177 12.186,7.085 12.186,6.787V6.305C12.186,6.006 12.286,5.915 12.585,5.915H13.066C13.365,5.915 13.465,6.006 13.465,6.305V6.787C13.465,7.085 13.365,7.177 13.066,7.177H12.585ZM4.434,9.85C4.143,9.85 4.043,9.758 4.043,9.459V8.978C4.043,8.679 4.143,8.588 4.434,8.588H4.923C5.222,8.588 5.322,8.679 5.322,8.978V9.459C5.322,9.758 5.222,9.85 4.923,9.85H4.434ZM7.148,9.85C6.857,9.85 6.758,9.758 6.758,9.459V8.978C6.758,8.679 6.857,8.588 7.148,8.588H7.638C7.937,8.588 8.036,8.679 8.036,8.978V9.459C8.036,9.758 7.937,9.85 7.638,9.85H7.148ZM9.871,9.85C9.572,9.85 9.472,9.758 9.472,9.459V8.978C9.472,8.679 9.572,8.588 9.871,8.588H10.352C10.651,8.588 10.75,8.679 10.75,8.978V9.459C10.75,9.758 10.651,9.85 10.352,9.85H9.871ZM12.585,9.85C12.286,9.85 12.186,9.758 12.186,9.459V8.978C12.186,8.679 12.286,8.588 12.585,8.588H13.066C13.365,8.588 13.465,8.679 13.465,8.978V9.459C13.465,9.758 13.365,9.85 13.066,9.85H12.585ZM4.434,12.523C4.143,12.523 4.043,12.431 4.043,12.132V11.651C4.043,11.352 4.143,11.261 4.434,11.261H4.923C5.222,11.261 5.322,11.352 5.322,11.651V12.132C5.322,12.431 5.222,12.523 4.923,12.523H4.434ZM7.148,12.523C6.857,12.523 6.758,12.431 6.758,12.132V11.651C6.758,11.352 6.857,11.261 7.148,11.261H7.638C7.937,11.261 8.036,11.352 8.036,11.651V12.132C8.036,12.431 7.937,12.523 7.638,12.523H7.148ZM9.871,12.523C9.572,12.523 9.472,12.431 9.472,12.132V11.651C9.472,11.352 9.572,11.261 9.871,11.261H10.352C10.651,11.261 10.75,11.352 10.75,11.651V12.132C10.75,12.431 10.651,12.523 10.352,12.523H9.871Z" | ||
| android:fillColor="@color/color_icon_menu"/> | ||
| </vector> |
This file contains hidden or 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 hidden or 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 hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JorgeMucientes Do you want to update this logic now, given there's new code in
trunkto check for CIAB sites?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the suggestion. I'll address that as part of WOOMOB-1351