Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: users logged out after SDK upgrade due to different cache path #1168

Merged
merged 10 commits into from
May 26, 2022
24 changes: 22 additions & 2 deletions parse/src/main/java/com/parse/ParsePlugins.java
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,17 @@ InstallationId installationId() {
File getCacheDir() {
synchronized (lock) {
if (cacheDir == null) {
cacheDir = new File(applicationContext.getCacheDir(), "com.parse");
/*
Check for old reference file before migration to v3.0.0.
If old reference found, copy the ref to new directory and delete the ref.
rommansabbir marked this conversation as resolved.
Show resolved Hide resolved
*/
File oldRef = applicationContext.getDir("Parse", Context.MODE_PRIVATE);
if (oldRef.exists()) {
cacheDir = new File(oldRef, "com.parse");
oldRef.deleteOnExit();
rommansabbir marked this conversation as resolved.
Show resolved Hide resolved
} else {
cacheDir = new File(applicationContext.getCacheDir(), "com.parse");
}
}
return createFileDir(cacheDir);
}
Expand All @@ -187,7 +197,17 @@ File getCacheDir() {
File getFilesDir() {
synchronized (lock) {
if (filesDir == null) {
filesDir = new File(applicationContext.getFilesDir(), "com.parse");
/*
rommansabbir marked this conversation as resolved.
Show resolved Hide resolved
Check for old reference file before migration to v3.0.0.
If old reference found, copy the ref to new directory and delete the ref.
*/
File oldRef = applicationContext.getDir("Parse", Context.MODE_PRIVATE);
if (oldRef.exists()) {
filesDir = new File(oldRef, "com.parse");
oldRef.deleteOnExit();
} else {
filesDir = new File(applicationContext.getFilesDir(), "com.parse");
}
}
return createFileDir(filesDir);
}
Expand Down