Skip to content

Commit 79a130a

Browse files
new firebase and maps API created
1 parent c249339 commit 79a130a

23 files changed

+226
-46
lines changed

.firebaserc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"projects": {
3-
"default": "ionic-angular-pr-1565107344855",
4-
"testing": "ionic-angular-pr-1565107344855"
3+
"default": "ionic-maps-api-1565705298126",
4+
"testing": "ionic-maps-api-1565705298126"
55
}
66
}

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,8 @@ private getGoogleMaps(): Promise<any> {
119119

120120
## Status & To-do list
121121

122-
* Status: issue with auth token means user is logged out immediately. New database used which is currently empty.
123-
* To-do: complete course
122+
* Status: working 95%. Bookings can be made and new places added to offers page. If a different user is logged in they cannot book their own places (the booking button does not show) - which is correct.
123+
* To-do: correct issues: Camera image does not display. Bookable place list is the same as the 'All Places' list - bookable places should not include the logged in users' places. 'My Offers' includes everyones places. 'Your Bookings' does not work - check path.
124124

125125
## Inspiration
126126

angular.json

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@
2929
"glob": "**/*.svg",
3030
"input": "node_modules/ionicons/dist/ionicons/svg",
3131
"output": "./svg"
32-
}
32+
},
33+
"src/manifest.webmanifest"
3334
],
3435
"styles": [
3536
{
@@ -64,7 +65,9 @@
6465
"maximumWarning": "2mb",
6566
"maximumError": "5mb"
6667
}
67-
]
68+
],
69+
"serviceWorker": true,
70+
"ngswConfigPath": "ngsw-config.json"
6871
},
6972
"ci": {
7073
"progress": false
@@ -110,7 +113,8 @@
110113
"glob": "**/*",
111114
"input": "src/assets",
112115
"output": "/assets"
113-
}
116+
},
117+
"src/manifest.webmanifest"
114118
]
115119
},
116120
"configurations": {

functions/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const uuid = require('uuid/v4');
99
const { Storage } = require('@google-cloud/storage');
1010

1111
const storage = new Storage({
12-
projectId: 'ionic-angular-pr-1565107344855'
12+
projectId: 'ionic-maps-api-1565705298126'
1313
});
1414

1515
exports.storeImage = functions.https.onRequest((req, res) => {
@@ -40,7 +40,7 @@ exports.storeImage = functions.https.onRequest((req, res) => {
4040

4141
console.log(uploadData.type);
4242
return storage
43-
.bucket('ionic-angular-pr-1565107344855.appspot.com')
43+
.bucket('ionic-maps-api-1565705298126.appspot.com')
4444
.upload(uploadData.filePath, {
4545
uploadType: 'media',
4646
destination: imagePath,
@@ -56,7 +56,7 @@ exports.storeImage = functions.https.onRequest((req, res) => {
5656
return res.status(201).json({
5757
imageUrl:
5858
'https://firebasestorage.googleapis.com/v0/b/' +
59-
storage.bucket('ionic-angular-pr-1565107344855.appspot.com').name +
59+
storage.bucket('ionic-maps-api-1565705298126.appspot.com').name +
6060
'/o/' +
6161
encodeURIComponent(imagePath) +
6262
'?alt=media&token=' +

ngsw-config.json

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"$schema": "./node_modules/@angular/service-worker/config/schema.json",
3+
"index": "/index.html",
4+
"assetGroups": [
5+
{
6+
"name": "app",
7+
"installMode": "prefetch",
8+
"resources": {
9+
"files": [
10+
"/favicon.ico",
11+
"/index.html",
12+
"/*.css",
13+
"/*.js"
14+
]
15+
}
16+
}, {
17+
"name": "assets",
18+
"installMode": "lazy",
19+
"updateMode": "prefetch",
20+
"resources": {
21+
"files": [
22+
"/assets/**",
23+
"/*.(eot|svg|cur|jpg|png|webp|gif|otf|ttf|woff|woff2|ani)"
24+
]
25+
}
26+
}
27+
]
28+
}

package-lock.json

Lines changed: 107 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@
1919
"@angular/forms": "~8.1.2",
2020
"@angular/platform-browser": "~8.1.2",
2121
"@angular/platform-browser-dynamic": "~8.1.2",
22+
"@angular/pwa": "^0.802.1",
2223
"@angular/router": "~8.1.2",
24+
"@angular/service-worker": "~8.1.2",
2325
"@capacitor/android": "^1.1.1",
2426
"@capacitor/core": "1.1.1",
2527
"@ionic-native/core": "^5.0.0",

src/app/app.module.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,13 @@ import { StatusBar } from '@ionic-native/status-bar/ngx';
1010

1111
import { AppComponent } from './app.component';
1212
import { AppRoutingModule } from './app-routing.module';
13+
import { ServiceWorkerModule } from '@angular/service-worker';
14+
import { environment } from '../environments/environment';
1315

1416
@NgModule({
1517
declarations: [AppComponent],
1618
entryComponents: [],
17-
imports: [BrowserModule, HttpClientModule, IonicModule.forRoot(), AppRoutingModule],
19+
imports: [BrowserModule, HttpClientModule, IonicModule.forRoot(), AppRoutingModule, ServiceWorkerModule.register('ngsw-worker.js', { enabled: environment.production })],
1820
providers: [
1921
StatusBar,
2022
SplashScreen,

src/app/auth/user.model.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ export class User {
1818
if (!this.token) {
1919
return 0;
2020
}
21-
return 2000;
22-
// return this.tokenExpirationDate.getTime() - new Date().getTime();
21+
return this.tokenExpirationDate.getTime() - new Date().getTime();
2322
}
2423

2524
}

src/app/bookings/booking.service.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ export class BookingService {
6666
);
6767
return this.http
6868
.post<{ name: string }>(
69-
`https://ionic-angular-pr-1565107344855.firebaseio.com/bookings.json?auth=${token}`,
69+
`https://ionic-maps-api-1565705298126.firebaseio.com/bookings.json?auth=${token}`,
7070
{ ...newBooking, id: null }
7171
);
7272
}),
@@ -88,7 +88,7 @@ export class BookingService {
8888
switchMap(token => {
8989
return this.http
9090
.delete(
91-
`https://ionic-angular-pr-1565107344855.firebaseio.com/bookings/${bookingId}.json?auth=${token}`
91+
`https://ionic-maps-api-1565705298126.firebaseio.com/bookings/${bookingId}.json?auth=${token}`
9292
);
9393
}),
9494
switchMap(() => {
@@ -115,7 +115,7 @@ export class BookingService {
115115
take(1),
116116
switchMap(token => {
117117
return this.http.get<{ [key: string]: BookingData }>(
118-
`https://ionic-angular-pr-1565107344855.firebaseio.com/bookings.json?orderBy="userId"&equalTo="${fetchedUserId}"&auth=${token}`
118+
`https://ionic-maps-api-1565705298126.firebaseio.com/bookings.json?orderBy="userId"&equalTo="${fetchedUserId}"&auth=${token}`
119119
);
120120
}),
121121

0 commit comments

Comments
 (0)