feat(active-workout): require paired Watch to start workout
This commit is contained in:
@@ -40,12 +40,7 @@ export function PreSwimScreen() {
|
||||
};
|
||||
|
||||
const handleStartSwim = async () => {
|
||||
if (!workout) return;
|
||||
|
||||
if (!isReady) {
|
||||
navigation.navigate("PostSwim", { workoutId: route.params.workoutId });
|
||||
return;
|
||||
}
|
||||
if (!workout || !isReady) return;
|
||||
|
||||
const result = await sendWorkoutToWatch(
|
||||
workout.id,
|
||||
@@ -101,10 +96,10 @@ export function PreSwimScreen() {
|
||||
</Text>
|
||||
</View>
|
||||
<Pressable
|
||||
onPress={() => navigation.navigate("PostSwim", { workoutId: route.params.workoutId })}
|
||||
onPress={() => setSyncResult(null)}
|
||||
className="bg-sky-500 rounded-2xl py-4 items-center w-full"
|
||||
>
|
||||
<Text className="text-white font-bold text-lg">{t("startWithoutWatch")}</Text>
|
||||
<Text className="text-white font-bold text-lg">{tc("retry")}</Text>
|
||||
</Pressable>
|
||||
</View>
|
||||
);
|
||||
@@ -172,25 +167,25 @@ export function PreSwimScreen() {
|
||||
|
||||
<Pressable
|
||||
onPress={handleStartSwim}
|
||||
disabled={isSyncing}
|
||||
disabled={isSyncing || !isReady}
|
||||
className={`rounded-2xl py-4 items-center ${
|
||||
isSyncing ? "bg-sky-300" : "bg-sky-500"
|
||||
isSyncing || !isReady ? "bg-slate-300" : "bg-sky-500"
|
||||
}`}
|
||||
>
|
||||
{isSyncing ? (
|
||||
<ActivityIndicator color="#fff" />
|
||||
) : (
|
||||
<Text className="text-white font-bold text-lg">
|
||||
{isReady ? t("sendToWatchAndStart") : t("startWithoutWatch")}
|
||||
<Text className={`font-bold text-lg ${!isReady ? "text-slate-500" : "text-white"}`}>
|
||||
{t("sendToWatchAndStart")}
|
||||
</Text>
|
||||
)}
|
||||
</Pressable>
|
||||
|
||||
<Text className="text-slate-400 text-xs text-center mt-3">
|
||||
{isReady
|
||||
? t("syncToWatch")
|
||||
: t("trackedOnDevice")}
|
||||
</Text>
|
||||
{!isReady && (
|
||||
<Text className="text-red-500 text-xs text-center mt-3">
|
||||
{t("watchRequired")}
|
||||
</Text>
|
||||
)}
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user