Skip to content

A local-first personal finance app

[AI] Make the mobile Reconciled toggle work and match the Cleared toggle (#9064)

youngcw167bae44f503
diff --git a/packages/desktop-client/src/components/mobile/transactions/TransactionEdit.tsx b/packages/desktop-client/src/components/mobile/transactions/TransactionEdit.tsx
index d7a5cdcc17..3b2b93ca29 100644
--- a/packages/desktop-client/src/components/mobile/transactions/TransactionEdit.tsx
+++ b/packages/desktop-client/src/components/mobile/transactions/TransactionEdit.tsx
@@ -31,7 +31,6 @@ import {
import { styles } from '@actual-app/components/styles';
import { Text } from '@actual-app/components/text';
import { theme } from '@actual-app/components/theme';
-import { Toggle } from '@actual-app/components/toggle';
import { View } from '@actual-app/components/view';
import { send } from '@actual-app/core/platform/client/connection';
import { DEFAULT_MAX_DISTANCE_METERS } from '@actual-app/core/shared/constants';
@@ -917,6 +916,29 @@ const TransactionEditInner = memo<TransactionEditInnerProps>(
[onClearActiveEdit, onUpdate],
);
+ const onUnlockReconciledInner = useCallback(
+ (serializedTransaction: TransactionEntity) => {
+ dispatch(
+ pushModal({
+ modal: {
+ name: 'confirm-transaction-edit',
+ options: {
+ confirmReason: 'unlockReconciled',
+ onConfirm: () => {
+ void onUpdateInner(
+ serializedTransaction,
+ 'reconciled',
+ false,
+ );
+ },
+ },
+ },
+ }),
+ );
+ },
+ [dispatch, onUpdateInner],
+ );
+
const onTotalAmountUpdate = useCallback(
(value: number) => {
if (transaction.amount !== value) {
@@ -1472,7 +1494,11 @@ const TransactionEditInner = memo<TransactionEditInnerProps>(
{transaction.reconciled ? (
<View style={{ alignItems: 'center' }}>
<FieldLabel title={t('Reconciled')} />
- <Toggle id="Reconciled" isOn isDisabled />
+ <ToggleField
+ id="reconciled"
+ isOn
+ onToggle={() => onUnlockReconciledInner(transaction)}
+ />
</View>
) : (
<View style={{ alignItems: 'center' }}>
diff --git a/packages/desktop-client/src/components/modals/ConfirmTransactionEditModal.tsx b/packages/desktop-client/src/components/modals/ConfirmTransactionEditModal.tsx
index 756c979bbe..eb890b6aef 100644
--- a/packages/desktop-client/src/components/modals/ConfirmTransactionEditModal.tsx
+++ b/packages/desktop-client/src/components/modals/ConfirmTransactionEditModal.tsx
@@ -115,7 +115,7 @@ export function ConfirmTransactionEditModal({
}}
onPress={() => {
state.close();
- onCancel();
+ onCancel?.();
}}
>
<Trans>Cancel</Trans>
diff --git a/upcoming-release-notes/mobile-reconciled-toggle.md b/upcoming-release-notes/mobile-reconciled-toggle.md
new file mode 100644
index 0000000000..035a5493b6
--- /dev/null
+++ b/upcoming-release-notes/mobile-reconciled-toggle.md
@@ -0,0 +1,6 @@
+---
+category: Bugfix
+authors: [youngcw]
+---
+
+Make the Reconciled toggle work when editing a transaction on mobile, so a reconciled transaction can be unlocked, and match its size to the Cleared toggle.