소스 검색

notificationSet

jpsp91 6 년 전
부모
커밋
9c91fef63c

+ 5
- 0
Vitamin/package-lock.json 파일 보기

@@ -104,6 +104,11 @@
104 104
       "resolved": "https://registry.npmjs.org/@ionic-native/core/-/core-4.11.0.tgz",
105 105
       "integrity": "sha512-bBFE6bM0P254CWmqAqWe2ju7WPo51yn/vIoBrEb5SX2Iousn+1xYwuIO93n9+nlx17EI7Uz+h2mPej4Chi7hLQ=="
106 106
     },
107
+    "@ionic-native/local-notifications": {
108
+      "version": "4.11.0",
109
+      "resolved": "https://registry.npmjs.org/@ionic-native/local-notifications/-/local-notifications-4.11.0.tgz",
110
+      "integrity": "sha512-hUPOKpmsjzeSLs1Ri4LpCrqCoy1+OG6xn10fWtDR/SBfeY1GtAlCK8M1iV/mFLxH/HCyRdp5bPHB72SoQRa9fg=="
111
+    },
107 112
     "@ionic-native/splash-screen": {
108 113
       "version": "4.11.0",
109 114
       "resolved": "https://registry.npmjs.org/@ionic-native/splash-screen/-/splash-screen-4.11.0.tgz",

+ 2
- 1
Vitamin/package.json 파일 보기

@@ -20,7 +20,8 @@
20 20
     "@angular/http": "5.2.11",
21 21
     "@angular/platform-browser": "5.2.11",
22 22
     "@angular/platform-browser-dynamic": "5.2.11",
23
-    "@ionic-native/core": "~4.11.0",
23
+    "@ionic-native/core": "^4.11.0",
24
+    "@ionic-native/local-notifications": "^4.11.0",
24 25
     "@ionic-native/splash-screen": "~4.11.0",
25 26
     "@ionic-native/status-bar": "~4.11.0",
26 27
     "@ionic/storage": "2.1.3",

+ 1
- 0
Vitamin/src/app/app.component.ts 파일 보기

@@ -5,6 +5,7 @@ import { SplashScreen } from '@ionic-native/splash-screen';
5 5
 
6 6
 import { HomePage } from '../pages/home/home';
7 7
 
8
+
8 9
 @Component({
9 10
   templateUrl: 'app.html'
10 11
 })

+ 9
- 3
Vitamin/src/app/app.module.ts 파일 보기

@@ -8,6 +8,9 @@ import { MyApp } from './app.component';
8 8
 import { HomePage } from '../pages/home/home';
9 9
 import { CommonVitaminsPage } from '../pages/common-vitamins/common-vitamins';
10 10
 import { RegisterPage } from '../pages/register/register';
11
+import { AlarmPage }from '../pages/alarm/alarm';
12
+
13
+import { LocalNotifications } from '@ionic-native/local-notifications';
11 14
 
12 15
 
13 16
 
@@ -16,7 +19,8 @@ import { RegisterPage } from '../pages/register/register';
16 19
     MyApp,
17 20
     HomePage,
18 21
     CommonVitaminsPage,
19
-    RegisterPage
22
+    RegisterPage,
23
+    AlarmPage
20 24
   ],
21 25
   imports: [
22 26
     BrowserModule,
@@ -27,12 +31,14 @@ import { RegisterPage } from '../pages/register/register';
27 31
     MyApp,
28 32
     HomePage,
29 33
     CommonVitaminsPage,
30
-    RegisterPage
34
+    RegisterPage,
35
+    AlarmPage
31 36
   ],
32 37
   providers: [
33 38
     StatusBar,
34 39
     SplashScreen,
35
-    {provide: ErrorHandler, useClass: IonicErrorHandler}
40
+    {provide: ErrorHandler, useClass: IonicErrorHandler},
41
+    LocalNotifications
36 42
   ]
37 43
 })
38 44
 export class AppModule {}

+ 16
- 0
Vitamin/src/pages/alarm/alarm.html 파일 보기

@@ -0,0 +1,16 @@
1
+
2
+
3
+<ion-header>
4
+
5
+  <ion-navbar>
6
+    <ion-title>Alarm</ion-title>
7
+  </ion-navbar>
8
+
9
+</ion-header>
10
+
11
+
12
+<ion-content padding>
13
+
14
+  <button ion-button full (click)="btnPushClicked()">Schedule!!!</button>
15
+
16
+</ion-content>

+ 13
- 0
Vitamin/src/pages/alarm/alarm.module.ts 파일 보기

@@ -0,0 +1,13 @@
1
+import { NgModule } from '@angular/core';
2
+import { IonicPageModule } from 'ionic-angular';
3
+import { AlarmPage } from './alarm';
4
+
5
+@NgModule({
6
+  declarations: [
7
+    AlarmPage,
8
+  ],
9
+  imports: [
10
+    IonicPageModule.forChild(AlarmPage),
11
+  ],
12
+})
13
+export class AlarmPageModule {}

+ 17
- 0
Vitamin/src/pages/alarm/alarm.scss 파일 보기

