add whisper download utils. add react-navigator.
This commit is contained in:
36
app/service/download.ts
Normal file
36
app/service/download.ts
Normal file
@ -0,0 +1,36 @@
|
||||
import { useState, useEffect, useRef } from 'react';
|
||||
import { Text, View, Button, Platform } from 'react-native';
|
||||
import * as Device from 'expo-device';
|
||||
import * as Notifications from 'expo-notifications';
|
||||
import Constants from 'expo-constants';
|
||||
|
||||
|
||||
export function initNotifications() {
|
||||
Notifications.setNotificationHandler({
|
||||
handleNotification: async () => ({
|
||||
shouldShowAlert: true,
|
||||
shouldPlaySound: true,
|
||||
shouldSetBadge: true,
|
||||
}),
|
||||
});
|
||||
}
|
||||
|
||||
async function sendPushNotification(expoPushToken: string) {
|
||||
const message = {
|
||||
to: expoPushToken,
|
||||
sound: 'default',
|
||||
title: 'Original Title',
|
||||
body: 'And here is the body!',
|
||||
data: { someData: 'goes here' },
|
||||
};
|
||||
|
||||
await fetch('https://exp.host/--/api/v2/push/send', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
Accept: 'application/json',
|
||||
'Accept-encoding': 'gzip, deflate',
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify(message),
|
||||
});
|
||||
}
|
Reference in New Issue
Block a user