diff --git a/config.xml b/config.xml
new file mode 100644
index 0000000..96e8bcd
--- /dev/null
+++ b/config.xml
@@ -0,0 +1,101 @@
+
+
+ MyApp
+ An awesome Ionic/Cordova app.
+ Ionic Framework Team
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ionic.config.json b/ionic.config.json
index 3fd7afa..78c2212 100644
--- a/ionic.config.json
+++ b/ionic.config.json
@@ -1,5 +1,7 @@
{
"name": "IonicTranslator",
- "integrations": {},
+ "integrations": {
+ "cordova": {}
+ },
"type": "angular"
}
diff --git a/package-lock.json b/package-lock.json
index 5c064c3..9ed331e 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1562,6 +1562,23 @@
}
}
},
+ "@ionic/storage": {
+ "version": "2.3.1",
+ "resolved": "https://registry.npmjs.org/@ionic/storage/-/storage-2.3.1.tgz",
+ "integrity": "sha512-IdYKr6xRatumkhceVbjmySCrA20KKcojQN0MyS857D4OgvcDtQhG9mvTXtfX/tU2hxaFlN6WkUaQOy3oPFcJvA==",
+ "requires": {
+ "localforage": "1.7.1",
+ "localforage-cordovasqlitedriver": "1.7.0",
+ "tslib": "^1.10.0"
+ },
+ "dependencies": {
+ "tslib": {
+ "version": "1.14.1",
+ "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz",
+ "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg=="
+ }
+ }
+ },
"@istanbuljs/schema": {
"version": "0.1.2",
"resolved": "https://registry.npmjs.org/@istanbuljs/schema/-/schema-0.1.2.tgz",
@@ -3623,6 +3640,21 @@
}
}
},
+ "cordova-sqlite-storage": {
+ "version": "5.1.0",
+ "resolved": "https://registry.npmjs.org/cordova-sqlite-storage/-/cordova-sqlite-storage-5.1.0.tgz",
+ "integrity": "sha512-UmHe9yQiYblDBToh3z91WHuD6ZgmCm3VX+1QFseYQs4WVQ3+ndj22qyGby/NV0uyCgok91gB1obLjLM+9vYJEw==",
+ "dev": true,
+ "requires": {
+ "cordova-sqlite-storage-dependencies": "3.0.0"
+ }
+ },
+ "cordova-sqlite-storage-dependencies": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/cordova-sqlite-storage-dependencies/-/cordova-sqlite-storage-dependencies-3.0.0.tgz",
+ "integrity": "sha512-A7gV5lQZc0oPrJ/a+lsZmMZr7vYou4MXyQFOY+b/dwuCMsagLT0EsL7oY54tqzpvjtzLfh0aZGGm9i8DMAIFSA==",
+ "dev": true
+ },
"core-js": {
"version": "3.6.4",
"resolved": "https://registry.npmjs.org/core-js/-/core-js-3.6.4.tgz",
@@ -6128,8 +6160,7 @@
"immediate": {
"version": "3.0.6",
"resolved": "https://registry.npmjs.org/immediate/-/immediate-3.0.6.tgz",
- "integrity": "sha1-nbHb0Pr43m++D13V5Wu2BigN5ps=",
- "dev": true
+ "integrity": "sha1-nbHb0Pr43m++D13V5Wu2BigN5ps="
},
"import-cwd": {
"version": "2.1.0",
@@ -7340,6 +7371,32 @@
"json5": "^2.1.2"
}
},
+ "localforage": {
+ "version": "1.7.1",
+ "resolved": "https://registry.npmjs.org/localforage/-/localforage-1.7.1.tgz",
+ "integrity": "sha1-5JJ+BCMCuGTbMPMhHxO1xvDell0=",
+ "requires": {
+ "lie": "3.1.1"
+ },
+ "dependencies": {
+ "lie": {
+ "version": "3.1.1",
+ "resolved": "https://registry.npmjs.org/lie/-/lie-3.1.1.tgz",
+ "integrity": "sha1-mkNrLMd0bKWd56QfpGmz77dr2H4=",
+ "requires": {
+ "immediate": "~3.0.5"
+ }
+ }
+ }
+ },
+ "localforage-cordovasqlitedriver": {
+ "version": "1.7.0",
+ "resolved": "https://registry.npmjs.org/localforage-cordovasqlitedriver/-/localforage-cordovasqlitedriver-1.7.0.tgz",
+ "integrity": "sha1-i5OVd1nuaI06WNW6fAR39sy1ODg=",
+ "requires": {
+ "localforage": ">=1.5.0"
+ }
+ },
"locate-path": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz",
diff --git a/package.json b/package.json
index 5ee600c..da35d11 100644
--- a/package.json
+++ b/package.json
@@ -23,6 +23,7 @@
"@ionic-native/splash-screen": "^5.0.0",
"@ionic-native/status-bar": "^5.0.0",
"@ionic/angular": "^5.0.0",
+ "@ionic/storage": "^2.3.1",
"rxjs": "~6.5.5",
"tslib": "^2.0.0",
"zone.js": "~0.10.3"
@@ -34,10 +35,11 @@
"@angular/compiler-cli": "~10.0.0",
"@angular/language-service": "~10.0.0",
"@ionic/angular-toolkit": "^2.3.0",
- "@types/node": "^12.11.1",
"@types/jasmine": "~3.5.0",
"@types/jasminewd2": "~2.0.3",
+ "@types/node": "^12.11.1",
"codelyzer": "^6.0.0",
+ "cordova-sqlite-storage": "^5.1.0",
"jasmine-core": "~3.5.0",
"jasmine-spec-reporter": "~5.0.0",
"karma": "~5.0.0",
@@ -50,5 +52,10 @@
"tslint": "~6.1.0",
"typescript": "~3.9.5"
},
- "description": "An Ionic project"
+ "description": "An Ionic project",
+ "cordova": {
+ "plugins": {
+ "cordova-sqlite-storage": {}
+ }
+ }
}
diff --git a/resources/README.md b/resources/README.md
new file mode 100644
index 0000000..46c696e
--- /dev/null
+++ b/resources/README.md
@@ -0,0 +1,8 @@
+These are Cordova resources. You can replace icon.png and splash.png and run
+`ionic cordova resources` to generate custom icons and splash screens for your
+app. See `ionic cordova resources --help` for details.
+
+Cordova reference documentation:
+
+- Icons: https://cordova.apache.org/docs/en/latest/config_ref/images.html
+- Splash Screens: https://cordova.apache.org/docs/en/latest/reference/cordova-plugin-splashscreen/
diff --git a/resources/android/icon/drawable-hdpi-icon.png b/resources/android/icon/drawable-hdpi-icon.png
new file mode 100644
index 0000000..3f84fc1
Binary files /dev/null and b/resources/android/icon/drawable-hdpi-icon.png differ
diff --git a/resources/android/icon/drawable-ldpi-icon.png b/resources/android/icon/drawable-ldpi-icon.png
new file mode 100644
index 0000000..3de9b4f
Binary files /dev/null and b/resources/android/icon/drawable-ldpi-icon.png differ
diff --git a/resources/android/icon/drawable-mdpi-icon.png b/resources/android/icon/drawable-mdpi-icon.png
new file mode 100644
index 0000000..4b455d3
Binary files /dev/null and b/resources/android/icon/drawable-mdpi-icon.png differ
diff --git a/resources/android/icon/drawable-xhdpi-icon.png b/resources/android/icon/drawable-xhdpi-icon.png
new file mode 100644
index 0000000..fe47ccc
Binary files /dev/null and b/resources/android/icon/drawable-xhdpi-icon.png differ
diff --git a/resources/android/icon/drawable-xxhdpi-icon.png b/resources/android/icon/drawable-xxhdpi-icon.png
new file mode 100644
index 0000000..391b4af
Binary files /dev/null and b/resources/android/icon/drawable-xxhdpi-icon.png differ
diff --git a/resources/android/icon/drawable-xxxhdpi-icon.png b/resources/android/icon/drawable-xxxhdpi-icon.png
new file mode 100644
index 0000000..09e50b7
Binary files /dev/null and b/resources/android/icon/drawable-xxxhdpi-icon.png differ
diff --git a/resources/android/splash/drawable-land-hdpi-screen.png b/resources/android/splash/drawable-land-hdpi-screen.png
new file mode 100644
index 0000000..74abe28
Binary files /dev/null and b/resources/android/splash/drawable-land-hdpi-screen.png differ
diff --git a/resources/android/splash/drawable-land-ldpi-screen.png b/resources/android/splash/drawable-land-ldpi-screen.png
new file mode 100644
index 0000000..b224ba8
Binary files /dev/null and b/resources/android/splash/drawable-land-ldpi-screen.png differ
diff --git a/resources/android/splash/drawable-land-mdpi-screen.png b/resources/android/splash/drawable-land-mdpi-screen.png
new file mode 100644
index 0000000..f18770e
Binary files /dev/null and b/resources/android/splash/drawable-land-mdpi-screen.png differ
diff --git a/resources/android/splash/drawable-land-xhdpi-screen.png b/resources/android/splash/drawable-land-xhdpi-screen.png
new file mode 100644
index 0000000..76eab0d
Binary files /dev/null and b/resources/android/splash/drawable-land-xhdpi-screen.png differ
diff --git a/resources/android/splash/drawable-land-xxhdpi-screen.png b/resources/android/splash/drawable-land-xxhdpi-screen.png
new file mode 100644
index 0000000..b15925d
Binary files /dev/null and b/resources/android/splash/drawable-land-xxhdpi-screen.png differ
diff --git a/resources/android/splash/drawable-land-xxxhdpi-screen.png b/resources/android/splash/drawable-land-xxxhdpi-screen.png
new file mode 100644
index 0000000..4b22b8b
Binary files /dev/null and b/resources/android/splash/drawable-land-xxxhdpi-screen.png differ
diff --git a/resources/android/splash/drawable-port-hdpi-screen.png b/resources/android/splash/drawable-port-hdpi-screen.png
new file mode 100644
index 0000000..c0c981b
Binary files /dev/null and b/resources/android/splash/drawable-port-hdpi-screen.png differ
diff --git a/resources/android/splash/drawable-port-ldpi-screen.png b/resources/android/splash/drawable-port-ldpi-screen.png
new file mode 100644
index 0000000..dfba932
Binary files /dev/null and b/resources/android/splash/drawable-port-ldpi-screen.png differ
diff --git a/resources/android/splash/drawable-port-mdpi-screen.png b/resources/android/splash/drawable-port-mdpi-screen.png
new file mode 100644
index 0000000..e5129fd
Binary files /dev/null and b/resources/android/splash/drawable-port-mdpi-screen.png differ
diff --git a/resources/android/splash/drawable-port-xhdpi-screen.png b/resources/android/splash/drawable-port-xhdpi-screen.png
new file mode 100644
index 0000000..14ec839
Binary files /dev/null and b/resources/android/splash/drawable-port-xhdpi-screen.png differ
diff --git a/resources/android/splash/drawable-port-xxhdpi-screen.png b/resources/android/splash/drawable-port-xxhdpi-screen.png
new file mode 100644
index 0000000..4df256f
Binary files /dev/null and b/resources/android/splash/drawable-port-xxhdpi-screen.png differ
diff --git a/resources/android/splash/drawable-port-xxxhdpi-screen.png b/resources/android/splash/drawable-port-xxxhdpi-screen.png
new file mode 100644
index 0000000..53f97f9
Binary files /dev/null and b/resources/android/splash/drawable-port-xxxhdpi-screen.png differ
diff --git a/resources/android/xml/network_security_config.xml b/resources/android/xml/network_security_config.xml
new file mode 100644
index 0000000..de61259
--- /dev/null
+++ b/resources/android/xml/network_security_config.xml
@@ -0,0 +1,6 @@
+
+
+
+ localhost
+
+
diff --git a/resources/icon.png b/resources/icon.png
new file mode 100644
index 0000000..bee7766
Binary files /dev/null and b/resources/icon.png differ
diff --git a/resources/ios/icon/icon-1024.png b/resources/ios/icon/icon-1024.png
new file mode 100644
index 0000000..be633f4
Binary files /dev/null and b/resources/ios/icon/icon-1024.png differ
diff --git a/resources/ios/icon/icon-20.png b/resources/ios/icon/icon-20.png
new file mode 100644
index 0000000..08993e0
Binary files /dev/null and b/resources/ios/icon/icon-20.png differ
diff --git a/resources/ios/icon/icon-20@2x.png b/resources/ios/icon/icon-20@2x.png
new file mode 100644
index 0000000..acbecd2
Binary files /dev/null and b/resources/ios/icon/icon-20@2x.png differ
diff --git a/resources/ios/icon/icon-20@3x.png b/resources/ios/icon/icon-20@3x.png
new file mode 100644
index 0000000..00de715
Binary files /dev/null and b/resources/ios/icon/icon-20@3x.png differ
diff --git a/resources/ios/icon/icon-24@2x.png b/resources/ios/icon/icon-24@2x.png
new file mode 100644
index 0000000..4b455d3
Binary files /dev/null and b/resources/ios/icon/icon-24@2x.png differ
diff --git a/resources/ios/icon/icon-27.5@2x.png b/resources/ios/icon/icon-27.5@2x.png
new file mode 100644
index 0000000..c623f27
Binary files /dev/null and b/resources/ios/icon/icon-27.5@2x.png differ
diff --git a/resources/ios/icon/icon-29.png b/resources/ios/icon/icon-29.png
new file mode 100644
index 0000000..8a55da5
Binary files /dev/null and b/resources/ios/icon/icon-29.png differ
diff --git a/resources/ios/icon/icon-29@2x.png b/resources/ios/icon/icon-29@2x.png
new file mode 100644
index 0000000..185277b
Binary files /dev/null and b/resources/ios/icon/icon-29@2x.png differ
diff --git a/resources/ios/icon/icon-29@3x.png b/resources/ios/icon/icon-29@3x.png
new file mode 100644
index 0000000..3393f84
Binary files /dev/null and b/resources/ios/icon/icon-29@3x.png differ
diff --git a/resources/ios/icon/icon-40.png b/resources/ios/icon/icon-40.png
new file mode 100644
index 0000000..acbecd2
Binary files /dev/null and b/resources/ios/icon/icon-40.png differ
diff --git a/resources/ios/icon/icon-40@2x.png b/resources/ios/icon/icon-40@2x.png
new file mode 100644
index 0000000..61d82a7
Binary files /dev/null and b/resources/ios/icon/icon-40@2x.png differ
diff --git a/resources/ios/icon/icon-40@3x.png b/resources/ios/icon/icon-40@3x.png
new file mode 100644
index 0000000..cc349de
Binary files /dev/null and b/resources/ios/icon/icon-40@3x.png differ
diff --git a/resources/ios/icon/icon-44@2x.png b/resources/ios/icon/icon-44@2x.png
new file mode 100644
index 0000000..00a2ff3
Binary files /dev/null and b/resources/ios/icon/icon-44@2x.png differ
diff --git a/resources/ios/icon/icon-50.png b/resources/ios/icon/icon-50.png
new file mode 100644
index 0000000..9e9a5c1
Binary files /dev/null and b/resources/ios/icon/icon-50.png differ
diff --git a/resources/ios/icon/icon-50@2x.png b/resources/ios/icon/icon-50@2x.png
new file mode 100644
index 0000000..fe547b1
Binary files /dev/null and b/resources/ios/icon/icon-50@2x.png differ
diff --git a/resources/ios/icon/icon-60.png b/resources/ios/icon/icon-60.png
new file mode 100644
index 0000000..00de715
Binary files /dev/null and b/resources/ios/icon/icon-60.png differ
diff --git a/resources/ios/icon/icon-60@2x.png b/resources/ios/icon/icon-60@2x.png
new file mode 100644
index 0000000..cc349de
Binary files /dev/null and b/resources/ios/icon/icon-60@2x.png differ
diff --git a/resources/ios/icon/icon-60@3x.png b/resources/ios/icon/icon-60@3x.png
new file mode 100644
index 0000000..3898828
Binary files /dev/null and b/resources/ios/icon/icon-60@3x.png differ
diff --git a/resources/ios/icon/icon-72.png b/resources/ios/icon/icon-72.png
new file mode 100644
index 0000000..3f84fc1
Binary files /dev/null and b/resources/ios/icon/icon-72.png differ
diff --git a/resources/ios/icon/icon-72@2x.png b/resources/ios/icon/icon-72@2x.png
new file mode 100644
index 0000000..391b4af
Binary files /dev/null and b/resources/ios/icon/icon-72@2x.png differ
diff --git a/resources/ios/icon/icon-76.png b/resources/ios/icon/icon-76.png
new file mode 100644
index 0000000..971034a
Binary files /dev/null and b/resources/ios/icon/icon-76.png differ
diff --git a/resources/ios/icon/icon-76@2x.png b/resources/ios/icon/icon-76@2x.png
new file mode 100644
index 0000000..b538930
Binary files /dev/null and b/resources/ios/icon/icon-76@2x.png differ
diff --git a/resources/ios/icon/icon-83.5@2x.png b/resources/ios/icon/icon-83.5@2x.png
new file mode 100644
index 0000000..5f8dbb2
Binary files /dev/null and b/resources/ios/icon/icon-83.5@2x.png differ
diff --git a/resources/ios/icon/icon-86@2x.png b/resources/ios/icon/icon-86@2x.png
new file mode 100644
index 0000000..9798fc2
Binary files /dev/null and b/resources/ios/icon/icon-86@2x.png differ
diff --git a/resources/ios/icon/icon-98@2x.png b/resources/ios/icon/icon-98@2x.png
new file mode 100644
index 0000000..5ebd9db
Binary files /dev/null and b/resources/ios/icon/icon-98@2x.png differ
diff --git a/resources/ios/icon/icon-small.png b/resources/ios/icon/icon-small.png
new file mode 100644
index 0000000..8a55da5
Binary files /dev/null and b/resources/ios/icon/icon-small.png differ
diff --git a/resources/ios/icon/icon-small@2x.png b/resources/ios/icon/icon-small@2x.png
new file mode 100644
index 0000000..185277b
Binary files /dev/null and b/resources/ios/icon/icon-small@2x.png differ
diff --git a/resources/ios/icon/icon-small@3x.png b/resources/ios/icon/icon-small@3x.png
new file mode 100644
index 0000000..3393f84
Binary files /dev/null and b/resources/ios/icon/icon-small@3x.png differ
diff --git a/resources/ios/icon/icon.png b/resources/ios/icon/icon.png
new file mode 100644
index 0000000..a90d46c
Binary files /dev/null and b/resources/ios/icon/icon.png differ
diff --git a/resources/ios/icon/icon@2x.png b/resources/ios/icon/icon@2x.png
new file mode 100644
index 0000000..946c6ce
Binary files /dev/null and b/resources/ios/icon/icon@2x.png differ
diff --git a/resources/ios/splash/Default-2436h.png b/resources/ios/splash/Default-2436h.png
new file mode 100644
index 0000000..bdbeb9d
Binary files /dev/null and b/resources/ios/splash/Default-2436h.png differ
diff --git a/resources/ios/splash/Default-568h@2x~iphone.png b/resources/ios/splash/Default-568h@2x~iphone.png
new file mode 100644
index 0000000..5e9edf6
Binary files /dev/null and b/resources/ios/splash/Default-568h@2x~iphone.png differ
diff --git a/resources/ios/splash/Default-667h.png b/resources/ios/splash/Default-667h.png
new file mode 100644
index 0000000..2843fb3
Binary files /dev/null and b/resources/ios/splash/Default-667h.png differ
diff --git a/resources/ios/splash/Default-736h.png b/resources/ios/splash/Default-736h.png
new file mode 100644
index 0000000..21f2d42
Binary files /dev/null and b/resources/ios/splash/Default-736h.png differ
diff --git a/resources/ios/splash/Default-Landscape-2436h.png b/resources/ios/splash/Default-Landscape-2436h.png
new file mode 100644
index 0000000..763ae78
Binary files /dev/null and b/resources/ios/splash/Default-Landscape-2436h.png differ
diff --git a/resources/ios/splash/Default-Landscape-736h.png b/resources/ios/splash/Default-Landscape-736h.png
new file mode 100644
index 0000000..9c069f7
Binary files /dev/null and b/resources/ios/splash/Default-Landscape-736h.png differ
diff --git a/resources/ios/splash/Default-Landscape@2x~ipad.png b/resources/ios/splash/Default-Landscape@2x~ipad.png
new file mode 100644
index 0000000..35407a9
Binary files /dev/null and b/resources/ios/splash/Default-Landscape@2x~ipad.png differ
diff --git a/resources/ios/splash/Default-Landscape@~ipadpro.png b/resources/ios/splash/Default-Landscape@~ipadpro.png
new file mode 100644
index 0000000..75de9e0
Binary files /dev/null and b/resources/ios/splash/Default-Landscape@~ipadpro.png differ
diff --git a/resources/ios/splash/Default-Landscape~ipad.png b/resources/ios/splash/Default-Landscape~ipad.png
new file mode 100644
index 0000000..b74bbf6
Binary files /dev/null and b/resources/ios/splash/Default-Landscape~ipad.png differ
diff --git a/resources/ios/splash/Default-Portrait@2x~ipad.png b/resources/ios/splash/Default-Portrait@2x~ipad.png
new file mode 100644
index 0000000..d0c33f7
Binary files /dev/null and b/resources/ios/splash/Default-Portrait@2x~ipad.png differ
diff --git a/resources/ios/splash/Default-Portrait@~ipadpro.png b/resources/ios/splash/Default-Portrait@~ipadpro.png
new file mode 100644
index 0000000..363dd1c
Binary files /dev/null and b/resources/ios/splash/Default-Portrait@~ipadpro.png differ
diff --git a/resources/ios/splash/Default-Portrait~ipad.png b/resources/ios/splash/Default-Portrait~ipad.png
new file mode 100644
index 0000000..aad1deb
Binary files /dev/null and b/resources/ios/splash/Default-Portrait~ipad.png differ
diff --git a/resources/ios/splash/Default@2x~iphone.png b/resources/ios/splash/Default@2x~iphone.png
new file mode 100644
index 0000000..f0f16ef
Binary files /dev/null and b/resources/ios/splash/Default@2x~iphone.png differ
diff --git a/resources/ios/splash/Default@2x~universal~anyany.png b/resources/ios/splash/Default@2x~universal~anyany.png
new file mode 100644
index 0000000..c8fcc8f
Binary files /dev/null and b/resources/ios/splash/Default@2x~universal~anyany.png differ
diff --git a/resources/ios/splash/Default~iphone.png b/resources/ios/splash/Default~iphone.png
new file mode 100644
index 0000000..e5129fd
Binary files /dev/null and b/resources/ios/splash/Default~iphone.png differ
diff --git a/resources/splash.png b/resources/splash.png
new file mode 100644
index 0000000..960cb82
Binary files /dev/null and b/resources/splash.png differ
diff --git a/src/app/api/history.service.spec.ts b/src/app/api/history.service.spec.ts
new file mode 100644
index 0000000..65de5db
--- /dev/null
+++ b/src/app/api/history.service.spec.ts
@@ -0,0 +1,16 @@
+import { TestBed } from '@angular/core/testing';
+
+import { HistoryService } from './history.service';
+
+describe('HistoryService', () => {
+ let service: HistoryService;
+
+ beforeEach(() => {
+ TestBed.configureTestingModule({});
+ service = TestBed.inject(HistoryService);
+ });
+
+ it('should be created', () => {
+ expect(service).toBeTruthy();
+ });
+});
diff --git a/src/app/api/history.service.ts b/src/app/api/history.service.ts
new file mode 100644
index 0000000..0496674
--- /dev/null
+++ b/src/app/api/history.service.ts
@@ -0,0 +1,24 @@
+import { Injectable } from '@angular/core';
+import { Storage } from '@ionic/storage';
+import { HistoryRecord } from '../models/history-record.model';
+
+@Injectable({
+ providedIn: 'root'
+})
+export class HistoryService
+{
+ historyArray: HistoryRecord[] = []
+
+ constructor(private storage: Storage) { }
+
+ public saveRecord(record: HistoryRecord)
+ {
+ this.historyArray.unshift(record);
+ this.storage.set('history', JSON.stringify(this.historyArray));
+ }
+
+ public getRecord()
+ {
+ return this.historyArray;
+ }
+}
\ No newline at end of file
diff --git a/src/app/app.module.ts b/src/app/app.module.ts
index a52ca66..b61dd56 100644
--- a/src/app/app.module.ts
+++ b/src/app/app.module.ts
@@ -9,11 +9,12 @@ import { StatusBar } from '@ionic-native/status-bar/ngx';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { HttpClientModule } from '@angular/common/http';
+import { IonicStorageModule } from '@ionic/storage';
@NgModule({
declarations: [AppComponent],
entryComponents: [],
- imports: [BrowserModule, HttpClientModule, IonicModule.forRoot(), AppRoutingModule],
+ imports: [BrowserModule, HttpClientModule, IonicModule.forRoot(), IonicStorageModule.forRoot(), AppRoutingModule],
providers: [
StatusBar,
SplashScreen,
diff --git a/src/app/models/history-record.model.ts b/src/app/models/history-record.model.ts
new file mode 100644
index 0000000..074a996
--- /dev/null
+++ b/src/app/models/history-record.model.ts
@@ -0,0 +1,11 @@
+export class HistoryRecord
+{
+ inputHistory: String
+ outputHistory: String
+
+ constructor(inputHistory: String, outputHistory: String)
+ {
+ this.inputHistory = inputHistory;
+ this.outputHistory = outputHistory;
+ }
+}
diff --git a/src/app/tab1/tab1.page.ts b/src/app/tab1/tab1.page.ts
index 11f5c51..77c8324 100644
--- a/src/app/tab1/tab1.page.ts
+++ b/src/app/tab1/tab1.page.ts
@@ -1,6 +1,8 @@
import { Component } from '@angular/core';
import {TranslationService} from '../api/translation.service';
import { LoadingController } from '@ionic/angular';
+import { HistoryRecord } from '../models/history-record.model';
+import { HistoryService } from '../api/history.service';
@Component({
selector: 'app-tab1',
@@ -12,7 +14,7 @@ export class Tab1Page {
myinput:String = ''
myoutput:String = ''
loadingDialog: any;
- constructor(private translationService: TranslationService, public loadingController: LoadingController)
+ constructor(private translationService: TranslationService, public loadingController: LoadingController, private historyService: HistoryService)
{
}
@@ -26,6 +28,8 @@ export class Tab1Page {
{
this.myoutput = data['responseData']['translatedText'];
this.loadingDialog.dismiss();
+ let record = new HistoryRecord(this.myinput, this.myoutput);
+ this.historyService.saveRecord(record);
console.log(data);
});
}
diff --git a/src/app/tab2/tab2.page.ts b/src/app/tab2/tab2.page.ts
index e14cad4..dd8aa97 100644
--- a/src/app/tab2/tab2.page.ts
+++ b/src/app/tab2/tab2.page.ts
@@ -1,4 +1,5 @@
import { Component } from '@angular/core';
+import { Storage } from '@ionic/storage';
@Component({
selector: 'app-tab2',
@@ -7,6 +8,6 @@ import { Component } from '@angular/core';
})
export class Tab2Page {
- constructor() {}
+ constructor(private storage: Storage) {}
}