|
|
|
@ -61,6 +61,7 @@ public class BaseActivity extends AppCompatActivity { |
|
|
|
|
protected void onCreate(@Nullable Bundle savedInstanceState) { |
|
|
|
|
super.onCreate(savedInstanceState); |
|
|
|
|
|
|
|
|
|
redirectIfNotLoggedIn(); |
|
|
|
|
createMastodonAPI(); |
|
|
|
|
createTuskyAPI(); |
|
|
|
|
|
|
|
|
@ -153,6 +154,19 @@ public class BaseActivity extends AppCompatActivity { |
|
|
|
|
tuskyAPI = retrofit.create(TuskyAPI.class); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
protected void redirectIfNotLoggedIn() { |
|
|
|
|
SharedPreferences preferences = getSharedPreferences( |
|
|
|
|
getString(R.string.preferences_file_key), Context.MODE_PRIVATE); |
|
|
|
|
String domain = preferences.getString("domain", null); |
|
|
|
|
String accessToken = preferences.getString("accessToken", null); |
|
|
|
|
if (domain != null && accessToken != null) { |
|
|
|
|
Intent intent = new Intent(this, MainActivity.class); |
|
|
|
|
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK); |
|
|
|
|
startActivity(intent); |
|
|
|
|
finish(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public boolean onCreateOptionsMenu(Menu menu) { |
|
|
|
|
TypedValue value = new TypedValue(); |
|
|
|
|