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

NullInjectorError: No provider for IonRouterOutlet!

$
0
0

Hi guys, I really need your help. I’m about to rage quit!

I’m trying to create a simple modal component but keep getting this error and I don’t know what to do :sob:

Discover Page” is a tab of my “Index Page

discover.module.ts

import { NgModule } from "@angular/core";
import { CommonModule } from "@angular/common";
import { FormsModule } from "@angular/forms";
import { IonicModule } from "@ionic/angular";
import { DiscoverPageRoutingModule } from "./discover-routing.module";
import { DiscoverPage } from "./discover.page";

@NgModule({
  imports: [
    CommonModule,
    FormsModule,
    IonicModule.forRoot(),
    DiscoverPageRoutingModule,
  ],
  declarations: [DiscoverPage],
})
export class DiscoverPageModule {}

discover.page.ts

...
import { StoreProfileModalComponent } from "../../components/store-profile-modal/store-profile-modal.component";
import { ModalController, IonRouterOutlet } from "@ionic/angular";
...
constructor(
    private routerOutlet: IonRouterOutlet,
    private modalController: ModalController
  ) {}

async openStoreProfileModal(storeID: number) {
    const storeProfileModal = await this.modalController.create({
      component: StoreProfileModalComponent,
      presentingElement: this.routerOutlet.nativeEl,
      swipeToClose: true,
      componentProps: {
        storeID: storeID,
      },
    });
    return await storeProfileModal.present();
  }

Please help

1 post - 1 participant

Read full topic


Problem displaying downloaded images (Angular)

$
0
0

I’ve been pulling my hair out the last many hours over this, I hope someone can help.

My application is downloading images for offline use. I use Angular and Cordova.

For a specific page I need to display:
Question image: 1 image placed it a separate component.
Answer images: 4 images placed in another separate component.

I use this code to display my image:
public win: any = window;
src = this.win.Ionic.WebView.convertFileSrc(this.file.dataDirectory + “images/” + image + “.png”);

All images are displayed correctly on Android emulator. Then on my iOS device ONLY the question image is displayed, not the answer images. If I replace the code above to display an online image, there are no problems on iOS either.

Another observation: If I place one of the answer images in the same component as the question image, it is displayed correctly.

Is there something in the code “Ionic.WebView.convertFileSrc” that only permits me to display the image in one componenet? What am I missing here?

1 post - 1 participant

Read full topic

[ionic5] cordova-res not working

$
0
0

Hey, im trying to change my app icon using cordova-res.

I installed cordova-res by:

npm install cordova-res@latest -g

When im using cordova-res I get this:

Error: Unmatched closing tag: widget
Line: 15
Column: 9
Char: >
at error (/Users/vitalthings/.nvm/versions/node/v14.4.0/lib/node_modules/cordova-res/node_modules/sax/lib/sax.js:666:10)
at strictFail (/Users/vitalthings/.nvm/versions/node/v14.4.0/lib/node_modules/cordova-res/node_modules/sax/lib/sax.js:692:7)
at closeTag (/Users/vitalthings/.nvm/versions/node/v14.4.0/lib/node_modules/cordova-res/node_modules/sax/lib/sax.js:893:7)
at SAXParser.write (/Users/vitalthings/.nvm/versions/node/v14.4.0/lib/node_modules/cordova-res/node_modules/sax/lib/sax.js:1436:13)
at XMLParser.feed (/Users/vitalthings/.nvm/versions/node/v14.4.0/lib/node_modules/cordova-res/node_modules/elementtree/lib/parsers/sax.js:48:15)
at ElementTree.parse (/Users/vitalthings/.nvm/versions/node/v14.4.0/lib/node_modules/cordova-res/node_modules/elementtree/lib/elementtree.js:271:10)
at Object.parse (/Users/vitalthings/.nvm/versions/node/v14.4.0/lib/node_modules/cordova-res/node_modules/elementtree/lib/elementtree.js:584:8)
at Object.read (/Users/vitalthings/.nvm/versions/node/v14.4.0/lib/node_modules/cordova-res/dist/cordova/config.js:151:39)
at async AsyncFunction.CordovaRes [as run] (/Users/vitalthings/.nvm/versions/node/v14.4.0/lib/node_modules/cordova-res/dist/index.js:24:22)
at async AsyncFunction.runCommandLine (/Users/vitalthings/.nvm/versions/node/v14.4.0/lib/node_modules/cordova-res/dist/index.js:92:28)

1 post - 1 participant

Read full topic

Fonts selection for hybrid apps from Accessibility stand point

$
0
0

hello All, In a Hybrid mobile app, is it best to stick with default fonts that are coming from OS, for example, Roboto for Android and San Francisco for iOS, or should we overwrite and use a different one from accessibility standpoint? for example, Muli which is from google fonts? is there any resource that I can look into? Thanks in advance.

1 post - 1 participant

Read full topic

Pinch Image in Ionic 5

$
0
0

Good day! Has anyone managed to get an image pinch working in Ionic 5 ? Could anyone suggest please.

1 post - 1 participant

Read full topic

Android 10: Permissoins appear initially denied

$
0
0

In the app I’m working on, but also even in a fresh install of a basic test app, all permissions appear actively denied to start with on Android 10 and therefore can’t be requested from the user. This is not the case on Android 9, where they appear not requested yet.

I have the permissions entries in my manifest xml but is there something else I need to do? Target and compile SDK versions are set to 29, trying 28 didn’t have any effect.

1 post - 1 participant

Read full topic

Pre Sale Home Renovation Chicago | Monetize Chicago

$
0
0

Monetize is a pre-sale home renovation company based in Chicago, IL that serves real estate agents. We help decide upon a set of value-add improvements brokers can make to the client listings that will help them to sell faster and at a better price and their clients pay for the renovation at closing time. Visit here https://monetizechicago.com/

1 post - 1 participant

Read full topic

Can iOS Block my app for Limit Funcionality?

$
0
0

Hi all

I have a question about how iOS works, I have an application in the App Store, I need to block functionality if the user does not have the latest version installed.

Does anybody know if there is a problem when it comes to blocking / banning the application due to this issue?

From already thank you very much
Regards

1 post - 1 participant

Read full topic


Is there an Apollo client example?

$
0
0

Hi,
my Angular app built with Ionic is not working on Android. Apollo client is not responding. On PC everything is fine. Is there any example I could try?
Thanks

1 post - 1 participant

Read full topic

Ionic5 app problems on Android 5.1

$
0
0

I am creating an app with latest version of Ionic, that would run on a device with Android 5.1. The problem is that the app doesn’t look correctly once deployed to the actual device:

