Skip to content

Commit e0625ac

Browse files
authored
Fixed navigation and cart related bugs (#90)
* Fixed navigation bugs when trying to add a product by manual search. * Emptying the cart lead to an app crash, that's not the case anymore.
1 parent 0cf43c3 commit e0625ac

File tree

5 files changed

+14
-3
lines changed

5 files changed

+14
-3
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@ All notable changes to this project will be documented in this file.
33

44
## UNRELEASED
55

6+
## [0.69.1-beta07]
7+
### Fixed
8+
* Fixed navigation when using manual product search
9+
* Fixed app crash when removing the last item from the cart
10+
611
## [0.69.1-beta06]
712
### Added
813
* ui-toolkit: Add VersionWidget to display the app and sdk version (#87)

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ allprojects {
3737
}
3838

3939
project.ext {
40-
sdkVersion = '0.69.1-beta06'
40+
sdkVersion = '0.69.1-beta07'
4141
versionCode = 1
4242

4343
compileSdkVersion = 31

kotlin-sample/src/main/java/io/snabble/sdk/sample/MainActivity.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,9 @@ class MainActivity : AppCompatActivity() {
216216
val isBottomNavigationVisible = arguments?.getBoolean("hideBottomNavigation") != true
217217
navBarView.isVisible = isBottomNavigationVisible
218218
navBarView.isEnabled = isBottomNavigationVisible
219+
if (destination.id == R.id.not_checked_in && Snabble.checkedInProject.value != null) {
220+
navigate(R.id.navigation_scanner)
221+
}
219222
}
220223
}
221224

kotlin-sample/src/main/java/io/snabble/sdk/sample/SnabbleUiEventHandler.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ fun setUpUiEvents(activity: AppCompatActivity, navController: NavController, bot
7171
activity,
7272
SnabbleUI.Event.GO_BACK
7373
) { _, _ ->
74+
navController.popBackStack()
7475
}
7576

7677
SnabbleUiToolkit.setUiAction(

ui/src/main/java/io/snabble/sdk/ui/cart/ShoppingCartView.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -594,7 +594,7 @@ public static class ShoppingCartAdapter extends RecyclerView.Adapter<RecyclerVie
594594
private static final int TYPE_SIMPLE = 1;
595595
private List<Row> list = Collections.emptyList();
596596
private final Context context;
597-
private final ShoppingCart cart;
597+
private ShoppingCart cart;
598598
private final View parentView;
599599
private boolean hasAnyImages = false;
600600

@@ -626,6 +626,8 @@ public int getItemCount() {
626626

627627
// for fetching the data from outside of this view
628628
public void fetchFrom(ShoppingCart cart) {
629+
this.cart = cart;
630+
629631
hasAnyImages = false;
630632

631633
for (int i = 0; i < cart.size(); i++) {
@@ -737,4 +739,4 @@ public void removeAndShowUndoSnackbar(int adapterPosition, ShoppingCart.Item ite
737739
fetchFrom(cart);
738740
}
739741
}
740-
}
742+
}

0 commit comments

Comments
 (0)