diff --git a/lib/About.dart b/lib/About.dart index 8df11a5..00132a4 100644 --- a/lib/About.dart +++ b/lib/About.dart @@ -1,6 +1,8 @@ import 'package:flutter/material.dart'; import 'package:ything_radio/SafeZone.dart'; +import 'Globals.dart'; + class About extends StatelessWidget { const About({super.key}); @@ -17,31 +19,9 @@ class About extends StatelessWidget { child: SafeZone( child: DefaultTextStyle( style: Theme.of(context).textTheme.bodyLarge!, - child: const SingleChildScrollView( + child: SingleChildScrollView( child: Text( - 'Ything Radio is an app that is intended to provide a demonstration of the ' - 'open source ything_radio app. This app is used to provide the ability for the ' - '"look and feel" of the app to be tested on real devices for those wishing to ' - 'either use the code as a template for themselves; or, alternatively, have Ything LLC ' - 'create a custom app for them!' - '\n\n' - 'This app intentionally does not provide a method to change the streaming source ' - 'as it is intended for use by internet radio stations to provide a dedicated app ' - 'for their radio station. This is not intended to be an app for generic usage for ' - 'multiple radio stations, a discovery platform, or to facilitate user input for ' - 'internet radio sites.' - '\n\n' - 'This app has been designed to run across all platforms!' - '\n\n' - 'Android, iOS, MacOS, Windows, Linux, and Web!' - '\n\n' - 'Have a single unified experience across all platforms for your users!' - '\n\n' - 'Want to have us modify this app for you? Reach out at info@ything.net ' - 'We can add additional features for you! Schedule views, up next listings, ' - 'and even custom user interactivity! ' - '\n\n' - 'We look forward to hearing from you soon! We would love to build your app!', + getAboutText(), textAlign: TextAlign.justify, ), ), diff --git a/lib/Globals.dart b/lib/Globals.dart index 4076638..9f11205 100644 --- a/lib/Globals.dart +++ b/lib/Globals.dart @@ -8,7 +8,7 @@ import 'ListenHandler.dart'; late final ListenHandler _listenHandler; late final AudioSession _session; -final String _fallback = +const String _fallback = "https://generic.ything.app/music/separation-185196.mp3"; final _urlSource = Uri.parse("https://generic.ything.app/music/player.url"); late final String _radioUrl; @@ -17,12 +17,33 @@ Future loadCurrentUrl() async { final resp = await http.get(_urlSource); if (resp.statusCode == 200) { _radioUrl = resp.body.trim(); + print('Loaded remote url'); } else { _radioUrl = _fallback; - print('Request for current streaming url failed'); + print('Request for current streaming url failed, using fallback url'); } } +const String _fallbackAbout = + "Ything Radio is an internet radio streaming application."; +final _urlAbout = + Uri.parse("https://generic.ything.app/ything_radio/about.txt"); +late final String _remoteAbout; + +Future loadAboutUrl() async { + final resp = await http.get(_urlAbout); + + if (resp.statusCode == 200) { + _remoteAbout = resp.body; + print('Loaded remote about'); + } else { + _remoteAbout = _fallbackAbout; + print('Request for remote about failed, using fallback about'); + } +} + +String getAboutText() => _remoteAbout; + Future setupListenHandler() async { _listenHandler = await AudioService.init( builder: () => ListenHandler(), diff --git a/lib/main.dart b/lib/main.dart index 7f81f87..8274aef 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -5,6 +5,7 @@ import 'YthingRadio.dart'; Future main() async { await loadCurrentUrl(); + await loadAboutUrl(); await setupListenHandler(); runApp(const YthingRadio()); }