diff --git a/app/components/settings/Settings.svelte b/app/components/settings/Settings.svelte index d826b56..85899fe 100644 --- a/app/components/settings/Settings.svelte +++ b/app/components/settings/Settings.svelte @@ -47,6 +47,7 @@ import { colors, fonts, windowInset } from '~/variables'; import IconButton from '../common/IconButton.svelte'; import { getJSON } from '@nativescript-community/https'; + import { inappItems, presentInAppSponsorBottomsheet } from '@shared/utils/inapp-purchase'; const version = __APP_VERSION__ + ' Build ' + __APP_BUILD_NUMBER__; const storeSettings = {}; @@ -60,6 +61,8 @@ let collectionView: NativeViewElementNode; let page: NativeViewElementNode; + const inAppAvailable = PLAY_STORE_BUILD && inappItems?.length > 0; + let items: ObservableArray; const bottomOffset = currentBottomOffset; @@ -268,7 +271,7 @@ [ { type: 'header', - title: __IOS__ ? lc('show_love') : lc('donate') + title: __IOS__ && !inAppAvailable ? lc('show_love') : lc('donate') }, { type: 'sectionheader', @@ -560,9 +563,13 @@ break; default: - // Apple wants us to use in-app purchase for donations => taking 30% ... - // so lets just open github and ask for love... - openLink(__IOS__ ? GIT_URL : SPONSOR_URL); + if (inAppAvailable) { + presentInAppSponsorBottomsheet(); + } else { + // Apple wants us to use in-app purchase for donations => taking 30% ... + // so lets just open github and ask for love... + openLink(__IOS__ ? GIT_URL : SPONSOR_URL); + } break; } break; diff --git a/app/main.ts b/app/main.ts index d9adb71..49cf181 100644 --- a/app/main.ts +++ b/app/main.ts @@ -79,6 +79,9 @@ try { SwipeMenuElement.register(); PagerElement.register(); // DrawerElement.register(); + if (PLAY_STORE_BUILD) { + import('@shared/utils/inapp-purchase').then((r) => r.init()); + } if (!PRODUCTION) { // Trace.addCategories(Trace.categories.Navigation); diff --git a/package.json b/package.json index 46515e4..0f4b801 100644 --- a/package.json +++ b/package.json @@ -41,6 +41,7 @@ "@akylas/nativescript": "8.8.10", "@akylas/nativescript-app-tools": "file:tools", "@akylas/nativescript-app-utils": "2.2.1", + "@akylas/nativescript-inapp-purchase": "0.0.4", "@akylas/nativescript-inappbrowser": "3.1.8", "@akylas/non-playstore": "portal:plugin_non_playstore", "@mdi/font": "7.4.47", @@ -60,8 +61,8 @@ "@nativescript-community/sqlite": "3.5.1", "@nativescript-community/systemui": "1.1.23", "@nativescript-community/text": "1.6.7", - "@nativescript-community/ui-canvas": "4.6.38", - "@nativescript-community/ui-canvaslabel": "1.2.41", + "@nativescript-community/ui-canvas": "4.6.39", + "@nativescript-community/ui-canvaslabel": "1.2.42", "@nativescript-community/ui-checkbox": "2.0.12", "@nativescript-community/ui-collectionview": "6.0.4", "@nativescript-community/ui-collectionview-swipemenu": "6.0.4", diff --git a/tools b/tools index def4e12..5804c70 160000 --- a/tools +++ b/tools @@ -1 +1 @@ -Subproject commit def4e12360d67a611133dfff49886033f20b0f26 +Subproject commit 5804c70b5f78a2bc190022021e9c4e0b37f89573 diff --git a/yarn.lock b/yarn.lock index 674eae8..fb5568b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -95,6 +95,13 @@ __metadata: languageName: node linkType: hard +"@akylas/nativescript-inapp-purchase@npm:0.0.4": + version: 0.0.4 + resolution: "@akylas/nativescript-inapp-purchase@npm:0.0.4" + checksum: 10/b03783e49ced38964ef802cdfb8b88c533188771552cd4ccf4fab61d0af7242ca4d70ab274763df8e69b9f968b0c84321c73c07895c952362fd4e2a04a5b71fd + languageName: node + linkType: hard + "@akylas/nativescript-inappbrowser@npm:3.1.8": version: 3.1.8 resolution: "@akylas/nativescript-inappbrowser@npm:3.1.8" @@ -1116,22 +1123,22 @@ __metadata: languageName: node linkType: hard -"@nativescript-community/ui-canvas@npm:4.6.38": - version: 4.6.38 - resolution: "@nativescript-community/ui-canvas@npm:4.6.38" +"@nativescript-community/ui-canvas@npm:4.6.39": + version: 4.6.39 + resolution: "@nativescript-community/ui-canvas@npm:4.6.39" dependencies: "@nativescript-community/arraybuffers": "npm:^1.1.5" - checksum: 10/92e5c834e95715f15114130fe31faffba3f2da30fecd8eb509d3e8e2bf7dae5718281c600406eb700a76de0227c87ff76abb428f263614c7deae7145f33b89dc + checksum: 10/4fea0819901b67ec9dc8df4657db4a20918d2932ea2855e817ee430d7a240f45f787df779904e5e80a80bf5e85c6959de321fe33528f0b4a39907d8fdd668f75 languageName: node linkType: hard -"@nativescript-community/ui-canvaslabel@npm:1.2.41": - version: 1.2.41 - resolution: "@nativescript-community/ui-canvaslabel@npm:1.2.41" +"@nativescript-community/ui-canvaslabel@npm:1.2.42": + version: 1.2.42 + resolution: "@nativescript-community/ui-canvaslabel@npm:1.2.42" peerDependencies: "@nativescript-community/text": ^1.5.33 "@nativescript-community/ui-canvas": ^4.5.1 - checksum: 10/a95ac2311bbdf919effbb7e6720bfa8c27aad9f017364fd03024ba87c4f60e2adc6dc92e2adafc89cd41b6e23a7e7950ce6f2894763583aaf09c39018126f7cc + checksum: 10/dd316c3d6319841b9d6020a662edccd921a4310111fed72b7d7235d108afb0ea9fe3ab99c036f687816bbae8c41ba34039e6e3eafeffc4d91abead6291e8fe1c languageName: node linkType: hard @@ -8944,6 +8951,7 @@ __metadata: "@akylas/nativescript-android-runtime": "npm:8.8.5" "@akylas/nativescript-app-tools": "file:tools" "@akylas/nativescript-app-utils": "npm:2.2.1" + "@akylas/nativescript-inapp-purchase": "npm:0.0.4" "@akylas/nativescript-inappbrowser": "npm:3.1.8" "@akylas/nativescript-ios-runtime": "npm:8.8.2" "@akylas/nativescript-webpack": "npm:5.0.22" @@ -8965,8 +8973,8 @@ __metadata: "@nativescript-community/sqlite": "npm:3.5.1" "@nativescript-community/systemui": "npm:1.1.23" "@nativescript-community/text": "npm:1.6.7" - "@nativescript-community/ui-canvas": "npm:4.6.38" - "@nativescript-community/ui-canvaslabel": "npm:1.2.41" + "@nativescript-community/ui-canvas": "npm:4.6.39" + "@nativescript-community/ui-canvaslabel": "npm:1.2.42" "@nativescript-community/ui-checkbox": "npm:2.0.12" "@nativescript-community/ui-collectionview": "npm:6.0.4" "@nativescript-community/ui-collectionview-swipemenu": "npm:6.0.4"