@@ -17,7 +17,7 @@ import java.util.concurrent.TimeoutException
17
17
*
18
18
* @param [torService] for context.
19
19
* @param [torConfigFiles] [TorConfigFiles] to know where files/directories are.
20
- * @param [appVersionCode ] Mitigate copying of geoip files to app updates only. Use [BuildConfig.VERSION_CODE].
20
+ * @param [buildConfigVersionCode ] Mitigate copying of geoip files to app updates only. Use [BuildConfig.VERSION_CODE].
21
21
* @param [geoIpAssetPath] The path to geoip file within the application, ex: "common/geoip"
22
22
* @param [geoIp6AssetPath] The path to geoip6 file within the application, ex: "common/geoip6"
23
23
*
@@ -26,7 +26,7 @@ import java.util.concurrent.TimeoutException
26
26
internal class OnionProxyInstaller (
27
27
private val torService : TorService ,
28
28
private val torConfigFiles : TorConfigFiles ,
29
- private val appVersionCode : Int ,
29
+ private val buildConfigVersionCode : Int ,
30
30
private val geoIpAssetPath : String ,
31
31
private val geoIp6AssetPath : String
32
32
): TorInstaller() {
@@ -45,13 +45,16 @@ internal class OnionProxyInstaller(
45
45
geoIp6FileCoppied = " "
46
46
47
47
// If the app version has been increased, or if this is a debug build of topl-service
48
- // module, copy over geoip assets then update SharedPreferences with the new appVersion
49
- if (appVersionCode > prefs.getInt(" APP_VERSION" , - 1 ) ? : - 1 || BuildConfig .DEBUG ) {
48
+ // module, copy over geoip assets then update SharedPreferences with the updated
49
+ // version code. Mitigates copying to be done only if a version upgrade is had.
50
+ if (buildConfigVersionCode > prefs.getInt(" BUILD_CONFIG_VERSION_CODE" , - 1 ) ? : - 1 ||
51
+ BuildConfig .DEBUG
52
+ ) {
50
53
if (! ::geoIpFileCoppied.isInitialized)
51
54
copyAsset(geoIpAssetPath, torConfigFiles.geoIpFile)
52
55
if (! ::geoIp6FileCoppied.isInitialized)
53
56
copyAsset(geoIp6AssetPath, torConfigFiles.geoIpv6File)
54
- prefs.putInt(" APP_VERSION " , appVersionCode )
57
+ prefs.putInt(" BUILD_CONFIG_VERSION_CODE " , buildConfigVersionCode )
55
58
}
56
59
}
57
60
0 commit comments