Skip to content

Commit

Permalink
feat(image-loader): add ionic webView 2 support (#189)
Browse files Browse the repository at this point in the history
Closes #187
  • Loading branch information
madoBaker authored and ihadeed committed Sep 17, 2018
1 parent cb8fd22 commit da035a8
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/providers/image-loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ interface QueueItem {
reject: Function;
}

declare const Ionic: any;

@Injectable()
export class ImageLoader {
/**
Expand Down Expand Up @@ -517,7 +519,13 @@ export class ImageLoader {
// therefore the file needs to be copied into that directory first!
if (this.isIonicWKWebView) {
// Use Ionic normalizeUrl to generate the right URL for Ionic WKWebView
resolve(normalizeURL(fileEntry.nativeURL));
if(typeof Ionic.normalizeURL === 'function' ) {
resolve(Ionic.normalizeURL(fileEntry.nativeURL));
} else if (Ionic.WebView && typeof Ionic.WebView.convertFileSrc === 'function') {
resolve(Ionic.WebView.convertFileSrc(fileEntry.nativeURL));
} else {
resolve(normalizeURL(fileEntry.nativeURL));
}
} else if (this.isWKWebView) {
// check if file already exists in temp directory
this.file
Expand Down

0 comments on commit da035a8

Please sign in to comment.