Skip to content

Commit

Permalink
Abbreviate server selection presets so they fit horizontally, don't s…
Browse files Browse the repository at this point in the history
…how server selection unless in debug mode
  • Loading branch information
sveinbjornt committed May 23, 2023
1 parent 009b699 commit d82ebdc
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 20 deletions.
8 changes: 4 additions & 4 deletions lib/common.dart
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,16 @@ const String kPrivacyURL = 'https://embla.is/privacy.html';
// Ratatoskur server preset options (for debugging purposes)
const List<List<String>> kRatatoskurServerPresetOptions = [
['API', kDefaultRatatoskurServer],
['Staging', "https://staging.api.greynir.is"],
['Brand', 'http://brandur.mideind.is:8080'],
['Stg.', "https://staging.api.greynir.is"],
['Br.', 'http://brandur.mideind.is:8080'],
['Lókal', 'http://192.168.1.8:8080']
];

// Query server preset options (for debugging purposes)
const List<List<String>> kQueryServerPresetOptions = [
['Greynir', kDefaultQueryServer],
['Stag', "https://staging.greynir.is"],
['Brand', 'http://brandur.mideind.is:5000'],
['Stg.', "https://staging.greynir.is"],
['Br.', 'http://brandur.mideind.is:5000'],
['Lókal', 'http://192.168.1.8:5000']
];

Expand Down
34 changes: 18 additions & 16 deletions lib/settings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import 'dart:async';
// import 'dart:io';

// import 'package:flutter/foundation.dart' show kDebugMode;
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';

Expand Down Expand Up @@ -585,22 +586,23 @@ List<Widget> _settings(BuildContext context, void Function() refreshCallback) {
];

// Only include query server selection widget in debug builds
// if (kDebugMode) {
settingsWidgets.addAll([
// ASR engine selection
const SettingsASRSelectionWidget(label: 'Talgreining'),
divider,
// Ratatoskur server selection
const SettingsFullTextLabelWidget('Ratatoskur:'),
const SettingsServerSelectionWidget(
items: kRatatoskurServerPresetOptions, prefKey: 'ratatoskur_server'),
divider,
// Query server selection
const SettingsFullTextLabelWidget('Fyrirspurnaþjónn:'),
const SettingsServerSelectionWidget(items: kQueryServerPresetOptions, prefKey: 'query_server'),
const Padding(padding: EdgeInsets.only(top: 0, bottom: 0), child: Text(''))
]);
// }
if (kDebugMode) {
settingsWidgets.addAll([
// ASR engine selection
const SettingsASRSelectionWidget(label: 'Talgreining'),
divider,
// Ratatoskur server selection
const SettingsFullTextLabelWidget('Ratatoskur:'),
const SettingsServerSelectionWidget(
items: kRatatoskurServerPresetOptions, prefKey: 'ratatoskur_server'),
divider,
// Query server selection
const SettingsFullTextLabelWidget('Fyrirspurnaþjónn:'),
const SettingsServerSelectionWidget(
items: kQueryServerPresetOptions, prefKey: 'query_server'),
const Padding(padding: EdgeInsets.only(top: 0, bottom: 0), child: Text(''))
]);
}

/// Make API call to clear user data
void clearData({bool all = false}) async {
Expand Down

0 comments on commit d82ebdc

Please sign in to comment.