Bläddra i källkod

setting up ionic

Jared Norris 8 år sedan
förälder
incheckning
0129a431db
87 ändrade filer med 9833 tillägg och 0 borttagningar
  1. 17
    0
      01-login/.editorconfig
  2. 37
    0
      01-login/.gitignore
  3. 63
    0
      01-login/README.md
  4. 100
    0
      01-login/config.xml
  5. 8
    0
      01-login/ionic.config.json
  6. 8991
    0
      01-login/package-lock.json
  7. 78
    0
      01-login/package.json
  8. 8
    0
      01-login/resources/README.md
  9. Binär
      01-login/resources/android/icon/drawable-hdpi-icon.png
  10. Binär
      01-login/resources/android/icon/drawable-ldpi-icon.png
  11. Binär
      01-login/resources/android/icon/drawable-mdpi-icon.png
  12. Binär
      01-login/resources/android/icon/drawable-xhdpi-icon.png
  13. Binär
      01-login/resources/android/icon/drawable-xxhdpi-icon.png
  14. Binär
      01-login/resources/android/icon/drawable-xxxhdpi-icon.png
  15. Binär
      01-login/resources/android/splash/drawable-land-hdpi-screen.png
  16. Binär
      01-login/resources/android/splash/drawable-land-ldpi-screen.png
  17. Binär
      01-login/resources/android/splash/drawable-land-mdpi-screen.png
  18. Binär
      01-login/resources/android/splash/drawable-land-xhdpi-screen.png
  19. Binär
      01-login/resources/android/splash/drawable-land-xxhdpi-screen.png
  20. Binär
      01-login/resources/android/splash/drawable-land-xxxhdpi-screen.png
  21. Binär
      01-login/resources/android/splash/drawable-port-hdpi-screen.png
  22. Binär
      01-login/resources/android/splash/drawable-port-ldpi-screen.png
  23. Binär
      01-login/resources/android/splash/drawable-port-mdpi-screen.png
  24. Binär
      01-login/resources/android/splash/drawable-port-xhdpi-screen.png
  25. Binär
      01-login/resources/android/splash/drawable-port-xxhdpi-screen.png
  26. Binär
      01-login/resources/android/splash/drawable-port-xxxhdpi-screen.png
  27. Binär
      01-login/resources/icon.png
  28. 1
    0
      01-login/resources/icon.png.md5
  29. Binär
      01-login/resources/ios/icon/icon-1024.png
  30. Binär
      01-login/resources/ios/icon/icon-40.png
  31. Binär
      01-login/resources/ios/icon/icon-40@2x.png
  32. Binär
      01-login/resources/ios/icon/icon-40@3x.png
  33. Binär
      01-login/resources/ios/icon/icon-50.png
  34. Binär
      01-login/resources/ios/icon/icon-50@2x.png
  35. Binär
      01-login/resources/ios/icon/icon-60.png
  36. Binär
      01-login/resources/ios/icon/icon-60@2x.png
  37. Binär
      01-login/resources/ios/icon/icon-60@3x.png
  38. Binär
      01-login/resources/ios/icon/icon-72.png
  39. Binär
      01-login/resources/ios/icon/icon-72@2x.png
  40. Binär
      01-login/resources/ios/icon/icon-76.png
  41. Binär
      01-login/resources/ios/icon/icon-76@2x.png
  42. Binär
      01-login/resources/ios/icon/icon-83.5@2x.png
  43. Binär
      01-login/resources/ios/icon/icon-small.png
  44. Binär
      01-login/resources/ios/icon/icon-small@2x.png
  45. Binär
      01-login/resources/ios/icon/icon-small@3x.png
  46. Binär
      01-login/resources/ios/icon/icon.png
  47. Binär
      01-login/resources/ios/icon/icon@2x.png
  48. Binär
      01-login/resources/ios/splash/Default-568h@2x~iphone.png
  49. Binär
      01-login/resources/ios/splash/Default-667h.png
  50. Binär
      01-login/resources/ios/splash/Default-736h.png
  51. Binär
      01-login/resources/ios/splash/Default-Landscape-736h.png
  52. Binär
      01-login/resources/ios/splash/Default-Landscape@2x~ipad.png
  53. Binär
      01-login/resources/ios/splash/Default-Landscape@~ipadpro.png
  54. Binär
      01-login/resources/ios/splash/Default-Landscape~ipad.png
  55. Binär
      01-login/resources/ios/splash/Default-Portrait@2x~ipad.png
  56. Binär
      01-login/resources/ios/splash/Default-Portrait@~ipadpro.png
  57. Binär
      01-login/resources/ios/splash/Default-Portrait~ipad.png
  58. Binär
      01-login/resources/ios/splash/Default@2x~iphone.png
  59. Binär
      01-login/resources/ios/splash/Default@2x~universal~anyany.png
  60. Binär
      01-login/resources/ios/splash/Default~iphone.png
  61. Binär
      01-login/resources/splash.png
  62. 1
    0
      01-login/resources/splash.png.md5
  63. 34
    0
      01-login/src/app/app.component.ts
  64. 1
    0
      01-login/src/app/app.html
  65. 45
    0
      01-login/src/app/app.module.ts
  66. 16
    0
      01-login/src/app/app.scss
  67. 5
    0
      01-login/src/app/main.ts
  68. Binär
      01-login/src/assets/icon/favicon.ico
  69. Binär
      01-login/src/assets/imgs/logo.png
  70. 49
    0
      01-login/src/index.html
  71. 13
    0
      01-login/src/manifest.json
  72. 11
    0
      01-login/src/pages/about/about.html
  73. 3
    0
      01-login/src/pages/about/about.scss
  74. 14
    0
      01-login/src/pages/about/about.ts
  75. 17
    0
      01-login/src/pages/contact/contact.html
  76. 3
    0
      01-login/src/pages/contact/contact.scss
  77. 14
    0
      01-login/src/pages/contact/contact.ts
  78. 34
    0
      01-login/src/pages/home/home.html
  79. 3
    0
      01-login/src/pages/home/home.scss
  80. 16
    0
      01-login/src/pages/home/home.ts
  81. 5
    0
      01-login/src/pages/tabs/tabs.html
  82. 19
    0
      01-login/src/pages/tabs/tabs.ts
  83. 31
    0
      01-login/src/service-worker.js
  84. 69
    0
      01-login/src/services/auth.service.ts
  85. 88
    0
      01-login/src/theme/variables.scss
  86. 28
    0
      01-login/tsconfig.json
  87. 11
    0
      01-login/tslint.json

