Skip to content

Commit

Permalink
Remove updater on web
Browse files Browse the repository at this point in the history
  • Loading branch information
CodeDoctorDE committed Jul 23, 2022
1 parent abe2b39 commit 0d430a1
Showing 1 changed file with 60 additions and 58 deletions.
118 changes: 60 additions & 58 deletions app/lib/settings/general.dart
Original file line number Diff line number Diff line change
Expand Up @@ -75,72 +75,74 @@ class GeneralSettingsPage extends StatelessWidget {
style: Theme.of(context).textTheme.headline5,
),
const SizedBox(height: 16),
FutureBuilder<Meta>(
future: _fetchMeta(),
builder: (context, snapshot) {
if (snapshot.hasError) {
return Text('Error: ${snapshot.error}');
}
if (!snapshot.hasData) {
return const Center(
child: CircularProgressIndicator());
}
final meta = snapshot.data!;
final currentVersion = meta.currentVersion;
final stableVersion = meta.stableVersion;
final nightlyVersion = meta.nightlyVersion;
final isStable = currentVersion == stableVersion;
final isNightly = currentVersion == nightlyVersion;
final isError = meta.nightlyVersion == '?' ||
meta.stableVersion == '?';
final isUpdateAvailable =
!isError && !isStable && !isNightly;
return Column(children: [
ListTile(
title: Text(AppLocalizations.of(context)!.stable),
subtitle: Text(stableVersion),
),
ListTile(
title:
Text(AppLocalizations.of(context)!.nightly),
subtitle: Text(nightlyVersion),
),
ListTile(
title: Text(
AppLocalizations.of(context)!.currentVersion),
subtitle: Text(currentVersion),
),
const Divider(),
if (isStable)
if (!kIsWeb)
FutureBuilder<Meta>(
future: _fetchMeta(),
builder: (context, snapshot) {
if (snapshot.hasError) {
return Text('Error: ${snapshot.error}');
}
if (!snapshot.hasData) {
return const Center(
child: CircularProgressIndicator());
}
final meta = snapshot.data!;
final currentVersion = meta.currentVersion;
final stableVersion = meta.stableVersion;
final nightlyVersion = meta.nightlyVersion;
final isStable = currentVersion == stableVersion;
final isNightly = currentVersion == nightlyVersion;
final isError = meta.nightlyVersion == '?' ||
meta.stableVersion == '?';
final isUpdateAvailable =
!isError && !isStable && !isNightly;
return Column(children: [
ListTile(
title: Text(AppLocalizations.of(context)!
.usingLatestStable),
),
if (isNightly)
ListTile(
title: Text(AppLocalizations.of(context)!
.usingLatestNightly),
title:
Text(AppLocalizations.of(context)!.stable),
subtitle: Text(stableVersion),
),
if (isError)
ListTile(
title:
Text(AppLocalizations.of(context)!.error),
Text(AppLocalizations.of(context)!.nightly),
subtitle: Text(nightlyVersion),
),
if (isUpdateAvailable)
ListTile(
title: Text(AppLocalizations.of(context)!
.updateAvailable),
subtitle: Text(
AppLocalizations.of(context)!.updateNow),
leading:
const Icon(PhosphorIcons.arrowRightLight),
onTap: () async {
await launchUrl(Uri.parse(
'https://docs.butterfly.linwood.dev/downloads'));
},
.currentVersion),
subtitle: Text(currentVersion),
),
]);
}),
const Divider(),
if (isStable)
ListTile(
title: Text(AppLocalizations.of(context)!
.usingLatestStable),
),
if (isNightly)
ListTile(
title: Text(AppLocalizations.of(context)!
.usingLatestNightly),
),
if (isError)
ListTile(
title:
Text(AppLocalizations.of(context)!.error),
),
if (isUpdateAvailable)
ListTile(
title: Text(AppLocalizations.of(context)!
.updateAvailable),
subtitle: Text(
AppLocalizations.of(context)!.updateNow),
leading:
const Icon(PhosphorIcons.arrowRightLight),
onTap: () async {
await launchUrl(Uri.parse(
'https://docs.butterfly.linwood.dev/downloads'));
},
),
]);
}),
]),
),
),
Expand Down

0 comments on commit 0d430a1

Please sign in to comment.