[@nativescript/payments] Not possible to use both subscriptions and IAPs in the same project
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 35/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Ferma
- Stack tecnologico
- typescript
Direzione di ricerca
Start by tracing fetchSubscriptions and fetchItems, focusing on how _fetchedItems, _fetchedSubscriptions, and _fetchedProducts are populated and whether consecutive calls overwrite shared state. Confirm the behavior with a project that loads both subscription and in-app-purchase products; done means both product types remain available without polling or manually merging arrays.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
I have a situation where I offer two subscriptions and an additional "lifetime" subscription (which is really an in-app purchase, consumable). I may easily be mistaken, but the way the plugin implementation is designed, you can't really offer both subs and purchases because of an overwrite of _fetchedItems when calling both fetchSubscriptions and fetchItems consecutively?
My very hacky workaround is to:
fetchSubscriptionswhere I normally would- Call a separate method, like
loadAll()after that:
async loadAll() {
await this.waitForSubscriptions();
fetchItems(["com.nativescript.whatever.item]);
}
- This will
awaitsubscriptions being loaded andwaitForSubscriptionsreturns a promise when there is something in the array (yeah this isn't perfect):
waitForSubscriptions(): Promise<void> {
return new Promise<void>((resolve) => {
const check = setInterval(() => {
if (this._fetchedSubscriptions.length > 0) {
clearInterval(check);
resolve(); // now valid, since T is void
}
}, 500);
});
}
- After subscriptions are confirmed, then call
fetchItems(see step 2). - Finally merge the two arrays:
if (this._fetchedSubscriptions.length > 0 && this._fetchedProducts.length > 0) {
this._fetchedItems = [
...this._fetchedSubscriptions,
...this._fetchedProducts,
];
console.log('Fetched subscription items:', this._fetchedItems);
}
It's a little more complicated than this and I'd be happy to share my full code if anyone is curious.
- Lingua principale
- TypeScript
- Stelle
- 35
- Fork
- 13
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di NativeScript/payments
-
com.android.billingclient:billing@@8.0.0 - com.google.android.gms.internal.play_billing.zzbg.zzeAperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 28/100
NativeScript/payments#45 ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
NativeScript/payments#43 · 2 reazioni ·
-
support Amazon Android appsAperta
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
NativeScript/payments#36 · 2 commenti ·
-
[Restore Orders] MistakeAperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 35/100
NativeScript/payments#35 ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
NativeScript/payments#31 · 2 commenti ·
Tutte le issue di NativeScript/payments
Issue simili
-
Remove unused dependenciesForse già presa @alastair-smith l’ha presa oggi. Apertachore other
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
alastair-smith/card-games#384 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
code-yeongyu/senpi#5571 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
nexu-io/open-design#9262 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
friction
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
kentcdodds/kody#4753 ·
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 62/100
lingdojo/kana-dojo#33508 · 1 commento · 5 reazioni ·
I maintainer di solito rispondono entro 1 giorno