import { CodePush } from '@ionic-native/code-push' ; import { Observable } from 'rxjs/Observable' ; import { Observer } from 'rxjs/Observer' ; /**
 * Defines a package. All fields are non-nullable, except when retrieving the currently running package on the first run of the app,
 * in which case only the appVersion is compulsory.
 *
 * !! THIS TYPE IS READ FROM NATIVE CODE AS WELL. ANY CHANGES TO THIS INTERFACE NEEDS TO BE UPDATED IN NATIVE CODE !!
 */ export interface IPackage { deploymentKey : string ; description : string ; label : string ; appVersion : string ; isMandatory : boolean ; packageHash : string ; packageSize : number ; failedInstall : boolean ; } /**
 * Defines a remote package, which represents an update package available for download.
 */ export interface IRemotePackage extends IPackage { /**
     * The URL at which the package is available for download.
     */ downloadUrl : string ; param downloadSuccess param downloadError param downloadProgress download ( downloadSuccess , downloadError ? , downloadProgress ? ) : void ; param abortSuccess param abortError abortDownload ( abortSuccess ? , abortError ? ) : void ; } /**
 * Defines a local package.
 *
 * !! THIS TYPE IS READ FROM NATIVE CODE AS WELL. ANY CHANGES TO THIS INTERFACE NEEDS TO BE UPDATED IN NATIVE CODE !!
 */ export interface ILocalPackage extends IPackage { /**
     * The local storage path where this package is located.
     */ localPath : string ; /**
     * Indicates if the current application run is the first one after the package was applied.
     */ isFirstRun : boolean ; param installSuccess param installError param installOptions install ( installSuccess , errorCallback ? , installOptions ? ) : void ; } export interface Callback < T > { ( error , parameter ) : void ; } export interface SuccessCallback < T > { ( result ? ) : void ; } export interface ErrorCallback { ( error ? ) : void ; } /**
 * Defines the possible result statuses of the window.codePush.sync operation.
 */ export declare enum SyncStatus { /**
     * The application is up to date.
     */ UP_TO_DATE = 0 , /**
     * An update is available, it has been downloaded, unzipped and copied to the deployment folder.
     * After the completion of the callback invoked with SyncStatus.UPDATE_INSTALLED, the application will be reloaded with the updated code and resources.
     */ UPDATE_INSTALLED = 1 , /**
     * An optional update is available, but the user declined to install it. The update was not downloaded.
     */ UPDATE_IGNORED = 2 , /**
     * An error happened during the sync operation. This might be an error while communicating with the server, downloading or unziping the update.
     * The console logs should contain more information about what happened. No update has been applied in this case.
     */ ERROR = 3 , /**
     * There is an ongoing sync in progress, so this attempt to sync has been aborted.
     */ IN_PROGRESS = 4 , /**
     * Intermediate status - the plugin is about to check for updates.
     */ CHECKING_FOR_UPDATE = 5 , /**
     * Intermediate status - a user dialog is about to be displayed. This status will be reported only if user interaction is enabled.
     */ AWAITING_USER_ACTION = 6 , /**
     * Intermediate status - the update package is about to be downloaded.
     */ DOWNLOADING_PACKAGE = 7 , /**
     * Intermediate status - the update package is about to be installed.
     */ INSTALLING_UPDATE = 8 } /**
 * Defines the available install modes for updates.
 */ export declare enum InstallMode { /**
     * The update will be applied to the running application immediately. The application will be reloaded with the new content immediately.
     */ IMMEDIATE = 0 , /**
     * The update is downloaded but not installed immediately. The new content will be available the next time the application is started.
     */ ON_NEXT_RESTART = 1 , /**
     * The udpate is downloaded but not installed immediately. The new content will be available the next time the application is resumed or restarted, whichever event happends first.
     */ ON_NEXT_RESUME = 2 } /**
 * Defines the install operation options.
 */ export interface InstallOptions { /**
     * Used to specify the InstallMode used for the install operation. This is optional and defaults to InstallMode.ON_NEXT_RESTART.
     */ installMode ? : InstallMode ; /**
     * If installMode === ON_NEXT_RESUME, the minimum amount of time (in seconds) which needs to pass with the app in the background before an update install occurs when the app is resumed.
     */ minimumBackgroundDuration ? : number ; /**
     * Used to specify the InstallMode used for the install operation if the update is mandatory. This is optional and defaults to InstallMode.IMMEDIATE.
     */ mandatoryInstallMode ? : InstallMode ; } /**
 * Defines the sync operation options.
 */ export interface SyncOptions extends InstallOptions { /**
     * Optional boolean flag. If set, previous updates which were rolled back will be ignored. Defaults to true.
     */ ignoreFailedUpdates ? : boolean ; /**
     * Used to enable, disable or customize the user interaction during sync.
     * If set to false, user interaction will be disabled. If set to true, the user will be alerted or asked to confirm new updates, based on whether the update is mandatory.
     * To customize the user dialog, this option can be set to a custom UpdateDialogOptions instance.
     */ updateDialog ? : boolean | UpdateDialogOptions ; /**
     * Overrides the config.xml deployment key when checking for updates.
     */ deploymentKey ? : string ; } /**
 * Defines the configuration options for the alert or confirmation dialog
 */ export interface UpdateDialogOptions { /**
     * If a mandatory update is available and this option is set, the message will be displayed to the user in an alert dialog before downloading and installing the update.
     * The user will not be able to cancel the operation, since the update is mandatory.
     */ mandatoryUpdateMessage ? : string ; /**
     * If an optional update is available and this option is set, the message will be displayed to the user in a confirmation dialog.
     * If the user confirms the update, it will be downloaded and installed. Otherwise, the update update is not downloaded.
     */ optionalUpdateMessage ? : string ; /**
     * The title of the dialog box used for interacting with the user in case of a mandatory or optional update.
     * This title will only be used if at least one of mandatoryUpdateMessage or optionalUpdateMessage options are set.
     */ updateTitle ? : string ; /**
     * The label of the confirmation button in case of an optional update.
     */ optionalInstallButtonLabel ? : string ; /**
     * The label of the cancel button in case of an optional update.
     */ optionalIgnoreButtonLabel ? : string ; /**
     * The label of the continue button in case of a mandatory update.
     */ mandatoryContinueButtonLabel ? : string ; /**
     * Flag indicating if the update description provided by the CodePush server should be displayed in the dialog box appended to the update message.
     */ appendReleaseDescription ? : boolean ; /**
     * Optional prefix to add to the release description.
     */ descriptionPrefix ? : string ; } /**
 * Defines the format of the DownloadProgress object, used to send periodical update notifications on the progress of the update download.
 */ export interface DownloadProgress { totalBytes : number ; receivedBytes : number ; } name description usage export class CodePushMock extends CodePush { param packageSuccess param packageError returns { Promise < ILocalPackage > } getCurrentPackage ( ) { let response ; return new Promise ( ( resolve , reject ) => { resolve ( response ) ; } ) ; } ; returns { Promise < ILocalPackage > } getPendingPackage ( ) { let response ; return new Promise ( ( resolve , reject ) => { resolve ( response ) ; } ) ; } ; param querySuccess param queryError param deploymentKey returns { Promise < IRemotePackage > } checkForUpdate ( deploymentKey ? ) { let response ; return new Promise ( ( resolve , reject ) => { resolve ( response ) ; } ) ; } ; param notifySucceeded param notifyFailed returns { Promise < void > } notifyApplicationReady ( ) { return ; } ; returns { Promise < void > } restartApplication ( ) { return ; } ; param syncCallback param syncOptions param downloadProgress returns { Observable < SyncStatus > } sync ( syncOptions ? , downloadProgress ? ) { let response ; return Observable . create ( ( observer ) => { observer . next ( response ) ; observer . complete ( ) ; } ) ; } ; }