Quantcast
Channel: Ionic Forum - Latest posts
Viewing all 228535 articles
Browse latest View live

Translation custom loader CORS issue when reading from data directory

$
0
0

I made some more progress on this. I have changed the function to:

getTranslation(lang: string): Observable<any> {
  const subDirectory = 'i18n';
  const fileName = lang;
  const fileExtension = '.json';
  let rootDirectory = '';
  let rootDirectoryPath = '';
  let directory = '';
  let directoryPath = '';
  if (this.platform.is('cordova')) {
    this.platform.ready()
      .then(() => {
        rootDirectory = this.file.dataDirectory;
        rootDirectoryPath = rootDirectory;
        directory = rootDirectoryPath + subDirectory;
        directoryPath = directory + '/';
        console.log(directoryPath + fileName + fileExtension + ':');
        const translationFilePath = this.webview.convertFileSrc(directoryPath + fileName + fileExtension);
        // return this.http.get(translationFilePath);
        return this.http.get(translationFilePath)
          .pipe(map((res: JSON) => {
            return res;
          }));
      });
  } else {
    rootDirectory = '/assets/data';
    rootDirectoryPath = rootDirectory + '/';
    directory = rootDirectoryPath + subDirectory;
    directoryPath = directory + '/';
    console.log(directoryPath + fileName + fileExtension + ':');
    return this.http.get(directoryPath + fileName + fileExtension);
  }
}

So now I have resolved the CORS issue by using WebView to convert the file source.

Now the only issue I have is that the Observable returned is obviously not understood by ngx-translate. So I have created a StackOverflow post.


Do Android native calls via Capacitor still use webview?

$
0
0

I am developing an Ionic (v5) mobile app that uses the Cordova Oracle Mobile Cloud SDK. However, there is an issue with making HTTPS requests to the Oracle Mobile Hub - it’s the familiar CORS issue. However, because mobile client requests can come from any domain/IP range, it doesn’t seem possible to add a CORS whitelist to the Mobile Hub server. I tried adding the Access-Control-Allow-Origin headers to my server request code on the server (node.js) but the issue occurs at the authentication stage, before the requests even hit my node.js code. The solution is to add a CORS whitelist to the server environment, but as already mentioned, there’s no set domains where requests can come from.

With all that in mind, I have been looking at Capacitor as a possible solution by installing the Android Oracle Mobile Cloud SDK. Would this circumvent the problems of the request coming from a webview? There’s a note on the Capacitor docs under Android Development, which states the following:

Also, Capacitor requires an Android WebView with Chrome version 50 or later. On Android 5 and 6, the Capacitor uses the System WebView. On Android 7+, Google Chrome is used.

I’m not sure how to interpret that. Any help much appreciated.

When i am building Ionic 4 for android and running the build on android studio 3.4.1 , it gave me error?

$
0
0

I am using ionic 4 and using the command
ionic cordova build android
after creating the build i am running that build on android studio 3.4.1 but it is not working.
Can anyone help me what to do , when i was running on studio 3.0.1 it was fine but for android studio 3.4.1 it is not working.
Is there anyone who faced this problem please share the solution.

SVG file is not shown on ionic view

$
0
0

These images are working fine on Browser when we use ionic serve however when we push this to the device the image SVG will not show.
I thougth this was a whitlist issue but one error causes the entire app to keep failing on XCode simulator iPhoneX

Ion-select text wrap not working-How to overwrite the white-space property

$
0
0

Just try this
.alert-radio-label.sc-ion-alert-md {
white-space: pre-line !important;
}

.alert-radio-label.sc-ion-alert-ios {
white-space: pre-line !important;
}

Ionic 4 Text-wrap Ion-Select-Options

$
0
0

just try this in your app.scss
.alert-radio-label.sc-ion-alert-md {
white-space: pre-line !important;
}

.alert-radio-label.sc-ion-alert-ios {
white-space: pre-line !important;
}

How to disable input form validation

$
0
0

None of this worked for me in Ionic v4, but I managed to make it work with this:

.item-interactive {
  --highlight-background: transparent !important;
}

this will disable the feedback (valid or invalid)

normalizeURL file:///var.. -> http://localhost:8080/var

$
0
0

@lucbonnin did you find any solution ?
When I use
<preference name="CordovaWebViewEngine" value="CDVUIWebViewEngine" />
in config.xml, my app does not work. Process is stopped after splashcreen display.

Here are the Xcode console logs :

