Created
March 1, 2014 01:29
-
-
Save ImDevinC/9283418 to your computer and use it in GitHub Desktop.
Bad Nested If Statements
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (tempToken != null) { | |
loginToken = parseToken(tempToken); | |
if (loginToken != null) { | |
// This creates our login information | |
List<NameValuePair> parameters = createParams(); | |
// Here we send the information to the server and login | |
String postResults = conn.postData("https://mytlc.bestbuy.com/etm/login.jsp", parameters); | |
// If we logged in properly, then we download the schedule | |
if (postResults.contains("etmMenu.jsp")) { | |
// Here is the actual call for the schedule | |
updateStatus("Retrieving schedule..."); | |
String schedule = conn.getData("https://mytlc.bestbuy.com/etm/time/timesheet/etmTnsMonth.jsp"); | |
// If we successfully got the information, then parse out the schedule to read it properly | |
if (schedule != null) { | |
updateStatus("Parsing schedule..."); | |
workDays = parseSchedule(schedule); | |
String secToken = parseSecureToken(schedule); | |
if (secToken != null) { | |
parameters = createSecondParams(secToken); | |
schedule = conn.postData("https://mytlc.bestbuy.com/etm/time/timesheet/etmTnsMonth.jsp", parameters); | |
if (schedule != null) { | |
List<String[]> secondMonth = parseSchedule(schedule); | |
if (secondMonth != null) { | |
workDays.addAll(secondMonth); | |
finalDays = workDays; | |
updateStatus("Adding shifts to calendar..."); | |
// Add our shifts to the calendar | |
if (addDays()) { | |
// Report back that we're successful! | |
Message msg = Message.obtain(); | |
Bundle b = new Bundle(); | |
b.putString("status", "DONE"); | |
b.putInt("count", workDays.size()); | |
msg.setData(b); | |
try { | |
messenger.send(msg); | |
} catch (Exception e) { | |
// Nothing | |
} | |
} | |
} else { | |
showError("There was an error retrieving your schedule, please try again"); | |
} | |
} else { | |
showError("Could not obtain user schedule, make sure you have a valid network connection"); | |
} | |
} else { | |
showError("Error retrieving your login token, make sure you have a valid network connection"); | |
} | |
} else { | |
showError("Could not obtain user schedule, make sure you have a valid network connection"); | |
} | |
} else { | |
showError("Error logging in, please verify your username and password"); | |
} | |
} else { | |
showError("Error retrieving your login token, make sure you have a valid network connection"); | |
} | |
} else { | |
showError("Error retrieving your login token, make sure you have a valid network connection"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment