forked from EVOgeek/Vmeda.Online
		
	MOBILE-2995 qr: Add scan QR button in login
This commit is contained in:
		
							parent
							
								
									e14b3ed0f8
								
							
						
					
					
						commit
						394dd6e24d
					
				| @ -47,6 +47,11 @@ | ||||
|                     <ion-option *ngFor="let site of fixedSites" [value]="site.url">{{site.name}}</ion-option> | ||||
|                 </ion-select> | ||||
|             </ion-item> | ||||
| 
 | ||||
|             <a *ngIf="showScanQR" ion-button block color="light" margin-top icon-start (click)="scanQR()"> | ||||
|                 <core-icon name="fa-qrcode" aria-hidden="true"></core-icon> | ||||
|                 {{ 'core.scanqr' | translate }} | ||||
|             </a> | ||||
|         </form> | ||||
| 
 | ||||
|         <!-- Pick the site from a list of fixed sites. --> | ||||
|  | ||||
| @ -58,6 +58,7 @@ export class CoreLoginSitePage { | ||||
|     loadingSites = false; | ||||
|     onlyWrittenSite = false; | ||||
|     searchFnc: Function; | ||||
|     showScanQR: boolean; | ||||
| 
 | ||||
|     constructor(navParams: NavParams, | ||||
|             protected navCtrl: NavController, | ||||
| @ -74,6 +75,7 @@ export class CoreLoginSitePage { | ||||
|             protected utils: CoreUtilsProvider) { | ||||
| 
 | ||||
|         this.showKeyboard = !!navParams.get('showKeyboard'); | ||||
|         this.showScanQR = this.utils.canScanQR(); | ||||
| 
 | ||||
|         let url = ''; | ||||
| 
 | ||||
| @ -356,4 +358,17 @@ export class CoreLoginSitePage { | ||||
|       }; | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * Scan a QR code and put its text in the URL input. | ||||
|      */ | ||||
|     scanQR(): void { | ||||
|         // Scan for a QR code.
 | ||||
|         this.utils.scanQR().then((text) => { | ||||
|             if (text) { | ||||
|                 this.siteForm.controls.siteUrl.setValue(text); | ||||
| 
 | ||||
|                 this.connect(new Event('click'), text); | ||||
|             } | ||||
|         }); | ||||
|     } | ||||
| } | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user