mirror of
https://github.com/2009scape/2009Scape-mobile.git
synced 2025-12-20 13:30:15 -07:00
[Account manager] Still trying to fix wrong account path
This commit is contained in:
parent
fcdeab1935
commit
9f7f2fb62d
4 changed files with 7 additions and 18 deletions
|
|
@ -39,7 +39,6 @@ public class MCLauncherActivity extends BaseLauncherActivity
|
|||
private TabLayout tabLayout;
|
||||
|
||||
private TextView tvUsernameView;
|
||||
private String profilePath = null;
|
||||
private ViewPagerAdapter viewPageAdapter;
|
||||
|
||||
private Button switchUsrBtn, logoutBtn; // MineButtons
|
||||
|
|
@ -74,7 +73,6 @@ public class MCLauncherActivity extends BaseLauncherActivity
|
|||
mTextVersion = (TextView) findViewById(R.id.launcherMainVersionView);
|
||||
|
||||
try {
|
||||
profilePath = PojavProfile.getCurrentProfilePath(this);
|
||||
mProfile = PojavProfile.getCurrentProfileContent(this);
|
||||
|
||||
tvUsernameView.setText(getString(R.string.main_welcome, mProfile.username));
|
||||
|
|
|
|||
|
|
@ -38,7 +38,6 @@ public class PojavLauncherActivity extends BaseLauncherActivity
|
|||
|
||||
private TextView tvUsernameView;
|
||||
private Spinner accountSelector;
|
||||
private String profilePath = null;
|
||||
private ViewPagerAdapter viewPageAdapter;
|
||||
|
||||
private Button switchUsrBtn, logoutBtn; // MineButtons
|
||||
|
|
@ -136,7 +135,7 @@ public class PojavLauncherActivity extends BaseLauncherActivity
|
|||
PojavProfile.setCurrentProfile(PojavLauncherActivity.this, tempProfile);
|
||||
} else {
|
||||
PojavProfile.setCurrentProfile(PojavLauncherActivity.this,
|
||||
Tools.DIR_ACCOUNT_NEW + "/" + accountList.get(position + (tempProfile != null ? 1 : 0)) + ".json");
|
||||
accountList.get(position + (tempProfile != null ? 1 : 0)));
|
||||
}
|
||||
pickAccount();
|
||||
}
|
||||
|
|
@ -212,12 +211,10 @@ public class PojavLauncherActivity extends BaseLauncherActivity
|
|||
|
||||
private void pickAccount() {
|
||||
try {
|
||||
profilePath = PojavProfile.getCurrentProfilePath(this);
|
||||
mProfile = PojavProfile.getCurrentProfileContent(this);
|
||||
|
||||
tvUsernameView.setText(getString(R.string.main_welcome, mProfile.username));
|
||||
} catch(Exception e) {
|
||||
profilePath = "";
|
||||
mProfile = new MinecraftAccount();
|
||||
Tools.showError(this, e, true);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -283,8 +283,6 @@ public class PojavLoginActivity extends BaseActivity
|
|||
|
||||
// Clear current profile
|
||||
PojavProfile.setCurrentProfile(this, null);
|
||||
|
||||
|
||||
}
|
||||
|
||||
private boolean isJavaRuntimeInstalled(AssetManager am) {
|
||||
|
|
@ -825,9 +823,8 @@ public class PojavLoginActivity extends BaseActivity
|
|||
try {
|
||||
String profileName = null;
|
||||
if (sRemember.isChecked() || notOnLogin) {
|
||||
profileName = new File(mProfile.save()).getName();
|
||||
profileName = mProfile.save();
|
||||
}
|
||||
profileName = profileName.substring(0, profileName.length() - 5);
|
||||
|
||||
MCProfile.launch(PojavLoginActivity.this, profileName == null ? mProfile : profileName);
|
||||
} catch (IOException e) {
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ public class PojavProfile
|
|||
}
|
||||
|
||||
public static MinecraftAccount getCurrentProfileContent(Context ctx) throws IOException, JsonSyntaxException {
|
||||
MinecraftAccount build = MinecraftAccount.load(getPrefs(ctx).getString(PROFILE_PREF_FILE, ""));
|
||||
MinecraftAccount build = MinecraftAccount.load(getCurrentProfileName(ctx));
|
||||
if (build == null) {
|
||||
getTempProfileContent(ctx);
|
||||
}
|
||||
|
|
@ -26,7 +26,7 @@ public class PojavProfile
|
|||
return MinecraftAccount.parse(getPrefs(ctx).getString(PROFILE_PREF_TEMP_CONTENT, ""));
|
||||
}
|
||||
|
||||
public static String getCurrentProfilePath(Context ctx) {
|
||||
public static String getCurrentProfileName(Context ctx) {
|
||||
return getPrefs(ctx).getString(PROFILE_PREF_FILE, "");
|
||||
}
|
||||
|
||||
|
|
@ -42,10 +42,7 @@ public class PojavProfile
|
|||
}
|
||||
} else if (obj instanceof String) {
|
||||
String acc = (String) obj;
|
||||
pref.putString(PROFILE_PREF_FILE,
|
||||
acc.startsWith("/") ?
|
||||
acc :
|
||||
Tools.DIR_ACCOUNT_NEW + "/" + acc + ".json");
|
||||
pref.putString(PROFILE_PREF_FILE, acc);
|
||||
MinecraftAccount.clearTempAccount();
|
||||
} else if (obj == null) {
|
||||
pref.putString(PROFILE_PREF_FILE, "");
|
||||
|
|
@ -58,6 +55,6 @@ public class PojavProfile
|
|||
}
|
||||
|
||||
public static boolean isFileType(Context ctx) {
|
||||
return new File(PojavProfile.getCurrentProfilePath(ctx)).exists();
|
||||
return new File(Tools.DIR_ACCOUNT_NEW + "/" + PojavProfile.getCurrentProfileName(ctx) + ".json").exists();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue