Skip to content

Commit

Permalink
chore: fix typo
Browse files Browse the repository at this point in the history
  • Loading branch information
evan361425 committed Dec 29, 2024
1 parent 30cfe16 commit ae33073
Show file tree
Hide file tree
Showing 9 changed files with 42 additions and 15 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ bump: ## Bump beta version
git push --tags

##@ Tools
.PHONY: mock
mock: ## Mock dependencies
.PHONY: build-mock
build-mock: ## Mock dependencies
dart run build_runner build --delete-conflicting-outputs
dart format --line-length 120 .

Expand Down
3 changes: 3 additions & 0 deletions assets/l10n/en/order.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ tutorial:
content: Printer status has changed, please check.
snackbar:
printer:
connected:
- 'Printer connected: {names}'
- names:
disconnected:
- 'Printer "{name}" disconnected'
- name:
Expand Down
4 changes: 2 additions & 2 deletions assets/l10n/en/printer.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ error:
[Contact Us](mailto:evanlu361425@gmail.com) for assistance.
bluetoothOff: Bluetooth is off
disconnected: Printer is disconnected
timeout: Connection timeout
canceled: Connection request interrupted
timeout: Printer connection timeout
canceled: Printer connection request interrupted
timeoutMore: |-
Try the following:
• Check if the device is powered on (usually will flash)
Expand Down
1 change: 1 addition & 0 deletions assets/l10n/zh/order.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ tutorial:
content: 出單機狀態出現異動,請查看。
snackbar:
printer:
connected: 出單機連線成功:{names}
disconnected: 出單機「{name}」斷線
cashier:
notEnough: 收銀機錢不夠找囉!
Expand Down
4 changes: 2 additions & 2 deletions assets/l10n/zh/printer.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ error:
目前尚未支援此裝置,你可以[聯絡我們](mailto:evanlu361425@gmail.com)以取得協助。
bluetoothOff: 藍牙未開啟
disconnected: 出單機已斷線
timeout: 連線逾時
canceled: 連線請求被中斷
timeout: 出單機連線逾時
canceled: 出單機連線請求被中斷
timeoutMore: |-
可以嘗試以下操作:
• 確認裝置是否開啟(通常裝置會閃爍)
Expand Down
2 changes: 1 addition & 1 deletion assets/l10n/zh/stock.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ replenishment:
hint: 設定增加/減少的量
quantity:
title: 份量
description: 半糖、微糖等
description: 半糖、微糖等
_title:
$prefix: title
create: 新增份量
Expand Down
12 changes: 10 additions & 2 deletions lib/l10n/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -241,8 +241,8 @@
"printerErrorNotSupportContent": "This device is currently unsupported.\n\n[Contact Us](mailto:evanlu361425@gmail.com) for assistance.",
"printerErrorBluetoothOff": "Bluetooth is off",
"printerErrorDisconnected": "Printer is disconnected",
"printerErrorTimeout": "Connection timeout",
"printerErrorCanceled": "Connection request interrupted",
"printerErrorTimeout": "Printer connection timeout",
"printerErrorCanceled": "Printer connection request interrupted",
"printerErrorTimeoutMore": "Try the following:\n• Check if the device is powered on (usually will flash)\n• Ensure the device is within range\n• Restart Bluetooth",
"printerNameLabel": "Printer Name",
"printerNameHint": "e.g., Kitchen's Printer",
Expand Down Expand Up @@ -1621,6 +1621,14 @@
"orderTutorialContent": "Once you have set up your menu, you can start ordering!\nLet's tap and go see what's available!\n",
"orderTutorialPrinterBtnTitle": "Printer Status Change",
"orderTutorialPrinterBtnContent": "Printer status has changed, please check.",
"orderSnackbarPrinterConnected": "Printer connected: {names}",
"@orderSnackbarPrinterConnected": {
"placeholders": {
"names": {
"type": "String"
}
}
},
"orderSnackbarPrinterDisconnected": "Printer \"{name}\" disconnected",
"@orderSnackbarPrinterDisconnected": {
"placeholders": {
Expand Down
14 changes: 11 additions & 3 deletions lib/l10n/app_zh.arb
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@
"stockReplenishmentIngredientsHelper": "點選以設定不同成分欲採購的量",
"stockReplenishmentIngredientAmountHint": "設定增加/減少的量",
"stockQuantityTitle": "份量",
"stockQuantityDescription": "半糖、微糖等",
"stockQuantityDescription": "半糖、微糖等",
"stockQuantityTitleCreate": "新增份量",
"stockQuantityTitleUpdate": "編輯份量",
"stockQuantityEmptyBody": "份量可以快速調整成分的量,例如:\n半糖、微糖。",
Expand Down Expand Up @@ -241,8 +241,8 @@
"printerErrorNotSupportContent": "目前尚未支援此裝置,你可以[聯絡我們](mailto:evanlu361425@gmail.com)以取得協助。",
"printerErrorBluetoothOff": "藍牙未開啟",
"printerErrorDisconnected": "出單機已斷線",
"printerErrorTimeout": "連線逾時",
"printerErrorCanceled": "連線請求被中斷",
"printerErrorTimeout": "出單機連線逾時",
"printerErrorCanceled": "出單機連線請求被中斷",
"printerErrorTimeoutMore": "可以嘗試以下操作:\n• 確認裝置是否開啟(通常裝置會閃爍)\n• 確認裝置是否在範圍內\n• 重新開啟藍牙",
"printerNameLabel": "出單機名稱",
"printerNameHint": "例如:廚房的出單機",
Expand Down Expand Up @@ -1621,6 +1621,14 @@
"orderTutorialContent": "一旦設定好菜單,就可以開始點餐囉\n讓我們趕緊進去看看有什麼吧!\n",
"orderTutorialPrinterBtnTitle": "出單機異動",
"orderTutorialPrinterBtnContent": "出單機狀態出現異動,請查看。",
"orderSnackbarPrinterConnected": "出單機連線成功:{names}",
"@orderSnackbarPrinterConnected": {
"placeholders": {
"names": {
"type": "String"
}
}
},
"orderSnackbarPrinterDisconnected": "出單機「{name}」斷線",
"@orderSnackbarPrinterDisconnected": {
"placeholders": {
Expand Down
13 changes: 10 additions & 3 deletions lib/ui/order/widgets/printer_button_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ class _PrinterButtonViewState extends State<PrinterButtonView> {
void _connectWantedPrinters() async {
if (connecting.isNotEmpty) {
Log.ger('connect_order_printer', {'length': connecting.length});
final names = connecting.map((e) => e.name).join(', ');
await Future.wait([
// [toList] create new list which avoid concurrent modification of the original list
for (final printer in connecting.toList())
Expand All @@ -137,9 +138,15 @@ class _PrinterButtonViewState extends State<PrinterButtonView> {
]);

// if failed, remove all connecting printers
if (connecting.where((e) => !e.connected).isNotEmpty && mounted) {
Log.ger('order_printer_failed', {'length': connecting.length});
setState(connecting.clear);
if (connecting.where((e) => !e.connected).isNotEmpty) {
if (mounted) {
Log.ger('order_printer_failed', {'length': connecting.length});
setState(connecting.clear);
}
} else {
if (mounted) {
showSnackBar(S.orderSnackbarPrinterConnected(names), context: context);
}
}
}
}
Expand Down

0 comments on commit ae33073

Please sign in to comment.