Skip to content

Commit 57750f7

Browse files
Merge pull request #45 from plankes-projects/master
Notifications fixed
2 parents 0690849 + 06fddc6 commit 57750f7

22 files changed

+1149
-80
lines changed

clients/vue/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
node_modules
33
/dist
44
/config.ts
5+
/public/firebase.config.js
6+
57

68
/tests/e2e/videos/
79
/tests/e2e/screenshots/

clients/vue/config.ts.template

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,18 @@
11
export default {
22
basePath: "http://localhost:8081",
33
aboutEmail: "[email protected]",
4+
firebase: {
5+
config: {
6+
apiKey: "xx",
7+
authDomain: "xx",
8+
databaseURL: "xx",
9+
projectId: "xx",
10+
storageBucket: "xx",
11+
messagingSenderId: "xx",
12+
appId: "xx",
13+
measurementId: "xx",
14+
},
15+
publicVapidKey:
16+
"xx",
17+
},
418
};

clients/vue/package-lock.json

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

clients/vue/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
"axios": "^0.19.2",
1818
"buefy": "^0.8.20",
1919
"core-js": "^3.6.5",
20+
"firebase": "7.19.1",
2021
"register-service-worker": "^1.7.1",
2122
"uuid": "^8.3.0",
2223
"vue": "^2.6.11",
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// [START initialize_firebase_in_sw]
2+
// Give the service worker access to Firebase Messaging.
3+
// Note that you can only use Firebase Messaging here, other Firebase libraries
4+
// are not available in the service worker.
5+
importScripts("https://www.gstatic.com/firebasejs/7.19.1/firebase-app.js");
6+
importScripts(
7+
"https://www.gstatic.com/firebasejs/7.19.1/firebase-messaging.js"
8+
);
9+
importScripts("./firebase.config.js");
10+
// Initialize the Firebase app in the service worker by passing in the messagingSenderId.
11+
12+
firebase.initializeApp(firebaseConfig);
13+
14+
// Retrieve an instance of Firebase Messaging so that it can handle background messages.
15+
const messaging = firebase.messaging();
16+
// [END initialize_firebase_in_sw]
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
const firebaseConfig = {
2+
apiKey: "xx",
3+
authDomain: "xx",
4+
databaseURL: "xx",
5+
projectId: "xx",
6+
storageBucket: "xx",
7+
messagingSenderId: "xx",
8+
appId: "xx",
9+
measurementId: "xx",
10+
};

clients/vue/public/manifest.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"name": "Splitastic",
33
"short_name": "Splitastic",
44
"theme_color": "#4DBA87",
5+
"gcm_sender_id": "103953800507",
56
"icons": [
67
{
78
"src": "img/icons/manifest-icon-192.png",
@@ -19,4 +20,4 @@
1920
"start_url": ".",
2021
"display": "standalone",
2122
"background_color": "#000000"
22-
}
23+
}

clients/vue/src/generated/api-axios/api.ts

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2915,6 +2915,53 @@ export const UserApiAxiosParamCreator = function (configuration?: Configuration)
29152915

29162916

29172917

