From 5000d7cbd766a2467dfb52f2368b893be253356b Mon Sep 17 00:00:00 2001 From: Jigar-f Date: Mon, 27 May 2024 16:22:50 +0530 Subject: [PATCH] Hide bandwidth widget and small other changes. --- ios/Runner/Lantern/Models/SessionModel.swift | 2 +- lib/account/language.dart | 5 ++--- lib/i18n/localization_constants.dart | 7 +++++++ lib/vpn/vpn_tab.dart | 6 +++--- 4 files changed, 13 insertions(+), 7 deletions(-) diff --git a/ios/Runner/Lantern/Models/SessionModel.swift b/ios/Runner/Lantern/Models/SessionModel.swift index adf35cf7e..67237ba04 100644 --- a/ios/Runner/Lantern/Models/SessionModel.swift +++ b/ios/Runner/Lantern/Models/SessionModel.swift @@ -115,7 +115,7 @@ class SessionModel: BaseModel { as? [String: Any] { try invoke("updateStats", dataDict) - logger.debug("New data received: \(dataDict)") + logger.debug("updateStats data received: \(dataDict)") } } catch { logger.debug("Failed to deserialize JSON data: \(error)") diff --git a/lib/account/language.dart b/lib/account/language.dart index fa7a9ef78..cf6fc0a59 100644 --- a/lib/account/language.dart +++ b/lib/account/language.dart @@ -1,11 +1,10 @@ import 'package:intl/intl.dart'; import 'package:lantern/common/common.dart'; import 'package:lantern/i18n/localization_constants.dart'; -import 'package:sentry_flutter/sentry_flutter.dart'; @RoutePage(name: 'Language') class Language extends StatelessWidget { - Language({Key? key}) : super(key: key); + const Language({Key? key}) : super(key: key); @override Widget build(BuildContext context) { @@ -15,7 +14,7 @@ class Language extends StatelessWidget { body: sessionModel .language((BuildContext context, String currentLang, Widget? child) { // Splint language by just code - final countryCode= currentLang; + final countryCode= checkSupportedLanguages(currentLang) ; return ListView.builder( itemCount: languages.length, itemBuilder: (BuildContext context, int index) { diff --git a/lib/i18n/localization_constants.dart b/lib/i18n/localization_constants.dart index 73a10c396..9624b464b 100644 --- a/lib/i18n/localization_constants.dart +++ b/lib/i18n/localization_constants.dart @@ -18,6 +18,13 @@ const languages = [ 'bn_BD', ]; +String checkSupportedLanguages(String language){ + if(languages.contains(language)){ + return language; + } + return 'en_Us'; +} + String displayLanguage(String languageCode) { if (languageCode == 'ar_EG') { return 'العربية'; diff --git a/lib/vpn/vpn_tab.dart b/lib/vpn/vpn_tab.dart index 910ab8cd9..407e2a2f4 100644 --- a/lib/vpn/vpn_tab.dart +++ b/lib/vpn/vpn_tab.dart @@ -8,7 +8,7 @@ import 'vpn_status.dart'; import 'vpn_switch.dart'; class VPNTab extends StatelessWidget { - VPNTab({Key? key}) : super(key: key); + const VPNTab({Key? key}) : super(key: key); @override Widget build(BuildContext context) { @@ -44,12 +44,12 @@ class VPNTab extends StatelessWidget { children: [ VPNStatus(), const CDivider(height: 32.0), - ServerLocationWidget(), + const ServerLocationWidget(), if (Platform.isAndroid) ...{ const CDivider(height: 32.0), SplitTunnelingWidget(), }, - if (!proUser) const VPNBandwidth(), + if (!proUser&& Platform.isAndroid) const VPNBandwidth(), ], ), ),