リファクタリング

This commit is contained in:
harukin-DeskMini
2022-09-28 19:13:10 +09:00
parent 209568df4c
commit dc089cf8f0
3 changed files with 11 additions and 21 deletions

View File

@@ -1,19 +1,18 @@
import { ToastAndroid } from "react-native";
import * as Updates from "expo-updates";
export function UpdateAsync() {
export const UpdateAsync = () =>
Updates.checkForUpdateAsync()
.then((update) => {
if (update.isAvailable) {
ToastAndroid.showWithGravityAndOffset(
"アプリのデータを更新しています。",
ToastAndroid.LONG,
ToastAndroid.BOTTOM,
25,
50
);
Updates.fetchUpdateAsync().then(() => Updates.reloadAsync());
}
if (!update.isAvailable) return;
ToastAndroid.showWithGravityAndOffset(
"アプリのデータを更新しています。",
ToastAndroid.LONG,
ToastAndroid.BOTTOM,
25,
50
);
Updates.fetchUpdateAsync().then(() => Updates.reloadAsync());
})
.catch((e) =>
ToastAndroid.showWithGravityAndOffset(
@@ -24,4 +23,3 @@ export function UpdateAsync() {
50
)
);
}