Skip to content

Commit

Permalink
Merge pull request #1718 from numbersprotocol/feature-in-app-puchase
Browse files Browse the repository at this point in the history
Feature in app puchase
  • Loading branch information
sultanmyrza authored Jun 21, 2022
2 parents 438100e + 9286ed9 commit 66e76cf
Show file tree
Hide file tree
Showing 33 changed files with 949 additions and 7 deletions.
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

0 comments on commit 66e76cf

Please sign in to comment.