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

feat: Implement skip login feature #233

Merged
merged 1 commit into from
Jun 20, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion app/src/main/java/com/example/saar/Constant.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ public class Constant {
public static final String ACHIEVEMENTS = "achievements";
public static final String IMG_URL = "img_url";

//Notification service
//Utility Constants
public static final String SUBSCRIBE_NOTIFICATION = "subscribe_notification";
public static final String SKIP_LOGIN = "skip_login";

}
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ public void onClick(View v) {
skipLogin.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
sharedPreferenceEditor.putBoolean(Constant.SKIP_LOGIN,true);
sharedPreferenceEditor.apply();
Intent intent = new Intent(getActivity(), MainActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
Expand Down
5 changes: 5 additions & 0 deletions app/src/main/java/com/example/saar/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@ protected void onCreate(Bundle savedInstanceState) {
setSupportActionBar(toolbar);

preferences = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());

if(!preferences.getBoolean(Constant.LOGIN_STATUS,false) && !preferences.getBoolean(Constant.SKIP_LOGIN,false)){
startActivity(new Intent(this, LoginSignupActivity.class));
}

DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
Expand Down
1 change: 1 addition & 0 deletions app/src/main/java/com/example/saar/Utils/Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ public static void logout(SharedPreferences.Editor editor, Context context) {
editor.putString(Constant.CITY, "");
editor.putString(Constant.STATE, "");
editor.putString(Constant.ACHIEVEMENTS, "");
editor.putBoolean(Constant.SKIP_LOGIN,false);
editor.apply();
Toast.makeText(context, "Logged Out", Toast.LENGTH_LONG).show();
context.startActivity(new Intent(context, LoginSignupActivity.class));
Expand Down