Skip to content

Commit

Permalink
try and fix sharing again
Browse files Browse the repository at this point in the history
  • Loading branch information
docimin committed Sep 17, 2024
1 parent ba1bdb2 commit c2a1f95
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 38 deletions.
2 changes: 1 addition & 1 deletion app.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"expo": {
"name": "Headpat",
"slug": "headpat-app",
"version": "0.7.6",
"version": "0.7.7",
"orientation": "portrait",
"icon": "./assets/images/icon.png",
"scheme": "headpatapp",
Expand Down
68 changes: 31 additions & 37 deletions app/_layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,46 +76,40 @@ async function bootstrap() {
}
}

TaskManager.defineTask(
'background-location-task',
async ({
data,
error,
}: {
data: { locations: LocationObject }
error: any
}) => {
if (error) {
console.error(error)
Sentry.captureException(error)
return BackgroundFetch.BackgroundFetchResult.Failed
}
TaskManager.defineTask('background-location-task', async ({ data, error }) => {

Check warning on line 79 in app/_layout.tsx

View workflow job for this annotation

GitHub Actions / Qodana for JS

Unused local symbol

Unused parameter data
if (error) {
console.error(error)
Sentry.captureException(error)
return BackgroundFetch.BackgroundFetchResult.Failed
}

// Use the user data from the task
const userId = await AsyncStorage.getItem('userId')
//const preciseLocation = await AsyncStorage.getItem('preciseLocation')
// Use the user data from the task
const userId = await AsyncStorage.getItem('userId')
//const preciseLocation = await AsyncStorage.getItem('preciseLocation')

if (!userId) {
return Location.stopLocationUpdatesAsync('background-location-task')
}
if (!userId) {
return Location.stopLocationUpdatesAsync('background-location-task')
}

// Make API calls to update or create location document
await database
.updateDocument('hp_db', 'locations', userId, {
long: data.locations.coords.longitude,
lat: data.locations.coords.latitude,
})
.catch(async () => {
await database.createDocument('hp_db', 'locations', userId, {
long: data.locations.coords.longitude,
lat: data.locations.coords.latitude,
timeUntilEnd: new Date(
Date.now() + 24 * 60 * 60 * 1000
).toISOString(),
})
// Get current location
const location = await Location.getCurrentPositionAsync({
accuracy: Location.LocationAccuracy.High,
})

// Make API calls to update or create location document
await database
.updateDocument('hp_db', 'locations', userId, {
long: location.coords.longitude,
lat: location.coords.latitude,
})
.catch(async () => {
await database.createDocument('hp_db', 'locations', userId, {
long: location.coords.longitude,
lat: location.coords.latitude,
timeUntilEnd: new Date(Date.now() + 24 * 60 * 60 * 1000).toISOString(),
})
}
)
})
})

const LIGHT_THEME: Theme = {
dark: false,
Expand Down Expand Up @@ -409,7 +403,7 @@ function CustomDrawerContent() {
textAlign: 'center',
}}
>
Headpat App v0.7.6
Headpat App v0.7.7
</Text>
<Muted className={'text-center pb-4'}>BETA</Muted>
</ScrollView>
Expand Down

0 comments on commit c2a1f95

Please sign in to comment.