diff --git a/ios/App/App.xcodeproj/project.pbxproj b/ios/App/App.xcodeproj/project.pbxproj index 5eab35ca..6b1570c6 100644 --- a/ios/App/App.xcodeproj/project.pbxproj +++ b/ios/App/App.xcodeproj/project.pbxproj @@ -504,7 +504,7 @@ CODE_SIGN_ENTITLEMENTS = App/App.entitlements; CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 109; + CURRENT_PROJECT_VERSION = 110; DEVELOPMENT_TEAM = 3HYX3N9WTV; INFOPLIST_FILE = App/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 13.0; @@ -512,7 +512,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 4.5.4; + MARKETING_VERSION = 4.5.5; OTHER_SWIFT_FLAGS = "$(inherited) \"-D\" \"COCOAPODS\" \"-DDEBUG\""; PRODUCT_BUNDLE_IDENTIFIER = in.beaconcha.mobile; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -535,7 +535,7 @@ CODE_SIGN_ENTITLEMENTS = App/AppRelease.entitlements; CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 109; + CURRENT_PROJECT_VERSION = 110; DEVELOPMENT_TEAM = 3HYX3N9WTV; INFOPLIST_FILE = App/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 13.0; @@ -543,7 +543,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 4.5.4; + MARKETING_VERSION = 4.5.5; PRODUCT_BUNDLE_IDENTIFIER = in.beaconcha.mobile; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -566,7 +566,7 @@ CODE_SIGN_ENTITLEMENTS = "Beaconchain WidgetExtension.entitlements"; CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 109; + CURRENT_PROJECT_VERSION = 110; DEVELOPMENT_TEAM = 3HYX3N9WTV; INFOPLIST_FILE = "Beaconchain Widget/Info.plist"; IPHONEOS_DEPLOYMENT_TARGET = 14.0; @@ -575,7 +575,7 @@ "@executable_path/Frameworks", "@executable_path/../../Frameworks", ); - MARKETING_VERSION = 4.5.4; + MARKETING_VERSION = 4.5.5; MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; MTL_FAST_MATH = YES; PRODUCT_BUNDLE_IDENTIFIER = "in.beaconcha.mobile.Beaconchain-Widget"; @@ -598,7 +598,7 @@ CODE_SIGN_ENTITLEMENTS = "Beaconchain WidgetExtension.entitlements"; CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 109; + CURRENT_PROJECT_VERSION = 110; DEVELOPMENT_TEAM = 3HYX3N9WTV; INFOPLIST_FILE = "Beaconchain Widget/Info.plist"; IPHONEOS_DEPLOYMENT_TARGET = 14.0; @@ -607,7 +607,7 @@ "@executable_path/Frameworks", "@executable_path/../../Frameworks", ); - MARKETING_VERSION = 4.5.4; + MARKETING_VERSION = 4.5.5; MTL_FAST_MATH = YES; PRODUCT_BUNDLE_IDENTIFIER = "in.beaconcha.mobile.Beaconchain-Widget"; PRODUCT_NAME = "$(TARGET_NAME)"; diff --git a/package-lock.json b/package-lock.json index 9a87f113..b6139725 100644 --- a/package-lock.json +++ b/package-lock.json @@ -40,7 +40,7 @@ "bignumber.js": "^9.1.2", "canvas-confetti": "^1.3.3", "capacitor-navigationbarnx": "0.1.6", - "cordova-plugin-purchase": "^13.8.6", + "cordova-plugin-purchase": "^13.10.0", "cordova-res": "^0.15.2", "ethereum-blockies": "^0.1.1", "hammerjs": "^2.0.8", @@ -6861,9 +6861,9 @@ } }, "node_modules/cordova-plugin-purchase": { - "version": "13.8.6", - "resolved": "https://registry.npmjs.org/cordova-plugin-purchase/-/cordova-plugin-purchase-13.8.6.tgz", - "integrity": "sha512-BttD5UiyAgAS07NrqE/C7sM2vXopBWbtjq0Ae/vFP0op8TnIDlGRsZbEZfG3hXyIz9fZ363nOJk4mEtAo3iPYQ==" + "version": "13.10.0", + "resolved": "https://registry.npmjs.org/cordova-plugin-purchase/-/cordova-plugin-purchase-13.10.0.tgz", + "integrity": "sha512-MZCmy+jYwi1sVt+FKSzybDnekn+RmcCxCCGD37w12ST+nQDkbrRv0lBUFKMZlNWP93+KQN2U/vZ3knrneb4Rww==" }, "node_modules/cordova-res": { "version": "0.15.2", @@ -21839,9 +21839,9 @@ } }, "cordova-plugin-purchase": { - "version": "13.8.6", - "resolved": "https://registry.npmjs.org/cordova-plugin-purchase/-/cordova-plugin-purchase-13.8.6.tgz", - "integrity": "sha512-BttD5UiyAgAS07NrqE/C7sM2vXopBWbtjq0Ae/vFP0op8TnIDlGRsZbEZfG3hXyIz9fZ363nOJk4mEtAo3iPYQ==" + "version": "13.10.0", + "resolved": "https://registry.npmjs.org/cordova-plugin-purchase/-/cordova-plugin-purchase-13.10.0.tgz", + "integrity": "sha512-MZCmy+jYwi1sVt+FKSzybDnekn+RmcCxCCGD37w12ST+nQDkbrRv0lBUFKMZlNWP93+KQN2U/vZ3knrneb4Rww==" }, "cordova-res": { "version": "0.15.2", diff --git a/package.json b/package.json index 2e80f069..f4f1f5ad 100644 --- a/package.json +++ b/package.json @@ -46,7 +46,7 @@ "bignumber.js": "^9.1.2", "canvas-confetti": "^1.3.3", "capacitor-navigationbarnx": "0.1.6", - "cordova-plugin-purchase": "^13.8.6", + "cordova-plugin-purchase": "^13.10.0", "cordova-res": "^0.15.2", "ethereum-blockies": "^0.1.1", "hammerjs": "^2.0.8", diff --git a/src/app/pages/subscribe/subscribe.page.ts b/src/app/pages/subscribe/subscribe.page.ts index 9490e426..896af52c 100644 --- a/src/app/pages/subscribe/subscribe.page.ts +++ b/src/app/pages/subscribe/subscribe.page.ts @@ -146,7 +146,7 @@ export class SubscribePage implements OnInit { return } - await this.merchant.restore() + await this.merchant.restore(this.selectedPackage.purchaseKey) } const currentPackage = await this.merchant.getCurrentPlanConfirmed() diff --git a/src/app/requests/requests.ts b/src/app/requests/requests.ts index b25571d5..6793a604 100644 --- a/src/app/requests/requests.ts +++ b/src/app/requests/requests.ts @@ -561,26 +561,6 @@ export class NotificationGetRequest extends APIRequest } } -export class NotificationSubsRequest extends APIRequest { - private subscribe = 'subscribe' - private unsubscribe = 'unsubscribe' - - resource = 'user/notifications/' - method = Method.POST - requiresAuth = true - postData = {} - ignoreFails = true - - constructor(eventName: string, filter: string = null, enabled: boolean) { - super() - if (filter != null) { - this.resource += (enabled ? this.subscribe : this.unsubscribe) + '?event=' + eventName + '&filter=' + filter - } else { - this.resource += (enabled ? this.subscribe : this.unsubscribe) + '?event=' + eventName - } - } -} - export interface BundleSub { event_name: string event_filter: string diff --git a/src/app/tab-preferences/tab-preferences.page.html b/src/app/tab-preferences/tab-preferences.page.html index 39c7575f..1c73acc7 100644 --- a/src/app/tab-preferences/tab-preferences.page.html +++ b/src/app/tab-preferences/tab-preferences.page.html @@ -284,7 +284,7 @@

-

2020 - 2023 © Bitfly GmbH

+

2020 - {{ currentYear }} © Bitfly GmbH

Version {{ appVersion }}

{{ package }}

diff --git a/src/app/tab-preferences/tab-preferences.page.ts b/src/app/tab-preferences/tab-preferences.page.ts index 47450e48..a62f26ef 100644 --- a/src/app/tab-preferences/tab-preferences.page.ts +++ b/src/app/tab-preferences/tab-preferences.page.ts @@ -83,6 +83,8 @@ export class Tab3Page { protected package = '' protected currentFiatCurrency + protected currentYear = new Date().getFullYear() + constructor( protected api: ApiService, protected oauth: OAuthUtils, diff --git a/src/app/utils/MerchantUtils.ts b/src/app/utils/MerchantUtils.ts index e60257ae..1c8825ae 100644 --- a/src/app/utils/MerchantUtils.ts +++ b/src/app/utils/MerchantUtils.ts @@ -96,6 +96,8 @@ export class MerchantUtils { currentPlan = PRODUCT_STANDARD // use getCurrentPlanConfirmed instead + purchaseIntent = '' // temp workaround until new api is live + constructor(private alertService: AlertService, private api: ApiService, private platform: Platform, private storage: StorageService) { if (!this.platform.is('ios') && !this.platform.is('android')) { console.info('merchant is not supported on this platform') @@ -124,7 +126,7 @@ export class MerchantUtils { product: CdvPurchase.Validator.Request.Body, callback: CdvPurchase.Callback ) => { - if (this.restorePurchase && product.id != 'in.beaconcha.mobile') { + if (this.restorePurchase) { this.restorePurchase = false await this.confirmPurchaseOnRemote(product) } @@ -238,8 +240,9 @@ export class MerchantUtils { CdvPurchase.store.manageSubscriptions() } - async restore() { + async restore(product: string) { this.restorePurchase = true + this.purchaseIntent = product await CdvPurchase.store.restorePurchases() } @@ -247,10 +250,10 @@ export class MerchantUtils { const offer = CdvPurchase.store.get(product).getOffer() const loading = await this.alertService.presentLoading('') loading.present() + this.restorePurchase = true + this.purchaseIntent = product CdvPurchase.store.order(offer).then( () => { - this.restorePurchase = true - setTimeout(() => { loading.dismiss() }, 1500) @@ -265,15 +268,13 @@ export class MerchantUtils { } private async confirmPurchaseOnRemote(product) { - if (product.id == 'in.beaconcha.mobile') { - this.alertService.showError('Purchase Error', 'Invalid product, try again later or report this issue to us if persistent.', PURCHASEUTILS + 4) - return - } - const isIOS = this.platform.is('ios') + + // TODO in the future replace isIOS ? product.transaction.appStoreReceipt : product.transaction.purchaseToken + // with isIOS ? product.id : product.transaction.purchaseToken const purchaseData = { currency: product.currency, - id: product.id, + id: isIOS ? this.purchaseIntent : product.id, priceMicros: product.priceMicros, valid: product.valid, transaction: {