Quantcast
Channel: Ionic Forum - Latest topics
Viewing all 70434 articles
Browse latest View live

How to implement a cancel function to several downloads being made using Promise.all()

$
0
0

@leonardofmed wrote:

I have a Promise.all() that returns when all my download promises are finished, the downloads are basically several images. I’m trying to add the possibility to cancel the remainig downloads in the list of urls that is passed to Promise.all(). I tried some ways to do this, but the remainig items are always downloaded anyway.

How my code is right now:

async downloadFunction(arrayToDownload: Object[]): Promise<void[]> {
	let loading = await this.loadingController.create({
		message: 'Touch backgroud to cancel',
		backdropDismiss: true
	});
	await loading.present();

	const fileTransfer: FileTransferObject = this.transfer.create();
	let canceled: boolean = false;

	loading.onDidDismiss().then(obj => {
		console.log(obj); // obj.role will be = 'backdrop' if clicked in background
		if (obj.role === 'backdrop') {
			console.log('canceled');
			//fileTransfer.abort(); -> Tried to abort filetransfer here first, but it seems that it need to be fired during download.
			canceled = true;
			return;
		}
	}); 

	return Promise.all(arrayToDownload.map(element => {
		if (canceled === true) {
			return;	// Added a return here, so it would skip the rest, but didn't work					
		}

		if (element != undefined) {
			// Get data from URL and do other preparations
			//...

			return fileTransfer.download(encodedURI, this.file.externalDataDirectory + 'randomFolder').then(entry => {
				return;
			
			}, error => {
				console.log("Error while downloading image: ", error);
				return;		
			}).catch(error => {
				console.log("Error while downloading image: ", error);
				return;
			}); 
		} else {
			throw new Error("image url not available");  				
		}

	})).then(() => {
		loading.dismiss();
		return [];
	});
}

Posts: 1

Participants: 1

Read full topic


Trouble with Google map plugins

Can't resolve all parameters for setupplatform

$
0
0

@stammroy wrote:

I need your help. What is wrong:

Uncaught Error: Can’t resolve all parameters for setupPlatform: (?, [object Object], [object Object]).

Here my package.json:
“dependencies”: {

"@angular/animations": "8.2.14",

"@angular/common": "8.2.14",

"@angular/compiler": "8.2.14",

"@angular/compiler-cli": "8.2.14",

"@angular/core": "8.2.14",

"@angular/forms": "8.2.14",

"@angular/http": "^7.2.16",

"@angular/platform-browser": "8.2.14",

"@angular/platform-browser-dynamic": "8.2.14",

"@angular/platform-server": "8.2.14",

"@angular/router": "8.2.14",

"@ionic-native/core": "~5.23.0",

"@ionic-native/native-audio": "^5.23.0",

"@ionic-native/onesignal": "^5.23.0",

"@ionic-native/splash-screen": "~5.23.0",

"@ionic-native/sqlite": "^5.23.0",

"@ionic-native/sqlite-porter": "^5.23.0",

"@ionic-native/status-bar": "~5.23.0",

"@ionic-native/web-intent": "^5.23.0",

"@ionic/angular": "^5.0.7",

"@ionic/storage": "2.2.0",

"@ngx-translate/core": "^12.1.2",

"@ngx-translate/http-loader": "^4.0.0",

"@stomp/ng2-stompjs": "^7.2.0",

"@swimlane/ngx-datatable": "^16.0.3",

"chart.js": "^2.9.3",

"com-darryncampbell-cordova-plugin-intent": "2.0.0",

"cordova-android": "^8.1.0",

"cordova-plugin-device": "^2.0.3",

"cordova-plugin-ionic-keyboard": "2.2.0",

"cordova-plugin-ionic-webview": "4.1.3",

"cordova-plugin-nativeaudio": "^3.0.9",

"cordova-plugin-splashscreen": "5.0.3",

"cordova-plugin-statusbar": "2.4.3",

"cordova-plugin-whitelist": "1.3.4",

"cordova-sqlite-storage": "5.0.0",

"ionic-angular": "3.9.9",

"ionicons": "^4.6.4-1",

"linkifyjs": "^2.1.9",

"onesignal-cordova-plugin": "2.8.4",

"onesignal-push-icon": "^0.1.1",

"rxjs": "~6.4.0",

"rxjs-compat": "^6.5.4",

"sw-toolbox": "3.6.0",

"uk.co.workingedge.cordova.plugin.sqliteporter": "^1.1.1",

"zone.js": "0.10.3"

},

