Merge branch 'wipe-etag-on-language-change' into 'master'
Force repo update after changing language. See merge request !503
This commit is contained in:
		
						commit
						16ddcbd5d8
					
				| @ -286,6 +286,18 @@ public class RepoProvider extends FDroidProvider { | ||||
| 
 | ||||
|             return count; | ||||
|         } | ||||
| 
 | ||||
|         /** | ||||
|          * Helper method to ensure that next time the user asks for a repository update, we will | ||||
|          * fetch the metadata and update regardless of whether the metadata has changed or not. | ||||
|          * This is useful for when we change languages, because we need to ask the user to fetch | ||||
|          * the metadata again, so that we can extract the correctly-localized metadata. | ||||
|          */ | ||||
|         public static void clearEtags(Context context) { | ||||
|             ContentValues values = new ContentValues(1); | ||||
|             values.put(Cols.LAST_ETAG, (String) null); | ||||
|             context.getContentResolver().update(getContentUri(), values, null, null); | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     private static final String PROVIDER_NAME = "RepoProvider"; | ||||
|  | ||||
| @ -22,6 +22,7 @@ import org.fdroid.fdroid.Languages; | ||||
| import org.fdroid.fdroid.Preferences; | ||||
| import org.fdroid.fdroid.R; | ||||
| import org.fdroid.fdroid.UpdateService; | ||||
| import org.fdroid.fdroid.data.RepoProvider; | ||||
| import org.fdroid.fdroid.installer.InstallHistoryService; | ||||
| import org.fdroid.fdroid.installer.PrivilegedInstaller; | ||||
| 
 | ||||
| @ -158,6 +159,10 @@ public class PreferencesFragment extends PreferenceFragment | ||||
|                 if (changing) { | ||||
|                     Activity activity = getActivity(); | ||||
|                     Languages.setLanguage(activity, Preferences.get().getLanguage(), false); | ||||
| 
 | ||||
|                     RepoProvider.Helper.clearEtags(getContext()); | ||||
|                     UpdateService.updateNow(getContext()); | ||||
| 
 | ||||
|                     Languages.forceChangeLanguage(activity); | ||||
|                 } | ||||
|                 break; | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Hans-Christoph Steiner
						Hans-Christoph Steiner