From 5a18ff1ff778986fd63705441da3ddf5ee6cc3ec Mon Sep 17 00:00:00 2001 From: Jigar-f Date: Fri, 22 Sep 2023 12:07:10 +0530 Subject: [PATCH] Fixed language issue. --- internalsdk/session_model.go | 6 +++--- ios/Podfile.lock | 2 +- ios/Runner/Lantern/Db/Database.swift | 5 ++--- lib/account/language.dart | 11 ++++++----- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/internalsdk/session_model.go b/internalsdk/session_model.go index 726ecaac4..10d43130e 100644 --- a/internalsdk/session_model.go +++ b/internalsdk/session_model.go @@ -70,7 +70,7 @@ const SESSION_MODEL_METHOD_SET_DNS_SERVER = "setDNSServer" const SESSION_MODEL_METHOD_SET_PROVIDER = "setProvider" const SESSION_MODEL_METHOD_SET_EMAIL = "setEmail" const SESSION_MODEL_METHOD_SET_PRO_USER = "setProUser" -const SESSION_MODEL_METHOD_SET_LOCAL = "setLocal" +const SESSION_MODEL_METHOD_SET_LOCAL = "setLanguage" const SESSION_MODEL_METHOD_SET_CURRENCY = "setCurrency" const SESSION_MODEL_METHOD_ACCEPT_TERMS = "acceptTerms" const SESSION_MODEL_METHOD_SET_STORE_VERSION = "setStoreVersion" @@ -188,7 +188,7 @@ func (s *SessionModel) InvokeMethod(method string, arguments minisql.Values) (*m } case SESSION_MODEL_METHOD_SET_LOCAL: local := arguments.Get(0) - err := setLocale(s.baseModel, local.String()) + err := setLanguage(s.baseModel, local.String()) if err != nil { return nil, err } else { @@ -420,7 +420,7 @@ func (s *SessionModel) Locale() (string, error) { return string(locale), nil } -func setLocale(m *baseModel, langCode string) error { +func setLanguage(m *baseModel, langCode string) error { pathdb.Mutate(m.db, func(tx pathdb.TX) error { pathdb.Put[string](tx, LANG, langCode, "") return nil diff --git a/ios/Podfile.lock b/ios/Podfile.lock index a95f9c8a8..2c0f207e0 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -316,4 +316,4 @@ SPEC CHECKSUMS: PODFILE CHECKSUM: 4cde1e23c4c277b696c6e6e9589bbb76fb18fd3a -COCOAPODS: 1.12.1 +COCOAPODS: 1.11.3 diff --git a/ios/Runner/Lantern/Db/Database.swift b/ios/Runner/Lantern/Db/Database.swift index 5963f5a06..b4a193b8e 100644 --- a/ios/Runner/Lantern/Db/Database.swift +++ b/ios/Runner/Lantern/Db/Database.swift @@ -142,10 +142,9 @@ class QueryResult: NSObject, MinisqlResultProtocol { } class RowData: NSObject, MinisqlRowsProtocol { - - let rows: [Statement.Element] + let rows: [Statement.Element] var currentIndex: Int = -1 - private let syncQueue = DispatchQueue(label: "com.yourapp.RowData.syncQueue") + private let syncQueue = DispatchQueue(label: "com.lantern.RowData.syncQueue") init(rows: [Statement.Element]) { diff --git a/lib/account/language.dart b/lib/account/language.dart index 8408a73a7..86634a6a2 100644 --- a/lib/account/language.dart +++ b/lib/account/language.dart @@ -13,22 +13,23 @@ class Language extends StatelessWidget { padVertical: true, body: sessionModel .language((BuildContext context, String currentLang, Widget? child) { - print("Language code $currentLang"); - return ListView.builder( + // Splint language by just code + final countryCode= currentLang.split('_')[0]; + return ListView.builder( itemCount: languages.length, itemBuilder: (BuildContext context, int index) { - var lang = languages[index]; + var lang = languages[index].split('_')[0]; return RadioListTile( activeColor: pink4, contentPadding: const EdgeInsetsDirectional.all(0), - tileColor: lang == currentLang ? grey2 : transparent, + tileColor: lang == countryCode ? grey2 : transparent, dense: true, title: CText( toBeginningOfSentenceCase(displayLanguage(lang))!, style: tsBody1, ), value: lang, - groupValue: currentLang, + groupValue: countryCode, onChanged: (String? value) async { await sessionModel.setLanguage(lang); Navigator.pop(context);