“devDependencies”: {

"@ionic/app-scripts": "^3.2.4",

"copyfiles": "^2.2.0",

"typescript": "^3.8.3",

"cordova-plugin-console": "^1.1.0",

"ionic-plugin-keyboard": "^2.2.1",

"cordova-plugin-x-toast": "^2.7.2",

"cordova-plugin-background-mode": "~0.7.3"

},

Posts: 1

Participants: 1

Read full topic

Open specific page when app is not running

$
0
0

@divyasmehta wrote:

I am creating a voip app. I am sending a FCM push notification to my ionic app when there is a new call instantiated. I want to show my call’s screen when notification is received.
I am stuck in this issue and didn’t find any solution.
Can someone help me with this? How can I open the app and show the call’s page with a ringtone in incoming push notification?
Any help will be really appreciated. Thanks!

Posts: 2

Participants: 2

Read full topic

Keychain touch id issue on ios

$
0
0

@baako wrote:

I need help please, I am using this plugin https://ionicframework.com/docs/native/keychain-touch-id for fingerprint and face ID, using the example code, it works on android, however on IOS I am getting an error Password could not be save in chain

my angular code looks like

await this.keychainTouchId.isAvailable().then((res: any) => {
   console.log(res); `// res = true`
  this.keychainTouchId.save('refresh_token', credentials, true).then((result: any) => {
     console.log(result);`  // result = Password could not be save in chain`
     return result;
   }).catch((err: any) => {
      console.log('key save error ' + err)
      return err;
});

I believe this might be broken because i created cordova app project just to test it, using the example code in https://github.com/sjhoeksma/cordova-plugin-keychain-touch-id the fingerprint dialog shows on ios. So I am left really confused.
Is the an issue with the ionic-native library?

Posts: 1

Participants: 1

Read full topic

Feat: picker component, Multiple tab design and Ionic calendar

$
0
0

@indraraj26 wrote:

Go to below link and thumbs up Guys if you want this components/styles to be in core ionic

Picker Component

Ionic Calendar

Multiple Tab Design

Thank you.

Posts: 1

Participants: 1

Read full topic

Ionic 4: CORS issue

$
0
0

@venkateshb wrote:

I am using a reverse proxy from serverside, and we have multiple servers(Environments).
I have configured these below rule to access My servers API’s

Header always set Access-Control-Allow-Headers "X-Requested-With, X-HTTP-Method-Override, Accept, x-forwarded-user, workspacekey, upgrade-insecure-requests, csrf-token, Access-Control-Allow-Origin, cookie, Content-Type, lazyupdate, x-http-method, X-Requested-With, normalizednames, headers"
Header always set Access-Control-Allow-Credentials "true"
Header always set Access-Control-Allow-Origin *

I tried below example to access proxy URLs to resolved CORS issue: but no use.

https://ionicframework.com/blog/handling-cors-issues-in-ionic/
its throwing below error:

Access to XMLHttpRequest at 'https://ionicabc.com/getUserinitContext?_dc=1585750583523&$format=JSON' from origin 'http://localhost:8100' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: The value of the 'Access-Control-Allow-Origin' header in the response must not be the wildcard '*' when the request's credentials mode is 'include'. The credentials mode of requests initiated by the XMLHttpRequest is controlled by the withCredentials attribute.

Code of http call:
Headers that i am inclding while API call:

const headers = {
            'Content-Type': 'application/json; charset=UTF-8',
            'Accept': '*/*',
            'X-Requested-With': 'XMLHttpRequest',
            'isMobileApp': 'true',
            'x-http-method': 'MERGE'
        };

const options = { headers, observe: 'response' as 'body' };
return this.httpClient.get(url, options)
            .map(this._mapResponse)
            .catch(err => this.onError(err))
            .do(response => this.onSuccess(response));

Note: We have a VPAT team which says allowing localhost in the server can cause severe security issue, so we are not allowing specific to localhost in the “Access-Control-Allow-Origin Header”.

Help will be appriciated.

Posts: 1

Participants: 1

Read full topic

Ionic View with Vue project?

$
0
0

@ancor wrote:

Hi there!

I am testing with ionic-vue but I cannot find a way to launch my app to the ionic view application. Is it possible to do it?

Thanks greetings.

Posts: 1

Participants: 1

Read full topic


Ionic 4 show live location from mysql database

$
0
0

@sehsah2020 wrote:

hi ,

i’ve two application
first app update location with geolocation to mysql database
second app i need show location on google map by get location from database when updated

how can i make it ?

Posts: 1

Participants: 1

Read full topic

How to change background color of ion-radio without updating background color of entire app?

$
0
0

@Sweg wrote:

I am trying to change the background of the ion-radio-group below to match the other rows:

enter image description here

I have shown my HTML & CSS below.

I tried adding the rowStyle class to the row. That changes the background of the row, but the radio button’s are still appearing blue.

If I update the --ion-background-color value in my CSS for ion-content , the radio button background does change, but so does the entire page.

I just want all the rows to match.

Can someone please tell me how to do this?

<ion-content>
  <ion-grid style="width: 75%">

    <ion-radio-group [(ngModel)]="userType">
      <ion-row class="rowStyle">
        <ion-item>
          <ion-label>Customer</ion-label>
          <ion-radio value="customer"></ion-radio>
        </ion-item>
        <ion-item>
          <ion-label>Supplier</ion-label>
          <ion-radio value="supplier"></ion-radio>
        </ion-item>
      </ion-row>
    </ion-radio-group>

    <ion-row class="rowStyle">
      <ion-icon name="person" color="secondary"></ion-icon>
      <ion-input type="text" placeholder="Your Name" [(ngModel)]="name"></ion-input>
    </ion-row>

    <ion-row class="rowStyle">
      <ion-icon name="mail" color="secondary"></ion-icon>
      <ion-input type="email" placeholder="Your Email" [(ngModel)]="email"></ion-input>
    </ion-row>

    <ion-row class="rowStyle">
      <ion-icon name="key" color="secondary"></ion-icon>
      <ion-input type="password" placeholder="Your Password" [(ngModel)]="password"></ion-input>
    </ion-row>

    <ion-button expand="block" shape="round" fill="outline" color="light" style="margin-top: 20px;" (click)="signUp()">Sign Up</ion-button>
  </ion-grid>
</ion-content>

CSS:

ion-content {
    --ion-background-color:#3dc2ff;
  }

  .logo { 
    font-size: 25vh;
    margin-top: 40px;
    margin-bottom: 20px;
  }

  h1, h6 {
    color: white;
    font-size: 1em;
    background-color: danger
  }

  .rowStyle {
    background-color: white;
    padding-left: 10px;
    border-radius: 30px;
    margin-bottom: 10px;

    ion-icon {
      margin-top: 13px;
      margin-right: 10px;
    }
  }

I added the rowStyle class to the row. The background of the tag is appearing white, but the background of the 2 radio buttons isn’t changing.

Posts: 1

Participants: 1

Read full topic

How to remove bottom border of ?

$
0
0

@Sweg wrote:

I am displaying some radio buttons like so:

snip2

But now I want to remove the bottom border from them.

Below is my HTML & CSS, can someone please tell me how to do this?

<ion-radio-group [(ngModel)]="userType">
      <ion-row class="rowStyle">
        <ion-item color="primary-contrast">
          <ion-label>Customer:</ion-label>
          <ion-radio value="customer"></ion-radio>
        </ion-item>
        <ion-item color="primary-contrast">
          <ion-label>Supplier:</ion-label>
          <ion-radio value="supplier"></ion-radio>
        </ion-item>
      </ion-row>
    </ion-radio-group>

CSS:

.rowStyle {
    background-color: white;
    padding-left: 10px;
    border-radius: 30px;
    margin-bottom: 10px;
  
    ion-icon {
      margin-top: 13px;
      margin-right: 10px;
    }
  }

Posts: 1

Participants: 1

Read full topic

Mousewheel and keyboard is not working on mac for ionslide component

$
0
0

@saammybwoy wrote:

When I scroll using trackpad on ionslides, slides are not scrolling up , i have to move them by clicking and dragging.

But on idangerous website in mousewheel demo, it is working fine.

Posts: 1

Participants: 1

Read full topic

Is it possibile to "slice" a Modal?

$
0
0

@Fringo wrote:

Hi, i’m trying to make something like the image shown below.

The “pop-up” is swipable and all three elements closes toghether

I tried with Modals but i think i cannot call 3 different modals at the same time or “slice” a modal in three pieces showing different content.

Another option could be using multipleToasts but i can’t put HTML (images, link ecc) into a toast and, afterall, this isn’t the purpose of this kind of Ionic Component.

So, any ideas?
Any kind of help is very appreciated

Posts: 2

Participants: 2

Read full topic

How to implement scrolling bar of IonicChips in React

$
0
0

@matthewgoodman13 wrote:

Hi,
I am having trouble being able to make a horizontal scrolling bar of Ionic Chips. How can I implement this.
I am trying to get the ‘filter’ or ‘category’ effect. The photo below shows what I have. I want all the ‘Chips’ to be horizontally scroll-able on one row so I can add as many as I want.

bar

Posts: 1

Participants: 1

Read full topic

Trigger an event on user is on screen lock

$
0
0

@Ludoztw wrote:

Hello,

Do you know if it’s possible to trigger an event in my Ionic application on user is checking his screen lock (Android device)

Example :

?.on('...', function() {
   console.log("I turned on my screen and I'm on screenlock!");
});

Many thanks,

Posts: 1

Participants: 1

Read full topic


Button Auto Submit

$
0
0

@viswanathb wrote:

Hello I’ve developed an SMS reader application I want to auto submit the message after receiving it is there any way I tried calling that click function using an if based on the length of SMS body but is not working can anyone help me do this

<ion-header>
  <ion-toolbar color="primary"></ion-toolbar>
</ion-header>
<ion-content no-padding>
      <h2 style="text-align: center;">AUTO SMS READER</h2>
        <ion-row>
          <ion-col>
            <p style="text-align: center;"> Note : Send SMS to this Mobilenumber it will auto read the message</p>
          </ion-col>
        </ion-row>
        <ion-row>
          <ion-col>
            <ion-item>
              <ion-input type="number"   [(ngModel)]="phone" required>{{smsaddress}}</ion-input>
            </ion-item>
            <ion-item>
              <ion-input type="text"   [(ngModel)]="message" required>{{smsbody}}</ion-input>
            </ion-item>
          </ion-col>
        </ion-row>
        <ion-row>
          <ion-col>
            <ion-button expand="block" (click)="submit()" color="undefined" class="transition">
              <strong class="white">
                SUBMIT </strong></ion-button>
          </ion-col>
        </ion-row>
</ion-content>
ts code 

ionViewWillEnter() {
    this.start();
     }

  start() {
    SMSReceive.startWatch(
      () => {
        console.log('watch started');
        document.addEventListener('onSMSArrive', (e: any) => {
          console.log('onSMSArrive()');
          var IncomingSMS = e.data;
          this.smsaddress = IncomingSMS.address;
          this.smsbody = IncomingSMS.body;
          console.log(JSON.stringify(this.smsbody))
        });
      },
      () => { console.log('watch start failed') }
    )
 
  }

  resetdata(){
    this.smsaddress="";
    this.smsbody="";
  }

  submit() {
    var data = {
      phone: this.smsaddress,
      message: this.smsbody,
    }
       const headers = new HttpHeaders();  
    headers.append('content-type', 'application/json');
    this.http.post(this.ip + '/api/test', data,
      { headers: new HttpHeaders({ "content-Type": "application/json" }) }).subscribe(response => {
       alert(response);
        alert(JSON.stringify(response));
      })
    this.presentToast('Message has been submitted successfully', false, 'bottom');
    this.resetdata();
  }

 
 

Posts: 1

Participants: 1

Read full topic

Unable to implement ionic animation in a div inside every slider

$
0
0

@dipankar123 wrote:

Dear all,
I am trying to implement ionic animation api inside a div. this div is placed in every ion-slide
ionic animation working in 1st ion-slide but not working from 2nd ion-slide

here is my code
HTML

<ion-slides #slider [options]="slideOpts" effect='fade'  (ionSlideDidChange)='slideChanged()'>
    <ion-slide class="slider" *ngFor="let item of slideImages" [ngStyle]="{'background-image': 'url('+item.image+')'}">
      <div class="slide-background">
        <div class="info-on" id="info"
        [innerHTML]="domSanithize.bypassSecurityTrustHtml(item.info)" #animatedInfo>
      </div>
      </div>
    </ion-slide>
  </ion-slides>

page.ts

slideImages = [
    {
      info: 'this is <br><span style=\'font-size: 3rem;font-weight: 900\'>First information</span><br> click  here',
      image: '../../../assets/IMG/frstInfo.jpg',
    },
    {
      info: 'this is <br><span style=\'font-size: 3rem;font-weight: 900\'>Second information</span><br> click  here',
      image: '../../../assets/IMG/2ndInfo.jpg',
    },
    {
      info: 'this is <br><span style=\'font-size: 3rem;font-weight: 900\'>Thirs information</span><br> click  here',
      image: '../../../assets/IMG/3rdInfo.jpg',
    },
]


ngOnInit() {
    this.menu.enable(false);
    setTimeout(() => {
      this.playAnimation(); //<--animation working
    }, 700);
  }

playAnimation() {
    console.log('started animation');
    this.animation = Animation;
    this.animation = this.animationCtrl.create()
      .addElement(this.animatedInfo.nativeElement)
      .duration(1300)
      .fromTo('left', '-10px', '10px')
      .fromTo('opacity', '0', '1');

    this.animation.play();
}

slideChanged() {
    this.playAnimation()// not working
  }

please help
thanks in advance

Posts: 1

Participants: 1

Read full topic

IonSegment default checked item not working

$
0
0

@tanchifu wrote:

I have used IonSegment in Ionic v4, and I just updated ionic to v5 (5.0.7) But the default selection is not working any more! Help!

Posts: 1

Participants: 1

Read full topic

PWA firebase push : messaging.onMessage never called

$
0
0

@vgoesi06 wrote:

Hi alls,
I have an ionic 4 angular PWA project and want to use firebase cloud messaging.
Registration with firebase is ok aénd I can get token my problem that messaging.onMessage never called and the notification catched by OS

this my firebase-messagin-sw.js

importScripts('https://www.gstatic.com/firebasejs/7.12.0/firebase-app.js');
importScripts('https://www.gstatic.com/firebasejs/7.12.0/firebase-messaging.js');

const messaging = firebase.messaging();

messaging.setBackgroundMessageHandler(function(payload) {
  
    const notificationTitle = 'Background Message Title';
    const notificationOptions = {
      body: 'Test ' + JSON.stringify(payload),
      
    };
  
    return self.registration.showNotification(notificationTitle,
      notificationOptions);
});

other staff is made in my notification service

Any idea ?

Posts: 1

Participants: 1

Read full topic

Ionic navbar dropdown-menu

$
0
0

@akshh wrote:

Wanted to create dropdown menu similar to the picture mentioned.Can anyone please help me regarding this.Clicking on icon must display the dropdown.Usage angular ionic4. dropdown .

Posts: 1

Participants: 1

Read full topic

Viewing all 70434 articles
Browse latest View live


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