-
Notifications
You must be signed in to change notification settings - Fork 136
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(livereload): Images not loading #161
Merged
Merged
Changes from 6 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
79f8f3d
fix(wkwebview): Images not loading in Ionic WKWebView
eduardoRoth fc00969
Merge pull request #1 from eduardoRoth/eduardoRoth-patch-ios-ionicwkw…
eduardoRoth 367f674
fix(livereload): Images not loading
eduardoRoth e12f4a6
Merge pull request #2 from eduardoRoth/eduardoRoth-fix-livereload
eduardoRoth fd23fe5
Merge branch 'master' into pr/3
eduardoRoth 94b3b29
Merge pull request #4 from eduardoRoth/pr/3
eduardoRoth 5b5ccd1
lint(livereload): Updated for ihadeed comments
eduardoRoth File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -414,12 +414,19 @@ export class ImageLoader { | |
* @returns {Promise<string>} Returns a promise that resolves with the local path if exists, or rejects if doesn't exist | ||
*/ | ||
private getCachedImagePath(url: string): Promise<string> { | ||
// Check if we're running with livereload | ||
let _isDev: boolean = (window['IonicDevServer'] != undefined); | ||
return new Promise<string>((resolve, reject) => { | ||
|
||
// make sure cache is ready | ||
if (!this.isCacheReady) { | ||
return reject(); | ||
} | ||
|
||
// if we're running with livereload, ignore cache and call the resource from it's URL | ||
if(!!_isDev){ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
return reject(); | ||
} | ||
|
||
// get file name | ||
const fileName = this.createFileName(url); | ||
|
@@ -452,10 +459,8 @@ export class ImageLoader { | |
// in this case only the tempDirectory is accessible, | ||
// 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)); | ||
|
||
} else if (this.isWKWebView) { | ||
|
||
// check if file already exists in temp directory | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IonicDevServer
variable is defined before the app loads, it makes more sense to make this a global variable (either a variable outside the class, or a private property of the class). This way we don't have to evaluate the expression every timegetCachedImagePath
is called.