|
|
@ -54,26 +54,43 @@ class _HomePageState extends State<HomePage> with tray.TrayListener, WindowListe |
|
|
|
|
|
|
|
|
|
|
|
// ignore cached version and prevent duplicate dialogs |
|
|
|
// ignore cached version and prevent duplicate dialogs |
|
|
|
if (result is ResultSuccess) { |
|
|
|
if (result is ResultSuccess) { |
|
|
|
const requiredMajorVersion = 24; |
|
|
|
_appsBloc.appImplementations.listen((final appsResult) async { |
|
|
|
if (result.data!.version!.major! < requiredMajorVersion) { |
|
|
|
// ignore cached version and prevent duplicate dialogs |
|
|
|
await showDialog( |
|
|
|
if (appsResult is ResultSuccess) { |
|
|
|
context: context, |
|
|
|
for (final id in [ |
|
|
|
builder: (final context) => AlertDialog( |
|
|
|
'core', |
|
|
|
title: Text(AppLocalizations.of(context).errorUnsupportedNextcloudVersion(requiredMajorVersion)), |
|
|
|
...appsResult.data!.map((final a) => a.id), |
|
|
|
actions: [ |
|
|
|
]) { |
|
|
|
ElevatedButton( |
|
|
|
try { |
|
|
|
style: ElevatedButton.styleFrom( |
|
|
|
bool? supported; |
|
|
|
backgroundColor: Colors.red, |
|
|
|
switch (id) { |
|
|
|
), |
|
|
|
case 'core': |
|
|
|
onPressed: () { |
|
|
|
supported = await widget.account.client.core.isSupported(result.data!); |
|
|
|
Navigator.of(context).pop(); |
|
|
|
break; |
|
|
|
}, |
|
|
|
case 'news': |
|
|
|
child: Text(AppLocalizations.of(context).close), |
|
|
|
supported = await widget.account.client.news.isSupported(); |
|
|
|
), |
|
|
|
break; |
|
|
|
], |
|
|
|
case 'notes': |
|
|
|
), |
|
|
|
supported = await widget.account.client.notes.isSupported(result.data!); |
|
|
|
); |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (!(supported ?? true)) { |
|
|
|
|
|
|
|
if (!mounted) { |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
await _showUnsupportedVersion( |
|
|
|
|
|
|
|
id == 'core' |
|
|
|
|
|
|
|
? AppLocalizations.of(context).coreName |
|
|
|
|
|
|
|
: appsResult.data!.singleWhere((final a) => a.id == id).name(context), |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} catch (e, s) { |
|
|
|
|
|
|
|
debugPrint(e.toString()); |
|
|
|
|
|
|
|
debugPrint(s.toString()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
@ -259,6 +276,26 @@ class _HomePageState extends State<HomePage> with tray.TrayListener, WindowListe |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Future _showUnsupportedVersion(final String appName) async { |
|
|
|
|
|
|
|
await showDialog( |
|
|
|
|
|
|
|
context: context, |
|
|
|
|
|
|
|
builder: (final context) => AlertDialog( |
|
|
|
|
|
|
|
title: Text(AppLocalizations.of(context).errorUnsupportedVersion(appName)), |
|
|
|
|
|
|
|
actions: [ |
|
|
|
|
|
|
|
ElevatedButton( |
|
|
|
|
|
|
|
style: ElevatedButton.styleFrom( |
|
|
|
|
|
|
|
backgroundColor: Colors.red, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
onPressed: () { |
|
|
|
|
|
|
|
Navigator.of(context).pop(); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
child: Text(AppLocalizations.of(context).close), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@override |
|
|
|
@override |
|
|
|
void dispose() { |
|
|
|
void dispose() { |
|
|
|
_capabilitiesBloc.dispose(); |
|
|
|
_capabilitiesBloc.dispose(); |
|
|
|