[@nativescript/payments] Not possible to use both subscriptions and IAPs in the same project
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Accessibilité débutants
- 35/100
- Type d'issue
- Bug
- Clarté
- Plutôt claire
- Activité
- À l'abandon
- Stack technique
- typescript
Piste de recherche
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.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
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.
- Langage dominant
- TypeScript
- Étoiles
- 35
- Forks
- 13
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Préparer son environnement
- Aucun Dockerfile ni fichier Docker Compose
- Aucun modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de NativeScript/payments
-
com.android.billingclient:billing@@8.0.0 - com.google.android.gms.internal.play_billing.zzbg.zzeOuverte
Difficulté 4/5 3-5 jours Accessibilité débutants 28/100
NativeScript/payments#45 ·
-
Difficulté 4/5 3-5 jours Accessibilité débutants 35/100
NativeScript/payments#43 · 2 réactions ·
-
support Amazon Android appsOuverte
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 25/100
NativeScript/payments#36 · 2 commentaires ·
-
[Restore Orders] MistakeOuverte
Difficulté 3/5 1-2 jours Accessibilité débutants 35/100
NativeScript/payments#35 ·
-
Difficulté 4/5 3-5 jours Accessibilité débutants 35/100
NativeScript/payments#31 · 2 commentaires ·
Toutes les issues de NativeScript/payments
Issues similaires
-
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
Open-Earth-Foundation/CityCatalyst#3399 ·
Les mainteneurs répondent en général sous 2 jours
-
userReport
Difficulté 1/5 Moins d'une heure Accessibilité débutants 72/100
nkprasad12/morcus-net#631 ·
Les mainteneurs répondent en général sous 1 jour
-
fix(app): fail closed if GetGeneralSetting fails during initializationPeut-être pris @kalavt l’a pris aujourd’hui. Ouvertebug
Difficulté 2/5 1-3 heures Accessibilité débutants 76/100
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 1/5 Moins d'une heure Accessibilité débutants 85/100
nekko-labs/nekko-agent#1756 ·
Les mainteneurs répondent en général sous 1 jour
-
needs-area-label
Difficulté 2/5 1-3 heures Accessibilité débutants 66/100
Les mainteneurs répondent en général sous 2 jours