Left side is how it looks on the browse; right side is how it actually looks on the device (BTW, the Server # input on the device HAS a value, but its not visible for some reason). Any ideas of what the problem may be ?

Regards

Victor Espina

PD-1: Just tried with Capacitor: same problem.
PD-2: The problem is specific to Android 5.1. Just installed the exact same APK on an Android 6 and it runs perfectly.

1 post - 1 participant

Read full topic

Angular Routing Issue, "Can't resolve all parameters for NavParams: (?)"

$
0
0

Currently, I have been working on upgrading my current Ionic Cordova application from Ionic 3 to Ionic 5. In the process, the Angular routing has been throwing many errors and I was able to resolve most of them but when I try to change the root page for the application I always end up with a blank screen. I tried many online solutions but they did not work for me. Originally I tried the lazy loading method for all my pages but I found that it is a poor method so I changed it with direct imports. Currently, this is my app module:

@NgModule({
    declarations: [MyAppPage,
    ],
    entryComponents: [MyAppPage],
    imports: [BrowserModule,
        AppRoutingModule,
        HttpClientModule,
        IonicSignaturePadModule,
        IonicModule.forRoot()],
    providers: [
        StatusBar,
        SplashScreen,
        { provide: RouteReuseStrategy, useClass: IonicRouteStrategy },
        ApiService,
        Device,
        Camera,
        InAppBrowser,
        FingerprintAIO,
        LocalNotifications,
        Contacts,
        BackgroundMode,
        Keyboard,
        Firebase,
        Badge,
        HttpClient,
        IonicsignaturepadProvider,
        NavParams,
    ],
    bootstrap: [MyAppPage],
    schemas: [CUSTOM_ELEMENTS_SCHEMA]

})
export class AppModule {}

This is my app routing file:

import { NgModule } from '@angular/core';
import { PreloadAllModules, RouterModule, Routes } from '@angular/router';
import {APP_BASE_HREF} from '@angular/common';
import {AuthPageModule} from './auth/auth.module';
import {CareTeamPageModule} from './care-team/care-team.module';
import {CommunitiesPageModule} from './communities/communities.module';
import {DashboardPageModule} from './dashboard/dashboard.module';
import {FaqPageModule} from './faq/faq.module';
import {ForgotPasswordPageModule} from './forgot-password/forgot-password.module';
import {ForgotUsernamePageModule} from './forgot-username/forgot-username.module';
import {FriendsPageModule} from './friends/friends.module';
import {HcsPageModule} from './hcs/hcs.module';
import {HistoryPageModule} from './history/history.module';
import {LoginPageModule} from './login/login.module';
import {MedicineDetailPageModule} from './medicine-detail/medicine-detail.module';
import {MedicinesPageModule} from './medicines/medicines.module';
import {NotificationsPageModule} from './notifications/notifications.module';
import {PrivacyPageModule} from './privacy/privacy.module';
import {ProfilePageModule} from './profile/profile.module';
import {SettingsPageModule} from './settings/settings.module';
import {SignupPageModule} from './signup/signup.module';
import {TermsPageModule} from './terms/terms.module';
import {WearablesPageModule} from './wearables/wearables.module';

const routes: Routes = [
  { path: '', redirectTo: 'login', pathMatch: 'full' },
  {
    path: 'login',
    component: LoginPageModule
  },
  {
    path: 'auth',
    component: AuthPageModule,
  },
  {
    path: 'care-team',
    component: CareTeamPageModule
  },
  {
    path: 'communities',
    component: CommunitiesPageModule
  },
  {
    path: 'dashboard',
    component: DashboardPageModule
  },
  {
    path: 'faq',
    component: FaqPageModule
  },
  {
    path: 'forgot-password',
    component: ForgotPasswordPageModule
  },
  {
    path: 'forgot-username',
    component: ForgotUsernamePageModule
  },
  {
    path: 'friends',
    component: FriendsPageModule
  },
  {
    path: 'hcs',
    component: HcsPageModule
  },
  {
    path: 'history',
    component: HistoryPageModule
  },
  {
    path: 'medicine-detail',
    component: MedicineDetailPageModule
  },
  {
    path: 'medicines',
    component: MedicinesPageModule
  },
  {
    path: 'notifications',
    component: NotificationsPageModule
  },
  {
    path: 'privacy',
    component: PrivacyPageModule
  },
  {
    path: 'profile',
    component: ProfilePageModule
  },
  {
    path: 'settings',
    component: SettingsPageModule
  },
  {
    path: 'signup',
    component: SignupPageModule
  },
  {
    path: 'terms',
    component: TermsPageModule
  },
  {
    path: 'wearables',
    component: WearablesPageModule
  },
];

@NgModule({
  imports: [
    RouterModule.forRoot(routes, { preloadingStrategy: PreloadAllModules, enableTracing: true, useHash: true }),
    AuthPageModule,
    CareTeamPageModule,
    CommunitiesPageModule,
    DashboardPageModule,
    FaqPageModule,
    ForgotPasswordPageModule,
    ForgotUsernamePageModule,
    FriendsPageModule,
    HcsPageModule,
    HistoryPageModule,
    LoginPageModule,
    MedicineDetailPageModule,
    MedicinesPageModule,
    NotificationsPageModule,
    PrivacyPageModule,
    ProfilePageModule,
    SettingsPageModule,
    SignupPageModule,
    TermsPageModule,
    WearablesPageModule,
  ],
  providers: [{ provide: APP_BASE_HREF, useValue: '/' }, ],
  exports: [RouterModule]
})
export class AppRoutingModule { }

This is the app component:

import {Component, ViewChild} from '@angular/core';
import { NavController, Platform, ToastController, MenuController} from '@ionic/angular';
import { Router } from '@angular/router';
import {DashboardPage} from './dashboard/dashboard.page';
import {MedicinesPage} from './medicines/medicines.page';
import {CareTeamPage} from './care-team/care-team.page';
import {HcsPage} from './hcs/hcs.page';
import {SettingsPage} from './settings/settings.page';
import {CommunitiesPage} from './communities/communities.page';
import {FaqPage} from './faq/faq.page';
import {WearablesPage} from './wearables/wearables.page';

import {NotificationsPage} from './notifications/notifications.page';

import {FriendsPage} from './friends/friends.page';

import {Keyboard} from '@ionic-native/keyboard/ngx';

import {ApiService} from './services/app.services';
import {BackgroundMode} from '@ionic-native/background-mode/ngx';

import {Firebase} from '@ionic-native/firebase/ngx';

import {Badge} from '@ionic-native/badge/ngx';
import { SplashScreen } from '@ionic-native/splash-screen/ngx';

@Component({
    templateUrl: 'app.component.html',
    selector: 'app-root',
})
export class MyAppPage {
    @ViewChild(NavController) nav: NavController;

    backButtonPressedOnceToExit: any;
    menu: any;
    document: any;
    pages: Array<{ title: string, component: any, icon: string }>;
    hideWaves: boolean;
    bgInterval: any;
    config: {
        scrollAssist: false,
        autoFocusAssist: false
    };

    constructor(public platform: Platform,
                public splashScreen: SplashScreen,
                private toastCtrl: ToastController,
                private route: Router,
                // tslint:disable-next-line:no-shadowed-variable
                private ApiService: ApiService,
                public menuCtrl: MenuController,
                private keyboard: Keyboard,
                private backgroundMode: BackgroundMode,
                private fcm: Firebase,
                private badge: Badge
    ) {
        this.initializeApp();

        this.hideWaves = false;

        // used for an example of ngFor and navigation
        this.pages = [
            {title: 'Today\'s Meds', component: DashboardPage, icon: 'assets/imgs/menu-today-med.png'},
            {title: 'Medicines', component: MedicinesPage, icon: 'assets/imgs/menu-medicine.png'},
            {title: 'Healthcare Providers', component: CareTeamPage, icon: 'assets/imgs/menu-care-team.png'},
            {title: 'Invite Friends', component: FriendsPage, icon: 'assets/imgs/menu-friends.png'},
            {title: 'Communities', component: CommunitiesPage, icon: 'assets/imgs/menu-communities.png'},
            {title: 'Connect to healthcare systems', component: HcsPage, icon: 'assets/imgs/menu-hcs.png'},
            {title: 'Devices / Wearables', component: WearablesPage, icon: 'assets/imgs/menu-wearables.png'},
            {title: 'Notifications', component: NotificationsPage, icon: 'assets/imgs/menu-notification.png'},
            {title: 'Settings', component: SettingsPage, icon: 'assets/imgs/menu-setting.png'},
            {title: 'Help & Support', component: FaqPage, icon: 'assets/imgs/menu-help.png'}
        ];

        if (localStorage.getItem('userToken')) {
            this.route.navigate(['auth']);
        }else{
            this.route.navigate(['login']);
        }

    }

    initializeApp() {
        this.platform.ready().then(() => {

            // Clear badge
            this.badge.clear();
            // Okay, so the platform is ready and our plugins are available.
            // Here you can do any higher level native things you might need.
            // this.statusBar.styleDefault();
            this.splashScreen.hide();
            // this.backgroundMode.enable();
            // this.keyboard.onKeyboardShow().subscribe( (value)=>{
            //   this.hideWaves = true;
            // });

            // this.keyboard.onKeyboardHide().subscribe( (value)=>{
            //   this.hideWaves = false;
            // });

            // this.platform.registerBackButtonAction(() => {
            //   if (this.backButtonPressedOnceToExit) {
            //     this.platform.exitApp();
            //   } else if (this.nav.canGoBack()) {
            //     this.nav.pop({});
            //   } else {
            //     this.menu.close(); //Close menu if open
            //     this.showToast();
            //     this.backButtonPressedOnceToExit = true;
            //     setTimeout(() => {
            //       this.backButtonPressedOnceToExit = false;
            //     },2000)
            //   }
            // });
        });
    }

    logout() {
        this.menuCtrl.close();
        this.menuCtrl.get().then((menu: HTMLIonMenuElement) => {
          menu.swipeGesture = false;
        });
        this.ApiService.showToast('Logged Out');
        localStorage.removeItem('userId');
        localStorage.removeItem('userToken');
        localStorage.removeItem('userDetails');
        localStorage.removeItem('userNotifications');
    }

    profile() {
        this.menuCtrl.close();
        this.route.navigateByUrl('/profile');
    }

  async showToast() {
        const toast = await this.toastCtrl.create({
            message: 'Press Back Again To Exit The App',
            duration: 3000,
            position: 'bottom'
        });
        toast.present();
    }

    openPage(page) {
        // Reset the content nav to have just this page
        // we wouldn't want the back button to show in this scenario
        this.nav.navigateRoot(page.component);
    }
}

app.component.html:

<ion-menu [attr.content]="content" type="overlay" contentId="main">
<!--   <ion-header>
    <ion-toolbar>
      <ion-title>Menu</ion-title>
    </ion-toolbar>
  </ion-header>
 -->
  <ion-content>
    <div class = "menu-header">
    </div>
    <div class="ion-text-center center-content relative" (click) = "profile()">
      <img id = "userPicture" alt = "" src = "assets/imgs/user-default.png" />
      <div class = "profile-edit">
        <div class="ion-text-center">
          <img alt = "" src = "assets/imgs/camera_green.png" />
        </div>
      </div>
    </div>
    <ion-list class = "menu-list">
      <button menuClose ion-item *ngFor="let p of pages" (click)="openPage(p)">
        <img [src] = "p.icon" item-left />
        {{p.title}}
      </button>
    </ion-list>
    <div class="ion-text-right logout" (click) = "logout()">
      Logout
    </div>
  </ion-content>

</ion-menu>

<!-- Disable swipe-to-go-back because it's poor UX to combine STGB with side menus -->
<ion-app>
<router-outlet></router-outlet>
</ion-app>

login page routing module:

import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { IonicModule } from '@ionic/angular';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';

import { LoginPage } from './login.page';

const routes: Routes = [
  {
    path: '',
    component: LoginPage
  }
];

@NgModule({
  imports: [RouterModule.forChild(routes),
            IonicModule,
            CommonModule,
            FormsModule],
  exports: [RouterModule],
})
export class LoginPageRoutingModule {}

login.page.ts:

import { Component, OnInit } from '@angular/core';
import { NavController, Platform, NavParams, MenuController } from '@ionic/angular';
import {Routes, RouterModule, Router, ActivatedRoute} from '@angular/router';

import { ApiService } from '../services/app.services';
import { LoadingController } from '@ionic/angular';
import {NavigationExtras} from '@angular/router';
import { StatusBar } from '@ionic-native/status-bar/ngx';

@Component({
  selector: 'app-login',
  templateUrl: './login.page.html',
  styleUrls: ['./login.page.scss'],
  providers: [NavParams]
})
export class LoginPage implements OnInit {
  public navParams: NavParams;
  loginState: string;
  user: any;
  loading: any;
  hideWaves: boolean;
  origCode: number;
  showForgotPassword: boolean;
  userMobile: number;
  passwordType = 'password';
  passwordIcon = 'eye-off';
  constructor(private route: Router,
              public navCtrl: NavController,
              public statusBar: StatusBar,
              private loadingCtrl: LoadingController,
              private ApiService: ApiService,
              public menuCtrl: MenuController,
              public platform: Platform,
              private actRoute: ActivatedRoute,
  ) {
      this.loginState = 'init';
      this.showForgotPassword = false;
      this.user = {};
      this.actRoute.queryParams.subscribe(params => {
        if (route.getCurrentNavigation().extras.state) {
          this.loginState = route.getCurrentNavigation().extras.state.item;
        }
      });
      this.menuCtrl.get().then((menu: HTMLIonMenuElement) => {
        menu.swipeGesture = false;
      });
      this.statusBar.backgroundColorByHexString('#000000');
      this.statusBar.styleLightContent();
    }


  ngOnInit() {
    this.platform.ready().then(() => {
      // let video = this.mVideoPlayer.nativeElement;
      // video.src = "assets/video/clinakos_video.mp4";
      // video.load();
    });
  }

  ionViewWillLeave() {
    // the .nativeElement property of the ViewChild is the reference to the tag <video>
    // this.mVideoPlayer.nativeElement.src = '';
    // this.mVideoPlayer.nativeElement.load();
  }

  signUp() {
    this.navCtrl.navigateRoot('/signup');
  }

  signIn() {

    if ( (this.user.username) && (this.user.password) ) {

      this.loading = this.loadingCtrl.create({
        message: 'Please wait...'
      });
      this.loading.present();

      this.ApiService.login(this.user)
      .then(r => {
        localStorage.setItem('userToken', r.token);
        localStorage.setItem('userId', r.userId);

        // Check if user has reminders.
        this.ApiService.getReminders()
        .then(r => {
          this.loading.dismiss();
          this.navCtrl.navigateRoot('/dashboard');
          this.ApiService.showToast('Logged In');
        })
        .catch(e => {
          this.navCtrl.navigateRoot('/medicines');
          this.loading.dismiss();
          this.ApiService.showToast('Logged In');
        });



        this.menuCtrl.enable(true);
        this.menuCtrl.get().then((menu: HTMLIonMenuElement) => {
          menu.swipeGesture = true;
        });

        if (localStorage.getItem('userNotifications') === null) {
          localStorage.setItem('userNotifications', JSON.stringify([]));
        }

      })
      .catch(e => {
        console.log (e);
        if (e.status == '404') {
          this.ApiService.showToast('User does not exist');
        }
        if (e.status == '400') {
          this.ApiService.showToast('Invalid credentials');
          this.showForgotPassword = true;
        }
        this.loading.dismiss();
      });
    } else {
      this.ApiService.showToast('Please enter username and password');
    }

  }

  terms() {
    this.navCtrl.navigateForward('/terms');
  }

  privacy() {
    this.navCtrl.navigateForward('/privacy');
  }

  navigateForgotPasswd() {
    const navigationExtras: NavigationExtras = { state: { user: this.user } };
    this.navCtrl.navigateForward('/forgot-password', navigationExtras);
  }

  navigateForgotUserName() {
    const navigationExtras: NavigationExtras = { state: { user: this.user } };
    this.navCtrl.navigateForward('/forgot-username', navigationExtras);
  }

  hideShowPassword() {
    this.passwordType = this.passwordType === 'text' ? 'password' : 'text';
    this.passwordIcon = this.passwordIcon === 'eye-off' ? 'eye' : 'eye-off';
  }

}

This is the error I am receiving when the app tries to startup and move to the login page:

"Uncaught Error: Can't resolve all parameters for NavParams: (?)."

1 post - 1 participant

Read full topic

App reject from app store due to blank screen

$
0
0

My app was reject from the app store with the following message.

We discovered one or more bugs in your app when reviewed on iPad running iOS 13.5.1 on Wi-Fi.

Specifically, the app displayed a blank screen upon launch and we were unable to proceed.

Everything on my app works fine while my device is connected to wifi and running ionic cap run ios -l --external

I was able to reproduce this error a few ways.

  1. Turning off wifi and trying to run app on cellular network
  2. Putting my device in airplane mode
  3. Building and running the app without ionic serve ionic cap run ios --release --prod

xcode is giving me the following error:

:zap: WebView failed provisional navigation :zap: Error: Could not connect to the server.

can anyone point me in the right direction to a solution to this issue?

I am using ionic/react/capacitor to build the app

1 post - 1 participant

Read full topic

Where to set the version code in a Ionic/Capacitor app?

$
0
0

Hi,
I’m trying to upload the second version of an app on GooglePlay.

With Cordova the version was in the file config.xml.

With Capacitor in which file should I put the version code?
I thought it was package.json, but it isn’t because GooglePlay says that the app I’m trying to upload has the same version code of the previous.

Thank you very much

cld

1 post - 1 participant

Read full topic

New App shows only blank screen on Android with Ionic 6, Angular 9 and Capacitor

$
0
0

Hey guys,

I’m totally new to Ionic and I’m already failing to get my first app running on an Android device or emulator. :slight_smile: I’m using Angular 9.1.11, Ionic 6.10.1 and Capacitor 2.2.0. I did not do more than basically follow the instructions from “build your first app” in the Angular section of the Ionic documentation except leaving out all the photo stuff. I basically did only the setup with the 3 tabs and then tried to deploy on Android. Deploying to Android means:

  • I run ionic build (no errors)
  • I run npx cap sync android
  • I run npx cap open android
  • In Android Studio, I start the App on an emulator (Pixel 2 Pie 9.0 - API 28) or my Android phone (Huawei RNE L21 - API 26)

Then the App starts with the Splash Screen, after the Splash Screen goes away there is only a blank screen. The Android Studio logs in the run tab don’t show any obvious problems. There are a couple of errors, but they don’t seem to be problematic (see below in this post). I also tried remote debugging with Chrome dev tools, which doesn’t show any errors in the console.
Running the App in the browser with ionic serve works by the way, I can see the 3 tabs, do changes with live reload, etc.

I tried to research the problem in the internet, and there is a ton of issues with this blank screen out there. But 98% seems to be with Cordova, not Capacitor, and I’ve found nothing about Ionic 6, only Ionic 3 and 4. Of course I tried a couple of standard things (clean project, invalidate caches) but most of the things I found are just not applicable to my case.

During my research I found another command to use instead of npx cap open android: ionic capacitor run android -l --external. When I do that, then everything works. The app loads as it should, on my phone and in the emulator as well. I compared the output in the run tab of Android Studio, and I don’t see any meaningful differences. But that could just be me having no idea about Ionic, Capacitor and Android as well. :slight_smile:
I can’t test on IPhone by the way, because I don’t have a Mac at hand. I’m developing on a Windows 10 computer if that matters.

Please find here the logs from Android Studio run tab in case they are of any interest.
First the ones from the app running on the emulator opening Android Studio with the npx cap open android command (where only blank screen occurs after Splash Screen):

Summary

07/01 18:20:14: Launching ‘app’ on Pixel 2 Pie 9.0 - API 28.
$ adb shell am start -n “io.ionic.starter/io.ionic.starter.MainActivity” -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Connected to process 21137 on device ‘emulator-5554’.
Capturing and displaying logcat messages from application. This behavior can be disabled in the “Logcat output” section of the “Debugger” settings page.
W/FirebaseApp: Default FirebaseApp failed to initialize because no default options were found. This usually means that com.google.gms:google-services was not applied to your gradle project.
I/FirebaseInitProvider: FirebaseApp initialization unsuccessful
W/o.ionic.starte: Accessing hidden method Landroid/graphics/drawable/Drawable;->getOpticalInsets()Landroid/graphics/Insets; (light greylist, linking)
Accessing hidden field Landroid/graphics/Insets;->left:I (light greylist, linking)
Accessing hidden field Landroid/graphics/Insets;->right:I (light greylist, linking)
Accessing hidden field Landroid/graphics/Insets;->top:I (light greylist, linking)
Accessing hidden field Landroid/graphics/Insets;->bottom:I (light greylist, linking)
E/o.ionic.starte: Invalid ID 0x00000000.
W/o.ionic.starte: Accessing hidden method Landroid/view/View;->getAccessibilityDelegate()Landroid/view/View$AccessibilityDelegate; (light greylist, linking)
W/o.ionic.starte: Accessing hidden method Landroid/view/View;->computeFitSystemWindows(Landroid/graphics/Rect;Landroid/graphics/Rect;)Z (light greylist, reflection)
W/o.ionic.starte: Accessing hidden method Landroid/view/ViewGroup;->makeOptionalFitsSystemWindows()V (light greylist, reflection)
I/WebViewFactory: Loading com.android.chrome version 69.0.3497.100 (code 349710017)
I/o.ionic.starte: The ClassLoaderContext is a special shared library.
I/cr_LibraryLoader: Time to load native libraries: 298 ms (timestamps 7252-7550)
E/cr_VariationsUtils: Failed reading seed file “/data/user/0/io.ionic.starter/app_webview/variations_seed”: /data/user/0/io.ionic.starter/app_webview/variations_seed (No such file or directory)
E/o.ionic.starte: Invalid ID 0x00000000.
E/o.ionic.starte: Invalid ID 0x00000000.
I/chromium: [INFO:library_loader_hooks.cc(36)] Chromium logging enabled: level = 0, default verbosity = 0
I/cr_LibraryLoader: Expected native library version number “69.0.3497.100”, actual native library version number “69.0.3497.100”
W/cr_ChildProcLH: Create a new ChildConnectionAllocator with package name = com.android.chrome, sandboxed = true
I/cr_BrowserStartup: Initializing chromium process, singleProcess=false
W/o.ionic.starte: Accessing hidden method Landroid/view/textclassifier/logging/SmartSelectionEventTracker;->(Landroid/content/Context;I)V (light greylist, reflection)
Accessing hidden method Landroid/view/textclassifier/logging/SmartSelectionEventTracker;->logEvent(Landroid/view/textclassifier/logging/SmartSelectionEventTracker$SelectionEvent;)V (light greylist, reflection)
Accessing hidden method Landroid/view/textclassifier/logging/SmartSelectionEventTracker$SelectionEvent;->selectionStarted(I)Landroid/view/textclassifier/logging/SmartSelectionEventTracker$SelectionEvent; (light greylist, reflection)
W/o.ionic.starte: Accessing hidden method Landroid/view/textclassifier/logging/SmartSelectionEventTracker$SelectionEvent;->selectionModified(II)Landroid/view/textclassifier/logging/SmartSelectionEventTracker$SelectionEvent; (light greylist, reflection)
Accessing hidden method Landroid/view/textclassifier/logging/SmartSelectionEventTracker$SelectionEvent;->selectionModified(IILandroid/view/textclassifier/TextClassification;)Landroid/view/textclassifier/logging/SmartSelectionEventTracker$SelectionEvent; (light greylist, reflection)
Accessing hidden method Landroid/view/textclassifier/logging/SmartSelectionEventTracker$SelectionEvent;->selectionModified(IILandroid/view/textclassifier/TextSelection;)Landroid/view/textclassifier/logging/SmartSelectionEventTracker$SelectionEvent; (light greylist, reflection)
Accessing hidden method Landroid/view/textclassifier/logging/SmartSelectionEventTracker$SelectionEvent;->selectionAction(III)Landroid/view/textclassifier/logging/SmartSelectionEventTracker$SelectionEvent; (light greylist, reflection)
Accessing hidden method Landroid/view/textclassifier/logging/SmartSelectionEventTracker$SelectionEvent;->selectionAction(IIILandroid/view/textclassifier/TextClassification;)Landroid/view/textclassifier/logging/SmartSelectionEventTracker$SelectionEvent; (light greylist, reflection)
D/Capacitor: Starting BridgeActivity
D/Capacitor: Registering plugin: App
D/Capacitor: Registering plugin: Accessibility
D/Capacitor: Registering plugin: BackgroundTask
D/Capacitor: Registering plugin: Browser
D/Capacitor: Registering plugin: Camera
D/Capacitor: Registering plugin: Clipboard
D/Capacitor: Registering plugin: Device
D/Capacitor: Registering plugin: LocalNotifications
D/Capacitor: Registering plugin: Filesystem
D/Capacitor: Registering plugin: Geolocation
D/Capacitor: Registering plugin: Haptics
D/Capacitor: Registering plugin: Keyboard
D/Capacitor: Registering plugin: Modals
D/Capacitor: Registering plugin: Network
D/Capacitor: Registering plugin: Permissions
D/Capacitor: Registering plugin: Photos
D/Capacitor: Registering plugin: PushNotifications
D/Capacitor: Registering plugin: Share
D/Capacitor: Registering plugin: SplashScreen
D/Capacitor: Registering plugin: StatusBar
D/Capacitor: Registering plugin: Storage
D/Capacitor: Registering plugin: Toast
D/Capacitor: Registering plugin: WebView
E/Capacitor: Unable to read file at path public/plugins
D/Capacitor: Loading app at http://localhost
I/o.ionic.starte: Background concurrent copying GC freed 17356(1925KB) AllocSpace objects, 8(188KB) LOS objects, 49% free, 1949KB/3MB, paused 1.328ms total 121.340ms
W/cr_media: Requires BLUETOOTH permission
D/HostConnection: HostConnection::get() New Host Connection established 0xd0132c30, tid 21221
D/HostConnection: HostComposition ext ANDROID_EMU_CHECKSUM_HELPER_v1 ANDROID_EMU_dma_v1 ANDROID_EMU_YUV420_888_to_NV21 ANDROID_EMU_YUV_Cache ANDROID_EMU_async_unmap_buffer GL_OES_vertex_array_object GL_KHR_texture_compression_astc_ldr ANDROID_EMU_gles_max_version_2
D/Capacitor: Handling local request: http://localhost/
I/ConfigStore: android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasWideColorDisplay retrieved: 0
I/ConfigStore: android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasHDRDisplay retrieved: 0
E/chromium: [ERROR:gl_surface_egl.cc(335)] eglChooseConfig failed with error EGL_SUCCESS
D/Capacitor/LN: LocalNotification received: null
Activity started without notification attached
D/eglCodecCommon: setVertexArrayObject: set vao to 0 (0) 0 0
D/EGL_emulation: eglCreateContext: 0xeb1fec80: maj 2 min 0 rcv 2
D/EGL_emulation: eglMakeCurrent: 0xeb1fec80: ver 2 0 (tinfo 0xd0004e90)
D/Capacitor: App started
D/Capacitor/App: Firing change: true
V/Capacitor/App: Notifying listeners for event appStateChange
D/Capacitor/App: No listeners found for event appStateChange
D/Capacitor: App resumed
D/OpenGLRenderer: HWUI GL Pipeline
V/Capacitor/Network: Notifying listeners for event networkStatusChange
D/Capacitor/Network: No listeners found for event networkStatusChange
W/VideoCapabilities: Unrecognized profile 4 for video/hevc
I/VideoCapabilities: Unsupported profile 4 for video/mp4v-es
W/cr_MediaCodecUtil: HW encoder for video/avc is not available on this device.
I/OpenGLRenderer: Initialized EGL, version 1.4
D/OpenGLRenderer: Swap behavior 1
D/HostConnection: HostConnection::get() New Host Connection established 0xd01334f0, tid 21224
D/HostConnection: HostComposition ext ANDROID_EMU_CHECKSUM_HELPER_v1 ANDROID_EMU_dma_v1 ANDROID_EMU_YUV420_888_to_NV21 ANDROID_EMU_YUV_Cache ANDROID_EMU_async_unmap_buffer GL_OES_vertex_array_object GL_KHR_texture_compression_astc_ldr ANDROID_EMU_gles_max_version_2
W/OpenGLRenderer: Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED, retrying without…
D/OpenGLRenderer: Swap behavior 0
D/eglCodecCommon: setVertexArrayObject: set vao to 0 (0) 0 0
D/EGL_emulation: eglCreateContext: 0xeb1ff760: maj 2 min 0 rcv 2
E/chromium: [ERROR:gl_surface_egl.cc(335)] eglChooseConfig failed with error EGL_SUCCESS
D/EGL_emulation: eglMakeCurrent: 0xeb1ff760: ver 2 0 (tinfo 0xd01624b0)
D/eglCodecCommon: setVertexArrayObject: set vao to 0 (0) 0 0
D/EGL_emulation: eglCreateContext: 0xeb1ca460: maj 2 min 0 rcv 2
D/EGL_emulation: eglMakeCurrent: 0xeb1ca460: ver 2 0 (tinfo 0xd0004e90)
D/eglCodecCommon: setVertexArrayObject: set vao to 1 (1) 0 0
D/HostConnection: createUnique: call
HostConnection::get() New Host Connection established 0xd0135c50, tid 21224
D/HostConnection: HostComposition ext ANDROID_EMU_CHECKSUM_HELPER_v1 ANDROID_EMU_dma_v1 ANDROID_EMU_YUV420_888_to_NV21 ANDROID_EMU_YUV_Cache ANDROID_EMU_async_unmap_buffer GL_OES_vertex_array_object GL_KHR_texture_compression_astc_ldr ANDROID_EMU_gles_max_version_2
E/eglCodecCommon: GoldfishAddressSpaceHostMemoryAllocator: ioctl_ping failed for device_type=5, ret=-1
I/Choreographer: Skipped 54 frames! The application may be doing too much work on its main thread.
D/EGL_emulation: eglMakeCurrent: 0xeb1ff760: ver 2 0 (tinfo 0xd01624b0)
D/eglCodecCommon: setVertexArrayObject: set vao to 2 (2) 0 0
D/eglCodecCommon: setVertexArrayObject: set vao to 1 (1) 0 0
E/eglCodecCommon: glUtilsParamSize: unknow param 0x000085b5
E/eglCodecCommon: glUtilsParamSize: unknow param 0x000085b5
D/eglCodecCommon: setVertexArrayObject: set vao to 0 (0) 0 0
D/eglCodecCommon: setVertexArrayObject: set vao to 1 (1) 0 0
D/eglCodecCommon: setVertexArrayObject: set vao to 0 (0) 7 0
I/OpenGLRenderer: Davey! duration=1305ms; Flags=0, IntendedVsync=10969693584058, Vsync=10970593584022, OldestInputEvent=9223372036854775807, NewestInputEvent=0, HandleInputStart=10970596573200, AnimationStart=10970596705700, PerformTraversalsStart=10970596834200, DrawStart=10970597981300, SyncQueued=10970602957600, SyncStart=10970615339200, IssueDrawCommandsStart=10970615940900, SwapBuffers=10970954187100, FrameCompleted=10971011035200, DequeueBufferDuration=95000, QueueBufferDuration=425000,
D/EGL_emulation: eglMakeCurrent: 0xeb1ff760: ver 2 0 (tinfo 0xd01624b0)
I/OpenGLRenderer: Davey! duration=1424ms; Flags=0, IntendedVsync=10969693584058, Vsync=10970593584022, OldestInputEvent=9223372036854775807, NewestInputEvent=0, HandleInputStart=10970596573200, AnimationStart=10970596705700, PerformTraversalsStart=10970596834200, DrawStart=10971011930000, SyncQueued=10971012441800, SyncStart=10971016488500, IssueDrawCommandsStart=10971040292400, SwapBuffers=10971066299000, FrameCompleted=10971122240100, DequeueBufferDuration=1534000, QueueBufferDuration=1162000,
D/EGL_emulation: eglMakeCurrent: 0xeb1ff760: ver 2 0 (tinfo 0xd01624b0)
E/eglCodecCommon: glUtilsParamSize: unknow param 0x000085b5
E/eglCodecCommon: glUtilsParamSize: unknow param 0x000085b5
D/eglCodecCommon: setVertexArrayObject: set vao to 0 (0) 0 0
D/eglCodecCommon: setVertexArrayObject: set vao to 0 (0) 0 0
D/EGL_emulation: eglMakeCurrent: 0xeb1ff760: ver 2 0 (tinfo 0xd01624b0)
W/cr_CrashFileManager: /data/user/0/io.ionic.starter/cache/WebView/Crash Reports does not exist or is not a directory
D/EGL_emulation: eglMakeCurrent: 0xeb1ff760: ver 2 0 (tinfo 0xd01624b0)
E/eglCodecCommon: glUtilsParamSize: unknow param 0x000085b5
glUtilsParamSize: unknow param 0x000085b5
D/eglCodecCommon: setVertexArrayObject: set vao to 0 (0) 0 0
D/eglCodecCommon: setVertexArrayObject: set vao to 0 (0) 0 0
I/OpenGLRenderer: Davey! duration=795ms; Flags=0, IntendedVsync=10971188761458, Vsync=10971605428108, OldestInputEvent=9223372036854775807, NewestInputEvent=0, HandleInputStart=10971608283600, AnimationStart=10971608416900, PerformTraversalsStart=10971614441500, DrawStart=10971615170800, SyncQueued=10971617870000, SyncStart=10971621558200, IssueDrawCommandsStart=10971621846100, SwapBuffers=10971950813600, FrameCompleted=10971988013600, DequeueBufferDuration=860000, QueueBufferDuration=907000,
D/Capacitor: Handling local request: http://localhost/assets/icon/favicon.png
E/eglCodecCommon: glUtilsParamSize: unknow param 0x000085b5
E/eglCodecCommon: glUtilsParamSize: unknow param 0x000085b5
D/eglCodecCommon: setVertexArrayObject: set vao to 0 (0) 0 0
D/eglCodecCommon: setVertexArrayObject: set vao to 0 (0) 0 0
E/eglCodecCommon: glUtilsParamSize: unknow param 0x000085b5
E/eglCodecCommon: glUtilsParamSize: unknow param 0x000085b5
D/eglCodecCommon: setVertexArrayObject: set vao to 0 (0) 0 0
D/eglCodecCommon: setVertexArrayObject: set vao to 1 (1) 0 0
D/eglCodecCommon: setVertexArrayObject: set vao to 0 (0) 5 0
E/eglCodecCommon: glUtilsParamSize: unknow param 0x000085b5
E/eglCodecCommon: glUtilsParamSize: unknow param 0x000085b5
D/eglCodecCommon: setVertexArrayObject: set vao to 0 (0) 0 0
D/eglCodecCommon: setVertexArrayObject: set vao to 1 (1) 0 0
D/eglCodecCommon: setVertexArrayObject: set vao to 0 (0) 5 0
D/Capacitor: SplashScreen was automatically hidden after the launch timeout. You should call SplashScreen.hide() as soon as your web app is loaded (or increase the timeout).Read more at https://capacitor.ionicframework.com/docs/apis/splash-screen/#hiding-the-splash-screen
D/EGL_emulation: eglMakeCurrent: 0xeb1ff760: ver 2 0 (tinfo 0xd01624b0)
D/EGL_emulation: eglMakeCurrent: 0xeb1ff760: ver 2 0 (tinfo 0xd01624b0)

edit: Regarding the version of Ionic, I’m a bit confused now… The release notes of Ionic say the latest version is 5.2.3. But when I enter ionic --version in the console, it prompts 6.10.1. When I enter npx --version, it promts 6.4.1. That doesn’t make sense to me either! :slight_smile:

2 posts - 1 participant

Read full topic

Ok-text change dynamically in ion-select

$
0
0

Hi all,

i am pretty new to ionic mobile development. i have a ion-select with yes and no buttons. i want to change the ok-text and cancel-text property dynamically. i tried property binding like <ion-select ok-text="{yes_lbl}" cancel-text="{no_lbl}"

but im getting error.

please help me solve this issue.

appreciate all your help.

1 post - 1 participant

Read full topic


Two ion-split-pane in parent-child pages

$
0
0

Hello,
I’m currently trying to use two ion-split-components in different pages but showing at the same time (located both sides start and end) of course if there is enough room for both of them.
The main split-pane is located in home.page at start side, the other one in secondary.page at end side.
The pages are related as: home.page (the parent) and secondary.page (child of the home.page’s child).

There is a strange behavior between both split-panes. In desktop version:

  1. Being at home and i navigate to secondary.page, it loads the page and shows its splitpane but the main split pane (the one in the home.page) disappears.
  2. If I reload the secondary.page both split-panes are visible correctly, but when i decrease the window’s width, they both disappears when the first one disappears (they have different when property).
  3. When i reload the secondary.page with a window’s width small enough for both splitpanes are not-visible. Then i increase the width, the second split pane appears correctly. If i keep increasing the window’s width the main split pane appears but the secondary hides.

I’m using Ionic-CLI 6.10.1 and Angular 9.1.9

I’ve put an example code in Github hoping you can help me to figure out what am i missing or it is a bug.
https://github.com/nicolasturen/two-ion-split-panes

I’ve placed a button on the main menu. If you click at it you will see the behavior #1 right away.

Greetings.

1 post - 1 participant

Read full topic

Angular Routing, "No component factory found for LoginPageModule. Did you add it to @NgModule.entryComponents?)"

$
0
0

Currently, I have been working on upgrading my current Ionic Cordova application from Ionic 3 to Ionic 5. In the process, the Angular routing has been throwing many errors and I was able to resolve most of them but when I try to change the root page for the application I always end up with a blank screen. I tried many online solutions but they did not work for me. Originally I tried the lazy loading method for all my pages but I found that it is a poor method so I changed it with direct imports. Currently, this is my app module:

@NgModule({
    declarations: [MyAppPage,
    ],
    entryComponents: [MyAppPage],
    imports: [BrowserModule,
        AppRoutingModule,
        HttpClientModule,
        IonicSignaturePadModule,
        IonicModule.forRoot()],
    providers: [
        StatusBar,
        SplashScreen,
        { provide: RouteReuseStrategy, useClass: IonicRouteStrategy },
        ApiService,
        Device,
        Camera,
        InAppBrowser,
        FingerprintAIO,
        LocalNotifications,
        Contacts,
        BackgroundMode,
        Keyboard,
        Firebase,
        Badge,
        HttpClient,
        IonicsignaturepadProvider,
    ],
    bootstrap: [MyAppPage],
    schemas: [CUSTOM_ELEMENTS_SCHEMA]

})
export class AppModule {}

This is my app routing file:

import { NgModule } from '@angular/core';
import { PreloadAllModules, RouterModule, Routes } from '@angular/router';
import {APP_BASE_HREF} from '@angular/common';
import {AuthPageModule} from './auth/auth.module';
import {CareTeamPageModule} from './care-team/care-team.module';
import {CommunitiesPageModule} from './communities/communities.module';
import {DashboardPageModule} from './dashboard/dashboard.module';
import {FaqPageModule} from './faq/faq.module';
import {ForgotPasswordPageModule} from './forgot-password/forgot-password.module';
import {ForgotUsernamePageModule} from './forgot-username/forgot-username.module';
import {FriendsPageModule} from './friends/friends.module';
import {HcsPageModule} from './hcs/hcs.module';
import {HistoryPageModule} from './history/history.module';
import {LoginPageModule} from './login/login.module';
import {MedicineDetailPageModule} from './medicine-detail/medicine-detail.module';
import {MedicinesPageModule} from './medicines/medicines.module';
import {NotificationsPageModule} from './notifications/notifications.module';
import {PrivacyPageModule} from './privacy/privacy.module';
import {ProfilePageModule} from './profile/profile.module';
import {SettingsPageModule} from './settings/settings.module';
import {SignupPageModule} from './signup/signup.module';
import {TermsPageModule} from './terms/terms.module';
import {WearablesPageModule} from './wearables/wearables.module';

const routes: Routes = [
  { path: '', redirectTo: 'login', pathMatch: 'full' },
  {
    path: 'login',
    component: LoginPageModule
  },
  {
    path: 'auth',
    component: AuthPageModule,
  },
  {
    path: 'care-team',
    component: CareTeamPageModule
  },
  {
    path: 'communities',
    component: CommunitiesPageModule
  },
  {
    path: 'dashboard',
    component: DashboardPageModule
  },
  {
    path: 'faq',
    component: FaqPageModule
  },
  {
    path: 'forgot-password',
    component: ForgotPasswordPageModule
  },
  {
    path: 'forgot-username',
    component: ForgotUsernamePageModule
  },
  {
    path: 'friends',
    component: FriendsPageModule
  },
  {
    path: 'hcs',
    component: HcsPageModule
  },
  {
    path: 'history',
    component: HistoryPageModule
  },
  {
    path: 'medicine-detail',
    component: MedicineDetailPageModule
  },
  {
    path: 'medicines',
    component: MedicinesPageModule
  },
  {
    path: 'notifications',
    component: NotificationsPageModule
  },
  {
    path: 'privacy',
    component: PrivacyPageModule
  },
  {
    path: 'profile',
    component: ProfilePageModule
  },
  {
    path: 'settings',
    component: SettingsPageModule
  },
  {
    path: 'signup',
    component: SignupPageModule
  },
  {
    path: 'terms',
    component: TermsPageModule
  },
  {
    path: 'wearables',
    component: WearablesPageModule
  },
];

@NgModule({
  imports: [
    RouterModule.forRoot(routes, { preloadingStrategy: PreloadAllModules, enableTracing: true, useHash: true }),
    AuthPageModule,
    CareTeamPageModule,
    CommunitiesPageModule,
    DashboardPageModule,
    FaqPageModule,
    ForgotPasswordPageModule,
    ForgotUsernamePageModule,
    FriendsPageModule,
    HcsPageModule,
    HistoryPageModule,
    LoginPageModule,
    MedicineDetailPageModule,
    MedicinesPageModule,
    NotificationsPageModule,
    PrivacyPageModule,
    ProfilePageModule,
    SettingsPageModule,
    SignupPageModule,
    TermsPageModule,
    WearablesPageModule,
  ],
  providers: [{ provide: APP_BASE_HREF, useValue: '/' }, ],
  exports: [RouterModule]
})
export class AppRoutingModule { }

This is the app component:

import {Component, ViewChild} from '@angular/core';
import { NavController, Platform, ToastController, MenuController} from '@ionic/angular';
import { Router } from '@angular/router';
import {DashboardPage} from './dashboard/dashboard.page';
import {MedicinesPage} from './medicines/medicines.page';
import {CareTeamPage} from './care-team/care-team.page';
import {HcsPage} from './hcs/hcs.page';
import {SettingsPage} from './settings/settings.page';
import {CommunitiesPage} from './communities/communities.page';
import {FaqPage} from './faq/faq.page';
import {WearablesPage} from './wearables/wearables.page';

import {NotificationsPage} from './notifications/notifications.page';

import {FriendsPage} from './friends/friends.page';

import {Keyboard} from '@ionic-native/keyboard/ngx';

import {ApiService} from './services/app.services';
import {BackgroundMode} from '@ionic-native/background-mode/ngx';

import {Firebase} from '@ionic-native/firebase/ngx';

import {Badge} from '@ionic-native/badge/ngx';
import { SplashScreen } from '@ionic-native/splash-screen/ngx';

@Component({
    templateUrl: 'app.component.html',
    selector: 'app-root',
})
export class MyAppPage {
    @ViewChild(NavController) nav: NavController;

    backButtonPressedOnceToExit: any;
    menu: any;
    document: any;
    pages: Array<{ title: string, component: any, icon: string }>;
    hideWaves: boolean;
    bgInterval: any;
    config: {
        scrollAssist: false,
        autoFocusAssist: false
    };

    constructor(public platform: Platform,
                public splashScreen: SplashScreen,
                private toastCtrl: ToastController,
                private route: Router,
                // tslint:disable-next-line:no-shadowed-variable
                private ApiService: ApiService,
                public menuCtrl: MenuController,
                private keyboard: Keyboard,
                private backgroundMode: BackgroundMode,
                private fcm: Firebase,
                private badge: Badge
    ) {
        this.initializeApp();

        this.hideWaves = false;

        // used for an example of ngFor and navigation
        this.pages = [
            {title: 'Today\'s Meds', component: DashboardPage, icon: 'assets/imgs/menu-today-med.png'},
            {title: 'Medicines', component: MedicinesPage, icon: 'assets/imgs/menu-medicine.png'},
            {title: 'Healthcare Providers', component: CareTeamPage, icon: 'assets/imgs/menu-care-team.png'},
            {title: 'Invite Friends', component: FriendsPage, icon: 'assets/imgs/menu-friends.png'},
            {title: 'Communities', component: CommunitiesPage, icon: 'assets/imgs/menu-communities.png'},
            {title: 'Connect to healthcare systems', component: HcsPage, icon: 'assets/imgs/menu-hcs.png'},
            {title: 'Devices / Wearables', component: WearablesPage, icon: 'assets/imgs/menu-wearables.png'},
            {title: 'Notifications', component: NotificationsPage, icon: 'assets/imgs/menu-notification.png'},
            {title: 'Settings', component: SettingsPage, icon: 'assets/imgs/menu-setting.png'},
            {title: 'Help & Support', component: FaqPage, icon: 'assets/imgs/menu-help.png'}
        ];

        if (localStorage.getItem('userToken')) {
            this.route.navigate(['auth']);
        }else{
            this.route.navigate(['login']);
        }

    }

    initializeApp() {
        this.platform.ready().then(() => {

            // Clear badge
            this.badge.clear();
            // Okay, so the platform is ready and our plugins are available.
            // Here you can do any higher level native things you might need.
            // this.statusBar.styleDefault();
            this.splashScreen.hide();
            // this.backgroundMode.enable();
            // this.keyboard.onKeyboardShow().subscribe( (value)=>{
            //   this.hideWaves = true;
            // });

            // this.keyboard.onKeyboardHide().subscribe( (value)=>{
            //   this.hideWaves = false;
            // });

            // this.platform.registerBackButtonAction(() => {
            //   if (this.backButtonPressedOnceToExit) {
            //     this.platform.exitApp();
            //   } else if (this.nav.canGoBack()) {
            //     this.nav.pop({});
            //   } else {
            //     this.menu.close(); //Close menu if open
            //     this.showToast();
            //     this.backButtonPressedOnceToExit = true;
            //     setTimeout(() => {
            //       this.backButtonPressedOnceToExit = false;
            //     },2000)
            //   }
            // });
        });
    }

    logout() {
        this.menuCtrl.close();
        this.menuCtrl.get().then((menu: HTMLIonMenuElement) => {
          menu.swipeGesture = false;
        });
        this.ApiService.showToast('Logged Out');
        localStorage.removeItem('userId');
        localStorage.removeItem('userToken');
        localStorage.removeItem('userDetails');
        localStorage.removeItem('userNotifications');
    }

    profile() {
        this.menuCtrl.close();
        this.route.navigateByUrl('/profile');
    }

  async showToast() {
        const toast = await this.toastCtrl.create({
            message: 'Press Back Again To Exit The App',
            duration: 3000,
            position: 'bottom'
        });
        toast.present();
    }

    openPage(page) {
        // Reset the content nav to have just this page
        // we wouldn't want the back button to show in this scenario
        this.nav.navigateRoot(page.component);
    }
}

app.component.html:

<ion-menu [attr.content]="content" type="overlay" contentId="main">
<!--   <ion-header>
    <ion-toolbar>
      <ion-title>Menu</ion-title>
    </ion-toolbar>
  </ion-header>
 -->
  <ion-content>
    <div class = "menu-header">
    </div>
    <div class="ion-text-center center-content relative" (click) = "profile()">
      <img id = "userPicture" alt = "" src = "assets/imgs/user-default.png" />
      <div class = "profile-edit">
        <div class="ion-text-center">
          <img alt = "" src = "assets/imgs/camera_green.png" />
        </div>
      </div>
    </div>
    <ion-list class = "menu-list">
      <button menuClose ion-item *ngFor="let p of pages" (click)="openPage(p)">
        <img [src] = "p.icon" item-left />
        {{p.title}}
      </button>
    </ion-list>
    <div class="ion-text-right logout" (click) = "logout()">
      Logout
    </div>
  </ion-content>

</ion-menu>

<!-- Disable swipe-to-go-back because it's poor UX to combine STGB with side menus -->
<ion-app>
<router-outlet></router-outlet>
</ion-app>

login page routing module:

import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { IonicModule } from '@ionic/angular';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';

import { LoginPage } from './login.page';

const routes: Routes = [
  {
    path: '',
    component: LoginPage
  }
];

@NgModule({
  imports: [RouterModule.forChild(routes),
            IonicModule,
            CommonModule,
            FormsModule],
  exports: [RouterModule],
})
export class LoginPageRoutingModule {}

login.page.ts:

import { Component, OnInit } from '@angular/core';
import { NavController, Platform, NavParams, MenuController } from '@ionic/angular';
import {Routes, RouterModule, Router, ActivatedRoute} from '@angular/router';

import { ApiService } from '../services/app.services';
import { LoadingController } from '@ionic/angular';
import {NavigationExtras} from '@angular/router';
import { StatusBar } from '@ionic-native/status-bar/ngx';

@Component({
  selector: 'app-login',
  templateUrl: './login.page.html',
  styleUrls: ['./login.page.scss'],
  providers: [NavParams]
})
export class LoginPage implements OnInit {
  public navParams: NavParams;
  loginState: string;
  user: any;
  loading: any;
  hideWaves: boolean;
  origCode: number;
  showForgotPassword: boolean;
  userMobile: number;
  passwordType = 'password';
  passwordIcon = 'eye-off';
  constructor(private route: Router,
              public navCtrl: NavController,
              public statusBar: StatusBar,
              private loadingCtrl: LoadingController,
              private ApiService: ApiService,
              public menuCtrl: MenuController,
              public platform: Platform,
              private actRoute: ActivatedRoute,
  ) {
      this.loginState = 'init';
      this.showForgotPassword = false;
      this.user = {};
      this.actRoute.queryParams.subscribe(params => {
        if (route.getCurrentNavigation().extras.state) {
          this.loginState = route.getCurrentNavigation().extras.state.item;
        }
      });
      this.menuCtrl.get().then((menu: HTMLIonMenuElement) => {
        menu.swipeGesture = false;
      });
      this.statusBar.backgroundColorByHexString('#000000');
      this.statusBar.styleLightContent();
    }


  ngOnInit() {
    this.platform.ready().then(() => {
      // let video = this.mVideoPlayer.nativeElement;
      // video.src = "assets/video/clinakos_video.mp4";
      // video.load();
    });
  }

  ionViewWillLeave() {
    // the .nativeElement property of the ViewChild is the reference to the tag <video>
    // this.mVideoPlayer.nativeElement.src = '';
    // this.mVideoPlayer.nativeElement.load();
  }

  signUp() {
    this.navCtrl.navigateRoot('/signup');
  }

  signIn() {

    if ( (this.user.username) && (this.user.password) ) {

      this.loading = this.loadingCtrl.create({
        message: 'Please wait...'
      });
      this.loading.present();

      this.ApiService.login(this.user)
      .then(r => {
        localStorage.setItem('userToken', r.token);
        localStorage.setItem('userId', r.userId);

        // Check if user has reminders.
        this.ApiService.getReminders()
        .then(r => {
          this.loading.dismiss();
          this.navCtrl.navigateRoot('/dashboard');
          this.ApiService.showToast('Logged In');
        })
        .catch(e => {
          this.navCtrl.navigateRoot('/medicines');
          this.loading.dismiss();
          this.ApiService.showToast('Logged In');
        });



        this.menuCtrl.enable(true);
        this.menuCtrl.get().then((menu: HTMLIonMenuElement) => {
          menu.swipeGesture = true;
        });

        if (localStorage.getItem('userNotifications') === null) {
          localStorage.setItem('userNotifications', JSON.stringify([]));
        }

      })
      .catch(e => {
        console.log (e);
        if (e.status == '404') {
          this.ApiService.showToast('User does not exist');
        }
        if (e.status == '400') {
          this.ApiService.showToast('Invalid credentials');
          this.showForgotPassword = true;
        }
        this.loading.dismiss();
      });
    } else {
      this.ApiService.showToast('Please enter username and password');
    }

  }

  terms() {
    this.navCtrl.navigateForward('/terms');
  }

  privacy() {
    this.navCtrl.navigateForward('/privacy');
  }

  navigateForgotPasswd() {
    const navigationExtras: NavigationExtras = { state: { user: this.user } };
    this.navCtrl.navigateForward('/forgot-password', navigationExtras);
  }

  navigateForgotUserName() {
    const navigationExtras: NavigationExtras = { state: { user: this.user } };
    this.navCtrl.navigateForward('/forgot-username', navigationExtras);
  }

  hideShowPassword() {
    this.passwordType = this.passwordType === 'text' ? 'password' : 'text';
    this.passwordIcon = this.passwordIcon === 'eye-off' ? 'eye' : 'eye-off';
  }

}

This is the login-routing.module:

import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { IonicModule } from '@ionic/angular';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';

import { LoginPage } from './login.page';

const routes: Routes = [
  {
    path: '',
    component: LoginPage
  }
];

@NgModule({
  imports: [RouterModule.forChild(routes),
            IonicModule,
            CommonModule,
            FormsModule],
    entryComponents: [LoginPage],
  exports: [RouterModule],
})
export class LoginPageRoutingModule {}

This is the error I am receiving when the app tries to startup and move to the login page:

"error: Error: No component factory found for LoginPageModule. Did you add it to @NgModule.entryComponents?)"

2 posts - 2 participants

Read full topic

[ionic 5] How to correctly deploy an update of Angular PWA?

$
0
0

After executing

ionic build --prod
# or
ionic cordova build browser --prod

and after uploading the files located in www or cordova/platforms/browser/www

How to deploy, correctly, these files? It happens that after uploading them, the PWA does not update automatically, and the ServiceWorker checker does not catch it.

Should I update all files? Including:

  • index.html
  • ngsw.json
  • manifiest.json

What do I do with the old “ng hashed files”? Do I erase them? i.e.:

  • 98-es5.47b01e7ba6bbd8f8658e.js
  • common-es5.1719b2b4dbadb25c2d74.js
  • runtime-es5.d9ee687d05b6194a4b29.js
  • main-es5.6c81c313ff50eb0e9515.js

I am serving the files with an Apache + PHP, and the .htaccess configuration contains:

  • Redirection of requests to index.html
<IfModule mod_rewrite.c>
  RewriteEngine On

  # Redirection to HTTPS:
  RewriteCond %{HTTPS} !on
  RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
  
  # Redirection of requests to index.html
  RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -f [OR]
  RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -d
  RewriteRule ^.*$ - [NC,L]
  RewriteRule (.*) index.html [NC,L]
</IfModule>
  • Disable browser caching for all files that don’t get a hash string by Angular ← Is this necessary and useful? (I currently put this part out as a comment)
<FilesMatch "^(?!.*\.([0-9a-z]{20})\.).*$">
  <IfModule mod_headers.c>
    FileETag None
    Header unset ETag
    Header unset Pragma
    Header unset Cache-Control
    Header unset Last-Modified
    Header set Pragma "no-cache"
    Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate"
    Header set Expires "Mon, 10 Apr 1972 00:00:00 GMT"
  </IfModule>
</FilesMatch>

Also, in the src/app.component.ts I have the service worker check:

async ngOnInit() {
    this.swUpdate.available.subscribe(async res => {
      const toast = await this.toastCtrl.create({
        message: 'Update available!',
        position: 'bottom',
        buttons: [{ role: 'cancel', text: 'Reload' }]
      });
      await toast.present();
      toast
        .onDidDismiss()
        .then(() => this.swUpdate.activateUpdate())
        .then(() => window.location.reload());
    });
    this.swUpdate.checkForUpdate();
    setInterval(() => {
      this.swUpdate.checkForUpdate();
    } , 15 * 60 * 1000);
  }

What’s wrong? Why isn’t my PWA updating immediately or never update?

1 post - 1 participant

Read full topic

Best practice for React routing

$
0
0

I have routing setup like this…

        <IonRouterOutlet id="main">
          <Route path="/home" component={Home} exact />
          <Route path="/birthday/new" component={AddBirthday} exact />
          <Route path="/birthday/edit/:id" component={EditBirthday} exact />
          <Route path="/birthday/:id" component={ViewBirthday} exact />
          <Route path="/account/create" component={CreateAccount} exact />
          <Route path="/login" component={Login} exact />
          <Route path="/about" component={About} exact />
          <Route path="/contact" component={Contact} exact />
          <Redirect exact from="/" to="/home" />
        </IonRouterOutlet>

When a page is in an IonRouterOutlet , the container controls the transition animation between the pages as well as controls when a page is created and destroyed, which helps maintain the state between the views when switching back and forth between them. – source

So if I’m editing a birthday (EditBirthday), and then go to the page for viewing a birthday (ViewBirthday), and then delete that same birthday… then I have an error thrown because the EditBirthday page’s data for that deleted birthday is no longer accessible.

A snippet of the EditBirthday page looks like this…

const UpdateBirthday = ({ history, match }) => {
  const { state } = useContext(AppContext);
  const birthday = state.birthdays[match.params.id];

  const [error, setError] = useState();
  const [name, setName] = useState(birthday.name);
  const [day, setDay] = useState(birthday.dob.day);
  const [month, setMonth] = useState(birthday.dob.month.toString());
  const [year, setYear] = useState(birthday.dob.year);
  const [notes, setNotes] = useState(birthday.notes);
  const [updateClicked, setUpdateClicked] = useState(false);

birthday becomes undefined, so accessing properties of it throws a TypeError.

So what I really need is for the EditBirthday page to not save state between views. Or how do I actually destroy a page like this one once done with it?

Thanks

1 post - 1 participant

Read full topic

Sharing my experience

$
0
0
I came in here expecting horrible customer service based on some of the other reviews (and more importantly, Mark's responses always defending the employees instead of backing down and living up to their faults), however I arrived last night and it was quiet, clean, easy (just quarters, no cards, thank the lord), and the lady with orange/red hair working was the SWEETEST! I would return if needed when I'm in town again.

1 post - 1 participant

Read full topic

Viewing all 71531 articles
Browse latest View live


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