From 6be4b0858da227bc400913187a0a129406cfca0d Mon Sep 17 00:00:00 2001 From: Chris Duncan Date: Thu, 10 Oct 2024 14:41:31 -0700 Subject: [PATCH] Extend Settings page to feature each setting item details on a separate page. --- .../settings-item-detail-page.ts | 18 +++++ .../settings-item-detail-page.xml} | 17 ++--- app/settings/settings-items-page.ts | 29 ++++++++ app/settings/settings-items-page.xml | 26 +++++++ app/settings/settings-page.ts | 10 --- app/settings/settings-view-model.ts | 70 +++++++++++++++++++ app/settings/shared/item.ts | 7 ++ 7 files changed, 159 insertions(+), 18 deletions(-) create mode 100644 app/settings/settings-item-detail/settings-item-detail-page.ts rename app/settings/{settings-page.xml => settings-item-detail/settings-item-detail-page.xml} (57%) create mode 100644 app/settings/settings-items-page.ts create mode 100644 app/settings/settings-items-page.xml delete mode 100644 app/settings/settings-page.ts create mode 100644 app/settings/shared/item.ts diff --git a/app/settings/settings-item-detail/settings-item-detail-page.ts b/app/settings/settings-item-detail/settings-item-detail-page.ts new file mode 100644 index 0000000..6964552 --- /dev/null +++ b/app/settings/settings-item-detail/settings-item-detail-page.ts @@ -0,0 +1,18 @@ +// SPDX-FileCopyrightText: 2024 Chris Duncan +// SPDX-License-Identifier: GPL-3.0-or-later + +import { EventData, View, NavigatedData, Page } from '@nativescript/core' +import { Item } from '../shared/item' + +export function onNavigatingTo (args: NavigatedData) { + const page = args.object as Page + const item = args.context as Item + page.bindingContext = item +} + +export function onBackButtonTap (args: EventData) { + const view = args.object as View + const page = view.page as Page + + page.frame.goBack() +} diff --git a/app/settings/settings-page.xml b/app/settings/settings-item-detail/settings-item-detail-page.xml similarity index 57% rename from app/settings/settings-page.xml rename to app/settings/settings-item-detail/settings-item-detail-page.xml index 45e30bf..b22e936 100644 --- a/app/settings/settings-page.xml +++ b/app/settings/settings-item-detail/settings-item-detail-page.xml @@ -8,16 +8,17 @@ SPDX-License-Identifier: GPL-3.0-or-later xmlns="http://schemas.nativescript.org/tns.xsd" > - - -