Skip to content
This repository was archived by the owner on Feb 17, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion dist/esm/codePush.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,5 +159,5 @@ declare class CodePush implements CodePushCapacitorPlugin {
*/
private getDefaultUpdateDialogOptions;
}
export declare const codePush: CodePush;
export declare const codePush: CodePush | null;
export {};
15 changes: 12 additions & 3 deletions dist/esm/codePush.js

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

2 changes: 1 addition & 1 deletion dist/esm/codePush.js.map

Large diffs are not rendered by default.

12 changes: 8 additions & 4 deletions dist/plugin.js

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

2 changes: 1 addition & 1 deletion dist/plugin.js.map

Large diffs are not rendered by default.

15 changes: 12 additions & 3 deletions src/codePush.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { Capacitor } from "@capacitor/core";
import { ConfirmResult, Dialog } from "@capacitor/dialog";
import { AcquisitionStatus, NativeUpdateNotification } from "code-push/script/acquisition-sdk";
import { Callback, ErrorCallback, SuccessCallback } from "./callbackUtil";
import { CodePushUtil } from "./codePushUtil";
Expand All @@ -10,7 +12,6 @@ import { RemotePackage } from "./remotePackage";
import { Sdk } from "./sdk";
import { SyncOptions, UpdateDialogOptions } from "./syncOptions";
import { SyncStatus } from "./syncStatus";
import { ConfirmResult, Dialog } from "@capacitor/dialog";

interface CodePushCapacitorPlugin {

Expand Down Expand Up @@ -534,5 +535,13 @@ enum ReportStatus {
UPDATE_ROLLED_BACK = 2
}

export const codePush = new CodePush();
(window as any).codePush = codePush;
let codePushInstance: CodePush | null = null;
if(Capacitor.getPlatform() !== 'web') {
codePushInstance = new CodePush();
(window as any).codePush = codePushInstance;
} else {
/* Can't use CodePush without Capacitor */
/* The instance will be null */
}

export const codePush: CodePush | null = codePushInstance;