Closed Nikhil-Daffodil closed 5 years ago
can you provide a sample app?
https://drive.google.com/folderview?id=15gEFk_CbkhPbRin2COwJuR9L8laxjYtR
Check out sign up page for more clarification
I'm asking about the code, not the apk
app.module.ts `import { NgModule } from '@angular/core'; import { BrowserModule } from '@angular/platform-browser'; import { RouteReuseStrategy } from '@angular/router';
import { IonicModule, IonicRouteStrategy } from '@ionic/angular'; import { SplashScreen } from '@ionic-native/splash-screen/ngx'; import { StatusBar } from '@ionic-native/status-bar/ngx';
import { AppComponent } from './app.component'; import { AppRoutingModule } from './app-routing.module'; import { Pedometer } from '@ionic-native/pedometer/ngx'; import { Stepcounter } from '@ionic-native/stepcounter/ngx'; import { NgCircleProgressModule } from 'ng-circle-progress'; import { Network } from '@ionic-native/network/ngx'; import { StorageProvider } from './providers/storage/storage.service'; import { IonicStorageModule } from '@ionic/storage'; import { InAppBrowser } from '@ionic-native/in-app-browser/ngx'; import { Keyboard } from '@ionic-native/keyboard/ngx'; import { HTTP_INTERCEPTORS, HttpClientModule } from '@angular/common/http'; import { TokenInterceptor } from './providers/service/token.interceptor'; import { ServiceProvider } from './providers/service/service.service'; import { SetReminderComponent } from './components/set-reminder/set-reminder.component'; import { ReactiveFormsModule } from '@angular/forms'; import { ReminderDetailsComponent } from './components/reminder-details/reminder-details.component'; import { TextToSpeech } from '@ionic-native/text-to-speech/ngx'; import { BrowserAnimationsModule } from "@angular/platform-browser/animations"; import { LocalNotifications } from '@ionic-native/local-notifications/ngx'; import { Push } from '@ionic-native/push/ngx'; import { SocialSharing } from '@ionic-native/social-sharing/ngx';
app.component.ts `import { Component, ViewChild } from '@angular/core';
import { Platform, NavController, Events, IonRouterOutlet, AlertController, MenuController, LoadingController } from '@ionic/angular'; import { SplashScreen } from '@ionic-native/splash-screen/ngx'; import { StatusBar } from '@ionic-native/status-bar/ngx'; import { Config } from './app.config'; import { Keyboard } from '@ionic-native/keyboard/ngx'; import { StorageProvider } from './providers/storage/storage.service'; import { LoginService } from './providers/login/login.service'; import { CommonPopoverService } from './providers/common-popover/common-popover.service'; import { Push, PushObject, PushOptions, } from '@ionic-native/push/ngx'; import { PushNotificationService } from './providers/push-notification/push-notification.service';
@Component({ selector: 'app-root', templateUrl: 'app.component.html' }) export class AppComponent { userName: string; public appPages = Config; exitAlert: any; logoutLoading: any; deviceId: any; @ViewChild(IonRouterOutlet) routerOutlet: IonRouterOutlet;
constructor( private platform: Platform, private splashScreen: SplashScreen, private statusBar: StatusBar, private navCtrl: NavController, private events: Events, private keyboard: Keyboard, private alert: AlertController, private keystore: StorageProvider, private menu: MenuController, private loginService: LoginService, private loader: LoadingController, private commonPopover: CommonPopoverService, private push: Push, private pushService: PushNotificationService ) { this.initializeApp(); }
/**
App initialization */ initializeApp() { this.platform.ready().then(() => { this.keyboard.hideFormAccessoryBar(false); // this.keyboard.disableScroll(false); this.statusBar.styleDefault(); // Let status bar overlay webview this.statusBar.overlaysWebView(true); // Set status bar to white this.statusBar.backgroundColorByHexString('#78C000'); this.splashScreen.hide(); this.getUserName(); this.pushSetup();
//User name information this.events.subscribe('user:info', message => { this.getUserName(); })
//Login event this.events.subscribe('user:login', (form) => { this.getUserName(); this.keystore.set("isAuthenticated", true); this.navCtrl.navigateRoot("/home"); if (this.deviceId) { this.pushService.registerForPushNotification(this.deviceId).then((response) => { console.log(response); }); } });
//Logout event this.events.subscribe('user:logout', message => { this.loginService.logout().then(result => { this.commonPopover.toastPopOver(message); this.commonPopover.loaderDismiss(); this.navCtrl.navigateRoot('/login')//navigate to login this.events.publish('homePageDataLoaded', false); }) })
//Back button click this.platform.backButton.subscribe(() => { if (this.routerOutlet && this.routerOutlet.canGoBack()) { this.routerOutlet.pop(); } else { return this.onBackButton(); } }) }); }
pushSetup() {
// to check if we have permission this.push.hasPermission() .then((res: any) => {
if (res.isEnabled) {
console.log('We have permission to send push notifications');
} else {
console.log('We do not have permission to send push notifications');
}
});
// Create a channel (Android O and above). You'll need to provide the id, description and importance properties. this.push.createChannel({ id: "testchannel1", description: "My first test channel", // The importance property goes from 1 = Lowest, 2 = Low, 3 = Normal, 4 = High and 5 = Highest. importance: 3 }).then(() => console.log('Channel created'));
// Delete a channel (Android O and above) this.push.deleteChannel('testchannel1').then(() => console.log('Channel deleted'));
// Return a list of currently configured channels this.push.listChannels().then((channels) => console.log('List of channels', channels))
// to initialize push notifications
const options: PushOptions = { android: { senderID: "794988011253", sound: true, vibrate: true, icon: 'ic_notification', iconColor: '#78C000', forceShow: true }, ios: { alert: 'true', badge: true, sound: true, clearBadge: true }, windows: {}, browser: { pushServiceURL: 'http://push.api.phonegap.com/v1/push' } }
const pushObject: PushObject = this.push.init(options);
pushObject.on('notification').subscribe((notification: any) => { console.log('Received a notification', notification); if (notification.additionalData.foreground) { //console.log("notificaton foreground",data);
// if application open, show popup
this.commonPopover.alertPopOver(notification.message, notification.title)
} else { //if user NOT using app and push notification comes //TODO: Your logic on click of push notification directly // this.onPushNotificationClicked(data);
//console.log('Push notification clicked');
} });
pushObject.on('registration').subscribe((registration: any) => { console.log('Device registered', registration); this.deviceId = registration.registrationId });
pushObject.on('error').subscribe(error => console.error('Error with Push plugin', error)); }
/**
Getting the user name. */ getUserName() { this.keystore.get("userName").then(user => { if (user) this.userName = user; }) }
/**
Logout confirmation alert box */ goToLogout() { this.commonPopover.alertPopOver('Do you really want to logout?', 'Logout confirmation').then(data => { if (data) { this.menu.close().then(() => { this.logoutLoader(); }) } }) }
/**
Logout loader */ logoutLoader() { this.commonPopover.loaderPresent('Logging Out...'); let message = 'Successfully logged out'; if (this.deviceId) {
this.pushService.deletePushNotificationToken(this.deviceId).then((response) => { }).catch((err) => { this.commonPopover.toastPopOver("Unable to delete token"); }).then(() => {
this.events.publish('user:logout', message)
}) } else { this.events.publish('user:logout', message)
} }
/**
Unsubcribe logout event */ ngOnDestroy() { this.events.unsubscribe('user:logout') }
/**
{ "name": "PersonalHealthAssistant", "version": "0.0.1", "author": "Ionic Framework", "homepage": "https://ionicframework.com/", "scripts": { "ng": "ng", "start": "ng serve", "build": "ng build", "test": "ng test", "lint": "ng lint", "e2e": "ng e2e" }, "private": true, "dependencies": { "@angular/animations": "^8.2.3", "@angular/common": "^7.2.2", "@angular/core": "^7.2.2", "@angular/forms": "^7.2.2", "@angular/http": "^7.2.2", "@angular/platform-browser": "^7.2.2", "@angular/platform-browser-dynamic": "^7.2.2", "@angular/router": "^7.2.2", "@ionic-native/core": "^5.0.0", "@ionic-native/firebase": "^5.9.0", "@ionic-native/in-app-browser": "^5.6.1", "@ionic-native/keyboard": "^5.6.1", "@ionic-native/local-notifications": "^5.12.0", "@ionic-native/network": "^5.5.1", "@ionic-native/pedometer": "^5.5.1", "@ionic-native/push": "^5.12.0", "@ionic-native/social-sharing": "^5.12.0", "@ionic-native/splash-screen": "^5.0.0", "@ionic-native/status-bar": "^5.0.0", "@ionic-native/stepcounter": "^5.5.1", "@ionic-native/text-to-speech": "^5.10.0", "@ionic/angular": "^4.1.0", "@ionic/pro": "2.0.4", "@ionic/storage": "^2.2.0", "cordova-android": "^7.1.4", "cordova-plugin-badge": "0.8.8", "cordova-plugin-device": "^2.0.2", "cordova-plugin-inappbrowser": "3.0.0", "cordova-plugin-ionic-keyboard": "^2.1.3", "cordova-plugin-ionic-webview": "^4.0.1", "cordova-plugin-local-notification": "0.9.0-beta.2", "cordova-plugin-network-information": "2.0.1", "cordova-plugin-pedometer": "0.4.1", "cordova-plugin-splashscreen": "^5.0.2", "cordova-plugin-statusbar": "^2.4.2", "cordova-plugin-stepcounter": "1.0.1", "cordova-plugin-tts": "^0.2.3", "cordova-plugin-whitelist": "^1.3.3", "cordova-plugin-x-socialsharing": "^5.4.7", "cordova-sqlite-storage": "3.2.0", "cordova-support-google-services": "^1.1.0", "core-js": "^2.5.4", "es6-promise-plugin": "^4.2.2", "jwt-decode": "^2.2.0", "moment": "^2.24.0", "ng-animate": "^0.3.4", "ng-circle-progress": "^1.4.0", "phonegap-plugin-multidex": "^1.0.0", "phonegap-plugin-push": "^2.2.3", "rxjs": "~6.5.1", "tslib": "^1.9.0", "zone.js": "~0.8.29" }, "devDependencies": { "@angular-devkit/architect": "~0.13.8", "@angular-devkit/build-angular": "~0.13.8", "@angular-devkit/core": "~7.3.8", "@angular-devkit/schematics": "~7.3.8", "@angular/cli": "~7.3.8", "@angular/compiler": "~7.2.2", "@angular/compiler-cli": "~7.2.2", "@angular/language-service": "~7.2.2", "@ionic/angular-toolkit": "~1.5.1", "@types/node": "~10.14.2", "@types/jasmine": "~2.8.8", "@types/jasminewd2": "~2.0.3", "codelyzer": "~4.5.0", "jasmine-core": "~2.99.1", "jasmine-spec-reporter": "~4.2.1", "karma": "~4.1.0", "karma-chrome-launcher": "~2.2.0", "karma-coverage-istanbul-reporter": "~2.0.1", "karma-jasmine": "~1.1.2", "karma-jasmine-html-reporter": "^0.2.2", "protractor": "~5.4.0", "ts-node": "~8.1.0", "tslint": "~5.16.0", "typescript": "~3.1.6" }, "description": "An Ionic project", "cordova": { "plugins": { "cordova-plugin-whitelist": {}, "cordova-plugin-statusbar": {}, "cordova-plugin-device": {}, "cordova-plugin-splashscreen": {}, "cordova-plugin-ionic-webview": { "ANDROID_SUPPORT_ANNOTATIONS_VERSION": "27.+" }, "cordova-plugin-ionic-keyboard": {}, "cordova-plugin-network-information": {}, "cordova-sqlite-storage": {}, "cordova-plugin-inappbrowser": {}, "cordova-plugin-local-notification": {}, "cordova-plugin-tts": {}, "phonegap-plugin-push": { "ANDROID_SUPPORT_V13_VERSION": "27.+", "FCM_VERSION": "11.6.2" }, "cordova-plugin-x-socialsharing": { "ANDROID_SUPPORT_V4_VERSION": "24.1.1+" } }, "platforms": [ "android" ] } }
ionic info `Ionic:
Ionic CLI : 5.2.5 (/usr/local/lib/node_modules/ionic) Ionic Framework : @ionic/angular 4.3.1 @angular-devkit/build-angular : 0.13.8 @angular-devkit/schematics : 7.3.8 @angular/cli : 7.3.8 @ionic/angular-toolkit : 1.5.1
Cordova:
Cordova CLI : 9.0.0 (cordova-lib@9.0.1) Cordova Platforms : android 7.1.4 Cordova Plugins : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 4.0.1, (and 14 other plugins)
Utility:
cordova-res : not installed native-run : 0.2.8
System:
login.page.html
`
If you installed status bar plugin(https://ionicframework.com/docs/native/status-bar) that's fine otherwise install the plugin, after the installation open your app.component.ts, go to your constructor add below line,
this.statusBar.overlaysWebView(false);
That's it, hope it will solve your toolbar truncating problem.
Thanks, Mohan Batchu.
@MohanKrishnaBatchu Thanks man, it works. You save my day
That's why I was asking for a sample app, other plugins like status-bar plugin can cause conflicts like in this case.
Next release of cordova-plugin-ionic-keyboard (2.2.0) will have a new preference (<preference name="resizeOnFullScreen" value="true" />
) that can probably help with your issue you don' have to set overlaysWebView to false.
@jcesarmobile that will be great if we get it in the next release. Thanks for help
If you installed status bar plugin(https://ionicframework.com/docs/native/status-bar) that's fine otherwise install the plugin, after the installation open your app.component.ts, go to your constructor add below line,
this.statusBar.overlaysWebView(false);
That's it, hope it will solve your toolbar truncating problem.
Thanks, Mohan Batchu.
@MohanKrishnaBatchu I faced another issue, the input field doesn't come up at first. It hides under the keyboard and when I type it comes up
I uninstalled status bar and tested my app but the ion-content didn't scroll and the input field was covered by the keyboard.. then I installed again status bar and added
this.statusBar.overlaysWebView(false);
in the app.component.ts but the result was the same.. it didn't push ion-content and it hides the input
I just tested
//<preference name="resizeOnFullScreen" value="true"
with the latest commit, it works partially: when first touch on input the input remain hidden until I start writing, after that all my ion-footers hide like 30%
@poimsms do you found any solution to resolve this please ?
Yes, I downgrade the keyboard plugin and that solve muy problem
El vie., 28 de febrero de 2020 1:18 p. m., ElfatniAnass < notifications@github.com> escribió:
@poimsms https://github.com/poimsms do you found any solution to resolve this please ?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ionic-team/cordova-plugin-ionic-keyboard/issues/110?email_source=notifications&email_token=AJGDWOHV4LNHZBO7PEL7QN3RFE2M3A5CNFSM4IR6EZ2KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOENJCHKA#issuecomment-592585640, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJGDWOEVYBNVZO6ASGT5PVDRFE2M3ANCNFSM4IR6EZ2A .
@poimsms thanks for your replay i'm facing the same problem but i'm juste adding Keyboard offset
of the content that's solve the problem
@ElfatniAnass
Where did you add the Keyboard offset
of the content?
@smiledev1230 in your global scss file add Keyboard offset ex :
ion-content.class-content { --keyboard-offset: 10rem !important; }
In Android the keyboard covers the input field inside a form, thus making me unable to see what has been written unless I close the keyboard.
I'm not developing iOS, so can't say about that
Thanks in advance