+ 17
- 0
01-login/.editorconfig Visa fil

@@ -0,0 +1,17 @@
1
+# EditorConfig helps developers define and maintain consistent coding styles between different editors and IDEs
2
+# editorconfig.org
3
+
4
+root = true
5
+
6
+[*]
7
+indent_style = space
8
+indent_size = 2
9
+
10
+# We recommend you to keep these unchanged
11
+end_of_line = lf
12
+charset = utf-8
13
+trim_trailing_whitespace = true
14
+insert_final_newline = true
15
+
16
+[*.md]
17
+trim_trailing_whitespace = false

+ 37
- 0
01-login/.gitignore Visa fil

@@ -0,0 +1,37 @@
1
+# Specifies intentionally untracked files to ignore when using Git
2
+# http://git-scm.com/docs/gitignore
3
+
4
+auth.config.ts
5
+
6
+*~
7
+*.sw[mnpcod]
8
+*.log
9
+*.tmp
10
+*.tmp.*
11
+log.txt
12
+*.sublime-project
13
+*.sublime-workspace
14
+.vscode/
15
+npm-debug.log*
16
+
17
+.idea/
18
+.sourcemaps/
19
+.sass-cache/
20
+.tmp/
21
+.versions/
22
+coverage/
23
+dist/
24
+node_modules/
25
+tmp/
26
+temp/
27
+hooks/
28
+platforms/
29
+plugins/
30
+plugins/android.json
31
+plugins/ios.json
32
+www/
33
+$RECYCLE.BIN/
34
+
35
+.DS_Store
36
+Thumbs.db
37
+UserInterfaceState.xcuserstate

+ 63
- 0
01-login/README.md Visa fil

