Limit scheduled messages & unsend to newer server versions

This commit is contained in:
Tanay Neotia
2022-12-20 12:34:15 -05:00
parent 23351ad993
commit cde5e41493
3 changed files with 30 additions and 25 deletions

View File

@ -275,7 +275,7 @@ class _MessagePopupState extends OptimizedState<MessagePopup> with SingleTickerP
style: context.textTheme.bodyLarge!.apply(color: context.theme.colorScheme.properOnSurface), style: context.textTheme.bodyLarge!.apply(color: context.theme.colorScheme.properOnSurface),
), ),
), ),
if (ss.isMinVenturaSync && message.isFromMe!) if (ss.isMinVenturaSync && message.isFromMe! && ss.serverDetailsSync().item4 >= 148)
PopupMenuItem( PopupMenuItem(
value: 6, value: 6,
child: Text( child: Text(
@ -1118,7 +1118,7 @@ class _MessagePopupState extends OptimizedState<MessagePopup> with SingleTickerP
), ),
), ),
), ),
if (ss.isMinVenturaSync && message.isFromMe!) if (ss.isMinVenturaSync && message.isFromMe! && ss.serverDetailsSync().item4 >= 148)
Material( Material(
color: Colors.transparent, color: Colors.transparent,
child: InkWell( child: InkWell(

View File

@ -181,6 +181,7 @@ class _SettingsPageState extends OptimizedState<SettingsPage> {
trailing: nextIcon, trailing: nextIcon,
); );
}), }),
if (ss.serverDetailsSync().item4 >= 205)
Container( Container(
color: tileColor, color: tileColor,
child: Padding( child: Padding(
@ -188,6 +189,7 @@ class _SettingsPageState extends OptimizedState<SettingsPage> {
child: SettingsDivider(color: context.theme.colorScheme.surfaceVariant), child: SettingsDivider(color: context.theme.colorScheme.surfaceVariant),
), ),
), ),
if (ss.serverDetailsSync().item4 >= 205)
SettingsTile( SettingsTile(
backgroundColor: tileColor, backgroundColor: tileColor,
title: "Scheduled Messages", title: "Scheduled Messages",

View File

@ -103,6 +103,9 @@ class SettingsService extends GetxService {
} }
} }
Tuple4<int, int, String, int> serverDetailsSync() =>
Tuple4(prefs.getInt("macos-version") ?? 11, prefs.getInt("macos-minor-version") ?? 0, prefs.getString("server-version") ?? "0.0.0", prefs.getInt("server-version-code") ?? 0);
Future<bool> get isMinSierra async { Future<bool> get isMinSierra async {
final val = await getServerDetails(); final val = await getServerDetails();
return val.item1 > 10 || (val.item1 == 10 && val.item2 > 11); return val.item1 > 10 || (val.item1 == 10 && val.item2 > 11);