Merge branch 'danielsogl:master' into master

This commit is contained in:
Srinidhi
2023-07-21 17:43:54 +05:30
committed by GitHub
45 changed files with 2806 additions and 1666 deletions
@@ -1,12 +1,8 @@
import { Injectable } from '@angular/core';
import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core';
export interface AnylineOptions {
// Valid License Key
licenseKey: string;
// Scanning options
config: any;
export interface AnylineConfig {
[key: string]: any;
}
/**
@@ -38,14 +34,29 @@ export interface AnylineOptions {
})
@Injectable()
export class Anyline extends AwesomeCordovaNativePlugin {
@Cordova()
checkLicense(licenseKey: string): Promise<any> {
return;
}
@Cordova()
initAnylineSDK(licenseKey: string): Promise<any> {
return;
}
@Cordova()
getSDKVersion(): Promise<any> {
return;
}
/**
* Scan
*
* @param options {AnylineOptions} Scanning options
* @param config {AnylineConfig} Scanning options
* @returns {Promise<any>} Returns a promise that resolves when Code is captured
*/
@Cordova()
scan(options: AnylineOptions): Promise<any> {
scan(config: AnylineConfig): Promise<any> {
return;
}
}
@@ -0,0 +1,276 @@
import { Injectable } from '@angular/core';
import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core';
export enum CFEnvironment {
PRODUCTION = 'PRODUCTION',
SANDBOX = 'SANDBOX',
}
export class CFSession {
payment_session_id: string;
orderID: string;
environment: string;
constructor(sessionID: string, orderID: string, environment: CFEnvironment) {
if (sessionID === null || sessionID.trim() === '') {
throw new Error('sessionID cannot be empty');
}
if (orderID === null || orderID.trim() === '') {
throw new Error('orderID cannot be empty');
}
if (environment === null || environment.trim() === '') {
throw new Error('environment cannot be empty');
}
this.payment_session_id = sessionID;
this.orderID = orderID;
this.environment = CFEnvironment[environment];
}
}
export enum CFPaymentModes {
CARD = 'CARD',
UPI = 'UPI',
NB = 'NB',
WALLET = 'WALLET',
EMI = 'EMI',
PAY_LATER = 'PAY_LATER',
PAYPAL = 'PAYPAL',
}
export interface CFPaymentComponent {
hashset: Set<CFPaymentModes>;
}
export class CFPaymentComponentBuilder {
private hashset: Set<CFPaymentModes> = new Set<CFPaymentModes>();
private enableAllModes() {
this.hashset.add(CFPaymentModes.CARD);
this.hashset.add(CFPaymentModes.UPI);
this.hashset.add(CFPaymentModes.NB);
this.hashset.add(CFPaymentModes.WALLET);
this.hashset.add(CFPaymentModes.EMI);
this.hashset.add(CFPaymentModes.PAY_LATER);
this.hashset.add(CFPaymentModes.PAYPAL);
}
build(): CFPaymentComponent {
if (this.hashset.size === 0) {
this.enableAllModes();
}
return {
hashset: this.hashset,
};
}
add(cfPaymentModes: CFPaymentModes) {
this.hashset.add(cfPaymentModes);
return this;
}
}
export interface CFTheme {
navigationBarBackgroundColor: string;
navigationBarTextColor: string;
buttonBackgroundColor: string;
buttonTextColor: string;
backgroundColor: string;
primaryTextColor: string;
secondaryTextColor: string;
}
export class CFThemeBuilder {
private navigationBarBackgroundColor = '#6A3FD3';
private navigationBarTextColor = '#FFFFFF';
private buttonBackgroundColor = '#6A3FD3';
private buttonTextColor = '#FFFFFF';
private backgroundColor = '#FFFFFF';
private primaryTextColor = '#11385b';
private secondaryTextColor = '#808080';
setNavigationBarBackgroundColor(value: string) {
this.navigationBarBackgroundColor = value;
return this;
}
setNavigationBarTextColor(value: string) {
this.navigationBarTextColor = value;
return this;
}
setButtonBackgroundColor(value: string) {
this.buttonBackgroundColor = value;
return this;
}
setButtonTextColor(value: string) {
this.buttonTextColor = value;
return this;
}
setPrimaryTextColor(value: string) {
this.primaryTextColor = value;
return this;
}
setSecondaryTextColor(value: string) {
this.secondaryTextColor = value;
return this;
}
setBackgroundColor(value: string) {
this.backgroundColor = value;
return this;
}
build(): CFTheme {
return {
navigationBarBackgroundColor: this.navigationBarBackgroundColor,
navigationBarTextColor: this.navigationBarTextColor,
buttonBackgroundColor: this.buttonBackgroundColor,
backgroundColor: this.backgroundColor,
buttonTextColor: this.buttonTextColor,
primaryTextColor: this.primaryTextColor,
secondaryTextColor: this.secondaryTextColor,
};
}
}
export type CFWebTheme = CFTheme;
export class CFWebThemeBuilder {
private navigationBarBackgroundColor = '#6A3FD3';
private navigationBarTextColor = '#FFFFFF';
setNavigationBarBackgroundColor(value: string) {
this.navigationBarBackgroundColor = value;
return this;
}
setNavigationBarTextColor(value: string) {
this.navigationBarTextColor = value;
return this;
}
build(): CFWebTheme {
const cfTheme = new CFThemeBuilder().build();
return {
buttonBackgroundColor: cfTheme.buttonBackgroundColor,
buttonTextColor: cfTheme.buttonTextColor,
navigationBarBackgroundColor: this.navigationBarBackgroundColor,
navigationBarTextColor: this.navigationBarBackgroundColor,
secondaryTextColor: cfTheme.secondaryTextColor,
backgroundColor: cfTheme.backgroundColor,
primaryTextColor: cfTheme.buttonTextColor,
};
}
}
export interface CheckoutPayment {
version: string;
}
export class CFDropCheckoutPayment implements CheckoutPayment {
private readonly session: CFSession;
private readonly components: string[] = Array.from(new CFPaymentComponentBuilder().build().hashset);
private readonly theme: CFTheme = new CFThemeBuilder().build();
version: string;
constructor(session: CFSession, components: CFPaymentComponent | null, theme: CFTheme | null) {
this.session = session;
if (components !== null) {
this.components = Array.from(components.hashset);
}
if (theme !== null) {
this.theme = theme;
}
}
getSession() {
return this.session;
}
getComponents() {
return this.components;
}
getTheme() {
return this.theme;
}
}
export class CFWebCheckoutPayment implements CheckoutPayment {
private readonly session: CFSession;
private readonly theme: CFWebTheme = new CFWebThemeBuilder().build();
version: string;
constructor(session: CFSession, theme: CFWebTheme | null) {
this.session = session;
if (theme !== null) {
this.theme = theme;
}
}
getSession() {
return this.session;
}
getTheme() {
return this.theme;
}
}
interface CFResult {
orderID: string;
}
interface CFError {
orderID: string;
status: string;
message: string;
code: string;
type: string;
}
interface CFResult {
orderID: string;
}
export interface CFCallback {
onVerify: (result: CFResult) => void;
onError: (error: CFError) => void;
}
@Plugin({
pluginName: 'CFPaymentGateway',
plugin: 'cordova-plugin-cashfree-pg',
pluginRef: 'CFPaymentGateway',
repo: 'https://github.com/cashfree/cordova-plugin-cashfree',
platforms: ['Android', 'iOS'],
})
@Injectable()
export class CFPaymentGateway extends AwesomeCordovaNativePlugin {
/**
* Initiate Drop Payment.
* @param {CFDropCheckoutPayment} [dropObject] dropPaymentObject information
*/
@Cordova()
doDropPayment(dropObject: CFDropCheckoutPayment) {
return;
}
/**
* Initiate Web Checkout Payment.
* @param {CFWebCheckoutPayment} [webCheckoutPayment] webCheckoutPaymentObject information
*/
@Cordova()
doWebCheckoutPayment(webCheckoutPayment: CFWebCheckoutPayment) {
return;
}
/**
* Set Callback.
* @param {CFCallback} [cfCallback] callbacks for payment.
*/
@Cordova()
setCallback(cfCallback: CFCallback) {
return;
}
}
@@ -29,10 +29,11 @@ import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-pl
*/
@Plugin({
pluginName: 'CloudSettings',
plugin: 'cordova-plugin-cloud-settings',
plugin: '@marysuon/cordova-plugin-cloud-settings',
pluginRef: 'cordova.plugin.cloudsettings',
repo: 'https://github.com/dpa99c/cordova-plugin-cloud-settings',
install: 'ionic cordova plugin add cordova-plugin-cloud-settings --variable ANDROID_BACKUP_SERVICE_KEY=myapikey',
install:
'ionic cordova plugin add @marysuon/cordova-plugin-cloud-settings --variable ANDROID_BACKUP_SERVICE_KEY=myapikey',
installVariables: ['ANDROID_BACKUP_SERVICE_KEY'],
platforms: ['Android', 'iOS'],
})
@@ -1,6 +1,11 @@
import { Injectable } from '@angular/core';
import { Cordova, CordovaProperty, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core';
export interface OnProgress {
isProgress: boolean;
transferred: number;
total: number;
}
export interface HTTPResponse {
/**
* The HTTP status number of the response or a negative internal error code.
@@ -608,6 +613,7 @@ export class HTTP extends AwesomeCordovaNativePlugin {
* @param options.filePath {string} file path(s) to be used during upload and download see uploadFile and downloadFile for detailed information
* @param options.name {string} name(s) to be used during upload see uploadFile for detailed information
* @param options.responseType {string} response type, defaults to text
* @param options.onProgress {function} A callback that is called when is progress
* @returns {Promise<HTTPResponse>} returns a promise that will resolve on success, and reject on failure
*/
@Cordova()
@@ -623,6 +629,7 @@ export class HTTP extends AwesomeCordovaNativePlugin {
filePath?: string | string[];
name?: string | string[];
responseType?: 'text' | 'arraybuffer' | 'blob' | 'json';
onProgress?: (response: OnProgress) => void;
}
): Promise<HTTPResponse> {
return;
@@ -328,16 +328,19 @@ export class MobileMessaging extends AwesomeCordovaNativePlugin {
* @param event
*/
@Cordova({
observable: true,
sync: true,
})
register(event: Event): Observable<Message> {
register(event: Event, handler: Function): void {
return;
}
/**
* Alias for `register`.
*/
@Cordova({
observable: true,
sync: true,
})
on(event: Event): Observable<Message> {
on(event: Event, handler: Function): void {
return;
}
@@ -350,16 +353,19 @@ export class MobileMessaging extends AwesomeCordovaNativePlugin {
* @param {Function} handler will be unregistered from event
*/
@Cordova({
observable: true,
sync: true,
})
unregister(event: Event): Observable<Message> {
unregister(event: Event, handler: Function): void {
return;
}
/**
* Alias for `unregister`.
*/
@Cordova({
observable: true,
sync: true,
})
off(event: Event): Observable<Message> {
off(event: Event, handler: Function): void {
return;
}
@@ -407,7 +413,7 @@ export class MobileMessaging extends AwesomeCordovaNativePlugin {
@Cordova({
observable: true,
})
submitEventImmediately(event: CustomEvent): Promise<void> {
submitEventImmediately(event: CustomEvent): Observable<any> {
return;
}
@@ -419,7 +425,7 @@ export class MobileMessaging extends AwesomeCordovaNativePlugin {
* @param {Object} userData. An object containing user data
*/
@Cordova()
saveUser(userData: UserData): Promise<any> {
saveUser(userData: UserData): Promise<UserData> {
return;
}
@@ -124,7 +124,6 @@ export class NewRelic extends AwesomeCordovaNativePlugin {
return; // We add return; here to avoid any IDE / Compiler errors
}
/**
* Throws a demo run-time exception to test New Relic crash reporting.
* @param {string} message An optional argument attached to the exception.
@@ -304,7 +303,7 @@ export class NewRelic extends AwesomeCordovaNativePlugin {
noticeNetworkFailure(url: string, method: string, startTime: Number, endTime: Number, failure: string): void {
return; // We add return; here to avoid any IDE / Compiler errors
}
/**
* Records JavaScript errors for ionic.
* @param {Error} err The error to report.
@@ -315,5 +314,14 @@ export class NewRelic extends AwesomeCordovaNativePlugin {
recordError(err: Error): void {
return; // We add return; here to avoid any IDE / Compiler errors
}
/**
* Shut down the agent within the current application lifecycle during runtime.
*/
@Cordova({
sync: true,
})
shutdown(): void {
return; // We add return; here to avoid any IDE / Compiler errors
}
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,105 @@
import { Injectable } from '@angular/core';
import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core';
import { Observable, fromEvent } from 'rxjs';
export interface IncomingSMS {
message: string;
[key: string]: any;
}
export enum SmsRetrieverStatus {
AlreadyStarted = 'SMS_RETRIEVER_ALREADY_STARTED',
Started = 'SMS_RETRIEVER_STARTED',
Done = 'SMS_RETRIEVER_DONE',
Timeout = 'TIMEOUT',
}
/**
* @name SmsRetrieverApi
* @description
* This plugin retries the SMS which arrive without requiring READ permissions.
* @usage
* ```typescript
* import { SmsRetrieverApi } from '@awesome-cordova-plugins/sms-retriever-api/ngx';
*
*
* constructor(private SmsRetrieverApi: SmsRetrieverApi) { }
*
* ...
*
*
* this.SmsRetrieverApi.getHashString()
* .then((res: any) => console.log(res))
* .catch((error: any) => console.error(error));
* this.SmsRetrieverApi.startWatch()
* .subscribe(
* (res: any) => console.log(res),
* (error: any) => console.error(error),
* )
* .catch((error: any) => console.error(error));
* this.onSMSArrive.onSMSArrive()
* .subscribe(() => { console.log(); });
* ```
*/
@Plugin({
pluginName: 'SmsRetriever',
plugin: 'cordova-plugin-sms-retriever',
pluginRef: 'cordova.plugins.SMSRetriever',
repo: 'https://github.com/andreszs/cordova-plugin-sms-retriever',
install: 'ionic cordova plugin add cordova-plugin-sms-retriever --variable PLAY_SERVICES_VERSION="18.0.1"',
installVariables: ['PLAY_SERVICES_VERSION'],
platforms: ['Android'],
})
@Injectable()
export class SmsRetrieverApi extends AwesomeCordovaNativePlugin {
/**
* This function start watching message arrive event and retrieve message text.
*
* @returns {Observable<string>} Returns an observable that resolves when retries SMS text or TIMEOUT after 5 min.
*/
@Cordova({
observable: true,
})
startWatch(): Observable<string> {
return;
}
/**
* This function stop watching message.
*
* @returns {Promise<string>} Returns a promise that resolves when successfully remove sms listener.
*/
@Cordova()
stopWatch(): Promise<string> {
return;
}
/**
* This function is to get hash string of APP.
*
* @returns {Promise<string>} Returns a promise that resolves when successfully generate hash of APP.
*/
@Cordova()
getHashString(): Promise<string> {
return;
}
/**
* Opens a dialog to select your mobile numbers saved in phone and returns selected phone number.
*
* @returns {Promise<string>} Returns a promise that resolves when successfully get phone number
*/
@Cordova()
getPhoneNumber(): Promise<string> {
return;
}
/**
* Watch incoming SMS event listener
*
* @returns {Observable<IncomingSMS>}
*/
onSMSArrive(): Observable<IncomingSMS> {
return fromEvent<IncomingSMS>(document, 'onSMSArrive');
}
}
@@ -0,0 +1,70 @@
import { Injectable } from '@angular/core';
import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core';
/**
* @name Smtp Client
* @description
* @usage
* ```typescript
* import { SmtpClient } from '@awesome-cordova-plugins/smtp-client/ngx';
*
* constructor(private smtpClient: SmtpClient) { }
*
* ...
*
* this.smtpClient.sendMail(mailSettings, success, failure);
*
* ```
*/
@Plugin({
pluginName: 'SMTPClient',
plugin: 'cordova-plugin-smtp-client',
pluginRef: 'smtpClient',
repo: 'https://github.com/CWBudde/cordova-plugin-smtp-client',
install: 'ionic cordova plugin add cordova-plugin-smtp-client',
platforms: ['Android', 'iOS'],
})
@Injectable()
export class SmtpClient extends AwesomeCordovaNativePlugin {
/**
* The sendMail function.
*
* var mailSettings = {
* emailFrom: "emailFrom@domain.com",
* emailTo: "emailTo@domain.com",
* smtp: "smtp-mail.domain.com",
* smtpUserName: "authuser@domain.com",
* smtpPassword: "password",
* attachments: ["attachment1", "attachment2"],
* subject: "email subject",
* textBody: "write something within the body of the email"
* };
*
* var successCallback = function(message) {
* alert(message);
* }
*
* var errorCallback = function(message) {
* alert("Error sending the email");
* }
*
* @param mailSettings
* @param successCallback
* @param errorCallback
* @returns {Promise<any>}
*/
@Cordova()
sendMail(mailSettings: any, successCallback: any, errorCallback: any): Promise<any> {
return;
}
/**
* You can call isLoaded to check if client is loaded.
*
* @returns {Promise<any>}
*/
@Cordova()
isLoaded(): Promise<any> {
return;
}
}
@@ -1181,4 +1181,45 @@ export class UrbanAirShip extends AwesomeCordovaNativePlugin {
openPreferenceCenter(prenferenceCenterId: string): Promise<any> {
return;
}
/**
* Overrides the locale setting.
*
* @param {string} locale language and optional country code.
* @param {function} [success] Success callback.
* @param {function(message)} [failure] Failure callback.
* @param {string} failure.message The error message.
* @since 14.3.0
*/
@Cordova()
setCurrentLocale(locale: string): Promise<any> {
return;
}
/**
* Returns the currently set locale.
*
* @param {function(locale)} [success] Success callback.
* @param {string} success.locale The locale as a string.
* @param {function(message)} [failure] Failure callback.
* @param {string} failure.message The error message.
* @since 14.3.0
*/
@Cordova()
getCurrentLocale(): Promise<string> {
return;
}
/**
* Resets the current locale.
*
* @param {function} [success] Success callback.
* @param {function(message)} [failure] Failure callback.
* @param {string} failure.message The error message.
* @since 14.3.0
*/
@Cordova()
clearLocale(): Promise<any> {
return;
}
}
@@ -33,11 +33,12 @@ export class Zip extends AwesomeCordovaNativePlugin {
* Extracts files from a ZIP archive
* @param {string} sourceZip Source ZIP file
* @param {string} destFolder Destination folder
* @param {Function} onSuccess callback to be called on when done
* @param {Function} onProgress optional callback to be called on progress update
* @returns {Promise<number>} returns a promise that resolves with a number. 0 is success, -1 is error
*/
@Cordova()
unzip(sourceZip: string, destFolder: string, onProgress?: Function): Promise<number> {
unzip(sourceZip: string, destFolder: string, onSuccess: Function, onProgress?: Function): Promise<number> {
return;
}
}