Skip to content

Commit 2e170e7

Browse files
authored
Merge pull request #2 from steelhawks/dev
Dev
2 parents 36ad954 + 1c48272 commit 2e170e7

File tree

16 files changed

+588
-318
lines changed

16 files changed

+588
-318
lines changed

AnimationLoader.jsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,11 @@ const AnimationLoader = ({ isLoading = false, loop = true, animationKey = 'LOAD_
1818

1919
const setOn = (duration, callback) => {
2020
setTimeout(() => {
21-
callback();
21+
try { // quick fix to avoid crashing on chinese phones???
22+
callback();
23+
} catch (e) {
24+
console.error(e);
25+
}
2226
onAnimationComplete && onAnimationComplete(); // Check if onAnimationComplete is defined before calling it
2327
}, duration);
2428
};

android/app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ android {
8585
minSdkVersion rootProject.ext.minSdkVersion
8686
targetSdkVersion rootProject.ext.targetSdkVersion
8787
versionCode 1
88-
versionName "1.7"
88+
versionName "1.8"
8989
}
9090
sourceSets {
9191
main {

authentication/api.ts

Lines changed: 6 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ const eventNameSaveFilePath =
55
RNFS.DocumentDirectoryPath + '/data/eventName.json';
66
const formDataSaveFilePath = RNFS.DocumentDirectoryPath + '/data/formData.json';
77

8-
const SERVER_ENDPOINT = 'https://steelhawks.herokuapp.com'; // prod
9-
// const SERVER_ENDPOINT = 'http://192.168.1.175:8082'; //dev
8+
// const SERVER_ENDPOINT = 'https://steelhawks.herokuapp.com'; // prod
9+
const SERVER_ENDPOINT = 'http://localhost:8082'; //dev
1010

1111
export const fetchAfterLogin = async (username: string, osis: string, appVersion: string, accessToken: string) => {
1212
try {
@@ -151,44 +151,6 @@ export const fetchEventNameFromServer = async () => {
151151
}
152152
};
153153

154-
export const fetchFormsFromServer = async () => {
155-
try {
156-
const response = await fetch(`${SERVER_ENDPOINT}/api/forms`);
157-
158-
if (response.ok) {
159-
const forms = await response.json();
160-
161-
// ensure the directory exists
162-
try {
163-
await RNFS.mkdir(RNFS.DocumentDirectoryPath + '/data');
164-
console.log('Located at', RNFS.DocumentDirectoryPath);
165-
} catch (mkdirError) {
166-
console.error('Error creating directory:', mkdirError);
167-
}
168-
169-
// save forms to a JSON file
170-
try {
171-
await RNFS.writeFile(
172-
formDataSaveFilePath,
173-
JSON.stringify(forms, null, 2),
174-
'utf8',
175-
);
176-
console.log('Form data saved successfully.');
177-
} catch (writeError) {
178-
console.error('Error writing event name to file:', writeError);
179-
}
180-
181-
return forms;
182-
} else {
183-
throw new Error(`Server not reachable. Status: ${response.status}`);
184-
}
185-
} catch (error) {
186-
throw new Error(
187-
`Error requesting event name from the server: ${error}`,
188-
);
189-
}
190-
};
191-
192154
export const uploadDataToServer = async (data: any) => { // fix to find type later
193155
console.log(typeof data);
194156
const response = await fetch(`${SERVER_ENDPOINT}/upload`, {
@@ -224,10 +186,11 @@ export const createAccount = async (email: string, osis: string, name: string) =
224186
}
225187
}
226188

227-
export const getForms = async () => {
189+
export const fetchFormsFromServer = async () => {
228190
try {
229191
const response = await fetch(`${SERVER_ENDPOINT}/api/get_forms`);
230192
const forms = await response.json();
193+
console.log(forms);
231194

232195
try {
233196
await RNFS.mkdir(RNFS.DocumentDirectoryPath + '/data');
@@ -245,12 +208,12 @@ export const getForms = async () => {
245208
);
246209
console.log('Form data saved successfully.');
247210
} catch (writeError) {
248-
console.error('Error writing event name to file:', writeError);
211+
console.error('Error writing form data to file:', writeError);
249212
}
250213

251214
} catch (error) {
252215
throw new Error(`Error getting forms: ${error}`);
253216
}
254217
}
255218

256-
getForms(); // run on startup to get forms
219+
fetchFormsFromServer(); // run on startup to get forms

contexts/dict.jsx

Lines changed: 61 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -9,29 +9,29 @@ export const useDictStore = create(set => ({
99
matchType: '', // qualification, practice, or elimination
1010
driveStation: null,
1111
alliance: '', // red or blue
12-
preloaded: null, // true or false
13-
robotLeft: null, // true or false
14-
autonSpeakerNotesScored: 0,
15-
autonAmpNotesScored: 0,
16-
autonMissed: 0,
17-
autonNotesReceived: 0,
18-
droppedNotes: 0,
19-
autonIssues: [], // NOT_MOVING, STOPPED, OUT_OF_CONTROL, Default: EMPTY
20-
telopSpeakerNotesScored: 0,
21-
telopAmpNotesScored: 0,
22-
telopSpeakerNotesMissed: 0,
23-
telopAmpNotesMissed: 0,
24-
telopNotesReceivedFromHumanPlayer: 0,
25-
telopNotesReceivedFromGround: 0,
26-
ferryNotes: 0,
27-
endGame: null, // PARKED, ONSTAGE, SPOTLIGHT, Default: EMPTY
28-
trap: 0,
29-
fouls: 0,
30-
techFouls: 0,
31-
yellowCards: 0,
32-
redCards: 0,
33-
telopIssues: [], // NOT_MOVING, LOST_CONNECTION, FMS_ISSUES, DISABLED, Default: EMPTY
34-
didTeamPlayDefense: null, // YES, NO, Default: null
12+
// preloaded: null, // true or false
13+
// robotLeft: null, // true or false
14+
// autonSpeakerNotesScored: 0,
15+
// autonAmpNotesScored: 0,
16+
// autonMissed: 0,
17+
// autonNotesReceived: 0,
18+
// droppedNotes: 0,
19+
// autonIssues: [], // NOT_MOVING, STOPPED, OUT_OF_CONTROL, Default: EMPTY
20+
// telopSpeakerNotesScored: 0,
21+
// telopAmpNotesScored: 0,
22+
// telopSpeakerNotesMissed: 0,
23+
// telopAmpNotesMissed: 0,
24+
// telopNotesReceivedFromHumanPlayer: 0,
25+
// telopNotesReceivedFromGround: 0,
26+
// ferryNotes: 0,
27+
// endGame: null, // PARKED, ONSTAGE, SPOTLIGHT, Default: EMPTY
28+
// trap: 0,
29+
// fouls: 0,
30+
// techFouls: 0,
31+
// yellowCards: 0,
32+
// redCards: 0,
33+
// telopIssues: [], // NOT_MOVING, LOST_CONNECTION, FMS_ISSUES, DISABLED, Default: EMPTY
34+
// didTeamPlayDefense: null, // YES, NO, Default: null
3535
timeOfCreation: '',
3636
},
3737
setDict: (key, value) =>
@@ -49,29 +49,29 @@ export const useDictStore = create(set => ({
4949
driveStation: state.dict.driveStation !== undefined ? state.dict.driveStation : 0,
5050
// driveStation: null,
5151
alliance: '', // red or blue
52-
preloaded: null, // true or false
53-
robotLeft: null, // true or false
54-
autonSpeakerNotesScored: 0,
55-
autonAmpNotesScored: 0,
56-
autonMissed: 0,
57-
autonNotesReceived: 0,
58-
droppedNotes: 0,
52+
// preloaded: null, // true or false
53+
// robotLeft: null, // true or false
54+
// autonSpeakerNotesScored: 0,
55+
// autonAmpNotesScored: 0,
56+
// autonMissed: 0,
57+
// autonNotesReceived: 0,
58+
// droppedNotes: 0,
5959
autonIssues: [], // NOT_MOVING, STOPPED, OUT_OF_CONTROL, Default: EMPTY
60-
telopSpeakerNotesScored: 0,
61-
telopAmpNotesScored: 0,
62-
telopSpeakerNotesMissed: 0,
63-
telopAmpNotesMissed: 0,
64-
telopNotesReceivedFromHumanPlayer: 0,
65-
telopNotesReceivedFromGround: 0,
66-
ferryNotes: 0,
67-
endGame: null, // PARKED, ONSTAGE, SPOTLIGHT, Default: EMPTY
68-
trap: 0,
69-
fouls: 0,
70-
techFouls: 0,
71-
yellowCards: 0,
72-
redCards: 0,
73-
telopIssues: [], // NOT_MOVING, LOST_CONNECTION, FMS_ISSUES, DISABLED, Default: EMPTY
74-
didTeamPlayDefense: null, // YES, NO, Default: null
60+
// telopSpeakerNotesScored: 0,
61+
// telopAmpNotesScored: 0,
62+
// telopSpeakerNotesMissed: 0,
63+
// telopAmpNotesMissed: 0,
64+
// telopNotesReceivedFromHumanPlayer: 0,
65+
// telopNotesReceivedFromGround: 0,
66+
// ferryNotes: 0,
67+
// endGame: null, // PARKED, ONSTAGE, SPOTLIGHT, Default: EMPTY
68+
// trap: 0,
69+
// fouls: 0,
70+
// techFouls: 0,
71+
// yellowCards: 0,
72+
// redCards: 0,
73+
teleopIssues: [], // NOT_MOVING, LOST_CONNECTION, FMS_ISSUES, DISABLED, Default: EMPTY
74+
// didTeamPlayDefense: null, // YES, NO, Default: null
7575
timeOfCreation: '',
7676
},
7777
})),
@@ -83,14 +83,14 @@ export const usePitDict = create(set => ({
8383
scouterName: '',
8484
teamNumber: '',
8585
matchNumber: 'PIT',
86-
dimensions: '',
87-
weight: '',
88-
drivetrain: '',
89-
intake: '',
90-
vision: '',
91-
auton: '',
92-
robotExcel: [],
93-
trapScorer: '',
86+
// dimensions: '',
87+
// weight: '',
88+
// drivetrain: '',
89+
// intake: '',
90+
// vision: '',
91+
// auton: '',
92+
// robotExcel: [],
93+
// trapScorer: '',
9494
timeOfCreation: '',
9595
},
9696
setDict: (key, value) =>
@@ -102,14 +102,14 @@ export const usePitDict = create(set => ({
102102
scouterName: '',
103103
teamNumber: '',
104104
matchNumber: 'PIT',
105-
dimensions: '',
106-
weight: '',
107-
drivetrain: '',
108-
intake: '',
109-
vision: '',
110-
auton: '',
111-
robotExcel: [],
112-
trapScorer: '',
105+
// dimensions: '',
106+
// weight: '',
107+
// drivetrain: '',
108+
// intake: '',
109+
// vision: '',
110+
// auton: '',
111+
// robotExcel: [],
112+
// trapScorer: '',
113113
timeOfCreation: '',
114114
},
115115
})),

ios/ReactNative_ScoutApp2023.xcodeproj/project.pbxproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -682,7 +682,7 @@
682682
"$(inherited)",
683683
"@executable_path/Frameworks",
684684
);
685-
MARKETING_VERSION = 1.7;
685+
MARKETING_VERSION = 1.9;
686686
OTHER_LDFLAGS = (
687687
"$(inherited)",
688688
"-ObjC",
@@ -722,7 +722,7 @@
722722
"$(inherited)",
723723
"@executable_path/Frameworks",
724724
);
725-
MARKETING_VERSION = 1.7;
725+
MARKETING_VERSION = 1.9;
726726
OTHER_LDFLAGS = (
727727
"$(inherited)",
728728
"-ObjC",

0 commit comments

Comments
 (0)