Using with Ioinc Cloud Auth
selloutdesign opened this issue · comments
Following the documentation provided I am getting error:
VM132 main.js:57014 TypeError: platform.toLowerCase is not a function at Insights.normalizeDevicePlatform (http://localhost:8100/build/main.js:64708:25) at Insights.markActive (http://localhost:8100/build/main.js:64698:33) at Insights.checkActivity (http://localhost:8100/build/main.js:64687:22) at http://localhost:8100/build/main.js:64663:27 at t.invokeTask (http://localhost:8100/build/polyfills.js:3:9723) at Object.onInvokeTask (http://localhost:8100/build/main.js:37967:37) at t.invokeTask (http://localhost:8100/build/polyfills.js:3:9659) at e.runTask (http://localhost:8100/build/polyfills.js:3:7083) at invoke (http://localhost:8100/build/polyfills.js:3:10836) at e.args.(anonymous function) (http://localhost:8100/build/polyfills.js:2:30123)
`import { Component } from '@angular/core';
import { NavController, ToastController } from 'ionic-angular';
import { Auth, User } from '@ionic/cloud-angular';
import { TranslateService } from 'ng2-translate/ng2-translate';
import { MainPage } from '../../pages/pages';
// import { User } from '../../providers/user';
@component({
selector: 'page-login',
templateUrl: 'login.html'
})
export class LoginPage {
// The account fields for the login form.
// If you're using the username field with or without email, make
// sure to add it to the type
account: {email: string, password: string} = {
email: 'test@example.com',
password: 'test'
};
// Our translated text strings
private loginErrorString: string;
constructor(public navCtrl: NavController,
public user: User,
public toastCtrl: ToastController,
public translateService: TranslateService) {
this.translateService.get('LOGIN_ERROR').subscribe((value) => {
this.loginErrorString = value;
})
}
// Attempt to login in through our User service
doLogin() {
this.navCtrl.push(MainPage);
// this.user.login(this.account).subscribe((resp) => {
// this.navCtrl.push(MainPage);
// }, (err) => {
// this.navCtrl.push(MainPage);
// // Unable to log in
// let toast = this.toastCtrl.create({
// message: this.loginErrorString,
// duration: 3000,
// position: 'top'
// });
// toast.present();
// });
}
}
`
`import { NgModule, ErrorHandler } from '@angular/core';
import { Http } from '@angular/http';
import { IonicApp, IonicModule, IonicErrorHandler } from 'ionic-angular';
import { Storage } from '@ionic/storage';
import { MyApp } from './app.component';
import { CloudSettings, CloudModule } from '@ionic/cloud-angular';
import { CardsPage } from '../pages/cards/cards';
import { ContentPage } from '../pages/content/content';
import { LoginPage } from '../pages/login/login';
import { MapPage } from '../pages/map/map';
import { SignupPage } from '../pages/signup/signup';
import { TabsPage } from '../pages/tabs/tabs';
import { FoodTabsPage } from '../pages/food-detail-tabs/food-detail-tabs';
import { TutorialPage } from '../pages/tutorial/tutorial';
import { WelcomePage } from '../pages/welcome/welcome';
import { ListMasterPage } from '../pages/list-master/list-master';
import { ItemCreatePage } from '../pages/item-create/item-create';
import { ItemDetailPage } from '../pages/item-detail/item-detail';
import { FoodDetailPage } from '../pages/food-detail/food-detail';
import { NutritionFactsPage } from '../pages/nutrition-facts/nutrition-facts';
import { MenuPage } from '../pages/menu/menu';
import { SettingsPage } from '../pages/settings/settings';
import { SearchPage } from '../pages/search/search';
import { BarcodeScannerComponent } from '../pages/barcode-scanner/barcode-scanner'
import { HeartGauge } from '../pages/heart-gauge/heart-gauge';
import { SkullGauge } from '../pages/skull-gauge/skull-gauge';
import { OrderBy } from '../services/order-by';
import { ProteinModalComponent } from '../pages/food-detail/modals/protein/protein-modal';
import { FiberModalComponent } from '../pages/food-detail/modals/fiber/fiber-modal';
import { VitaminModalComponent } from '../pages/food-detail/modals/vitamin/vitamin-modal';
import { MineralModalComponent } from '../pages/food-detail/modals/mineral/mineral-modal';
import { SodiumModalComponent } from '../pages/food-detail/modals/sodium/sodium-modal';
import { SugarModalComponent } from '../pages/food-detail/modals/sugar/sugar-modal';
import { FatModalComponent } from '../pages/food-detail/modals/fat/fat-modal';
import { BadModalComponent } from '../pages/food-detail/modals/bad/bad-modal';
import { OverallModalComponent } from '../pages/food-detail/modals/overall/overall-modal';
import { User } from '../providers/user';
import { Api } from '../providers/api';
import { FoodApi } from '../providers/food-item-api';
import { Settings } from '../providers/settings';
import { Food } from '../providers/food-item'
import { Items } from '../mocks/providers/items';
import { TranslateModule, TranslateLoader, TranslateStaticLoader } from 'ng2-translate/ng2-translate';
// Ionic Cloud Settings
const cloudSettings: CloudSettings = {
'core': {
'app_id': '72ff4b3c'
}
};
// The translate loader needs to know where to load i18n files
// in Ionic's static asset pipeline.
export function createTranslateLoader(http: Http) {
return new TranslateStaticLoader(http, './assets/i18n', '.json');
}
export function provideSettings(storage: Storage) {
/**
- The Settings provider takes a set of default settings for your app.
- You can add new settings options at any time. Once the settings are saved,
- these values will not overwrite the saved values (this can be done manually if desired).
*/
return new Settings(storage, {
option1: true,
option2: 'Ionitron J. Framework',
option3: '3',
option4: 'Hello'
});
}
/**
- The Pages array lists all of the pages we want to use in our app.
- We then take these pages and inject them into our NgModule so Angular
- can find them. As you add and remove pages, make sure to keep this list up to date.
*/
let pages = [
MyApp,
CardsPage,
ContentPage,
LoginPage,
MapPage,
SignupPage,
TabsPage,
FoodTabsPage,
TutorialPage,
WelcomePage,
ListMasterPage,
ItemDetailPage,
ItemCreatePage,
MenuPage,
SettingsPage,
SearchPage,
BarcodeScannerComponent,
SkullGauge,
HeartGauge,
FoodDetailPage,
NutritionFactsPage,
ProteinModalComponent,
FiberModalComponent,
VitaminModalComponent,
MineralModalComponent,
SodiumModalComponent,
SugarModalComponent,
FatModalComponent,
BadModalComponent,
OverallModalComponent
];
export function declarations() {
return pages;
}
export function entryComponents() {
return pages;
}
export function providers() {
return [
Storage,
User,
Api,
FoodApi,
Items,
Food,
{ provide: Settings, useFactory: provideSettings, deps: [ Storage ] },
// Keep this to enable Ionic's runtime error handling during development
{ provide: ErrorHandler, useClass: IonicErrorHandler }
];
}
@NgModule({
declarations: [declarations(), OrderBy],
imports: [
IonicModule.forRoot(MyApp),
TranslateModule.forRoot({
provide: TranslateLoader,
useFactory: (createTranslateLoader),
deps: [Http]
}),
CloudModule.forRoot(cloudSettings)
],
bootstrap: [IonicApp],
entryComponents: entryComponents(),
providers: providers()
})
export class AppModule {}
`
Uncaught Error: Can't resolve all parameters for LoginPage: (NavController, ?, ToastController, TranslateService).
at CompileMetadataResolver._getDependenciesMetadata (http://localhost:8100/build/main.js:33778:19)
at CompileMetadataResolver._getTypeMetadata (http://localhost:8100/build/main.js:33672:26)
at http://localhost:8100/build/main.js:33589:53
at Array.map (native)
at CompileMetadataResolver._loadNgModuleMetadata (http://localhost:8100/build/main.js:33589:18)
at CompileMetadataResolver.loadNgModuleMetadata (http://localhost:8100/build/main.js:33468:29)
at RuntimeCompiler._loadModules (http://localhost:8100/build/main.js:52985:41)
at RuntimeCompiler.compileModuleAndComponents (http://localhost:8100/build/main.js:52955:35)
at RuntimeCompiler.compileModuleAsync (http://localhost:8100/build/main.js:52945:21)
at PlatformRef._bootstrapModuleWithZone (http://localhost:8100/build/main.js:35696:25)
Your formatting in here is hard to read, can you put it in monospace style please?
I rolled back to .8 @ionic/cloud-angular and it works fine.
So please file a bug at ionic-cloud and close this.