2918+
localVarUrlObj.query = {...localVarUrlObj.query, ...localVarQueryParameter, ...options.query};
2919+
// fix override query string Detail: https://stackoverflow.com/a/7517673/1077943
2920+
delete localVarUrlObj.search;
2921+
const headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
2922+
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
2923+
2924+
return {
2925+
url: globalImportUrl.format(localVarUrlObj),
2926+
options: localVarRequestOptions,
2927+
};
2928+
},
2929+
/**
2930+
*
2931+
* @summary Links the firebase token to this user.
2932+
* @param {string} firebaseToken The firebase token of this device.
2933+
* @param {*} [options] Override http request option.
2934+
* @throws {RequiredError}
2935+
*/
2936+
userFirebaseTokenPut: async (firebaseToken: string, options: any = {}): Promise<RequestArgs> => {
2937+
// verify required parameter 'firebaseToken' is not null or undefined
2938+
if (firebaseToken === null || firebaseToken === undefined) {
2939+
throw new RequiredError('firebaseToken','Required parameter firebaseToken was null or undefined when calling userFirebaseTokenPut.');
2940+
}
2941+
const localVarPath = `/user/firebaseToken`;
2942+
const localVarUrlObj = globalImportUrl.parse(localVarPath, true);
2943+
let baseOptions;
2944+
if (configuration) {
2945+
baseOptions = configuration.baseOptions;
2946+
}
2947+
const localVarRequestOptions = { method: 'PUT', ...baseOptions, ...options};
2948+
const localVarHeaderParameter = {} as any;
2949+
const localVarQueryParameter = {} as any;
2950+
2951+
// authentication ApiKeyAuthHeader required
2952+
if (configuration && configuration.apiKey) {
2953+
const localVarApiKeyValue = typeof configuration.apiKey === 'function'
2954+
? await configuration.apiKey("X-API-KEY")
2955+
: await configuration.apiKey;
2956+
localVarHeaderParameter["X-API-KEY"] = localVarApiKeyValue;
2957+
}
2958+
2959+
if (firebaseToken !== undefined) {
2960+
localVarQueryParameter['firebaseToken'] = firebaseToken;
2961+
}
2962+
2963+
2964+
29182965
localVarUrlObj.query = {...localVarUrlObj.query, ...localVarQueryParameter, ...options.query};
29192966
// fix override query string Detail: https://stackoverflow.com/a/7517673/1077943
29202967
delete localVarUrlObj.search;
@@ -3140,6 +3187,20 @@ export const UserApiFp = function(configuration?: Configuration) {
31403187
return axios.request(axiosRequestArgs);
31413188
};
31423189
},
3190+
/**
3191+
*
3192+
* @summary Links the firebase token to this user.
3193+
* @param {string} firebaseToken The firebase token of this device.
3194+
* @param {*} [options] Override http request option.
3195+
* @throws {RequiredError}
3196+
*/
3197+
async userFirebaseTokenPut(firebaseToken: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<void>> {
3198+
const localVarAxiosArgs = await UserApiAxiosParamCreator(configuration).userFirebaseTokenPut(firebaseToken, options);
3199+
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
3200+
const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
3201+
return axios.request(axiosRequestArgs);
3202+
};
3203+
},
31433204
/**
31443205
*
31453206
* @summary Returns user information of the current user.
@@ -3234,6 +3295,16 @@ export const UserApiFactory = function (configuration?: Configuration, basePath?
32343295
groupGroupIdUserUserIdDelete(groupId: number, userId: number, options?: any): AxiosPromise<void> {
32353296
return UserApiFp(configuration).groupGroupIdUserUserIdDelete(groupId, userId, options).then((request) => request(axios, basePath));
32363297
},
3298+
/**
3299+
*
3300+
* @summary Links the firebase token to this user.
3301+
* @param {string} firebaseToken The firebase token of this device.
3302+
* @param {*} [options] Override http request option.
3303+
* @throws {RequiredError}
3304+
*/
3305+
userFirebaseTokenPut(firebaseToken: string, options?: any): AxiosPromise<void> {
3306+
return UserApiFp(configuration).userFirebaseTokenPut(firebaseToken, options).then((request) => request(axios, basePath));
3307+
},
32373308
/**
32383309
*
32393310
* @summary Returns user information of the current user.
@@ -3319,6 +3390,18 @@ export class UserApi extends BaseAPI {
33193390
return UserApiFp(this.configuration).groupGroupIdUserUserIdDelete(groupId, userId, options).then((request) => request(this.axios, this.basePath));
33203391
}
33213392

3393+
/**
3394+
*
3395+
* @summary Links the firebase token to this user.
3396+
* @param {string} firebaseToken The firebase token of this device.
3397+
* @param {*} [options] Override http request option.
3398+
* @throws {RequiredError}
3399+
* @memberof UserApi
3400+
*/
3401+
public userFirebaseTokenPut(firebaseToken: string, options?: any) {
3402+
return UserApiFp(this.configuration).userFirebaseTokenPut(firebaseToken, options).then((request) => request(this.axios, this.basePath));
3403+
}
3404+
33223405
/**
33233406
*
33243407
* @summary Returns user information of the current user.

clients/vue/src/main.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,10 @@ import { library } from "@fortawesome/fontawesome-svg-core";
1111
import { fas } from "@fortawesome/free-solid-svg-icons";
1212
import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome";
1313
import { ExceptionHandler } from "./untils/ExceptionHandler";
14+
import { NotificationUtils } from "./untils/NotificationUtils";
1415

16+
//##########################################
17+
//setup vue
1518
library.add(fas);
1619
Vue.component("font-awesome-icon", FontAwesomeIcon);
1720
Vue.use(Buefy, { defaultIconPack: "fas" });
@@ -26,3 +29,5 @@ new Vue({
2629
store,
2730
render: (h) => h(App),
2831
}).$mount("#app");
32+
33+
NotificationUtils.init();

clients/vue/src/registerServiceWorker.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import { register } from "register-service-worker";
44

55
if (process.env.NODE_ENV === "production") {
6+
register(`${process.env.BASE_URL}firebase-messaging-sw.js`);
67
register(`${process.env.BASE_URL}service-worker.js`, {
78
ready() {
89
console.log(
@@ -29,6 +30,6 @@ if (process.env.NODE_ENV === "production") {
2930
},
3031
error(error) {
3132
console.error("Error during service worker registration:", error);
32-
}
33+
},
3334
});
3435
}

0 commit comments

Comments
 (0)