added a wrapper service for the native libraries

This commit is contained in:
Manuel Friedli 2016-09-20 22:34:31 +02:00
parent 9e95797211
commit f5999c5276
7 changed files with 47 additions and 29 deletions

View file

@ -1,9 +1,9 @@
import {Converter} from "./converter";
declare var utf8:any;
declare var quotedPrintable:any;
import {NativeLibraryWrapperService} from "../nativelibrarywrapper.service";
export class QuotedPrintableDecoder implements Converter {
constructor(private nativeLibraryWrapperService:NativeLibraryWrapperService) {
}
getDisplayname():string {
return "Decode quoted printable";
@ -14,6 +14,6 @@ export class QuotedPrintableDecoder implements Converter {
}
convert(input:string):string {
return utf8.decode(quotedPrintable.decode(input));
return this.nativeLibraryWrapperService.utf8.decode(this.nativeLibraryWrapperService.quotedPrintable.decode(input));
}
}

View file

@ -1,9 +1,9 @@
import {Converter} from "./converter";
declare var utf8:any;
declare var quotedPrintable:any;
import {NativeLibraryWrapperService} from "../nativelibrarywrapper.service";
export class QuotedPrintableEncoder implements Converter {
constructor(private nativeLibraryWrapperService:NativeLibraryWrapperService) {
}
getDisplayname():string {
return "Encode quoted printable";
@ -14,6 +14,6 @@ export class QuotedPrintableEncoder implements Converter {
}
convert(input:string):string {
return quotedPrintable.encode(utf8.encode(input));
return this.nativeLibraryWrapperService.quotedPrintable.encode(this.nativeLibraryWrapperService.utf8.encode(input));
}
}