Improve sign-up process for new users
This commit is contained in:
@@ -8,6 +8,8 @@ import {
|
||||
View,
|
||||
TouchableOpacity,
|
||||
TouchableHighlight,
|
||||
PermissionsAndroid,
|
||||
AsyncStorage,
|
||||
} from "react-native"
|
||||
import MapView, { Marker } from "react-native-maps"
|
||||
import { Icon, Header } from "../ui"
|
||||
@@ -15,9 +17,12 @@ import { api } from "../API"
|
||||
import autobind from "autobind-decorator"
|
||||
import { ifIphoneX } from "react-native-iphone-x-helper"
|
||||
import { workItemTypeText, pad, regionContainingPoints } from "../util"
|
||||
import { ensurePermission } from "../App"
|
||||
import { versionInfo } from "../version"
|
||||
import pinImage from "./images/pin.png"
|
||||
|
||||
const minGPSAccuracy = 20
|
||||
const neverAskForLocationPermissionKeyName = "NeverAskForLocationPermission"
|
||||
|
||||
export class Home extends React.Component {
|
||||
constructor(props) {
|
||||
@@ -34,10 +39,22 @@ export class Home extends React.Component {
|
||||
positionInfo: null,
|
||||
}
|
||||
|
||||
this.watchId = navigator.geolocation.watchPosition(
|
||||
this.handlePositionChange,
|
||||
null,
|
||||
{ distanceFilter: 10 }
|
||||
ensurePermission(
|
||||
PermissionsAndroid.PERMISSIONS.ACCESS_FINE_LOCATION,
|
||||
neverAskForLocationPermissionKeyName,
|
||||
{
|
||||
title: versionInfo.title,
|
||||
message:
|
||||
"This app needs access to your location so that " +
|
||||
"you can find and access the geo located items.",
|
||||
},
|
||||
() => {
|
||||
this.watchId = navigator.geolocation.watchPosition(
|
||||
this.handlePositionChange,
|
||||
null,
|
||||
{ distanceFilter: 10 }
|
||||
)
|
||||
}
|
||||
)
|
||||
|
||||
api
|
||||
@@ -59,6 +76,7 @@ export class Home extends React.Component {
|
||||
componentWillUnmount() {
|
||||
if (this.watchId) {
|
||||
navigator.geolocation.clearWatch(this.watchId)
|
||||
this.watchId = null
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user