...
 
Commits (4)
......@@ -195,7 +195,7 @@ export class AppManager {
continue;
}
await this.initializeApp(items.get(rl.getID()), rl, true);
await this.initializeApp(items.get(rl.getID()), rl, true).catch(console.error);
}
// Let's ensure the required settings are all set
......@@ -205,7 +205,7 @@ export class AppManager {
}
if (!this.areRequiredSettingsSet(rl.getStorageItem())) {
await rl.setStatus(AppStatus.INVALID_SETTINGS_DISABLED);
await rl.setStatus(AppStatus.INVALID_SETTINGS_DISABLED).catch(console.error);
}
}
......@@ -213,7 +213,7 @@ export class AppManager {
// but are not currently disabled.
for (const rl of this.apps.values()) {
if (!AppStatusUtils.isDisabled(rl.getStatus()) && AppStatusUtils.isEnabled(rl.getPreviousStatus())) {
await this.enableApp(items.get(rl.getID()), rl, true, rl.getPreviousStatus() === AppStatus.MANUALLY_ENABLED);
await this.enableApp(items.get(rl.getID()), rl, true, rl.getPreviousStatus() === AppStatus.MANUALLY_ENABLED).catch(console.error);
}
}
......@@ -589,7 +589,7 @@ export class AppManager {
const appStorageItem = app.getStorageItem();
const subscriptionInfo = appStorageItem.marketplaceInfo && appStorageItem.marketplaceInfo.subscriptionInfo;
if (subscriptionInfo && subscriptionInfo.startDate === appInfo.subscriptionInfo.startDate) {
if (subscriptionInfo && subscriptionInfo.license.license === appInfo.subscriptionInfo.license.license) {
return;
}
......@@ -702,7 +702,11 @@ export class AppManager {
// This is async, but we don't care since it only updates in the database
// and it should not mutate any properties we care about
storageItem.status = app.getStatus();
this.storage.update(storageItem);
this.storage.update(storageItem).catch(() => {
/**
* Avoiding some UNHANDLED_PROMISE_REJECTION
*/
});
}
return result;
......
......@@ -4,6 +4,7 @@ import { InvalidLicenseError } from '../errors';
import { IMarketplaceInfo } from '../marketplace';
import { AppLicenseValidationResult } from '../marketplace/license';
import { Crypto } from '../marketplace/license';
import { MarketplacePurchaseType } from '../marketplace/MarketplacePurchaseType';
enum LicenseVersion {
v1 = 1,
......@@ -18,7 +19,7 @@ export class AppLicenseManager {
}
public async validate(validationResult: AppLicenseValidationResult, appMarketplaceInfo?: IMarketplaceInfo): Promise<void> {
if (!appMarketplaceInfo || !appMarketplaceInfo.subscriptionInfo) {
if (!appMarketplaceInfo || appMarketplaceInfo.purchaseType !== MarketplacePurchaseType.PurchaseTypeSubscription) {
return;
}
......@@ -43,7 +44,7 @@ export class AppLicenseManager {
private async validateV1(appMarketplaceInfo: IMarketplaceInfo, license: any, validationResult: AppLicenseValidationResult): Promise<void> {
if (license.isBundle && (!appMarketplaceInfo.bundledIn || !appMarketplaceInfo.bundledIn.find((value) => value.bundleId === license.appId))) {
validationResult.addError('bundle', 'License issued for a bundle that does not contain the app');
} else if (license.appId !== appMarketplaceInfo.id) {
} else if (!license.isBundle && license.appId !== appMarketplaceInfo.id) {
validationResult.addError('appId', `License hasn't been issued for this app`);
}
......
......@@ -17,7 +17,7 @@ export interface IMarketplaceInfo extends IAppInfo {
modifiedDate: string;
price: number;
subscriptionInfo?: IMarketplaceSubscriptionInfo;
puchaseType: MarketplacePurchaseType;
purchaseType: MarketplacePurchaseType;
pricingPlans?: Array<IMarketplacePricingPlan>;
bundledIn?: Array<IMarketplaceSimpleBundleInfo>;
}