Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature in app puchase #1718

Merged
merged 19 commits into from
Jun 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
0fbce99
install in-app-purchase-2 plugin
sultanmyrza Jun 20, 2022
42c5ab5
add android billing permission
sultanmyrza Jun 20, 2022
086a962
add StoreKit config to test in-app purchases locally on iOS
sultanmyrza Jun 20, 2022
578db44
add translations for In App Purchases
sultanmyrza Jun 20, 2022
f1d3c55
add env var for BUBBLE_API endpoint
sultanmyrza Jun 20, 2022
f3e7d8d
add utility functions for in app purchases
sultanmyrza Jun 20, 2022
00fcfb3
add dia-backend-num service
sultanmyrza Jun 20, 2022
667fe19
add in-app-store service
sultanmyrza Jun 20, 2022
6a637a1
add buy num page for in-app purchases
sultanmyrza Jun 20, 2022
2cd4b7d
init in app purchases at app start
sultanmyrza Jun 20, 2022
dc579b7
Merge branch 'develop' into feature-in-app-puchase
sultanmyrza Jun 20, 2022
854a229
ci(.github/workflows): add BUBBLE_API_URL build env var
shc261392 Jun 21, 2022
b464c68
build(set-secret.js): add BUBBLE_API_URL in secret.js generation
shc261392 Jun 21, 2022
68f4084
fix(buy-num.page): add missing translation
sultanmyrza Jun 21, 2022
b5b5b38
fix(set-secret.js): add missing env var for BUBBLE_API_URL
sultanmyrza Jun 21, 2022
f0d244c
fix(buy-num.page): catch error for refreshNumPointsPricing
sultanmyrza Jun 21, 2022
0c675df
fix: in-app purchase related translations
sultanmyrza Jun 21, 2022
75baf1f
Merge branch 'feature-in-app-puchase' of https://github.com/numberspr…
sultanmyrza Jun 21, 2022
9286ed9
fix(set-secret.js): remove duplicate identifier BUBBLE_API_URL
sultanmyrza Jun 21, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/build-apks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ jobs:
NUMBERS_STORAGE_BASE_URL: ${{ secrets[matrix.storage_base_url] }}
NUMBERS_STORAGE_TRUSTED_CLIENT_KEY: ${{ secrets[matrix.storage_trusted_client_key] }}
NUMBERS_BUBBLE_DB_URL: ${{ secrets[matrix.bubble_db_url] }}
BUBBLE_API_URL: ${{ secrets.BUBBLE_API_URL }}
run: |
npm install -g @ionic/cli
npm install
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ jobs:
NUMBERS_STORAGE_BASE_URL: ${{ secrets.NUMBERS_STORAGE_BASE_URL }}
NUMBERS_STORAGE_TRUSTED_CLIENT_KEY: ${{ secrets.NUMBERS_STORAGE_TRUSTED_CLIENT_KEY }}
NUMBERS_BUBBLE_DB_URL: ${{ secrets.NUMBERS_BUBBLE_DB_URL }}
BUBBLE_API_URL: ${{ secrets.BUBBLE_API_URL }}
run: npm run build

- name: Build Android
Expand Down Expand Up @@ -109,6 +110,7 @@ jobs:
NUMBERS_STORAGE_BASE_URL: ${{ secrets.NUMBERS_STORAGE_BASE_URL }}
NUMBERS_STORAGE_TRUSTED_CLIENT_KEY: ${{ secrets.NUMBERS_STORAGE_TRUSTED_CLIENT_KEY }}
NUMBERS_BUBBLE_DB_URL: ${{ secrets.NUMBERS_BUBBLE_DB_URL }}
BUBBLE_API_URL: ${{ secrets.BUBBLE_API_URL }}
run: npm run build

