Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(position): gestion de localisation désactivée ou refusée (JMG_02) #74

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions android/app/capacitor.build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ dependencies {
implementation project(':capacitor-share')
implementation project(':capacitor-status-bar')
implementation project(':capacitor-toast')
implementation project(':capacitor-native-settings')

}

Expand Down
3 changes: 3 additions & 0 deletions android/capacitor.settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,6 @@ project(':capacitor-status-bar').projectDir = new File('../node_modules/@capacit

include ':capacitor-toast'
project(':capacitor-toast').projectDir = new File('../node_modules/@capacitor/toast/android')

include ':capacitor-native-settings'
project(':capacitor-native-settings').projectDir = new File('../node_modules/capacitor-native-settings/android')
1 change: 1 addition & 0 deletions ios/App/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ def capacitor_pods
pod 'CapacitorShare', :path => '../../node_modules/@capacitor/share'
pod 'CapacitorStatusBar', :path => '../../node_modules/@capacitor/status-bar'
pod 'CapacitorToast', :path => '../../node_modules/@capacitor/toast'
pod 'CapacitorNativeSettings', :path => '../../node_modules/capacitor-native-settings'
end

target 'App' do
Expand Down
17 changes: 13 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"@aashu-dubey/capacitor-statusbar-safe-area": "^2.1.1",
"@agorapulse/capacitor-mediastore": "^0.2.0",
"@capacitor/android": "5.6.0",
"@capacitor/app": "^5.0.6",
"@capacitor/app": "^5.0.7",
"@capacitor/core": "5.6.0",
"@capacitor/filesystem": "^5.2.0",
"@capacitor/geolocation": "5.0.6",
Expand All @@ -41,6 +41,7 @@
"@maplibre/maplibre-gl-directions": "^0.6.1",
"@turf/buffer": "^6.5.0",
"@turf/union": "^6.5.0",
"capacitor-native-settings": "^5.0.1",
"chart.js": "^4.4.1",
"maplibre-gl": "^3.6.2",
"proj4": "^2.10.0"
Expand Down
1 change: 1 addition & 0 deletions src/css/app.scss
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,5 @@
@use 'comparePoi.css';
@use 'signalement.css';
@use 'landmark.css';
@use 'location.css';
@use 'media-queries.css';
6 changes: 6 additions & 0 deletions src/css/assets/map-buttons/location-disabled.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions src/css/location.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
.btnOpenParameters {
appearance: unset; /* for ios */
display: block;
margin: auto;
border: none;
border-radius: 70px;
background-color: #26a581;
padding: 14px 28px;
font-family: "Open Sans";
font-weight: 600;
font-size: 9px;
color: white;
cursor: pointer;
text-align: center;
letter-spacing: 0;
line-height: normal;
white-space: nowrap;
width: 100%;
margin-top: 26px;
box-sizing: border-box;
}
6 changes: 3 additions & 3 deletions src/css/position.css
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@
*/

#interactivityPopup,
#positionPopup,
#locationPopup,
#routeDrawHelpPopup {
position: relative;
}
Expand All @@ -184,14 +184,14 @@

.routeDrawHelpPopup>.maplibregl-popup-content,
.interactivityPopup>.maplibregl-popup-content,
.positionPopup>.maplibregl-popup-content {
.locationPopup>.maplibregl-popup-content {
color: #3F4A55;
border-radius: 15px;
}

.routeDrawHelpPopup>.maplibregl-popup-tip,
.interactivityPopup>.maplibregl-popup-tip,
.positionPopup>.maplibregl-popup-tip {
.locationPopup>.maplibregl-popup-tip {
display: none;
}

Expand Down
18 changes: 7 additions & 11 deletions src/js/event-listeners.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import RecentSearch from "./search-recent";
import State from "./state";
import { SafeAreaController } from "@aashu-dubey/capacitor-statusbar-safe-area";
import { ScreenOrientation } from "@capacitor/screen-orientation";
import { App } from "@capacitor/app";

/**
* Ecouteurs generiques
Expand Down Expand Up @@ -77,24 +78,19 @@ function addListeners() {
// Action du backbutton
document.addEventListener("backbutton", State.onBackKeyDown, false);

// Sauvegarde de l'état de l'application
document.addEventListener("pause", () => {
const saveState = () => {
localStorage.setItem("lastMapLat", map.getCenter().lat);
localStorage.setItem("lastMapLng", map.getCenter().lng);
localStorage.setItem("lastMapZoom", map.getZoom());
localStorage.setItem("lastLayersDisplayed", JSON.stringify(Globals.layersDisplayed));
localStorage.setItem("savedRoutes", JSON.stringify(Globals.myaccount.routes));
localStorage.setItem("savedLandmarks", JSON.stringify(Globals.myaccount.landmarks));
});
};

window.addEventListener("beforeunload", () => {
localStorage.setItem("lastMapLat", map.getCenter().lat);
localStorage.setItem("lastMapLng", map.getCenter().lng);
localStorage.setItem("lastMapZoom", map.getZoom());
localStorage.setItem("lastLayersDisplayed", JSON.stringify(Globals.layersDisplayed));
localStorage.setItem("savedRoutes", JSON.stringify(Globals.myaccount.routes));
localStorage.setItem("savedLandmarks", JSON.stringify(Globals.myaccount.landmarks));
});
// Sauvegarde de l'état de l'application
App.addListener("pause", saveState);
document.addEventListener("pause", saveState);
window.addEventListener("beforeunload", saveState);

const handleresize = () => {
SafeAreaController.addSafeAreaVariables().then( () => {
Expand Down
6 changes: 3 additions & 3 deletions src/js/map-interactivity/interactivity-indicator.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,9 +172,9 @@ class InteractivityIndicator {
}

/**
* affiche la popup explicative
* @public
*/
* affiche la popup explicative
* @public
*/
showPopup() {
// on supprime la popup
if (this.popup) {
Expand Down
6 changes: 1 addition & 5 deletions src/js/position.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ class Position {
constructor(map, options) {
this.options = options || {
target: null,
tracking : false, // suivi de la position
// callback
openPositionCbk: null,
closePositionCbk: null,
Expand All @@ -36,9 +35,6 @@ class Position {
// carte
this.map = map;

// tracking
this.tracking = this.options.tracking;

// target
this.target = this.options.target;

Expand Down Expand Up @@ -283,7 +279,7 @@ Altitude : ${altitude} m
this.clear();
let position;
if (lngLat === false) {
position = await Location.getLocation(this.tracking);
position = await Location.getLocation();
} else {
position = {
coordinates: {
Expand Down
2 changes: 1 addition & 1 deletion src/js/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ class Search {
}, 250);
}
// on realise une geolocalisation
Location.getLocation(true)
Location.getLocation()
.then((result) => {
Location.moveTo(result.coordinates, Globals.map.getZoom(), true, true);
}, true);
Expand Down
Loading
Loading