Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix test login (maybe) #90

Merged
merged 5 commits into from
Apr 4, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions app/segments/drill/[id]/submission/input.js
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ export default function Input({ drillInfo, setToggleResult, setOutputData }) {
<Appbar.Action
icon="information-outline"
onPress={() => {
descriptionModalRef.current ?.present();
descriptionModalRef.current?.present();
}}
color={"#F24E1E"}
/>
Expand Down Expand Up @@ -468,7 +468,7 @@ export default function Input({ drillInfo, setToggleResult, setOutputData }) {
icon={getIconByKey(item.id)}
prompt={item.prompt}
distanceMeasure={item.distanceMeasure}
inputValue={inputValues[displayedShot] ?.[item.id] || ""}
inputValue={inputValues[displayedShot]?.[item.id] || ""}
onInputChange={(newText) => {
handleInputChange(item.id, newText);
}}
Expand Down Expand Up @@ -573,7 +573,7 @@ export default function Input({ drillInfo, setToggleResult, setOutputData }) {
<Text
style={{ color: "#F3572A" }}
onPress={() => {
navModalRef.current ?.present();
navModalRef.current?.present();
}}
>
View all shots
Expand Down
11 changes: 8 additions & 3 deletions context/Auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,20 @@ export const AuthProvider = ({ children }) => {
useEffect(() => {
//if this code is not in here, it'll run for infinite times
onAuthStateChanged(auth, (currentUserId) => {
// keep this log outside if statement to confirm e.g. logout of test user
console.log("user changed");
if (currentUserId) {
setCurrentUserId(currentUserId.uid ?? "Error (uid)");

// prevent "persistent login" of regular user login from conflicting with test user
if (!process.env.EXPO_PUBLIC_TEST_UID) {
solderq35 marked this conversation as resolved.
Show resolved Hide resolved
if (currentUserId) {
setCurrentUserId(currentUserId.uid ?? "Error (uid)");
}
}
});

// yarn test
// If you sign out, reload app to sign back in as test user
// Moved outside of useEffect to avoid race condition with logout
// Moved outside of onAuthChanged to avoid race condition with logout
if (process.env.EXPO_PUBLIC_TEST_UID) {
setCurrentUserId(process.env.EXPO_PUBLIC_TEST_UID);
}
Expand Down
Loading