- name: Import the Code-Signing PKCS12 Certificate
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/pre-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ jobs:
NUMBERS_STORAGE_BASE_URL: ${{ secrets.NUMBERS_STORAGE_BASE_URL }}
NUMBERS_STORAGE_TRUSTED_CLIENT_KEY: ${{ secrets.NUMBERS_STORAGE_TRUSTED_CLIENT_KEY }}
NUMBERS_BUBBLE_DB_URL: ${{ secrets.NUMBERS_BUBBLE_DB_URL }}
BUBBLE_API_URL: ${{ secrets.BUBBLE_API_URL }}
run: |
npm install -g @ionic/cli
npm install
Expand Down Expand Up @@ -90,6 +91,7 @@ jobs:
NUMBERS_STORAGE_BASE_URL: ${{ secrets.NUMBERS_STORAGE_BASE_URL }}
NUMBERS_STORAGE_TRUSTED_CLIENT_KEY: ${{ secrets.NUMBERS_STORAGE_TRUSTED_CLIENT_KEY }}
NUMBERS_BUBBLE_DB_URL: ${{ secrets.NUMBERS_BUBBLE_DB_URL }}
BUBBLE_API_URL: ${{ secrets.BUBBLE_API_URL }}
run: |
npm install -g @ionic/cli
npm install
Expand Down Expand Up @@ -199,6 +201,7 @@ jobs:
NUMBERS_STORAGE_BASE_URL: ${{ secrets[matrix.storage_base_url] }}
NUMBERS_STORAGE_TRUSTED_CLIENT_KEY: ${{ secrets[matrix.storage_trusted_client_key] }}
NUMBERS_BUBBLE_DB_URL: ${{ secrets[matrix.bubble_db_url] }}
BUBBLE_API_URL: ${{ secrets.BUBBLE_API_URL }}
run: |
npm install -g @ionic/cli
npm install
Expand Down Expand Up @@ -242,6 +245,7 @@ jobs:
NUMBERS_STORAGE_BASE_URL: ${{ secrets.NUMBERS_STORAGE_BASE_URL }}
NUMBERS_STORAGE_TRUSTED_CLIENT_KEY: ${{ secrets.NUMBERS_STORAGE_TRUSTED_CLIENT_KEY }}
NUMBERS_BUBBLE_DB_URL: ${{ secrets.NUMBERS_BUBBLE_DB_URL }}
BUBBLE_API_URL: ${{ secrets.BUBBLE_API_URL }}
run: |
npm install -g @ionic/cli
npm install
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/uiux-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ jobs:
NUMBERS_STORAGE_BASE_URL: ${{ secrets.NUMBERS_STORAGE_BASE_URL }}
NUMBERS_STORAGE_TRUSTED_CLIENT_KEY: ${{ secrets.NUMBERS_STORAGE_TRUSTED_CLIENT_KEY }}
NUMBERS_BUBBLE_DB_URL: ${{ secrets.NUMBERS_BUBBLE_DB_URL }}
BUBBLE_API_URL: ${{ secrets.BUBBLE_API_URL }}
run: |
npm install -g @ionic/cli
npm install
Expand Down
2 changes: 1 addition & 1 deletion android/app/capacitor.build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ dependencies {
implementation project(':numbersprotocol-preview-video')
implementation project(':appsflyer-capacitor-plugin')
implementation project(':capacitor-blob-writer')

implementation "com.android.billingclient:billing:4.0.0"
}


Expand Down
2 changes: 2 additions & 0 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@
<!-- Needed only if your app communicates with already-paired Bluetooth
devices. -->
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
<!-- For in-app purchases -->
<uses-permission android:name="com.android.vending.BILLING" />


<queries>
Expand Down
4 changes: 4 additions & 0 deletions android/app/src/main/res/xml/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,9 @@
<widget version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<access origin="*" />

<feature name="InAppBillingPlugin">
<param name="android-package" value="cc.fovea.PurchasePlugin"/>
</feature>


