private void showMessage(String msg) { Logger.debug(PanicConstants.TAG, "msg: " + msg); if (_display.getCurrent() == _tbMain) { try { _tbMain.setString(msg); } catch (Exception e) { e.printStackTrace(); } } else if (_display.getCurrent() == _lsCanvas) { _lsCanvas.setLargeString(msg); } }
public void wipingFileError(String path, String msg) { showMessage("ERROR wiping: " + path); Logger.debug(PanicConstants.TAG, "wiping error: " + path + ": " + msg); }
public void wipingFileSuccess(String path) { showMessage("wiping: " + path); Logger.debug(PanicConstants.TAG, "wiping: " + path); }
public void run() { ShoutController sControl = new ShoutController(); Logger.debug(PanicConstants.TAG, "starting panic run(); loading prefs..."); String recipients = _prefs.get(PanicConstants.PREFS_KEY_RECIPIENT); String userName = _prefs.get(PanicConstants.PREFS_KEY_NAME); String userMessage = _prefs.get(PanicConstants.PREFS_KEY_MESSAGE); String userLocation = _prefs.get(PanicConstants.PREFS_KEY_LOCATION); String panicMsg = sControl.buildShoutMessage(userName, userMessage, userLocation); String panicData = sControl.buildShoutData(userName); showMessage("PANIC MESSAGE: " + panicMsg + "\n\npreparing to send..."); doSecPause(5); _lsCanvas = new LargeStringCanvas(""); _lsCanvas.setCommandListener(this); _lsCanvas.addCommand(_cmdCancel); _manager.next(_lsCanvas); for (int i = 5; i > 0; i--) { showMessage("Sending in " + i + "..."); doSecPause(1); } int resendTimeout = PanicConstants.DEFAULT_RESEND_TIMEOUT; // one minute boolean wipeComplete = false; while (_keepPanicing) { try { showMessage("Sending messages..."); sControl.sendSMSShout(recipients, panicMsg, panicData); showMessage("Panic Sent!"); doSecPause(2); } catch (Exception e) { _display.setCurrent(_tbMain); doSecPause(1); showMessage("Error Sending: " + e.toString()); doSecPause(10); } // now that first shout has been sent, time to wipe if (!wipeComplete) { showMessage("Preparing to wipe data..."); WipeController wc = new WipeController(); String prefBool = _prefs.get(PanicConstants.PREFS_KEY_WIPE_CONTACTS); boolean wipeContacts = (prefBool != null && prefBool.equals("true")); prefBool = _prefs.get(PanicConstants.PREFS_KEY_WIPE_EVENTS); boolean wipeEvents = (prefBool != null && prefBool.equals("true")); prefBool = _prefs.get(PanicConstants.PREFS_KEY_WIPE_TODOS); boolean wipeToDos = (prefBool != null && prefBool.equals("true")); prefBool = _prefs.get(PanicConstants.PREFS_KEY_WIPE_PHOTOS); boolean wipePhotos = (prefBool != null && prefBool.equals("true")); prefBool = _prefs.get(PanicConstants.PREFS_KEY_WIPE_VIDEOS); boolean wipeVideos = (prefBool != null && prefBool.equals("true")); prefBool = _prefs.get(PanicConstants.PREFS_KEY_WIPE_ALL_FILES); boolean wipeAllFiles = (prefBool != null && prefBool.equals("true")); doSecPause(1); showMessage("Wiping selected personal data..."); try { wc.wipePIMData(wipeContacts, wipeEvents, wipeToDos); showMessage("Success! Personal data wiped!"); } catch (Exception e) { showMessage("WARNING: There was an error wiping your personal data."); e.printStackTrace(); } doSecPause(3); if (wipePhotos) { showMessage("Wiping all photos..."); try { wc.wipePhotos(this); showMessage("Wiping photos...\nWIPE COMPLETE."); } catch (Exception e) { showMessage("Wiping photos...nERROR. UNABLE TO WIPE PHOTOS."); e.printStackTrace(); } } doSecPause(3); if (wipeVideos) { showMessage("Wiping all videos..."); try { wc.wipePhotos(this); showMessage("Wiping videos...\nWIPE COMPLETE."); } catch (Exception e) { showMessage("Wiping videos...nERROR. UNABLE TO WIPE PHOTOS."); e.printStackTrace(); } } doSecPause(3); if (wipeAllFiles) { showMessage("Wiping all files..."); try { wc.wipeMemoryCard(this); wc.wipeAllRootPaths(this); showMessage("Wiping all files...\nWIPE COMPLETE."); } catch (Exception e) { showMessage("Wiping all photos...\nERROR. UNABLE TO WIPE ALL FILES."); e.printStackTrace(); } } wipeComplete = true; } int secs = resendTimeout / 1000; while (secs > 0) { showMessage("Panic! again in\n" + secs + "secs..."); doSecPause(1); secs--; } // update message with new mobile cid, lac info panicMsg = sControl.buildShoutMessage(userName, userMessage, userLocation); } _manager.next(_tbMain); }