Skip to content
This repository was archived by the owner on Jul 11, 2025. It is now read-only.

Commit 1f04dff

Browse files
committed
adds TODOs, changes data from strings to numbers and removes icon in weather.JSON
1 parent c00120c commit 1f04dff

2 files changed

Lines changed: 20 additions & 19 deletions

File tree

WebView/app/src/main/assets/main.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,13 @@ function sendAndroidMessage() {
1818
* in the WebViewCompat reference doc, the second parameter, MessagePorts, is optional.
1919
* Also note that onmessage, addEventListener and removeEventListener are not supported.
2020
*/
21+
// TODO: Change message to account for changes in data
2122
jsObject.postMessage("The weather in " + `${document.getElementById("title").innerText}` + " today is " +
2223
`${document.getElementById("shortDescription").innerText} `);
2324
}
2425

2526
function getData() {
27+
// TODO: Change the path to grab data from new location; Change longDescription and currentTemp to work with changes in data
2628
fetch("https://gcoleman799.github.io/Asset-Loader/weather.json").then(function(resp) {
2729
return resp.json();
2830
}).then(function(data) {
@@ -36,4 +38,6 @@ function getData() {
3638
+ `${data[currentLocation].humidity}.`;
3739
document.getElementById("icon").src = data[currentLocation].icon;
3840
})
39-
}
41+
}
42+
43+
// TODO: Create getIcon() function to decide which icon to render.

WebView/sampleData/weather.json

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,26 @@
11
{
22
"newYork":{
3-
"currentTemp":"75°",
4-
"highTemp":"83°",
5-
"lowTemp":"64°",
6-
"chancePrecip":"90%",
7-
"humidity":"23%",
3+
"currentTemp":75,
4+
"highTemp":83,
5+
"lowTemp":64,
6+
"chancePrecip":90,
7+
"humidity":23,
88
"description":"Rainy",
9-
"icon":"https://gcoleman799.github.io/res/drawable/rain.png"
109
},
1110
"sanFrancisco":{
12-
"currentTemp":"70°",
13-
"highTemp":"75°",
14-
"lowTemp":"61°",
15-
"chancePrecip":"0%",
16-
"humidity":"2%",
11+
"currentTemp":70,
12+
"highTemp":75,
13+
"lowTemp":61,
14+
"chancePrecip":0,
15+
"humidity":2,
1716
"description":"Clear Sky",
18-
"icon": "https://gcoleman799.github.io/res/drawable/sunny.png"
1917
},
2018
"london":{
21-
"currentTemp":"88°",
22-
"highTemp":"89°",
23-
"lowTemp":"67°",
24-
"chancePrecip":"15%",
25-
"humidity":"36%",
19+
"currentTemp":88,
20+
"highTemp":89,
21+
"lowTemp":67,
22+
"chancePrecip":15,
23+
"humidity":36,
2624
"description":"Partly Cloudy",
27-
"icon":"https://gcoleman799.github.io/res/drawable/partly_cloudy.png"
2825
}
2926
}

0 commit comments

Comments
 (0)