[ermine] Misc fixes to settings.
- Remove progress bar from memory setting.
- Hide locations missing temperature data in weather settings.
- Add missing timezone service declaration in ermine.cmx
Change-Id: Ic163dfd7089a21bba4a8039b001a790665787b6e
diff --git a/session_shells/ermine/settings/lib/src/memory.dart b/session_shells/ermine/settings/lib/src/memory.dart
index 4432266..e2af19d 100644
--- a/session_shells/ermine/settings/lib/src/memory.dart
+++ b/session_shells/ermine/settings/lib/src/memory.dart
@@ -50,7 +50,6 @@
String totalString = (total).toStringAsPrecision(3);
return Spec(title: _memory, groups: [
Group(title: _memory, values: [
- Value.withProgress(ProgressValue(value: value)),
Value.withText(TextValue(text: '${usedString}GB / ${totalString}GB')),
]),
]);
diff --git a/session_shells/ermine/settings/lib/src/weather.dart b/session_shells/ermine/settings/lib/src/weather.dart
index 01a6b94..786f2f0 100644
--- a/session_shells/ermine/settings/lib/src/weather.dart
+++ b/session_shells/ermine/settings/lib/src/weather.dart
@@ -59,10 +59,12 @@
}
static Spec _specForWeather(bool tempInFahrenheit) {
- final locations =
- _locations.where((location) => location.observation != null).toList();
+ final locations = _locations
+ .where((location) =>
+ location.observation != null && location.tempInDegrees != null)
+ .toList();
if (locations.isEmpty) {
- return null;
+ return UiSpec.nullSpec;
}
return Spec(title: _title, groups: [
Group(title: _title, values: [
@@ -99,9 +101,13 @@
var result = await _readResponse(response);
var data = json.decode(result);
var properties = data['properties'];
- location
- ..observation = properties['textDescription']
- ..tempInDegrees = properties['temperature']['value']?.toDouble();
+ if (properties['textDescription'] != null &&
+ properties['temperature'] != null &&
+ properties['temperature']['value'] != null) {
+ location
+ ..observation = properties['textDescription']
+ ..tempInDegrees = properties['temperature']['value'].toDouble();
+ }
}
// Read the string response from the [HttpClientResponse].
diff --git a/session_shells/ermine/settings/test/memory_test.dart b/session_shells/ermine/settings/test/memory_test.dart
index 1ec38c1..35ba7a0 100644
--- a/session_shells/ermine/settings/test/memory_test.dart
+++ b/session_shells/ermine/settings/test/memory_test.dart
@@ -25,16 +25,6 @@
expect(spec.groups.first.title, isNotNull);
expect(spec.groups.first.values.isEmpty, false);
- // Confirm progress value is correct
- ProgressValue progress = spec.groups.first.values
- .where((v) => v.$tag == ValueTag.progress)
- .first
- ?.progress;
- expect(progress, isNotNull);
- expect(progress?.value, greaterThan(0));
- expect(progress?.value, lessThan(1));
- expect(progress.value, 0.5);
-
// Confirm text value is correct
TextValue text = spec.groups.first.values
.where((v) => v.$tag == ValueTag.text)
@@ -59,16 +49,6 @@
expect(spec.groups.first.title, isNotNull);
expect(spec.groups.first.values.isEmpty, false);
- // Confirm progress value is correct
- ProgressValue progress = spec.groups.first.values
- .where((v) => v.$tag == ValueTag.progress)
- .first
- ?.progress;
- expect(progress, isNotNull);
- expect(progress?.value, greaterThan(0));
- expect(progress?.value, lessThan(1));
- expect(progress.value, 0.5);
-
// Confirm text value is correct
TextValue text = spec.groups.first.values
.where((v) => v.$tag == ValueTag.text)
@@ -83,16 +63,6 @@
expect(spec.groups.first.title, isNotNull);
expect(spec.groups.first.values.isEmpty, false);
- // Confirm progress value is correct
- progress = spec.groups.first.values
- .where((v) => v.$tag == ValueTag.progress)
- .first
- ?.progress;
- expect(progress, isNotNull);
- expect(progress?.value, greaterThan(0));
- expect(progress?.value, lessThan(1));
- expect(progress.value, moreOrLessEquals(0.3, epsilon: 1e-5));
-
// Confirm text value is correct
text = spec.groups.first.values
.where((v) => v.$tag == ValueTag.text)
@@ -117,15 +87,6 @@
expect(spec.groups.first.title, isNotNull);
expect(spec.groups.first.values.isEmpty, false);
- // Confirm progress value is correct
- ProgressValue progress = spec.groups.first.values
- .where((v) => v.$tag == ValueTag.progress)
- .first
- ?.progress;
- expect(progress, isNotNull);
- expect(progress?.value, lessThan(1));
- expect(progress.value, 0);
-
// Confirm text value is correct
TextValue text = spec.groups.first.values
.where((v) => v.$tag == ValueTag.text)
@@ -150,15 +111,6 @@
expect(spec.groups.first.title, isNotNull);
expect(spec.groups.first.values.isEmpty, false);
- // Confirm progress value is correct
- ProgressValue progress = spec.groups.first.values
- .where((v) => v.$tag == ValueTag.progress)
- .first
- ?.progress;
- expect(progress, isNotNull);
- expect(progress?.value, greaterThan(0));
- expect(progress.value, 1);
-
// Confirm text value is correct
TextValue text = spec.groups.first.values
.where((v) => v.$tag == ValueTag.text)
diff --git a/session_shells/ermine/shell/meta/ermine.cmx b/session_shells/ermine/shell/meta/ermine.cmx
index b3f234b..cdfd630 100644
--- a/session_shells/ermine/shell/meta/ermine.cmx
+++ b/session_shells/ermine/shell/meta/ermine.cmx
@@ -14,6 +14,8 @@
"fuchsia.app.discover.Suggestions",
"fuchsia.bluetooth.control.Control",
"fuchsia.cobalt.LoggerFactory",
+ "fuchsia.deprecatedtimezone.TimeService",
+ "fuchsia.deprecatedtimezone.Timezone",
"fuchsia.device.manager.Administrator",
"fuchsia.fonts.Provider",
"fuchsia.intl.PropertyProvider",
@@ -29,8 +31,6 @@
"fuchsia.power.BatteryManager",
"fuchsia.sys.Environment",
"fuchsia.sys.Launcher",
- "fuchsia.timezone.TimeService",
- "fuchsia.timezone.Timezone",
"fuchsia.ui.brightness.Control",
"fuchsia.ui.input.ImeService",
"fuchsia.ui.policy.Presenter",