Skip to content

Commit

Permalink
Add in-app purchases
Browse files Browse the repository at this point in the history
  • Loading branch information
braxtondiggs committed Oct 15, 2020
1 parent 715bef5 commit a90a0d8
Show file tree
Hide file tree
Showing 7 changed files with 137 additions and 9 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ To generate a release build for Android, run the following cli command:

To sign the unsigned APK, run the jarsigner tool which is also included in the Android SDK:

`jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore ./release.keystore ./platforms/android/app/build/outputs/apk/release/app-release-unsigned.apk cymbit`
`jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore ../release.keystore ./platforms/android/app/build/outputs/apk/release/app-release-unsigned.apk cymbit`

Finally, the zip align tool must be ran to optimize the APK:

Expand Down
2 changes: 1 addition & 1 deletion config.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='utf-8'?>
<widget id="com.cymbit.paras" version="0.1.0" xmlns="http://www.w3.org/ns/widgets" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<widget id="com.cymbit.paras" version="0.2.1" xmlns="http://www.w3.org/ns/widgets" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>ASP NYC</name>
<description>Get updates on alternate street parking rules &amp; schedules with NYC parking app.</description>
<author email="[email protected]" href="http://braxtondiggs.com/">Braxton Diggs</author>
Expand Down
41 changes: 41 additions & 0 deletions package-lock.json

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

12 changes: 10 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@
"@angular/platform-browser-dynamic": "^10.1.5",
"@angular/router": "^10.1.5",
"@ionic-native/core": "^5.28.0",
"@ionic-native/email-composer": "^5.28.0",
"@ionic-native/firebase-x": "^5.28.0",
"@ionic-native/in-app-purchase-2": "^5.28.0",
"@ionic-native/launch-review": "^5.28.0",
"@ionic-native/network": "^5.28.0",
"@ionic-native/splash-screen": "^5.28.0",
Expand Down Expand Up @@ -61,8 +63,10 @@
"cordova-android": "^9.0.0",
"cordova-launch-review": "^4.0.0",
"cordova-plugin-device": "^2.0.3",
"cordova-plugin-email-composer": "git+https://github.com/adityasingh0208/cordova-plugin-email-composer.git",
"cordova-plugin-firebasex": "^11.0.3",
"cordova-plugin-ionic-webview": "^5.0.0",
"cordova-plugin-purchase": "^10.3.0",
"jasmine-core": "~3.5.0",
"jasmine-spec-reporter": "~5.0.0",
"karma": "~5.0.0",
Expand Down Expand Up @@ -106,10 +110,14 @@
"ANDROID_GSON_VERSION": "2.8.6",
"ANDROID_FIREBASE_PERF_GRADLE_PLUGIN_VERSION": "1.3.1"
},
"cordova-launch-review": {}
"cordova-launch-review": {},
"cordova-plugin-purchase": {
"BILLING_KEY": "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwuM/ArM7gtw7mPH/K65/mb+W0U5ViehZ5xgHzKEDYSQ0PPTqylCnOxkubAWEWGPvdVDpirXHmgeRbuTZrRyZAV9Dc+BJI+ahh5e9/9u118e50XXT/Zo1z3oGblpfo68FY6btM2UxEQ7U/2U1J2Cxl7j/uhRrakJMO9U5BpZy7FWULEa1pfJTUlJxDqVRaHUIiMED62KKBylIEorKDDSy04wsA03bbh36FK4ftLr4nKCTB1y4Uyz1QSUipDgAje1QDPPiSYAHhTe/RHlLZZoIOacW8OSZgZtjnFEAj/IU6Udu+Z6gS19n3gwPG1UrN0+u4bBftV8ZkeoRliV5Q/GmRQIDAQAB"
},
"cordova-plugin-email-composer": {}
},
"platforms": [
"android"
]
}
}
}
4 changes: 3 additions & 1 deletion src/app/settings/settings.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import { FormsModule } from '@angular/forms';
import { RouterModule } from '@angular/router';
import { ReactiveFormsModule } from '@angular/forms';
import { LaunchReview } from '@ionic-native/launch-review/ngx';
import { InAppPurchase2 } from '@ionic-native/in-app-purchase-2/ngx';
import { EmailComposer } from '@ionic-native/email-composer/ngx';
import { SettingsPage } from './settings.page';