@@ -0,0 +1,17 @@
1
+page-alarm {
2
+
3
+
4
+
5
+
6
+
7
+
8
+
9
+    //this removes the scroll bar on the side
10
+.scroll-content {
11
+    overflow: hidden;
12
+}
13
+
14
+
15
+
16
+
17
+}

+ 42
- 0
Vitamin/src/pages/alarm/alarm.ts 파일 보기

@@ -0,0 +1,42 @@
1
+import { Component } from '@angular/core';
2
+import { IonicPage, NavController, NavParams, AlertController, Platform, DateTime } from 'ionic-angular';
3
+
4
+import { LocalNotifications } from '@ionic-native/local-notifications';
5
+
6
+
7
+
8
+@IonicPage()
9
+@Component({
10
+  selector: 'page-alarm',
11
+  templateUrl: 'alarm.html',
12
+})
13
+export class AlarmPage {
14
+
15
+
16
+  constructor(public navCtrl: NavController, private localNoti: LocalNotifications, private platform: Platform){
17
+
18
+
19
+  }
20
+
21
+
22
+  btnPushClicked(){
23
+    this.platform.ready().then(() => {
24
+      this.localNoti.schedule({
25
+        title: 'Vita-Alarm!',
26
+        text: 'Take your Vitamin!',
27
+        trigger: {at: new Date(new Date().getTime() + 3600)},
28
+        led: 'FF0000',
29
+        
30
+     });
31
+    });
32
+  }
33
+
34
+
35
+
36
+
37
+
38
+
39
+
40
+
41
+
42
+}

+ 2
- 4
Vitamin/src/pages/home/home.html 파일 보기

@@ -1,7 +1,5 @@
1 1
 <ion-header>
2
-  <ion-navbar>
3
-    <ion-title>Home</ion-title>
4
-  </ion-navbar>
2
+ 
5 3
 </ion-header>
6 4
 
7 5
 <ion-content text-center class = "login">
@@ -53,7 +51,7 @@
53 51
 
54 52
 
55 53
 
56
-  <button ion-button color="danger" (click)="commonVitaminPage()" round>Login</button>
54
+  <button ion-button color="danger" (click)="alarmPage()" round>Login</button>
57 55
   <br>
58 56
 
59 57
   <button ion-button color="danger" (click)="registerPage()" round>Sign Up</button>

+ 6
- 0
Vitamin/src/pages/home/home.ts 파일 보기

@@ -3,6 +3,8 @@ import { NavController } from 'ionic-angular';
3 3
 import { RegisterPage } from '../register/register';
4 4
 import { CommonVitaminsPage } from '../common-vitamins/common-vitamins';
5 5
 
6
+import { AlarmPage }from '../alarm/alarm';
7
+
6 8
 @Component({
7 9
   selector: 'page-home',
8 10
   templateUrl: 'home.html'
@@ -24,6 +26,10 @@ commonVitaminPage() {
24 26
     
25 27
   }
26 28
 
29
+  alarmPage() {
30
+    this.navCtrl.push(AlarmPage);
31
+  }
32
+
27 33
 
28 34
 
29 35
 }

+ 18
- 0
Vitamin/src/pages/menu/menu.html 파일 보기

@@ -0,0 +1,18 @@
1
+<!--
2
+  Generated template for the MenuPage page.
3
+
4
+  See http://ionicframework.com/docs/components/#navigation for more info on
5
+  Ionic pages and navigation.
6
+-->
7
+<ion-header>
8
+
9
+  <ion-navbar>
10
+    <ion-title>menu</ion-title>
11
+  </ion-navbar>
12
+
13
+</ion-header>
14
+
15
+
16
+<ion-content padding>
17
+
18
+</ion-content>

+ 13
- 0
Vitamin/src/pages/menu/menu.module.ts 파일 보기

@@ -0,0 +1,13 @@
1
+import { NgModule } from '@angular/core';
2
+import { IonicPageModule } from 'ionic-angular';
3
+import { MenuPage } from './menu';
4
+
5
+@NgModule({
6
+  declarations: [
7
+    MenuPage,
8
+  ],
9
+  imports: [
10
+    IonicPageModule.forChild(MenuPage),
11
+  ],
12
+})
13
+export class MenuPageModule {}

+ 3
- 0
Vitamin/src/pages/menu/menu.scss 파일 보기

@@ -0,0 +1,3 @@
1
+page-menu {
2
+
3
+}

+ 25
- 0
Vitamin/src/pages/menu/menu.ts 파일 보기

@@ -0,0 +1,25 @@
1
+import { Component } from '@angular/core';
2
+import { IonicPage, NavController, NavParams } from 'ionic-angular';
3
+
4
+/**
5
+ * Generated class for the MenuPage page.
6
+ *
7
+ * See https://ionicframework.com/docs/components/#navigation for more info on
8
+ * Ionic pages and navigation.
9
+ */
10
+
11
+@IonicPage()
12
+@Component({
13
+  selector: 'page-menu',
14
+  templateUrl: 'menu.html',
15
+})
16
+export class MenuPage {
17
+
18
+  constructor(public navCtrl: NavController, public navParams: NavParams) {
19
+  }
20
+
21
+  ionViewDidLoad() {
22
+    console.log('ionViewDidLoad MenuPage');
23
+  }
24
+
25
+}