Change instance for Lyon

This commit is contained in:
Thomas 2020-07-01 15:19:24 +02:00
parent 4b7b099fea
commit 07fc00e3ce
3 changed files with 9 additions and 3 deletions

View File

@ -119,6 +119,7 @@ public class LoginActivity extends AppCompatActivity implements OnRetrievePeertu
if (Helper.isLoggedIn(LoginActivity.this)) { if (Helper.isLoggedIn(LoginActivity.this)) {
not_connected.setVisibility(View.GONE); not_connected.setVisibility(View.GONE);
connected.setVisibility(View.VISIBLE);
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE); SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);
SQLiteDatabase db = Sqlite.getInstance(getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open(); SQLiteDatabase db = Sqlite.getInstance(getApplicationContext(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null); String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
@ -204,6 +205,7 @@ public class LoginActivity extends AppCompatActivity implements OnRetrievePeertu
asyncTask = new RetrievePeertubeNotificationsAsyncTask(LoginActivity.this, null, max_id, LoginActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); asyncTask = new RetrievePeertubeNotificationsAsyncTask(LoginActivity.this, null, max_id, LoginActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
} else { } else {
connected.setVisibility(View.GONE); connected.setVisibility(View.GONE);
not_connected.setVisibility(View.VISIBLE);
} }

View File

@ -135,7 +135,7 @@ public class MainActivity extends AppCompatActivity {
AlertDialog.Builder alt_bld = new AlertDialog.Builder(this); AlertDialog.Builder alt_bld = new AlertDialog.Builder(this);
alt_bld.setTitle(R.string.instance_choice); alt_bld.setTitle(R.string.instance_choice);
final SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE); final SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
String acad = sharedpreferences.getString(Helper.PREF_INSTANCE, "ac-lyon.fr"); String acad = sharedpreferences.getString(Helper.PREF_INSTANCE, "tube.ac-lyon.fr");
int i = 0; int i = 0;
for (String item : academies) { for (String item : academies) {
if (item.compareTo(acad) == 0) { if (item.compareTo(acad) == 0) {

View File

@ -199,7 +199,11 @@ public class Helper {
) { ) {
acad = "outremer.fr"; acad = "outremer.fr";
} }
return "tube-" + acad.replaceAll("ac-|\\.fr", "") + ".beta.education.fr"; if( !acad.contains("ac-lyon.fr")) {
return "tube-" + acad.replaceAll("ac-|\\.fr", "") + ".beta.education.fr";
}else{
return "tube.ac-lyon.fr";
}
} }
@ -211,7 +215,7 @@ public class Helper {
*/ */
public static String getLiveInstance(Context context) { public static String getLiveInstance(Context context) {
final SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE); final SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
String acad = sharedpreferences.getString(Helper.PREF_INSTANCE, "ac-lyon.fr"); String acad = sharedpreferences.getString(Helper.PREF_INSTANCE, "tube.ac-lyon.fr");
return getPeertubeUrl(acad); return getPeertubeUrl(acad);
} }