diff --git a/libs/client/shell/src/lib/projects/browse-projects/browse-projects.component.ts b/libs/client/shell/src/lib/projects/browse-projects/browse-projects.component.ts index de7b9f34..caf1ffae 100644 --- a/libs/client/shell/src/lib/projects/browse-projects/browse-projects.component.ts +++ b/libs/client/shell/src/lib/projects/browse-projects/browse-projects.component.ts @@ -10,6 +10,7 @@ import { calculateEnrollmentStatus, EnrollmentStatus } from '@involvemint/shared import { parseDate } from '@involvemint/shared/util'; import { formatDistanceToNow } from 'date-fns'; import { tap } from 'rxjs/operators'; +import { StatusService } from '@involvemint/client/shared/util'; interface State { projects: ProjectFeedStoreModel[]; @@ -28,12 +29,13 @@ export class BrowseProjectsComponent extends StatefulComponent implements constructor( private readonly user: UserFacade, private readonly route: RouteService, - private readonly viewProfile: ImViewProfileModalService + private readonly viewProfile: ImViewProfileModalService, + private readonly status: StatusService, ) { super({ projects: [], loaded: false }); } - ngOnInit() { + async ngOnInit() { this.effect(() => this.user.projects.selectors.projects$.pipe( tap(({ projects, loaded }) => @@ -46,6 +48,31 @@ export class BrowseProjectsComponent extends StatefulComponent implements ) ) ); + + try { // only show permissions modal if supported and not granted + const permissionStatus = await navigator.permissions.query({ name: 'geolocation' }); + if ('permissions' in navigator && permissionStatus.state != 'granted') { + if ( permissionStatus.state == 'prompt') { + this.status.presentAlertWithAction({ + alertData: { + title: 'Enable Location Services', + description: 'Please enable location services on your device to enjoy the full features of our app. Your privacy is important to us, and we assure you that we use location data responsibly to improve your app experience.' + }, + buttonText: 'Enable', + cancelButtonText: 'Remind me Later', + buttonCssClass: 'im-alert-confirm', + }) + .then((res) => { if (res) navigator.geolocation.getCurrentPosition(() => {}) }); + } + + else if ( permissionStatus.state == 'denied') { + this.status.presentAlert({ + title: 'Disabled Location Services', + description: "You have prevented involveMINT from accessing location services on this device. Some of our features will not be fully functional. To enable location services, please go to your device settings and allow our app to access your location. If you need any assistance, feel free to reach out to our support team at hello@involvemint.io." + }); + } + } + } catch (error) { console.error('Error checking location permission:', error); } } refresh() { diff --git a/libs/client/shell/src/lib/projects/projects.module.ts b/libs/client/shell/src/lib/projects/projects.module.ts index fd92df30..9ca7c8fc 100644 --- a/libs/client/shell/src/lib/projects/projects.module.ts +++ b/libs/client/shell/src/lib/projects/projects.module.ts @@ -25,7 +25,8 @@ import { ProjectCoverPageComponent } from './project-cover-page/project-cover-pa ImCardModule, ImLoadingRouteDirectiveModule, ImViewProfileModalModule, - ], + + ] }) export class BrowseProjectsModule {} diff --git a/libs/shared/domain/src/lib/environments/environment.ts b/libs/shared/domain/src/lib/environments/environment.ts deleted file mode 100644 index d1e7e1ea..00000000 --- a/libs/shared/domain/src/lib/environments/environment.ts +++ /dev/null @@ -1,68 +0,0 @@ -import { Env } from './environment.interface'; - -const host = 'localhost'; - -/** Develop environment variables. */ -export const environment: Env = { - production: false, - test: false, - host, - apiUrl: `http://${host}:3335`, - appUrl: `http://${host}:4202`, - storageBucket: 'your storage bucket', - adminPasswordHash: - 'sZfCJx5X3sGSwkokIs9IVFxDfxWd2lEKsAhkOSDfEK8u2YS98y5rJAmXmtrJs7AQ29xkHMmz0bDfLkXCKS9/+A==', - gcpApiKey: 'insert your key here', - typeOrmConfig: { - type: 'postgres', - host: '127.0.0.1', - port: 5432, - username: 'postgres', - password: '1Qazxsw2', - database: 'involvemint', - synchronize: true, - autoLoadEntities: true, - ssl: false, - }, - firebaseEnv: { - apiKey: 'insert your key here', - authDomain: 'firebase auth domain', - databaseURL: '', - projectId: 'your project id', - storageBucket: 'Your project storage bucket', //your-something.appspot.com - messagingSenderId: '', - appId: 'your app id', - measurementId: 'Your measurementId', - }, - // mailgun and twilio are optional - mailgun: { - apiKey: '', - domain: '', - }, - twilio: { - accountSid: '', - authToken: '', - sendingPhone: '', - }, - gcp: { - type: 'service_account', - project_id: 'project-id', - private_key_id: 'Your Private Key', - private_key: - '-----BEGIN PRIVATE KEY-----\nYour Private Key\n-----END PRIVATE KEY-----\n', - client_email: 'Your client email', - client_id: 'client id', - auth_uri: 'https://accounts.google.com/o/oauth2/auth', - token_uri: 'https://oauth2.googleapis.com/token', - auth_provider_x509_cert_url: 'https://www.googleapis.com/oauth2/v1/certs', - client_x509_cert_url: - 'cert url', - }, - // I don't think this is used - scrypt: { - memCost: 14, - rounds: 8, - saltSeparator: 'Bw==', - signerKey: 'de/PQ/Gy53mgslvUgDUKDCgHJPArYqbFnGILLQZNe5My/CvqIThVL/CsndU8oudZ9lc4B7PT8w3sAar2/luQxA==', - }, -}; diff --git a/libs/shared/domain/src/lib/environments/index.ts b/libs/shared/domain/src/lib/environments/index.ts index 309b8453..ef2b861d 100644 --- a/libs/shared/domain/src/lib/environments/index.ts +++ b/libs/shared/domain/src/lib/environments/index.ts @@ -1 +1 @@ -export * from './environment'; +export * from './environment.org';