don't offer to upgrade built-in wordlists

This commit is contained in:
Eric House 2024-02-09 14:36:31 -08:00
parent 4b470f5e0f
commit 49ade38aca

View file

@ -1423,23 +1423,10 @@ public class DictsDelegate extends ListDelegateBase
stopProgress();
}
private boolean digestData( String jsonData )
private Set<String> parseLangs( JSONArray langs ) throws JSONException
{
boolean success = false;
JSONArray langs = null;
m_needUpdates = new HashMap<>();
if ( null != jsonData ) {
Set<String> closedLangs = new HashSet<>();
final Set<String> curLangs =
new HashSet<>( Arrays.asList( m_langs ) );
// DictLangCache hits the DB hundreds of times below. Fix!
Log.w( TAG, "Fix me I'm stupid" );
try {
// Log.d( TAG, "digestData(%s)", jsonData );
JSONObject obj = new JSONObject( jsonData );
langs = obj.optJSONArray( "langs" );
Set<String> curLangs = new HashSet<>( Arrays.asList( m_langs ) );
int nLangs = langs.length();
m_remoteInfo = new HashMap<>();
@ -1519,11 +1506,29 @@ public class DictsDelegate extends ListDelegateBase
m_remoteInfo.put( localLangName, asArray );
}
}
return closedLangs;
}
private boolean digestData( String jsonData )
{
boolean success = false;
// JSONArray langs = null;
m_needUpdates = new HashMap<>();
if ( null != jsonData ) {
// DictLangCache hits the DB hundreds of times below. Fix!
Log.w( TAG, "Fix me I'm stupid" );
try {
Log.d( TAG, "digestData(%s)", jsonData );
JSONObject obj = new JSONObject( jsonData );
JSONArray langs = obj.optJSONArray( "langs" );
if ( null != langs ) {
Set<String> closedLangs = parseLangs( langs );
closedLangs.remove( m_filterLang );
m_closedLangs.addAll( closedLangs );
success = true;
}
} catch ( JSONException ex ) {
Log.ex( TAG, ex );
}