@@ -0,0 +1,63 @@
1
+# Auth0 Ionic 3: Login
2
+
3
+This sample application contains an Ionic 3 starter app with Auth0 login.
4
+
5
+> **Note:** It is advised that you begin with a clean starter app from scratch and follow the instructions in the [Quick Start](https://auth0.com/docs/quickstart/native/ionic3/01-login) to get set up and running quickly and painlessly. Ionic / Cordova are sensitive to remnants being left behind by plugins and platforms being added, altered, or removed, so the most stable method of development is to start from a clean slate.
6
+
7
+To work with the cloned sample app, follow the instructions below.
8
+
9
+## Dependencies
10
+
11
+You should have the appropriate **native application development tools** set up on your local machine. If you don't own devices, you can use emulators. For **iOS**, you should install [Xcode](https://developer.apple.com/xcode/) (free) and for **Android**, install [JDK 1.8](http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html) and an emulator of your choice, such as [Android Studio](https://developer.android.com/studio/index.html) (free) or better yet, [Genymotion](https://www.genymotion.com/) (paid, with free trial option).
12
+
13
+> **Note:** If using an emulator, make sure you also have a browser installed on the emulated device. In the case of Android, this may require the Google Play Store. See your emulator's documentation for details.
14
+
15
+## Clone the Repo
16
+
17
+Clone this repo to your local machine:
18
+
19
+```bash
20
+$ git clone https://github.com/auth0-samples/auth0-ionic3-samples.git
21
+```
22
+
23
+Once the repo is downloaded, navigate into the appropriate sample folder in your local filesystem, such as `01-Login` (this folder). From the correct folder, install the sample app's dependencies:
24
+
25
+```bash
26
+$ cd auth0-ionic3-samples/01-Login
27
+$ npm install
28
+```
29
+
30
+## Auth0 Setup
31
+
32
+1.  Sign up for [a free Auth0 account](https://auth0.com/signup).
33
+2.  Log into your [Auth0 Dashboard](https://manage.auth0.com).
34
+3.  Navigate to the [Clients](https://manage.auth0.com/#/clients) section in the sidebar and create a new client by clicking the **+ Create Client** button.
35
+4.  Give your app a name, such as "Ionic 3 Auth0 App", and select `Native` as the client type. Click the **Create** button.
36
+5.  Make note of the **Domain** and **Client ID**. You will need these for the Ionic app's auth configuration.
37
+6.  In **Allowed Callback URLs**, add: `com.auth0.ionic://{your_Auth0_domain}/cordova/com.auth0.ionic/callback` and replace `{your_Auth0_domain}` with the **Domain** identifier.
38
+
39
+> **Note:** You will add the **Allowed Origins (CORS)** shortly, after you `run` the app. Allowed navigation addresses will be automatically generated in the project's `config.xml` and you will then add them to your Auth0 configuration.
40
+
41
+## Run the App
42
+
43
+You will now need to allow Ionic / Cordova to install the necessary plugins and update your `config.xml` appropriately for the platform you wish to run on.
44
+
45
+Use the following commands to run the app on your desired platform(s) (e.g., `ios` or `android`):
46
+
47
+```bash
48
+# Run on desired platform (e.g., ios or android)
49
+$ npm run ionic:{platform}
50
+```
51
+
52
+This will then launch your app in the local emulation environment for the platform you chose (Xcode Simulator for iOS or the Android emulator of your choice).
53
+
54
+> **Note:** Don't be alarmed if you _cannot authenticate_ successfully yet at this stage! There was some configuration generated by running the app that you still need to add to your Auth0 settings.
55
+
56
+## Update Auth0 Dashboard Configuration
57
+
58
+1.  After executing the `run` command, your `config.xml` file should contain `<allow-navigation>` tag(s).
59
+2.  Make note of IP address URLs from any `<allow-navigation>` tags.
60
+3.  Log into your [Auth0 Dashboard](https://manage.auth0.com) and go to your Ionic app client's **Settings**.
61
+4.  Add the full allowed navigation addresses (including `http://` and ports) to the **Allowed Origins (CORS)** settings for your Auth0 client and click the **Save Changes** button.
62
+
63
+You should now be able to log into your app!

+ 100
- 0
01-login/config.xml Visa fil

@@ -0,0 +1,100 @@
1
+<?xml version='1.0' encoding='utf-8'?>
2
+<widget id="com.auth0.ionic" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
3
+    <name>auth0-app</name>
4
+    <description>An awesome Ionic/Cordova app.</description>
5
+    <author email="hi@ionicframework" href="http://ionicframework.com/">Ionic Framework Team</author>
6
+    <content src="index.html" />
7
+    <access origin="*" />
8
+    <allow-intent href="http://*/*" />
9
+    <allow-intent href="https://*/*" />
10
+    <allow-intent href="tel:*" />
11
+    <allow-intent href="sms:*" />
12
+    <allow-intent href="mailto:*" />
13
+    <allow-intent href="geo:*" />
14
+    <preference name="ScrollEnabled" value="false" />
15
+    <preference name="android-minSdkVersion" value="16" />
16
+    <preference name="BackupWebStorage" value="none" />
17
+    <preference name="SplashMaintainAspectRatio" value="true" />
18
+    <preference name="FadeSplashScreenDuration" value="300" />
19
+    <preference name="SplashShowOnlyFirstTime" value="false" />
20
+    <preference name="SplashScreen" value="screen" />
21
+    <preference name="SplashScreenDelay" value="3000" />
22
+    <preference name="AndroidLaunchMode" value="singleTask" />
23
+    <preference name="loadUrlTimeoutValue" value="700000" />
24
+    <platform name="android">
25
+        <allow-intent href="market:*" />
26
+        <icon density="ldpi" src="resources/android/icon/drawable-ldpi-icon.png" />
27
+        <icon density="mdpi" src="resources/android/icon/drawable-mdpi-icon.png" />
28
+        <icon density="hdpi" src="resources/android/icon/drawable-hdpi-icon.png" />
29
+        <icon density="xhdpi" src="resources/android/icon/drawable-xhdpi-icon.png" />
30
+        <icon density="xxhdpi" src="resources/android/icon/drawable-xxhdpi-icon.png" />
31
+        <icon density="xxxhdpi" src="resources/android/icon/drawable-xxxhdpi-icon.png" />
32
+        <splash density="land-ldpi" src="resources/android/splash/drawable-land-ldpi-screen.png" />
33
+        <splash density="land-mdpi" src="resources/android/splash/drawable-land-mdpi-screen.png" />
34
+        <splash density="land-hdpi" src="resources/android/splash/drawable-land-hdpi-screen.png" />
35
+        <splash density="land-xhdpi" src="resources/android/splash/drawable-land-xhdpi-screen.png" />
36
+        <splash density="land-xxhdpi" src="resources/android/splash/drawable-land-xxhdpi-screen.png" />
37
+        <splash density="land-xxxhdpi" src="resources/android/splash/drawable-land-xxxhdpi-screen.png" />
38
+        <splash density="port-ldpi" src="resources/android/splash/drawable-port-ldpi-screen.png" />
39
+        <splash density="port-mdpi" src="resources/android/splash/drawable-port-mdpi-screen.png" />
40
+        <splash density="port-hdpi" src="resources/android/splash/drawable-port-hdpi-screen.png" />
41
+        <splash density="port-xhdpi" src="resources/android/splash/drawable-port-xhdpi-screen.png" />
42
+        <splash density="port-xxhdpi" src="resources/android/splash/drawable-port-xxhdpi-screen.png" />
43
+        <splash density="port-xxxhdpi" src="resources/android/splash/drawable-port-xxxhdpi-screen.png" />
44
+    </platform>
45
+    <platform name="ios">
46
+        <allow-intent href="itms:*" />
47
+        <allow-intent href="itms-apps:*" />
48
+        <icon height="57" src="resources/ios/icon/icon.png" width="57" />
49
+        <icon height="114" src="resources/ios/icon/icon@2x.png" width="114" />
50
+        <icon height="40" src="resources/ios/icon/icon-40.png" width="40" />
51
+        <icon height="80" src="resources/ios/icon/icon-40@2x.png" width="80" />
52
+        <icon height="120" src="resources/ios/icon/icon-40@3x.png" width="120" />
53
+        <icon height="50" src="resources/ios/icon/icon-50.png" width="50" />
54
+        <icon height="100" src="resources/ios/icon/icon-50@2x.png" width="100" />
55
+        <icon height="60" src="resources/ios/icon/icon-60.png" width="60" />
56
+        <icon height="120" src="resources/ios/icon/icon-60@2x.png" width="120" />
57
+        <icon height="180" src="resources/ios/icon/icon-60@3x.png" width="180" />
58
+        <icon height="72" src="resources/ios/icon/icon-72.png" width="72" />
59
+        <icon height="144" src="resources/ios/icon/icon-72@2x.png" width="144" />
60
+        <icon height="76" src="resources/ios/icon/icon-76.png" width="76" />
61
+        <icon height="152" src="resources/ios/icon/icon-76@2x.png" width="152" />
62
+        <icon height="167" src="resources/ios/icon/icon-83.5@2x.png" width="167" />
63
+        <icon height="29" src="resources/ios/icon/icon-small.png" width="29" />
64
+        <icon height="58" src="resources/ios/icon/icon-small@2x.png" width="58" />
65
+        <icon height="87" src="resources/ios/icon/icon-small@3x.png" width="87" />
66
+        <icon height="1024" src="resources/ios/icon/icon-1024.png" width="1024" />
67
+        <splash height="1136" src="resources/ios/splash/Default-568h@2x~iphone.png" width="640" />
68
+        <splash height="1334" src="resources/ios/splash/Default-667h.png" width="750" />
69
+        <splash height="2208" src="resources/ios/splash/Default-736h.png" width="1242" />
70
+        <splash height="1242" src="resources/ios/splash/Default-Landscape-736h.png" width="2208" />
71
+        <splash height="1536" src="resources/ios/splash/Default-Landscape@2x~ipad.png" width="2048" />
72
+        <splash height="2048" src="resources/ios/splash/Default-Landscape@~ipadpro.png" width="2732" />
73
+        <splash height="768" src="resources/ios/splash/Default-Landscape~ipad.png" width="1024" />
74
+        <splash height="2048" src="resources/ios/splash/Default-Portrait@2x~ipad.png" width="1536" />
75
+        <splash height="2732" src="resources/ios/splash/Default-Portrait@~ipadpro.png" width="2048" />
76
+        <splash height="1024" src="resources/ios/splash/Default-Portrait~ipad.png" width="768" />
77
+        <splash height="960" src="resources/ios/splash/Default@2x~iphone.png" width="640" />
78
+        <splash height="480" src="resources/ios/splash/Default~iphone.png" width="320" />
79
+        <splash height="2732" src="resources/ios/splash/Default@2x~universal~anyany.png" width="2732" />
80
+    </platform>
81
+    <plugin name="ionic-plugin-keyboard" spec="~2.2.1" />
82
+    <plugin name="cordova-plugin-whitelist" spec="1.3.1" />
83
+    <plugin name="cordova-plugin-device" spec="1.1.4" />
84
+    <plugin name="cordova-plugin-splashscreen" spec="~4.0.1" />
85
+    <plugin name="cordova-plugin-ionic-webview" spec="^1.1.11" />
86
+    <plugin name="cordova-sqlite-storage" spec="^2.2.0" />
87
+    <allow-navigation href="http://192.168.42.127:8100" />
88
+    <allow-navigation href="http://192.168.254.18:8100" />
89
+    <engine name="ios" spec="4.5.4" />
90
+    <plugin name="cordova-plugin-customurlscheme" spec="^4.3.0">
91
+        <variable name="URL_SCHEME" value="com.auth0.ionic" />
92
+        <variable name="ANDROID_SCHEME" value="com.auth0.ionic" />
93
+        <variable name="ANDROID_HOST" value="kmaida.auth0.com" />
94
+        <variable name="ANDROID_PATHPREFIX" value="/cordova/com.auth0.ionic/callback" />
95
+    </plugin>
96
+    <allow-navigation href="http://192.168.56.1:8100" />
97
+    <engine name="android" spec="~7.0.0" />
98
+    <plugin name="cordova-plugin-safariviewcontroller" spec="^1.5.2" />
99
+    <plugin name="cordova-plugin-inappbrowser" spec="^2.0.1" />
100
+</widget>

+ 8
- 0
01-login/ionic.config.json Visa fil

@@ -0,0 +1,8 @@
1
+{
2
+  "name": "auth0-app",
3
+  "app_id": "97351afb",
4
+  "type": "ionic-angular",
5
+  "integrations": {
6
+    "cordova": {}
7
+  }
8
+}

+ 8991
- 0
01-login/package-lock.json
Filskillnaden har hållits tillbaka eftersom den är för stor
Visa fil


+ 78
- 0
01-login/package.json Visa fil

@@ -0,0 +1,78 @@
1
+{
2
+  "name": "auth0-app",
3
+  "version": "0.0.1",
4
+  "author": "Ionic Framework",
5
+  "homepage": "http://ionicframework.com/",
6
+  "private": true,
7
+  "scripts": {
8
+    "clean": "ionic-app-scripts clean",
9
+    "build": "ionic-app-scripts build",
10
+    "lint": "ionic-app-scripts lint",
11
+    "ionic:build": "ionic-app-scripts build",
12
+    "ionic:serve": "ionic-app-scripts serve",
13
+    "ionic:ios": "ionic cordova run ios --livereload",
14
+    "ionic:android": "ionic cordova run android --livereload"
15
+  },
16
+  "dependencies": {
17
+    "@angular/common": "^5.2.8",
18
+    "@angular/compiler": "^5.2.8",
19
+    "@angular/compiler-cli": "^5.2.8",
20
+    "@angular/core": "^5.2.8",
21
+    "@angular/forms": "^5.2.8",
22
+    "@angular/http": "^5.2.8",
23
+    "@angular/platform-browser": "^5.2.8",
24
+    "@angular/platform-browser-dynamic": "^5.2.8",
25
+    "@auth0/cordova": "^0.3.0",
26
+    "@ionic-native/core": "4.4.0",
27
+    "@ionic-native/splash-screen": "4.4.0",
28
+    "@ionic-native/status-bar": "4.4.0",
29
+    "@ionic/pro": "1.0.16",
30
+    "@ionic/storage": "^2.1.3",
31
+    "auth0-js": "^9.3.3",
32
+    "cordova-android": "7.0.0",
33
+    "cordova-ios": "4.5.4",
34
+    "cordova-plugin-customurlscheme": "^4.3.0",
35
+    "cordova-plugin-device": "^1.1.7",
36
+    "cordova-plugin-inappbrowser": "^2.0.2",
37
+    "cordova-plugin-ionic-webview": "^1.2.1",
38
+    "cordova-plugin-safariviewcontroller": "^1.5.3",
39
+    "cordova-plugin-splashscreen": "^4.1.0",
40
+    "cordova-plugin-whitelist": "^1.3.3",
41
+    "cordova-sqlite-storage": "^2.3.2",
42
+    "ionic-angular": "3.9.2",
43
+    "ionic-plugin-keyboard": "^2.2.1",
44
+    "ionicons": "3.0.0",
45
+    "rxjs": "5.5.2",
46
+    "sw-toolbox": "3.6.0",
47
+    "zone.js": "0.8.18"
48
+  },
49
+  "devDependencies": {
50
+    "@ionic/app-scripts": "3.1.6",
51
+    "cordova": "^8.0.0",
52
+    "ionic": "^3.20.0",
53
+    "typescript": "2.4.2"
54
+  },
55
+  "description": "An Ionic project",
56
+  "cordova": {
57
+    "plugins": {
58
+      "cordova-sqlite-storage": {},
59
+      "ionic-plugin-keyboard": {},
60
+      "cordova-plugin-whitelist": {},
61
+      "cordova-plugin-device": {},
62
+      "cordova-plugin-splashscreen": {},
63
+      "cordova-plugin-ionic-webview": {},
64
+      "cordova-plugin-customurlscheme": {
65
+        "URL_SCHEME": "com.auth0.ionic",
66
+        "ANDROID_SCHEME": "com.auth0.ionic",
67
+        "ANDROID_HOST": "kmaida.auth0.com",
68
+        "ANDROID_PATHPREFIX": "/cordova/com.auth0.ionic/callback"
69
+      },
70
+      "cordova-plugin-safariviewcontroller": {},
71
+      "cordova-plugin-inappbrowser": {}
72
+    },
73
+    "platforms": [
74
+      "ios",
75
+      "android"
76
+    ]
77
+  }
78
+}

+ 8
- 0
01-login/resources/README.md Visa fil

@@ -0,0 +1,8 @@
1
+These are Cordova resources. You can replace icon.png and splash.png and run
2
+`ionic cordova resources` to generate custom icons and splash screens for your
3
+app. See `ionic cordova resources --help` for details.
4
+
5
+Cordova reference documentation:
6
+
7
+- Icons: https://cordova.apache.org/docs/en/latest/config_ref/images.html
8
+- Splash Screens: https://cordova.apache.org/docs/en/latest/reference/cordova-plugin-splashscreen/

Binär
01-login/resources/android/icon/drawable-hdpi-icon.png Visa fil


Binär
01-login/resources/android/icon/drawable-ldpi-icon.png Visa fil


Binär
01-login/resources/android/icon/drawable-mdpi-icon.png Visa fil


Binär
01-login/resources/android/icon/drawable-xhdpi-icon.png Visa fil


Binär
01-login/resources/android/icon/drawable-xxhdpi-icon.png Visa fil


Binär
01-login/resources/android/icon/drawable-xxxhdpi-icon.png Visa fil


Binär
01-login/resources/android/splash/drawable-land-hdpi-screen.png Visa fil


Binär
01-login/resources/android/splash/drawable-land-ldpi-screen.png Visa fil


Binär
01-login/resources/android/splash/drawable-land-mdpi-screen.png Visa fil


Binär
01-login/resources/android/splash/drawable-land-xhdpi-screen.png Visa fil


Binär
01-login/resources/android/splash/drawable-land-xxhdpi-screen.png Visa fil


Binär
01-login/resources/android/splash/drawable-land-xxxhdpi-screen.png Visa fil


Binär
01-login/resources/android/splash/drawable-port-hdpi-screen.png Visa fil


Binär
01-login/resources/android/splash/drawable-port-ldpi-screen.png Visa fil


Binär
01-login/resources/android/splash/drawable-port-mdpi-screen.png Visa fil


Binär
01-login/resources/android/splash/drawable-port-xhdpi-screen.png Visa fil


Binär
01-login/resources/android/splash/drawable-port-xxhdpi-screen.png Visa fil


Binär
01-login/resources/android/splash/drawable-port-xxxhdpi-screen.png Visa fil


Binär
01-login/resources/icon.png Visa fil


+ 1
- 0
01-login/resources/icon.png.md5 Visa fil

@@ -0,0 +1 @@
1
+3f1bbdf1aefcb5ce7b60770ce907c68f

Binär
01-login/resources/ios/icon/icon-1024.png Visa fil


Binär
01-login/resources/ios/icon/icon-40.png Visa fil


Binär
01-login/resources/ios/icon/icon-40@2x.png Visa fil


Binär
01-login/resources/ios/icon/icon-40@3x.png Visa fil


Binär
01-login/resources/ios/icon/icon-50.png Visa fil


Binär
01-login/resources/ios/icon/icon-50@2x.png Visa fil


Binär
01-login/resources/ios/icon/icon-60.png Visa fil


Binär
01-login/resources/ios/icon/icon-60@2x.png Visa fil


Binär
01-login/resources/ios/icon/icon-60@3x.png Visa fil


Binär
01-login/resources/ios/icon/icon-72.png Visa fil


Binär
01-login/resources/ios/icon/icon-72@2x.png Visa fil


Binär
01-login/resources/ios/icon/icon-76.png Visa fil


Binär
01-login/resources/ios/icon/icon-76@2x.png Visa fil


Binär
01-login/resources/ios/icon/icon-83.5@2x.png Visa fil


Binär
01-login/resources/ios/icon/icon-small.png Visa fil


Binär
01-login/resources/ios/icon/icon-small@2x.png Visa fil


Binär
01-login/resources/ios/icon/icon-small@3x.png Visa fil


Binär
01-login/resources/ios/icon/icon.png Visa fil


Binär
01-login/resources/ios/icon/icon@2x.png Visa fil


Binär
01-login/resources/ios/splash/Default-568h@2x~iphone.png Visa fil


Binär
01-login/resources/ios/splash/Default-667h.png Visa fil


Binär
01-login/resources/ios/splash/Default-736h.png Visa fil


Binär
01-login/resources/ios/splash/Default-Landscape-736h.png Visa fil


Binär
01-login/resources/ios/splash/Default-Landscape@2x~ipad.png Visa fil


Binär
01-login/resources/ios/splash/Default-Landscape@~ipadpro.png Visa fil


Binär
01-login/resources/ios/splash/Default-Landscape~ipad.png Visa fil


Binär
01-login/resources/ios/splash/Default-Portrait@2x~ipad.png Visa fil


Binär
01-login/resources/ios/splash/Default-Portrait@~ipadpro.png Visa fil


Binär
01-login/resources/ios/splash/Default-Portrait~ipad.png Visa fil


Binär
01-login/resources/ios/splash/Default@2x~iphone.png Visa fil


Binär
01-login/resources/ios/splash/Default@2x~universal~anyany.png Visa fil


Binär
01-login/resources/ios/splash/Default~iphone.png Visa fil


Binär
01-login/resources/splash.png Visa fil


+ 1
- 0
01-login/resources/splash.png.md5 Visa fil

@@ -0,0 +1 @@
1
+2412a8324a656ec5993eb50b3b293c69

+ 34
- 0
01-login/src/app/app.component.ts Visa fil

@@ -0,0 +1,34 @@
1
+import { Component } from '@angular/core';
2
+import { Platform } from 'ionic-angular';
3
+import { StatusBar } from '@ionic-native/status-bar';
4
+import { SplashScreen } from '@ionic-native/splash-screen';
5
+
6
+import { TabsPage } from '../pages/tabs/tabs';
7
+
8
+// Import Auth0Cordova
9
+import Auth0Cordova from '@auth0/cordova';
10
+
11
+@Component({
12
+  templateUrl: 'app.html'
13
+})
14
+export class MyApp {
15
+  rootPage:any = TabsPage;
16
+
17
+  constructor(
18
+    platform: Platform,
19
+    statusBar: StatusBar,
20
+    splashScreen: SplashScreen
21
+  ) {
22
+    platform.ready().then(() => {
23
+      // Okay, so the platform is ready and our plugins are available.
24
+      // Here you can do any higher level native things you might need.
25
+      statusBar.styleDefault();
26
+      splashScreen.hide();
27
+
28
+      // Redirect back to app after authenticating
29
+      (window as any).handleOpenURL = (url: string) => {
30
+        Auth0Cordova.onRedirectUri(url);
31
+      }
32
+    });
33
+  }
34
+}

+ 1
- 0
01-login/src/app/app.html Visa fil

@@ -0,0 +1 @@
1
+<ion-nav [root]="rootPage"></ion-nav>

+ 45
- 0
01-login/src/app/app.module.ts Visa fil

@@ -0,0 +1,45 @@
1
+import { NgModule, ErrorHandler } from '@angular/core';
2
+import { BrowserModule } from '@angular/platform-browser';
3
+import { IonicApp, IonicModule, IonicErrorHandler } from 'ionic-angular';
4
+import { IonicStorageModule } from '@ionic/storage';
5
+import { MyApp } from './app.component';
6
+
7
+import { AuthService } from './../services/auth.service';
8
+
9
+import { AboutPage } from '../pages/about/about';
10
+import { ContactPage } from '../pages/contact/contact';
11
+import { HomePage } from '../pages/home/home';
12
+import { TabsPage } from '../pages/tabs/tabs';
13
+
14
+import { StatusBar } from '@ionic-native/status-bar';
15
+import { SplashScreen } from '@ionic-native/splash-screen';
16
+
17
+@NgModule({
18
+  declarations: [
19
+    MyApp,
20
+    AboutPage,
21
+    ContactPage,
22
+    HomePage,
23
+    TabsPage
24
+  ],
25
+  imports: [
26
+    BrowserModule,
27
+    IonicModule.forRoot(MyApp),
28
+    IonicStorageModule.forRoot()
29
+  ],
30
+  bootstrap: [IonicApp],
31
+  entryComponents: [
32
+    MyApp,
33
+    AboutPage,
34
+    ContactPage,
35
+    HomePage,
36
+    TabsPage
37
+  ],
38
+  providers: [
39
+    StatusBar,
40
+    SplashScreen,
41
+    {provide: ErrorHandler, useClass: IonicErrorHandler},
42
+    AuthService
43
+  ]
44
+})
45
+export class AppModule {}

+ 16
- 0
01-login/src/app/app.scss Visa fil

@@ -0,0 +1,16 @@
1
+// http://ionicframework.com/docs/theming/
2
+
3
+
4
+// App Global Sass
5
+// --------------------------------------------------
6
+// Put style rules here that you want to apply globally. These
7
+// styles are for the entire app and not just one component.
8
+// Additionally, this file can be also used as an entry point
9
+// to import other Sass files to be included in the output CSS.
10
+//
11
+// Shared Sass variables, which can be used to adjust Ionic's
12
+// default Sass variables, belong in "theme/variables.scss".
13
+//
14
+// To declare rules for a specific mode, create a child rule
15
+// for the .md, .ios, or .wp mode classes. The mode class is
16
+// automatically applied to the <body> element in the app.

+ 5
- 0
01-login/src/app/main.ts Visa fil

@@ -0,0 +1,5 @@
1
+import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
2
+
3
+import { AppModule } from './app.module';
4
+
5
+platformBrowserDynamic().bootstrapModule(AppModule);

Binär
01-login/src/assets/icon/favicon.ico Visa fil


Binär
01-login/src/assets/imgs/logo.png Visa fil


+ 49
- 0
01-login/src/index.html Visa fil

@@ -0,0 +1,49 @@
1
+<!DOCTYPE html>
2
+<html lang="en" dir="ltr">
3
+<head>
4
+  <meta charset="UTF-8">
5
+  <title>Ionic App</title>
6
+  <meta name="viewport" content="viewport-fit=cover, width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
7
+  <meta name="format-detection" content="telephone=no">
8
+  <meta name="msapplication-tap-highlight" content="no">
9
+
10
+  <link rel="icon" type="image/x-icon" href="assets/icon/favicon.ico">
11
+  <link rel="manifest" href="manifest.json">
12
+  <meta name="theme-color" content="#4e8ef7">
13
+
14
+  <!-- add to homescreen for ios -->
15
+  <meta name="apple-mobile-web-app-capable" content="yes">
16
+  <meta name="apple-mobile-web-app-status-bar-style" content="black">
17
+
18
+  <!-- cordova.js required for cordova apps (remove if not needed) -->
19
+  <script src="cordova.js"></script>
20
+
21
+  <!-- un-comment this code to enable service worker
22
+  <script>
23
+    if ('serviceWorker' in navigator) {
24
+      navigator.serviceWorker.register('service-worker.js')
25
+        .then(() => console.log('service worker installed'))
26
+        .catch(err => console.error('Error', err));
27
+    }
28
+  </script>-->
29
+
30
+  <link href="build/main.css" rel="stylesheet">
31
+
32
+</head>
33
+<body>
34
+
35
+  <!-- Ionic's root component and where the app will load -->
36
+  <ion-app></ion-app>
37
+
38
+  <!-- The polyfills js is generated during the build process -->
39
+  <script src="build/polyfills.js"></script>
40
+
41
+  <!-- The vendor js is generated during the build process
42
+       It contains all of the dependencies in node_modules -->
43
+  <script src="build/vendor.js"></script>
44
+
45
+  <!-- The main bundle js is generated during the build process -->
46
+  <script src="build/main.js"></script>
47
+
48
+</body>
49
+</html>

+ 13
- 0
01-login/src/manifest.json Visa fil

@@ -0,0 +1,13 @@
1
+{
2
+  "name": "Ionic",
3
+  "short_name": "Ionic",
4
+  "start_url": "index.html",
5
+  "display": "standalone",
6
+  "icons": [{
7
+    "src": "assets/imgs/logo.png",
8
+    "sizes": "512x512",
9
+    "type": "image/png"
10
+  }],
11
+  "background_color": "#4e8ef7",
12
+  "theme_color": "#4e8ef7"
13
+}

+ 11
- 0
01-login/src/pages/about/about.html Visa fil

@@ -0,0 +1,11 @@
1
+<ion-header>
2
+  <ion-navbar>
3
+    <ion-title>
4
+      About
5
+    </ion-title>
6
+  </ion-navbar>
7
+</ion-header>
8
+
9
+<ion-content padding>
10
+
11
+</ion-content>

+ 3
- 0
01-login/src/pages/about/about.scss Visa fil

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

+ 14
- 0
01-login/src/pages/about/about.ts Visa fil

@@ -0,0 +1,14 @@
1
+import { Component } from '@angular/core';
2
+import { NavController } from 'ionic-angular';
3
+
4
+@Component({
5
+  selector: 'page-about',
6
+  templateUrl: 'about.html'
7
+})
8
+export class AboutPage {
9
+
10
+  constructor(public navCtrl: NavController) {
11
+
12
+  }
13
+
14
+}

+ 17
- 0
01-login/src/pages/contact/contact.html Visa fil

@@ -0,0 +1,17 @@
1
+<ion-header>
2
+  <ion-navbar>
3
+    <ion-title>
4
+      Contact
5
+    </ion-title>
6
+  </ion-navbar>
7
+</ion-header>
8
+
9
+<ion-content>
10
+  <ion-list>
11
+    <ion-list-header>Follow us on Twitter</ion-list-header>
12
+    <ion-item>
13
+      <ion-icon name="ionic" item-start></ion-icon>
14
+      @ionicframework
15
+    </ion-item>
16
+  </ion-list>
17
+</ion-content>

+ 3
- 0
01-login/src/pages/contact/contact.scss Visa fil

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

+ 14
- 0
01-login/src/pages/contact/contact.ts Visa fil

@@ -0,0 +1,14 @@
1
+import { Component } from '@angular/core';
2
+import { NavController } from 'ionic-angular';
3
+
4
+@Component({
5
+  selector: 'page-contact',
6
+  templateUrl: 'contact.html'
7
+})
8
+export class ContactPage {
9
+
10
+  constructor(public navCtrl: NavController) {
11
+
12
+  }
13
+
14
+}

+ 34
- 0
01-login/src/pages/home/home.html Visa fil

@@ -0,0 +1,34 @@
1
+<ion-header>
2
+  <ion-navbar>
3
+    <ion-title>Home</ion-title>
4
+  </ion-navbar>
5
+</ion-header>
6
+
7
+<ion-content padding>
8
+  <p *ngIf="auth.loading" text-center>Loading...</p>
9
+  <ng-template [ngIf]="!auth.loading">
10
+    <!-- Not loading, not logged in: show login button -->
11
+    <button
12
+      ion-button
13
+      block
14
+      color="primary"
15
+      *ngIf="!auth.loggedIn"
16
+      (click)="auth.login()">Log In</button>
17
+    <!-- Not loading, logged in: show profile and logout button -->
18
+    <ng-template [ngIf]="auth.loggedIn">
19
+      <ion-card *ngIf="auth.user">
20
+        <img [src]="auth.user.picture">
21
+        <ion-card-content>
22
+          <ion-card-title>{{ auth.user.name }}</ion-card-title>
23
+          <pre>{{ auth.user | json }}</pre>
24
+        </ion-card-content>
25
+      </ion-card>
26
+      <button
27
+        ion-button
28
+        block
29
+        color="danger"
30
+        (click)="auth.logout()">Log Out</button>
31
+    </ng-template>
32
+  </ng-template>
33
+
34
+</ion-content>

+ 3
- 0
01-login/src/pages/home/home.scss Visa fil

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

+ 16
- 0
01-login/src/pages/home/home.ts Visa fil

@@ -0,0 +1,16 @@
1
+import { Component } from '@angular/core';
2
+import { NavController } from 'ionic-angular';
3
+import { AuthService } from './../../services/auth.service';
4
+
5
+@Component({
6
+  selector: 'page-home',
7
+  templateUrl: 'home.html'
8
+})
9
+export class HomePage {
10
+
11
+  constructor(
12
+    public navCtrl: NavController,
13
+    public auth: AuthService
14
+  ) {}
15
+
16
+}

+ 5
- 0
01-login/src/pages/tabs/tabs.html Visa fil

@@ -0,0 +1,5 @@
1
+<ion-tabs>
2
+  <ion-tab [root]="tab1Root" tabTitle="Home" tabIcon="home"></ion-tab>
3
+  <ion-tab [root]="tab2Root" tabTitle="About" tabIcon="information-circle"></ion-tab>
4
+  <ion-tab [root]="tab3Root" tabTitle="Contact" tabIcon="contacts"></ion-tab>
5
+</ion-tabs>

+ 19
- 0
01-login/src/pages/tabs/tabs.ts Visa fil

@@ -0,0 +1,19 @@
1
+import { Component } from '@angular/core';
2
+
3
+import { AboutPage } from '../about/about';
4
+import { ContactPage } from '../contact/contact';
5
+import { HomePage } from '../home/home';
6
+
7
+@Component({
8
+  templateUrl: 'tabs.html'
9
+})
10
+export class TabsPage {
11
+
12
+  tab1Root = HomePage;
13
+  tab2Root = AboutPage;
14
+  tab3Root = ContactPage;
15
+
16
+  constructor() {
17
+
18
+  }
19
+}

+ 31
- 0
01-login/src/service-worker.js Visa fil

@@ -0,0 +1,31 @@
1
+/**
2
+ * Check out https://googlechromelabs.github.io/sw-toolbox/ for
3
+ * more info on how to use sw-toolbox to custom configure your service worker.
4
+ */
5
+
6
+
7
+'use strict';
8
+importScripts('./build/sw-toolbox.js');
9
+
10
+self.toolbox.options.cache = {
11
+  name: 'ionic-cache'
12
+};
13
+
14
+// pre-cache our key assets
15
+self.toolbox.precache(
16
+  [
17
+    './build/main.js',
18
+    './build/vendor.js',
19
+    './build/main.css',
20
+    './build/polyfills.js',
21
+    'index.html',
22
+    'manifest.json'
23
+  ]
24
+);
25
+
26
+// dynamically cache any other local assets
27
+self.toolbox.router.any('/*', self.toolbox.fastest);
28
+
29
+// for any other requests go to the network, cache,
30
+// and then only use that cached resource if your user goes offline
31
+self.toolbox.router.default = self.toolbox.networkFirst;

+ 69
- 0
01-login/src/services/auth.service.ts Visa fil

@@ -0,0 +1,69 @@
1
+import { Injectable, NgZone } from '@angular/core';
2
+import { Storage } from '@ionic/storage';
3
+
4
+// Import AUTH_CONFIG, Auth0Cordova, and auth0.js
5
+import { AUTH_CONFIG } from './auth.config';
6
+import Auth0Cordova from '@auth0/cordova';
7
+import * as auth0 from 'auth0-js';
8
+
9
+@Injectable()
10
+export class AuthService {
11
+  Auth0 = new auth0.WebAuth(AUTH_CONFIG);
12
+  Client = new Auth0Cordova(AUTH_CONFIG);
13
+  accessToken: string;
14
+  user: any;
15
+  loggedIn: boolean;
16
+  loading = true;
17
+
18
+  constructor(
19
+    public zone: NgZone,
20
+    private storage: Storage
21
+  ) {
22
+    this.storage.get('profile').then(user => this.user = user);
23
+    this.storage.get('access_token').then(token => this.accessToken = token);
24
+    this.storage.get('expires_at').then(exp => {
25
+      this.loggedIn = Date.now() < JSON.parse(exp);
26
+      this.loading = false;
27
+    });
28
+  }
29
+
30
+  login() {
31
+    this.loading = true;
32
+    const options = {
33
+      scope: 'openid profile offline_access'
34
+    };
35
+    // Authorize login request with Auth0: open login page and get auth results
36
+    this.Client.authorize(options, (err, authResult) => {
37
+      if (err) {
38
+        throw err;
39
+      }
40
+      // Set access token
41
+      this.storage.set('access_token', authResult.accessToken);
42
+      this.accessToken = authResult.accessToken;
43
+      // Set access token expiration
44
+      const expiresAt = JSON.stringify((authResult.expiresIn * 1000) + new Date().getTime());
45
+      this.storage.set('expires_at', expiresAt);
46
+      // Set logged in
47
+      this.loading = false;
48
+      this.loggedIn = true;
49
+      // Fetch user's profile info
50
+      this.Auth0.client.userInfo(this.accessToken, (err, profile) => {
51
+        if (err) {
52
+          throw err;
53
+        }
54
+        this.storage.set('profile', profile).then(val =>
55
+          this.zone.run(() => this.user = profile)
56
+        );
57
+      });
58
+    });
59
+  }
60
+
61
+  logout() {
62
+    this.storage.remove('profile');
63
+    this.storage.remove('access_token');
64
+    this.storage.remove('expires_at');
65
+    this.accessToken = null;
66
+    this.user = null;
67
+    this.loggedIn = false;
68
+  }
69
+}

+ 88
- 0
01-login/src/theme/variables.scss Visa fil

@@ -0,0 +1,88 @@
1
+// Ionic Variables and Theming. For more info, please see:
2
+// http://ionicframework.com/docs/theming/
3
+
4
+// Font path is used to include ionicons,
5
+// roboto, and noto sans fonts
6
+$font-path: "../assets/fonts";
7
+
8
+
9
+// The app direction is used to include
10
+// rtl styles in your app. For more info, please see:
11
+// http://ionicframework.com/docs/theming/rtl-support/
12
+$app-direction: ltr;
13
+
14
+
15
+@import "ionic.globals";
16
+
17
+
18
+// Shared Variables
19
+// --------------------------------------------------
20
+// To customize the look and feel of this app, you can override
21
+// the Sass variables found in Ionic's source scss files.
22
+// To view all the possible Ionic variables, see:
23
+// http://ionicframework.com/docs/theming/overriding-ionic-variables/
24
+
25
+
26
+
27
+
28
+// Named Color Variables
29
+// --------------------------------------------------
30
+// Named colors makes it easy to reuse colors on various components.
31
+// It's highly recommended to change the default colors
32
+// to match your app's branding. Ionic uses a Sass map of
33
+// colors so you can add, rename and remove colors as needed.
34
+// The "primary" color is the only required color in the map.
35
+
36
+$colors: (
37
+  primary:    #488aff,
38
+  secondary:  #32db64,
39
+  danger:     #f53d3d,
40
+  light:      #f4f4f4,
41
+  dark:       #222
42
+);
43
+
44
+
45
+// App iOS Variables
46
+// --------------------------------------------------
47
+// iOS only Sass variables can go here
48
+
49
+
50
+
51
+
52
+// App Material Design Variables
53
+// --------------------------------------------------
54
+// Material Design only Sass variables can go here
55
+
56
+
57
+
58
+
59
+// App Windows Variables
60
+// --------------------------------------------------
61
+// Windows only Sass variables can go here
62
+
63
+
64
+
65
+
66
+// App Theme
67
+// --------------------------------------------------
68
+// Ionic apps can have different themes applied, which can
69
+// then be future customized. This import comes last
70
+// so that the above variables are used and Ionic's
71
+// default are overridden.
72
+
73
+@import "ionic.theme.default";
74
+
75
+
76
+// Ionicons
77
+// --------------------------------------------------
78
+// The premium icon font for Ionic. For more info, please see:
79
+// http://ionicframework.com/docs/ionicons/
80
+
81
+@import "ionic.ionicons";
82
+
83
+
84
+// Fonts
85
+// --------------------------------------------------
86
+
87
+@import "roboto";
88
+@import "noto-sans";

+ 28
- 0
01-login/tsconfig.json Visa fil

@@ -0,0 +1,28 @@
1
+{
2
+  "compilerOptions": {
3
+    "allowSyntheticDefaultImports": true,
4
+    "declaration": false,
5
+    "emitDecoratorMetadata": true,
6
+    "experimentalDecorators": true,
7
+    "lib": [
8
+      "dom",
9
+      "es2015"
10
+    ],
11
+    "module": "es2015",
12
+    "moduleResolution": "node",
13
+    "sourceMap": true,
14
+    "target": "es5"
15
+  },
16
+  "include": [
17
+    "src/**/*.ts"
18
+  ],
19
+  "exclude": [
20
+    "node_modules",
21
+    "src/**/*.spec.ts",
22
+    "src/**/__tests__/*.ts"
23
+  ],
24
+  "compileOnSave": false,
25
+  "atom": {
26
+    "rewriteTsconfig": false
27
+  }
28
+}

+ 11
- 0
01-login/tslint.json Visa fil

@@ -0,0 +1,11 @@
1
+{
2
+  "rules": {
3
+    "no-duplicate-variable": true,
4
+    "no-unused-variable": [
5
+      true
6
+    ]
7
+  },
8
+  "rulesDirectory": [
9
+    "node_modules/tslint-eslint-rules/dist/rules"
10
+  ]
11
+}