From f3ebcfabdfe72b8e1ccef86ad2b011b43035c684 Mon Sep 17 00:00:00 2001 From: ASHWANI KUMAR <85477554+ashwanil23@users.noreply.github.com> Date: Tue, 29 Oct 2024 01:06:33 +0530 Subject: [PATCH 1/3] Added flow Diagram.md The diagram explains the overall data flow of the "Cupcake" app. The architecture and flow can be summarized as follows: User Interaction (Screens): The user interacts with the app through four key screens: StartOrderScreen: Users select the number of cupcakes. FlavorScreen: Users select the cupcake flavor. PickupScreen: Users choose a pickup date. SummaryScreen: The final order details are displayed, and users can share the order. Cupcake Screens Enum: The app navigates between screens using the CupcakeScreen enum, where each screen is associated with a title resource (R.string.choose_flavor, etc.). OrderViewModel: The OrderViewModel manages the cupcake order state. It uses MutableStateFlow to store the order details, like quantity, flavor, and pickup date. The model also handles logic like price calculation, adding a surcharge for same-day pickup. As users interact with the UI (selecting a quantity, flavor, or date), the OrderViewModel updates the uiState, which is observed by the UI to reflect the changes in real-time. Navigation: The navigation between screens is handled using the NavController. Based on user actions (e.g., clicking "Next"), the app moves to the next screen, and the OrderViewModel updates the necessary state (e.g., quantity, flavor, or date). UI State and Updates: The UI is reactive, meaning that it observes changes in the uiState. For example, the price is recalculated every time the user changes the quantity or pickup date, and the updated price is displayed in the UI. Order Summary: The SummaryScreen displays the final order details and allows the user to share the order using an Android implicit intent. --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index 205382e..4ca9cbc 100644 --- a/README.md +++ b/README.md @@ -19,3 +19,8 @@ Getting Started 2. Download the sample. 3. Import the sample into Android Studio. 4. Build and run the sample. + + +Flow Diagram +--------------- +![cupcake app diagram](https://github.com/user-attachments/assets/a0b4a3db-90a0-49b0-874b-f1103d7e9a2c) From a0d1064d5772f131a6b6aef39e6d0da351561cbe Mon Sep 17 00:00:00 2001 From: ASHWANI KUMAR <85477554+ashwanil23@users.noreply.github.com> Date: Tue, 29 Oct 2024 01:08:23 +0530 Subject: [PATCH 2/3] Added-Diagram-Read Me.md The diagram explains the overall data flow of the "Cupcake" app. The architecture and flow can be summarized as follows: User Interaction (Screens): The user interacts with the app through four key screens: StartOrderScreen: Users select the number of cupcakes. FlavorScreen: Users select the cupcake flavor. PickupScreen: Users choose a pickup date. SummaryScreen: The final order details are displayed, and users can share the order. Cupcake Screens Enum: The app navigates between screens using the CupcakeScreen enum, where each screen is associated with a title resource (R.string.choose_flavor, etc.). OrderViewModel: The OrderViewModel manages the cupcake order state. It uses MutableStateFlow to store the order details, like quantity, flavor, and pickup date. The model also handles logic like price calculation, adding a surcharge for same-day pickup. As users interact with the UI (selecting a quantity, flavor, or date), the OrderViewModel updates the uiState, which is observed by the UI to reflect the changes in real-time. Navigation: The navigation between screens is handled using the NavController. Based on user actions (e.g., clicking "Next"), the app moves to the next screen, and the OrderViewModel updates the necessary state (e.g., quantity, flavor, or date). UI State and Updates: The UI is reactive, meaning that it observes changes in the uiState. For example, the price is recalculated every time the user changes the quantity or pickup date, and the updated price is displayed in the UI. Order Summary: The SummaryScreen displays the final order details and allows the user to share the order using an Android implicit intent. --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 4ca9cbc..d0f075d 100644 --- a/README.md +++ b/README.md @@ -23,4 +23,5 @@ Getting Started Flow Diagram --------------- -![cupcake app diagram](https://github.com/user-attachments/assets/a0b4a3db-90a0-49b0-874b-f1103d7e9a2c) +![cupcake app diagram (1)](https://github.com/user-attachments/assets/62f0a0aa-5497-4603-9f52-64cc759a7e01) + From 70ab84d2de9159430e2ddeb86e6d9f75f02013d7 Mon Sep 17 00:00:00 2001 From: ASHWANI KUMAR <85477554+ashwanil23@users.noreply.github.com> Date: Tue, 29 Oct 2024 01:12:44 +0530 Subject: [PATCH 3/3] Added-Flow-Diagram-README.md Data Flow and Code Structure (with Diagram Explanation): The diagram explains the overall data flow of the "Cupcake" app. The architecture and flow can be summarized as follows: User Interaction (Screens): The user interacts with the app through four key screens: StartOrderScreen: Users select the number of cupcakes. FlavorScreen: Users select the cupcake flavor. PickupScreen: Users choose a pickup date. SummaryScreen: The final order details are displayed, and users can share the order. Cupcake Screens Enum: The app navigates between screens using the CupcakeScreen enum, where each screen is associated with a title resource (R.string.choose_flavor, etc.). OrderViewModel: The OrderViewModel manages the cupcake order state. It uses MutableStateFlow to store the order details, like quantity, flavor, and pickup date. The model also handles logic like price calculation, adding a surcharge for same-day pickup. As users interact with the UI (selecting a quantity, flavor, or date), the OrderViewModel updates the uiState, which is observed by the UI to reflect the changes in real-time. Navigation: The navigation between screens is handled using the NavController. Based on user actions (e.g., clicking "Next"), the app moves to the next screen, and the OrderViewModel updates the necessary state (e.g., quantity, flavor, or date). UI State and Updates: The UI is reactive, meaning that it observes changes in the uiState. For example, the price is recalculated every time the user changes the quantity or pickup date, and the updated price is displayed in the UI. Order Summary: The SummaryScreen displays the final order details and allows the user to share the order using an Android implicit intent. --- README.md | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/README.md b/README.md index d0f075d..378436e 100644 --- a/README.md +++ b/README.md @@ -25,3 +25,31 @@ Flow Diagram --------------- ![cupcake app diagram (1)](https://github.com/user-attachments/assets/62f0a0aa-5497-4603-9f52-64cc759a7e01) +## Data Flow and Code Structure (with Diagram Explanation) + +The diagram explains the overall data flow of the "Cupcake" app. The architecture and flow can be summarized as follows: + +### User Interaction (Screens): +The user interacts with the app through four key screens: +1. **StartOrderScreen**: Users select the number of cupcakes. +2. **FlavorScreen**: Users select the cupcake flavor. +3. **PickupScreen**: Users choose a pickup date. +4. **SummaryScreen**: The final order details are displayed, and users can share the order. + +### Cupcake Screens Enum: +The app navigates between screens using the `CupcakeScreen` enum, where each screen is associated with a title resource (e.g., `R.string.choose_flavor`). + +### OrderViewModel: +The `OrderViewModel` manages the cupcake order state. It uses `MutableStateFlow` to store the order details, like quantity, flavor, and pickup date. The model also handles logic like price calculation, including adding a surcharge for same-day pickup. + +- As users interact with the UI (selecting a quantity, flavor, or date), the `OrderViewModel` updates the `uiState`, which is observed by the UI to reflect the changes in real-time. + +### Navigation: +The navigation between screens is handled using the `NavController`. Based on user actions (e.g., clicking "Next"), the app moves to the next screen, and the `OrderViewModel` updates the necessary state (e.g., quantity, flavor, or date). + +### UI State and Updates: +The UI is reactive, meaning that it observes changes in the `uiState`. For example, the price is recalculated every time the user changes the quantity or pickup date, and the updated price is displayed in the UI. + +### Order Summary: +The `SummaryScreen` displays the final order details and allows the user to share the order using an Android implicit intent. +