Skip to content
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

Fix transaction snackbar and filter correctly #35

Merged
merged 3 commits into from
Nov 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
cache-key: "flutter-:os:-:channel:-:version:-:arch:-:hash:"
cache-path: "${{ runner.tool_cache }}/flutter/:channel:-:version:-:arch:"
architecture: x64
- run: flutter build web --release --web-renderer html
- run: flutter build web --release
- uses: FirebaseExtended/action-hosting-deploy@v0
with:
repoToken: '${{ secrets.GITHUB_TOKEN }}'
Expand Down
1 change: 1 addition & 0 deletions functions/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ export const createTransaction = functions
const userTransactions = await db
.collection("Transaction")
.where("user2Id", "==", user2Id)
.where("availabilityId", "==", availabilityId)
.where("status", "in", [
TransactionStatus.IN_PROGRESS,
TransactionStatus.PENDING,
Expand Down
24 changes: 4 additions & 20 deletions lib/components/dialogs/book_detail.dart
Original file line number Diff line number Diff line change
Expand Up @@ -323,26 +323,10 @@ class _BookDetailDialogState extends State<BookDetailDialog> {
},
)).then((value) async {
if (!value!) return;
await _bookController
.requestBook(
availabilityId,
BookAvailableType.trade,
)
.then((value) => Get.snackbar(
"Troca Requisitada",
"A troca foi requisitada com sucesso! Aguarde a resposta do dono do livro.",
backgroundColor:
Colors.green,
colorText: Colors.white,
))
.catchError((e) {
Get.snackbar(
"Erro",
e.toString(),
backgroundColor: Colors.red,
colorText: Colors.white,
);
});
_bookController.requestBook(
availabilityId,
BookAvailableType.trade,
);
});
}
}),
Expand Down
4 changes: 2 additions & 2 deletions lib/controllers/book_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,8 @@ class BookController extends GetxController {
.requestBook(availabilityId, availableType)
.then(
(_) => Get.snackbar(
"Pedido Requisitado",
"O pedido foi requisitado com sucesso! Aguarde a resposta do dono do livro.",
"Livro Requisitado",
"O livro foi requisitado com sucesso! Aguarde a resposta do dono do livro.",
backgroundColor: green,
colorText: Colors.white,
),
Expand Down
6 changes: 5 additions & 1 deletion lib/controllers/register_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,14 @@ class RegisterController extends GetxController {

Future<void> register() async {
isLoading.value = true;
await authController.register(
var registerResult = await authController.register(
emailController.text,
passwordController.text,
);
if (registerResult == null) {
isLoading.value = false;
return;
}
await authController.login(
emailController.text,
passwordController.text,
Expand Down