feat: Reworked the awards logic so it is easy to add new ones.
This commit is contained in:
Vendored
+8
@@ -34,6 +34,8 @@ export function AntGeniusActivate(arg1:number,arg2:number):Promise<void>;
|
||||
|
||||
export function AntGeniusDeselect(arg1:number):Promise<void>;
|
||||
|
||||
export function ApplyAwardImport(arg1:string,arg2:Record<string, string>):Promise<main.AwardImportResult>;
|
||||
|
||||
export function ApplyAwardPreset(arg1:string,arg2:string):Promise<number>;
|
||||
|
||||
export function AssignAwardRefToQSOs(arg1:string,arg2:string,arg3:Array<number>):Promise<number>;
|
||||
@@ -150,6 +152,8 @@ export function ExportADIFFiltered(arg1:string,arg2:boolean,arg3:qso.QueryFilter
|
||||
|
||||
export function ExportADIFSelected(arg1:string,arg2:boolean,arg3:Array<number>):Promise<adif.ExportResult>;
|
||||
|
||||
export function ExportAward(arg1:string):Promise<string>;
|
||||
|
||||
export function ExportAwards():Promise<string>;
|
||||
|
||||
export function ExportCabrillo(arg1:string):Promise<main.CabrilloResult>;
|
||||
@@ -286,6 +290,8 @@ export function GetCATState():Promise<cat.RigState>;
|
||||
|
||||
export function GetCWDecoderPitch():Promise<number>;
|
||||
|
||||
export function GetCatalogCodes():Promise<Array<string>>;
|
||||
|
||||
export function GetChatHistory(arg1:number):Promise<Array<main.ChatMessage>>;
|
||||
|
||||
export function GetClublogCtyInfo():Promise<main.ClublogCtyInfo>;
|
||||
@@ -470,6 +476,8 @@ export function ImportAwardReferencesText(arg1:string,arg2:string):Promise<numbe
|
||||
|
||||
export function ImportAwards():Promise<main.AwardImportResult>;
|
||||
|
||||
export function InspectAwardImport():Promise<main.AwardImportPreview>;
|
||||
|
||||
export function LaunchAutostartProgram(arg1:string):Promise<main.AutostartLaunchResult>;
|
||||
|
||||
export function LaunchAutostartPrograms():Promise<Array<main.AutostartLaunchResult>>;
|
||||
|
||||
@@ -26,6 +26,10 @@ export function AntGeniusDeselect(arg1) {
|
||||
return window['go']['main']['App']['AntGeniusDeselect'](arg1);
|
||||
}
|
||||
|
||||
export function ApplyAwardImport(arg1, arg2) {
|
||||
return window['go']['main']['App']['ApplyAwardImport'](arg1, arg2);
|
||||
}
|
||||
|
||||
export function ApplyAwardPreset(arg1, arg2) {
|
||||
return window['go']['main']['App']['ApplyAwardPreset'](arg1, arg2);
|
||||
}
|
||||
@@ -258,6 +262,10 @@ export function ExportADIFSelected(arg1, arg2, arg3) {
|
||||
return window['go']['main']['App']['ExportADIFSelected'](arg1, arg2, arg3);
|
||||
}
|
||||
|
||||
export function ExportAward(arg1) {
|
||||
return window['go']['main']['App']['ExportAward'](arg1);
|
||||
}
|
||||
|
||||
export function ExportAwards() {
|
||||
return window['go']['main']['App']['ExportAwards']();
|
||||
}
|
||||
@@ -530,6 +538,10 @@ export function GetCWDecoderPitch() {
|
||||
return window['go']['main']['App']['GetCWDecoderPitch']();
|
||||
}
|
||||
|
||||
export function GetCatalogCodes() {
|
||||
return window['go']['main']['App']['GetCatalogCodes']();
|
||||
}
|
||||
|
||||
export function GetChatHistory(arg1) {
|
||||
return window['go']['main']['App']['GetChatHistory'](arg1);
|
||||
}
|
||||
@@ -898,6 +910,10 @@ export function ImportAwards() {
|
||||
return window['go']['main']['App']['ImportAwards']();
|
||||
}
|
||||
|
||||
export function InspectAwardImport() {
|
||||
return window['go']['main']['App']['InspectAwardImport']();
|
||||
}
|
||||
|
||||
export function LaunchAutostartProgram(arg1) {
|
||||
return window['go']['main']['App']['LaunchAutostartProgram'](arg1);
|
||||
}
|
||||
|
||||
@@ -1267,6 +1267,63 @@ export namespace main {
|
||||
this.enabled = source["enabled"];
|
||||
}
|
||||
}
|
||||
export class AwardImportPreviewEntry {
|
||||
code: string;
|
||||
name: string;
|
||||
references: number;
|
||||
exists: boolean;
|
||||
mine_name: string;
|
||||
mine_refs: number;
|
||||
protected: boolean;
|
||||
|
||||
static createFrom(source: any = {}) {
|
||||
return new AwardImportPreviewEntry(source);
|
||||
}
|
||||
|
||||
constructor(source: any = {}) {
|
||||
if ('string' === typeof source) source = JSON.parse(source);
|
||||
this.code = source["code"];
|
||||
this.name = source["name"];
|
||||
this.references = source["references"];
|
||||
this.exists = source["exists"];
|
||||
this.mine_name = source["mine_name"];
|
||||
this.mine_refs = source["mine_refs"];
|
||||
this.protected = source["protected"];
|
||||
}
|
||||
}
|
||||
export class AwardImportPreview {
|
||||
path: string;
|
||||
awards: AwardImportPreviewEntry[];
|
||||
|
||||
static createFrom(source: any = {}) {
|
||||
return new AwardImportPreview(source);
|
||||
}
|
||||
|
||||
constructor(source: any = {}) {
|
||||
if ('string' === typeof source) source = JSON.parse(source);
|
||||
this.path = source["path"];
|
||||
this.awards = this.convertValues(source["awards"], AwardImportPreviewEntry);
|
||||
}
|
||||
|
||||
convertValues(a: any, classs: any, asMap: boolean = false): any {
|
||||
if (!a) {
|
||||
return a;
|
||||
}
|
||||
if (a.slice && a.map) {
|
||||
return (a as any[]).map(elem => this.convertValues(elem, classs));
|
||||
} else if ("object" === typeof a) {
|
||||
if (asMap) {
|
||||
for (const key of Object.keys(a)) {
|
||||
a[key] = new classs(a[key]);
|
||||
}
|
||||
return a;
|
||||
}
|
||||
return new classs(a);
|
||||
}
|
||||
return a;
|
||||
}
|
||||
}
|
||||
|
||||
export class AwardImportResult {
|
||||
awards: number;
|
||||
references: number;
|
||||
|
||||
Reference in New Issue
Block a user