From 6a6475365efeb79e31a36a513766985fd7c929bc Mon Sep 17 00:00:00 2001 From: Tom Fong Date: Mon, 10 Jan 2022 00:37:24 +0800 Subject: [PATCH] refactor: remove comments --- src/app/app.module.ts | 4 - src/app/pages/history/history.page.ts | 57 ------- .../pages/import-image/import-image.page.ts | 1 - src/app/pages/result/result.page.ts | 161 +----------------- 4 files changed, 1 insertion(+), 222 deletions(-) diff --git a/src/app/app.module.ts b/src/app/app.module.ts index a7cacdd..6e7bed5 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -12,15 +12,12 @@ import { TranslateModule, TranslateLoader } from '@ngx-translate/core'; import { TranslateHttpLoader } from '@ngx-translate/http-loader'; import { HttpClient, HttpClientModule } from '@angular/common/http'; import { IonicStorageModule } from '@ionic/storage-angular'; -//import { Clipboard } from '@ionic-native/clipboard/ngx'; import { SocialSharing } from '@ionic-native/social-sharing/ngx'; import { CallNumber } from '@ionic-native/call-number/ngx'; import { SMS } from '@ionic-native/sms/ngx'; import { ThemeDetection } from '@ionic-native/theme-detection/ngx'; -//import { Device } from '@ionic-native/device/ngx'; import { AppVersion } from '@ionic-native/app-version/ngx'; import { OpenNativeSettings } from '@ionic-native/open-native-settings/ngx'; -//import { Camera } from '@ionic-native/camera/ngx'; import { File } from '@ionic-native/file/ngx'; import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; @@ -70,7 +67,6 @@ export function HttpLoaderFactory(http: HttpClient): TranslateHttpLoader { { provide: RouteReuseStrategy, useClass: IonicRouteStrategy }, AppVersion, CallNumber, - // Camera, DatePipe, DeviceMotion, File, diff --git a/src/app/pages/history/history.page.ts b/src/app/pages/history/history.page.ts index f70ccf1..61ca1b2 100644 --- a/src/app/pages/history/history.page.ts +++ b/src/app/pages/history/history.page.ts @@ -45,9 +45,7 @@ export class HistoryPage { } async ionViewDidEnter() { - // const loading = await this.presentLoading(this.translate.instant("PLEASE_WAIT")); await this.loadItems(); - // loading.dismiss(); this.firstLoad = false; if (this.env.notShowHistoryTutorial === false) { this.env.notShowHistoryTutorial = true; @@ -209,61 +207,6 @@ export class HistoryPage { } } - // async openMenu(ev: Event) { - // const menuItems = []; - - // const tutorialMenuItem = new MenuItem(); - // tutorialMenuItem.icon = { - // nameOrSrc: 'name', - // ref: 'book', - // color: 'primary' - // }; - // tutorialMenuItem.label = 'TUTORIAL'; - // tutorialMenuItem.action = 'tutorial'; - // menuItems.push(tutorialMenuItem); - - // const removeAllMenuItem = new MenuItem(); - // removeAllMenuItem.icon = { - // nameOrSrc: 'name', - // ref: 'trash', - // color: 'danger' - // }; - // removeAllMenuItem.label = 'REMOVE_ALL'; - // removeAllMenuItem.action = 'remove'; - // menuItems.push(removeAllMenuItem); - - // const popover = await this.popoverController.create({ - // component: MenuComponent, - // mode: "ios", - // animated: true, - // event: ev, - // translucent: false, - // showBackdrop: true, - // componentProps: { menuItems } - // }); - // popover.onWillDismiss().then( - // async (result) => { - // if (result.data != null && result.data?.action != null) { - // const action = result.data?.action as 'tutorial' | 'remove'; - // switch (action) { - // case 'tutorial': - // const modal = await this.modalController.create({ - // component: HistoryTutorialPage, - // cssClass: 'tutorial-modal-page', - // componentProps: { - // } - // }); - // modal.present(); - // break; - // case 'remove': - // await this.removeAll(); - // break; - // } - // } - // }); - // await popover.present(); - // } - async presentAlert(msg: string, head: string, buttonText: string, buttonless: boolean = false): Promise { let alert: any; if (!buttonless) { diff --git a/src/app/pages/import-image/import-image.page.ts b/src/app/pages/import-image/import-image.page.ts index 31640c2..456789d 100644 --- a/src/app/pages/import-image/import-image.page.ts +++ b/src/app/pages/import-image/import-image.page.ts @@ -20,7 +20,6 @@ export class ImportImagePage { private alertController: AlertController, private loadingController: LoadingController, private toastController: ToastController, - // private camera: Camera, private router: Router, ) { } diff --git a/src/app/pages/result/result.page.ts b/src/app/pages/result/result.page.ts index 8f22865..2eb8558 100644 --- a/src/app/pages/result/result.page.ts +++ b/src/app/pages/result/result.page.ts @@ -1,19 +1,16 @@ import { Component, OnInit } from '@angular/core'; import { ActivatedRoute, Router } from '@angular/router'; import { CallNumber } from '@ionic-native/call-number/ngx'; -// import { Clipboard } from '@ionic-native/clipboard/ngx'; import { Clipboard } from '@capacitor/clipboard'; import { Contacts, ContactType, EmailAddress, NewContact, PhoneNumber } from '@capacitor-community/contacts' import { SMS } from '@ionic-native/sms/ngx'; import { SocialSharing } from '@ionic-native/social-sharing/ngx'; -import { Haptics, ImpactStyle, NotificationType } from '@capacitor/haptics'; +import { Haptics, ImpactStyle } from '@capacitor/haptics'; import { AlertController, LoadingController, ModalController, Platform, PopoverController, ToastController } from '@ionic/angular'; import { TranslateService } from '@ngx-translate/core'; import { NgxQrcodeElementTypes, NgxQrcodeErrorCorrectionLevels } from '@techiediaries/ngx-qrcode'; import { VCardContact } from 'src/app/models/v-card-contact'; import { EnvService } from 'src/app/services/env.service'; -import { MenuItem } from 'src/app/models/menu-item'; -import { MenuComponent } from 'src/app/components/menu/menu.component'; import { QrcodeComponent } from 'src/app/components/qrcode/qrcode.component'; @Component({ @@ -50,8 +47,6 @@ export class ResultPage implements OnInit { base64Decoded: boolean = false; base64DecodedText: string = ""; - // webToast: HTMLIonToastElement; - bookmarked: boolean = false; constructor( @@ -89,58 +84,11 @@ export class ResultPage implements OnInit { }, 200 ); } - // if (this.contentType === "url") { - // this.webToast = await this.toastController.create({ - // header: this.translate.instant('WEBSITE'), - // message: `${this.qrCodeContent}`, - // duration: 3000, - // mode: "ios", - // color: "light", - // position: "top", - // buttons: [ - // { - // text: this.translate.instant('OPEN'), - // side: 'end', - // handler: () => { - // this.browseWebsite(); - // this.webToast.dismiss(); - // } - // } - // ] - // }); - // this.webToast.present(); - // } - // if (this.contentType === "wifi") { - // if (this.wifiSSID) { - // this.webToast = await this.toastController.create({ - // header: this.translate.instant('WIFI_NETWORK'), - // message: `SSID: ${this.wifiSSID}`, - // duration: 3000, - // mode: "ios", - // color: "light", - // position: "top", - // buttons: [ - // { - // text: this.translate.instant('CONNECT'), - // side: 'end', - // handler: async () => { - // await this.connectWifi(); - // } - // } - // ] - // }); - // this.webToast.present(); - // } - // } } async ionViewWillLeave(): Promise { this.base64Decoded = false; this.base64Encoded = false; - // if (this.webToast) { - // this.webToast.dismiss(); - // this.webToast = undefined; - // } } setContentType(): void { @@ -182,12 +130,10 @@ export class ResultPage implements OnInit { } get qrColorDark(): string { - // return this.env.colorTheme === "dark" ? "#ffffff" : "#222428"; return "#222428"; } get qrColorLight(): string { - // return this.env.colorTheme === "dark" ? "#121212" : "#ffffff"; return "#ffffff"; } @@ -692,111 +638,6 @@ export class ResultPage implements OnInit { } } - // async openMenu(ev: Event) { - // const menuItems = []; - - // const browseWebsiteMenuItem = new MenuItem(); - // browseWebsiteMenuItem.icon = { - // nameOrSrc: 'name', - // ref: 'globe', - // color: 'primary' - // }; - // browseWebsiteMenuItem.label = 'BROWSE_WEBSITE'; - // browseWebsiteMenuItem.action = 'browse'; - - // const addContactMenuItem = new MenuItem(); - // addContactMenuItem.icon = { - // nameOrSrc: 'name', - // ref: 'person-add-sharp', - // color: 'primary' - // }; - // addContactMenuItem.label = 'ADD_CONTACT'; - // addContactMenuItem.action = 'contact'; - - // const callMenuItem = new MenuItem(); - // callMenuItem.icon = { - // nameOrSrc: 'name', - // ref: 'call', - // color: 'primary' - // }; - // callMenuItem.label = 'CALL'; - // callMenuItem.action = 'call'; - - // const sendMessageMenuItem = new MenuItem(); - // sendMessageMenuItem.icon = { - // nameOrSrc: 'name', - // ref: 'send', - // color: 'primary' - // }; - // sendMessageMenuItem.label = 'SEND_MESSAGE'; - // sendMessageMenuItem.action = 'message'; - - // const sendEmailMenuItem = new MenuItem(); - // sendEmailMenuItem.icon = { - // nameOrSrc: 'name', - // ref: 'mail', - // color: 'primary' - // }; - // sendEmailMenuItem.label = 'SEND_EMAIL'; - // sendEmailMenuItem.action = 'email'; - - // switch (this.contentType) { - // case "url": - // menuItems.push(browseWebsiteMenuItem); - // break; - // case "contact": - // menuItems.push(addContactMenuItem); - // break; - // case "phone": - // menuItems.push(callMenuItem); - // menuItems.push(addContactMenuItem); - // break; - // case "sms": - // if (this.smsContent) { - // menuItems.push(sendMessageMenuItem); - // } - // menuItems.push(addContactMenuItem); - // break; - // case "email": - // menuItems.push(sendEmailMenuItem); - // break; - // } - - // const popover = await this.popoverController.create({ - // component: MenuComponent, - // mode: "ios", - // animated: true, - // event: ev, - // translucent: false, - // showBackdrop: true, - // componentProps: { menuItems } - // }); - // popover.onWillDismiss().then( - // async (result) => { - // if (result.data != null && result.data?.action != null) { - // const action = result.data?.action as 'browse' | 'contact' | 'call' | 'message' | 'email'; - // switch (action) { - // case 'browse': - // this.browseWebsite(); - // break; - // case 'contact': - // this.addContact(); - // break; - // case 'call': - // this.callPhone(); - // break; - // case 'message': - // this.sendSms(); - // break; - // case 'email': - // this.sendEmail(); - // break; - // } - // } - // }); - // await popover.present(); - // } - async presentToast(msg: string, msTimeout: number, pos: "top" | "middle" | "bottom", align: "left" | "center", size: "short" | "long") { if (size === "long") { if (align === "left") {