</widget>
2 changes: 2 additions & 0 deletions ios/App/App.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
AF277DCFFFF123FFC6DF26C7 /* Pods_App.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_App.framework; sourceTree = BUILT_PRODUCTS_DIR; };
AF51FD2D460BCFE21FA515B2 /* Pods-App.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-App.release.xcconfig"; path = "Pods/Target Support Files/Pods-App/Pods-App.release.xcconfig"; sourceTree = "<group>"; };
DE095CFF277AF00900242276 /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "GoogleService-Info.plist"; sourceTree = "<group>"; };
DE2706742854C3960046512E /* Configuration.storekit */ = {isa = PBXFileReference; lastKnownFileType = text; path = Configuration.storekit; sourceTree = "<group>"; };
DE28998F27B790A900F6581C /* public */ = {isa = PBXFileReference; lastKnownFileType = folder; path = public; sourceTree = "<group>"; };
FC68EB0AF532CFC21C3344DD /* Pods-App.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-App.debug.xcconfig"; path = "Pods/Target Support Files/Pods-App/Pods-App.debug.xcconfig"; sourceTree = "<group>"; };
/* End PBXFileReference section */
Expand Down Expand Up @@ -58,6 +59,7 @@
504EC2FB1FED79650016851F = {
isa = PBXGroup;
children = (
DE2706742854C3960046512E /* Configuration.storekit */,
504EC3061FED79650016851F /* App */,
504EC3051FED79650016851F /* Products */,
7F8756D8B27F46E3366F6CEA /* Pods */,
Expand Down
5 changes: 5 additions & 0 deletions ios/App/App/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,10 @@
<widget version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<access origin="*" />

<feature name="InAppPurchase">
<param name="ios-package" value="InAppPurchase"/>
<param name="onload" value="true"/>
</feature>


</widget>
78 changes: 78 additions & 0 deletions ios/App/Configuration.storekit
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
{
"identifier" : "509552BA",
"nonRenewingSubscriptions" : [

],
"products" : [
{
"displayPrice" : "0.99",
"familyShareable" : false,
"internalID" : "68D9071C",
"localizations" : [
{
"description" : "Bronze Pack (Description)",
"displayName" : "Bronze Pack",
"locale" : "en_US"
}
],
"productID" : "cap_lite_consumable_bronze_pack_099",
"referenceName" : "Bronze Pack",
"type" : "Consumable"
},
{
"displayPrice" : "1.99",
"familyShareable" : false,
"internalID" : "9A0F041B",
"localizations" : [
{
"description" : "Silver Pack (Description)",
"displayName" : "Silver Pack",
"locale" : "en_US"
}
],
"productID" : "cap_lite_consumable_silver_pack_199",
"referenceName" : "Silver Pack",
"type" : "Consumable"
},
{
"displayPrice" : "2.99",
"familyShareable" : false,
"internalID" : "D92B12C1",
"localizations" : [
{
"description" : "Gold Pack (Description)",
"displayName" : "Gold Pack",
"locale" : "en_US"
}
],
"productID" : "cap_lite_consumable_gold_pack_299",
"referenceName" : "Gold Pack",
"type" : "Consumable"
},
{
"displayPrice" : "3.99",
"familyShareable" : false,
"internalID" : "D0441E1B",
"localizations" : [
{
"description" : "Platinum Pack (Description)",
"displayName" : "Platinum Pack",
"locale" : "en_US"
}
],
"productID" : "cap_lite_consumable_platinum_pack_399",
"referenceName" : "Platinum Pack",
"type" : "Consumable"
}
],
"settings" : {

},
"subscriptionGroups" : [

],
"version" : {
"major" : 1,
"minor" : 2
}
}
1 change: 1 addition & 0 deletions ios/App/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ def capacitor_pods
pod 'NumbersprotocolPreviewVideo', :path => '../../node_modules/@numbersprotocol/preview-video'
pod 'AppsflyerCapacitorPlugin', :path => '../../node_modules/appsflyer-capacitor-plugin'
pod 'CapacitorBlobWriter', :path => '../../node_modules/capacitor-blob-writer'
pod 'CordovaPlugins', :path => '../capacitor-cordova-ios-plugins'
end

target 'App' do
Expand Down
63 changes: 63 additions & 0 deletions package-lock.json

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

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"@angular/platform-browser": "^12.2.4",
"@angular/platform-browser-dynamic": "^12.2.4",
"@angular/router": "^12.2.4",
"@awesome-cordova-plugins/in-app-purchase-2": "^5.43.0",
"@capacitor-community/advertising-id": "^1.0.0",
"@capacitor-community/bluetooth-le": "^1.7.0",
"@capacitor-community/http": "github:numbersprotocol/http#fix-catch-disabled-Local-Network-case-on-iOS",
Expand Down Expand Up @@ -65,6 +66,7 @@
"buffer": "^5.7.1",
"capacitor-blob-writer": "^1.0.4",
"compressorjs": "^1.0.7",
"cordova-plugin-purchase": "^11.0.0",
"immutable": "^4.0.0-rc.14",
"lodash-es": "^4.17.21",
"material-design-icons-iconfont": "^6.1.0",
Expand Down
1 change: 1 addition & 0 deletions set-secret.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const envConfigFile = `
export const BASE_URL = '${process.env.NUMBERS_STORAGE_BASE_URL}';
export const TRUSTED_CLIENT_KEY = '${process.env.NUMBERS_STORAGE_TRUSTED_CLIENT_KEY}';
export const BUBBLE_DB_URL = '${process.env.NUMBERS_BUBBLE_DB_URL}';
export const BUBBLE_API_URL = '${process.env.BUBBLE_API_URL}';
export const APPS_FLYER_DEV_KEY = '${process.env.APPS_FLYER_DEV_KEY}'
`;
fs.writeFile(targetPath, envConfigFile, err => {
Expand Down
12 changes: 11 additions & 1 deletion src/app/app.component.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { HttpClientTestingModule } from '@angular/common/http/testing';
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { TestBed, waitForAsync } from '@angular/core/testing';
import { InAppPurchase2 } from '@awesome-cordova-plugins/in-app-purchase-2/ngx';
import { Platform } from '@ionic/angular';
import { AppComponent } from './app.component';
import { CapacitorPluginsTestingModule } from './shared/capacitor-plugins/capacitor-plugins-testing.module';
Expand All @@ -21,6 +22,12 @@ describe('AppComponent', () => {
is: platformIsSpy,
});

const iap2SpyMethods = ['error', 'ready', 'when', 'refresh', 'off'];
const inAppPurchase2Spy = jasmine.createSpyObj(
'InAppPurchase2',
iap2SpyMethods
);

TestBed.configureTestingModule({
declarations: [AppComponent],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
Expand All @@ -30,7 +37,10 @@ describe('AppComponent', () => {
getTranslocoTestingModule(),
MaterialTestingModule,
],
providers: [{ provide: Platform, useValue: platformSpy }],
providers: [
{ provide: Platform, useValue: platformSpy },
{ provide: InAppPurchase2, useValue: inAppPurchase2Spy },
],
}).compileComponents();
})
);
Expand Down
Loading