2019-06-26 14:25:20.867271+0200 Desticity[1938:262989] Apache Cordova native platform version 4.5.3 is starting.
2019-06-26 14:25:20.868000+0200 Desticity[1938:262989] Multi-tasking -> Device: YES, App: YES
2019-06-26 14:25:20.909471+0200 Desticity[1938:262989] Using UIWebView
2019-06-26 14:25:20.911248+0200 Desticity[1938:262989] [CDVTimer][console] 0.059009ms
2019-06-26 14:25:20.911378+0200 Desticity[1938:262989] [CDVTimer][handleopenurl] 0.079989ms
2019-06-26 14:25:20.913428+0200 Desticity[1938:262989] [CDVTimer][intentandnavigationfilter] 2.020001ms
2019-06-26 14:25:20.913543+0200 Desticity[1938:262989] [CDVTimer][gesturehandler] 0.069022ms
2019-06-26 14:25:20.927413+0200 Desticity[1938:262989] [CDVTimer][backgroundmode] 13.831019ms
2019-06-26 14:25:20.927478+0200 Desticity[1938:262989] [CDVTimer][backgroundmode] 0.007987ms
2019-06-26 14:25:20.950194+0200 Desticity[1938:262989] [CDVTimer][file] 22.660017ms
2019-06-26 14:25:20.956775+0200 Desticity[1938:262989] [CDVTimer][splashscreen] 6.513000ms
2019-06-26 14:25:20.964947+0200 Desticity[1938:262989] [CDVTimer][statusbar] 8.095980ms
2019-06-26 14:25:20.966174+0200 Desticity[1938:262989] [CDVTimer][keyboard] 1.109958ms
2019-06-26 14:25:20.966248+0200 Desticity[1938:262989] [CDVTimer][TotalPluginStartup] 55.090070ms
2019-06-26 14:25:29.903933+0200 Desticity[1938:262989] Resetting plugins due to page load.
2019-06-26 14:25:36.168689+0200 Desticity[1938:262989] Finished load of: file:///var/containers/Bundle/Application/CC50C082-D23D-4AFE-872D-E101F2B2CA7F/MYAPP.app/www/index.html#/login

Cordova Andriod Plugin - open an android native activity from Cordova Plugin

Build fails when app is sub-directory in github repository

Local files on IOS device : can write but not read any file

$
0
0

Hi guys,

Issue again with WKWebview update (cordova-plugin-ionic-webview v4.1.0) which does not support normalizeURL().

According to other solutions I have tried :

private win: any = window;
this.img = this.win.Ionic.WebView.convertFileSrc(LocalString);

and
<img [src] = "img" />

to display image stored in local container but the image still doesn’t display on my device…

When I downgrade to WKWebview v1.1.11 (which was my previously version before my update) it all works fine.

Any help to manage local images display with WKWebview v4.1.0 ?

Local files on IOS device : can write but not read any file

$
0
0

I saw on twitter that they just released an update to the plugin. Have you tried using it?

Www folder not generated with ionic serve

$
0
0

Thank you very much , it’s work fine :slight_smile:

Local files on IOS device : can write but not read any file

$
0
0

Just upgraded version but still no local stored image displayed on my device :fearful:

No permission to read a file my app wrote to /Data dir?

$
0
0

Turns out I was using Capacitor Filesystem incorrectly. The correct way to import it is:

import { Plugins } from ‘@capacitor/core’
const { Filesystem } = Plugins;

If you do ‘import { Filesystem } from @capacitor/core’, it does not work for some reason.

Hope this helps someone.


Basic Validation in Ionic 5

$
0
0

Dear All

I have one Form with input field username and one submit button

I want to validate for required field before clicking submit button

How do i do this ?

Please answer in Ionic 4 with sample code and understanding less code

Regards
Shabbir Sahiwala

Storing mp3 file in app's file system, in Ionic v4, and reading and playing them

$
0
0

So, I was doing quite a few things wrong. Thanks for jcesarmobile on the Capacitor slack channel for helping me out.

I’ve made available a repository that shows how to solve my problems. Look in home.page.ts and code.ts for my solutions, in https://github.com/VictorNorman/AudioPlayFromData

Local files on IOS device : can write but not read any file

$
0
0

I wonder if you couldn’t benefit from the wisdom I’ve acquired over the last couple of weeks, where I was trying to download and save mp3 files to play with the html5 <audio> tag. I’ve just posted information about it in another solution on this forum. But, the easiest way to see what I’m doing is to look at my code in https://github.com/VictorNorman/AudioPlayFromData.

See home.page.ts and code.ts for code that copies files, reads them, changes the URLs to be useable, etc.

Basic Validation in Ionic 5

Ionic Android 5.1.1 SyntaxError: Use of const in strict mode

$
0
0

Hello,

do you found any solutions ?

Viewing all 228535 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>