[@nativescript/payments] Not possible to use both subscriptions and IAPs in the same project
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 3/5
- Tempo estimado
- 1-2 dias
- Facilidade para iniciantes
- 35/100
- Tipo de issue
- Bug
- Clareza
- Razoavelmente clara
- Status de atividade
- Estagnada
- Stack de tecnologia
- typescript
Direção de pesquisa
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.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
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.
- Linguagem predominante
- TypeScript
- Estrelas
- 35
- Forks
- 13
- Métricas de merge de PRs
- Nenhum PR com merge em 30d
Preparar o ambiente
- Sem Dockerfile nem arquivo Docker Compose
- Sem modelo de pull request
- Ler o guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de NativeScript/payments
-
com.android.billingclient:billing@@8.0.0 - com.google.android.gms.internal.play_billing.zzbg.zzeAberta
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 28/100
NativeScript/payments#45 ·
-
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 35/100
NativeScript/payments#43 · 2 reações ·
-
support Amazon Android appsAberta
Dificuldade 5/5 Mais de uma semana Facilidade para iniciantes 25/100
NativeScript/payments#36 · 2 comentários ·
-
[Restore Orders] MistakeAberta
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 35/100
NativeScript/payments#35 ·
-
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 35/100
NativeScript/payments#31 · 2 comentários ·
Todas as issues de NativeScript/payments
Issues semelhantes
-
needs-triage
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 66/100
microsoft/playwright#43875 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
feature
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
calagopus/panel#285 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 Menos de uma hora Facilidade para iniciantes 88/100
adobe/react-spectrum#10909 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 68/100
-
Run the dependency drift checkTalvez já em andamento @spaceninja assumiu hoje. Aberta
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 72/100
cloudfour/lighthouse-parade#449 ·
Mantenedores costumam responder em até 1 dia