@NgModule({
Expand All @@ -21,6 +23,6 @@ import { SettingsPage } from './settings.page';
])
],
declarations: [SettingsPage],
providers: [LaunchReview]
providers: [EmailComposer, LaunchReview, InAppPurchase2]
})
export class SettingsPageModule { }
23 changes: 19 additions & 4 deletions src/app/settings/settings.page.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ <h2>Custom Time</h2>
(ionCancel)="onNextDateCancel()"></ion-datetime>
</ion-item>
</ion-card>
<ion-list>
<ion-list lines="none">
<ion-item>
<ion-label>Exception Notifications Only:</ion-label>
<ion-checkbox formControlName="exceptionOnly" (ionChange)="save({exceptionOnly: $event.detail.checked})"></ion-checkbox>
Expand All @@ -60,18 +60,33 @@ <h2>Custom Time</h2>
<ion-checkbox formControlName="weekend" (ionChange)="save({weekend: $event.detail.checked})"></ion-checkbox>
</ion-item>
</ion-list>
<ion-list>
<br />
<ion-list lines="none">
<ion-list-header>
<ion-label>Account Settings</ion-label>
<ion-label color="primary">Other</ion-label>
</ion-list-header>
<ion-item>
<ion-label>Dark Mode</ion-label>
<ion-toggle slot="end" formControlName="darkMode"></ion-toggle>
<ion-icon name="moon" slot="start"></ion-icon>
</ion-item>
<ion-item (click)="about()">
<ion-label>
About this App
</ion-label>
<ion-icon name="information-circle" slot="start"></ion-icon>
</ion-item>
<ion-item (click)="rate()" detail>
<ion-label>
Rate Us
Rate Us On The App Store
</ion-label>
<ion-icon name="thumbs-up" slot="start"></ion-icon>
</ion-item>
<ion-item (click)="donate()">
<ion-label>
Support Development
</ion-label>
<ion-icon name="heart" slot="start"></ion-icon>
</ion-item>
</ion-list>
</form>
Expand Down
62 changes: 62 additions & 0 deletions src/app/settings/settings.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import { omitBy, isNil } from 'lodash-es';
import { distinctUntilChanged, take } from 'rxjs/operators';
import { AlertController, IonDatetime, LoadingController, ToastController } from '@ionic/angular';
import { LaunchReview } from '@ionic-native/launch-review/ngx';
import { InAppPurchase2 } from '@ionic-native/in-app-purchase-2/ngx';
import { EmailComposer } from '@ionic-native/email-composer/ngx';
@Component({
selector: 'app-settings',
templateUrl: './settings.page.html',
Expand All @@ -25,9 +27,11 @@ export class SettingsPage implements OnInit {
private alert: AlertController,
private auth: AuthService,
private db: DbService,
private email: EmailComposer,
private fcm: FcmService,
private launchReview: LaunchReview,
private loading: LoadingController,
private store: InAppPurchase2,
private toast: ToastController) {
this.settings = {
today: 'none',
Expand Down Expand Up @@ -162,4 +166,62 @@ export class SettingsPage implements OnInit {
this.launchReview.launch();
}
}

async about() {
const alert = await this.alert.create({
header: 'ASP For NYC',
message: 'This app was built and designed by Braxton Diggs of Cymbit Creative Studios.<br /><br />For more info and inquiries, email us at <strong>[email protected]</strong>',
buttons: [
{
text: 'Dismiss',
role: 'cancel'
}, {
text: 'Contact Us',
handler: () => {
this.email.open({ to: '[email protected]', subject: 'ASP for NYC' });
}
}
]
});

await alert.present();
}

async donate() {
const alert = await this.alert.create({
header: 'Support Development',
message: 'Hello, there! Hundreds of hours have been put into developing and perfecting ASP, so if you use this app quite often, why not considering supporting development.<br /><br />Your support ensures that we can keep up development, keeping the app alive.',
buttons: [
{
text: 'No, Thanks',
role: 'cancel'
}, {
text: 'Yes, Please',
handler: () => {
this.store.register({
id: 'donation_99',
type: this.store.CONSUMABLE,
});

this.store.when('donation_99')
.approved(p => p.verify())
.verified(async (p) => {
p.finish();
const toast = await this.toast.create({ message: 'Your support is always appreciated!', duration: 10000 });
toast.present();
})
.error(async () => {
const toast = await this.toast.create({ message: 'Something went wrong', duration: 10000 });
toast.present();
});
this.store.refresh();

this.store.order('donation_99');
}
}
]
});

await alert.present();
}
}

0 comments on commit a90a0d8

Please sign in to comment.