Skip to content

Commit

Permalink
Merge pull request #1741 from numbersprotocol/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
shc261392 authored Jun 28, 2022
2 parents 788a0a6 + 122abe2 commit b7362ac
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 10 deletions.
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## 0.59.4 - 2022-06-28

### Fixed

- Truncate reciept_id from in app purchase

## 0.59.3 - 2022-06-27

### Added
Expand All @@ -13,7 +19,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## 0.59.2 - 2022-06-22

#### Changed
### Changed

- Revert Show capture options menu regardless of backend response. #1703

Expand Down
4 changes: 2 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ android {
applicationId "io.numbersprotocol.capturelite"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 413
versionName "0.59.3"
versionCode 414
versionName "0.59.4"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildFeatures {
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "capture-lite",
"version": "0.59.3",
"version": "0.59.4",
"author": "numbersprotocol",
"homepage": "https://numbersprotocol.io/",
"scripts": {
Expand Down
3 changes: 2 additions & 1 deletion src/app/shared/dia-backend/num/dia-backend-num.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { defer } from 'rxjs';
import { concatMap } from 'rxjs/operators';
import { truncateReceipt } from '../../../utils/in-app-purchase';
import { DiaBackendAuthService } from '../auth/dia-backend-auth.service';
import { BASE_URL, BUBBLE_API_URL } from '../secret';

Expand All @@ -19,7 +20,7 @@ export class DiaBackendNumService {
concatMap(headers => {
const formData = new FormData();
formData.set('points', pointsToAdd.toString());
formData.set('receipt_id', receiptId);
formData.set('receipt_id', truncateReceipt(receiptId));
return this.httpClient.post<DiaBackendNumPointPurchaseResult>(
`${BASE_URL}/api/v3/num/points/purchase/`,
formData,
Expand Down
6 changes: 3 additions & 3 deletions src/app/shared/in-app-store/in-app-store.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export class InAppStoreService implements OnDestroy {

this.store.refresh();
} catch (error) {
const errorMessage = this.translocoService.getTranslation(
const errorMessage = this.translocoService.translate(
'inAppPurchase.failedToInitInAppStore'
);
this.errorService.toastError$(errorMessage).toPromise();
Expand Down Expand Up @@ -131,7 +131,7 @@ export class InAppStoreService implements OnDestroy {
})
);
} catch (error) {
const errorMessage = this.translocoService.getTranslation(
const errorMessage = this.translocoService.translate(
'wallets.buyNum.failedToAddPoints'
);
this.errorService.toastError$(errorMessage).toPromise();
Expand Down Expand Up @@ -175,7 +175,7 @@ export class InAppStoreService implements OnDestroy {
}

private readonly onStoreError = (_: IAPError) => {
const errorMessage = this.translocoService.getTranslation(
const errorMessage = this.translocoService.translate(
'inAppPurchase.inAppPurchaseErrorOcurred'
);
this.errorService.toastError$(errorMessage).toPromise();
Expand Down
6 changes: 6 additions & 0 deletions src/app/utils/in-app-purchase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ import { isDevMode } from '@angular/core';
import { IAPProduct } from '@awesome-cordova-plugins/in-app-purchase-2/ngx';
import { CaptureInAppProductIds } from '../shared/in-app-store/in-app-store.service';

export function truncateReceipt(recipt: string) {
const preferredMaxLength = 1024;
const receiptMaxLength = Math.min(recipt.length, preferredMaxLength);
return recipt.substring(0, receiptMaxLength);
}

/**
* Usefull to see in app product state changes in console for better debugging.
* It will pring to console only in dev mode aka isDevMode() === true
Expand Down

0 comments on commit b7362ac

Please sign in to comment.