From 3a6321f85634aba00bb413b3bc3777f62405f8df Mon Sep 17 00:00:00 2001 From: proletarius101 Date: Sat, 4 Feb 2023 14:07:02 +0000 Subject: [PATCH] restore standardnotes 3.146.1 --- metadata/com.standardnotes.yml | 62 +++++++++++++- .../remove-IAP.3.146.2.patch | 81 +++++++++++++++++++ 2 files changed, 139 insertions(+), 4 deletions(-) create mode 100644 metadata/com.standardnotes/remove-IAP.3.146.2.patch diff --git a/metadata/com.standardnotes.yml b/metadata/com.standardnotes.yml index e0f366e196..2eec5f2a41 100644 --- a/metadata/com.standardnotes.yml +++ b/metadata/com.standardnotes.yml @@ -8531,10 +8531,64 @@ Builds: - popd ndk: r21e -AutoUpdateMode: None -UpdateCheckMode: None + - versionName: 3.146.2 + versionCode: 3000818 + commit: '@standardnotes/mobile@3.146.2' + subdir: packages/mobile/android/app + sudo: + - apt-get update + - apt-get install -y libsecret-1-dev build-essential + - curl -Lo node.tar.gz https://nodejs.org/download/release/v16.19.0/node-v16.19.0-linux-x64.tar.gz + - echo "23770ba26a52cb8fedd1096613bbc419b8a033d774a457d9024bb5a0159f3585 node.tar.gz" + | sha256sum -c - + - tar xzf node.tar.gz --strip-components=1 -C /usr/local/ + - npm install -g yarn + - sysctl fs.inotify.max_user_watches=524288 || true + init: + - cd ../../../.. + - yarn config set -H enableImmutableInstalls false + - sed -i -e '/react-native-iap/d' packages/mobile/package.json + - npm_config_build_from_source=true yarn + - cd packages/mobile + - npm_config_build_from_source=true yarn + patch: + - remove-IAP.3.146.2.patch + gradle: + - prod + rm: + - packages/desktop + - packages/mobile/ios + - packages/mobile/android/app/gradle + prebuild: + - sed -i -e '/detox/Id' -e 's/versionName appVersionName/versionName "$$VERSION$$"/' + -e 's/versionCode appVersionCode/versionCode $$VERCODE$$/' -e '/universalApk/s/false/true/' + build.gradle + - pushd ../../../.. + - yarn run build:mobile + - popd + - pushd ../.. + - yarn run android:bundle + - popd + scanignore: + - packages/mobile/android/build.gradle + - packages/mobile/node_modules/jsc-android + - packages/mobile/node_modules/react-native + - packages/mobile/node_modules/detox/android/build.gradle + - packages/mobile/node_modules/@react-native-community/async-storage/android/build.gradle + - packages/mobile/node_modules/@standardnotes/react-native-utils/android/build.gradle + scandelete: + - node_modules/ + - packages/mobile/node_modules + - .yarn/ + ndk: r21e + +MaintainerNotes: | + Override gradle wrappers to make them consistent before the upstream merges https://github.com/standardnotes/app/pull/2197. The overridden version 7.2 can't build this application. + +AutoUpdateMode: Version @standardnotes/mobile@%v +UpdateCheckMode: HTTP VercodeOperation: - 3000310 + %c UpdateCheckData: https://github.com/standardnotes/app/actions/workflows/mobile.release.prod.yml|(\d+)\sworkflow\sruns|https://github.com/standardnotes/app/releases|/releases/tag/%40standardnotes%2Fmobile%40([\d.]+) -CurrentVersion: 3.46.1 -CurrentVersionCode: 3000639 +CurrentVersion: 3.146.2 +CurrentVersionCode: 3000818 diff --git a/metadata/com.standardnotes/remove-IAP.3.146.2.patch b/metadata/com.standardnotes/remove-IAP.3.146.2.patch new file mode 100644 index 0000000000..31f9a20c5b --- /dev/null +++ b/metadata/com.standardnotes/remove-IAP.3.146.2.patch @@ -0,0 +1,81 @@ +diff --git a/packages/mobile/src/PurchaseManager.ts b/packages/mobile/src/PurchaseManager.ts +index d005b4ea7..30b116099 100644 +--- a/packages/mobile/src/PurchaseManager.ts ++++ b/packages/mobile/src/PurchaseManager.ts +@@ -1,36 +1,9 @@ + import { AppleIAPProductId, AppleIAPReceipt } from '@standardnotes/snjs' +-import { EmitterSubscription } from 'react-native' +-import { +- endConnection, +- finishTransaction, +- getSubscriptions, +- initConnection, +- purchaseErrorListener, +- purchaseUpdatedListener, +- requestSubscription, +- type ProductPurchase, +- type PurchaseError, +- type SubscriptionPurchase, +-} from 'react-native-iap' +-import { log, LoggingDomain } from './Lib/Logging' + + export class PurchaseManager { + private static instance: PurchaseManager +- private listenerDisposer: EmitterSubscription +- private errorDisposer: EmitterSubscription + + private constructor() { +- this.listenerDisposer = purchaseUpdatedListener((purchase: SubscriptionPurchase | ProductPurchase) => { +- log(LoggingDomain.AppleIAP, 'purchaseUpdatedListener', purchase) +- const receipt = purchase.transactionReceipt +- if (receipt) { +- void finishTransaction({ purchase, isConsumable: false }) +- } +- }) +- +- this.errorDisposer = purchaseErrorListener((error: PurchaseError) => { +- log(LoggingDomain.AppleIAP, 'purchaseErrorListener', error) +- }) + } + + public static getInstance(): PurchaseManager { +@@ -42,39 +15,8 @@ export class PurchaseManager { + } + + deinit() { +- this.listenerDisposer.remove() +- this.errorDisposer.remove() +- void endConnection() + } + + async purchase(sku: AppleIAPProductId): Promise { +- await initConnection() +- +- const subscriptions = await getSubscriptions({ +- skus: [AppleIAPProductId.PlusPlanYearly, AppleIAPProductId.ProPlanYearly], +- }) +- +- log(LoggingDomain.AppleIAP, 'Retrieved subscriptions', subscriptions) +- +- try { +- const result = await requestSubscription({ sku, andDangerouslyFinishTransactionAutomaticallyIOS: true }) +- +- log(LoggingDomain.AppleIAP, 'Purchase result', result) +- +- if (result && result.transactionId && result.transactionDate) { +- return { +- transactionId: result.transactionId, +- productId: result.productId as AppleIAPProductId, +- transactionDate: String(result.transactionDate), +- transactionReceipt: result.transactionReceipt, +- } +- } else { +- log(LoggingDomain.AppleIAP, 'Purchase method returning undefined even though successful') +- return undefined +- } +- } catch (error) { +- log(LoggingDomain.AppleIAP, error) +- return undefined +- } + } + }