From 9bad8192e02354f928f658620292e9959e0895f3 Mon Sep 17 00:00:00 2001 From: Aaron Huttner Date: Wed, 24 Aug 2016 10:24:15 -0400 Subject: [PATCH] update opt-ins to be partner opt-ins. Make email opt-in default true. Add email text blurb add PennDOT and SSN enforcement text update spacing for error labels don't kill app when wifi is turned off changed helped --> help fix county spinner version bump --- app/build.gradle | 2 +- .../grommet/data/api/RegistrationService.java | 3 +- .../data/api/model/ApiRockyRequest.java | 6 +- .../grommet/data/db/DbOpenHelper.java | 2 +- .../grommet/data/db/model/RockyRequest.java | 6 +- .../grommet/ui/misc/ObservableValidator.java | 1 + .../registration/AdditionalInfoFragment.java | 13 ++-- .../grommet/ui/views/AddressView.java | 2 +- .../res/layout/fragment_additional_info.xml | 61 ++++++++++++++----- .../res/layout/fragment_assistant_info.xml | 3 +- .../res/layout/fragment_new_registrant.xml | 2 +- app/src/main/res/layout/view_address.xml | 12 ++-- app/src/main/res/layout/view_name.xml | 10 +-- app/src/main/res/values/strings.xml | 34 +++++++---- 14 files changed, 100 insertions(+), 57 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 40344c0a..0c8fbb0d 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,7 +1,7 @@ // Manifest version information! def versionMajor = 1 def versionMinor = 0 -def versionPatch = 5 +def versionPatch = 6 def versionBuild = 0 // bump for dogfood builds, public betas, etc. apply plugin: 'com.android.application' diff --git a/app/src/main/java/com/rockthevote/grommet/data/api/RegistrationService.java b/app/src/main/java/com/rockthevote/grommet/data/api/RegistrationService.java index f1cb879e..f910296d 100644 --- a/app/src/main/java/com/rockthevote/grommet/data/api/RegistrationService.java +++ b/app/src/main/java/com/rockthevote/grommet/data/api/RegistrationService.java @@ -132,7 +132,7 @@ private void doWorkIfNeeded() { PackageManager pm = context.getPackageManager(); pm.setComponentEnabledSetting(receiver, - PackageManager.COMPONENT_ENABLED_STATE_ENABLED, 0); + PackageManager.COMPONENT_ENABLED_STATE_ENABLED, PackageManager.DONT_KILL_APP); stopSelf(); } @@ -156,6 +156,7 @@ private void doWork(final RockyRequest rockyRequest) { RockyRequest.Status status = !regResponse.isError() && regResponse.response().isSuccessful() ? REGISTER_SUCCESS : REGISTER_SERVER_FAILURE; + UploadNotification.notify(getApplicationContext(), status); diff --git a/app/src/main/java/com/rockthevote/grommet/data/api/model/ApiRockyRequest.java b/app/src/main/java/com/rockthevote/grommet/data/api/model/ApiRockyRequest.java index 64441668..43c258f7 100644 --- a/app/src/main/java/com/rockthevote/grommet/data/api/model/ApiRockyRequest.java +++ b/app/src/main/java/com/rockthevote/grommet/data/api/model/ApiRockyRequest.java @@ -71,8 +71,6 @@ static Builder builder() { .optInEmail(false) .optInSms(false) .optInVolunteer(false) - .partnerOptInEmail(false) - .partnerOptInSms(false) .partnerOptInVolunteer(false) .finishWithState(true) .createdViaApi(true); @@ -123,8 +121,8 @@ public static ApiRockyRequest fromDb(RockyRequest rockyRequest, return builder() .phoneType(rockyRequest.phoneType().toString()) .partnerId(rockyRequest.partnerId()) - .optInEmail(rockyRequest.optInEmail()) - .optInSms(rockyRequest.optInSMS()) + .partnerOptInEmail(rockyRequest.partnerOptInEmail()) + .partnerOptInSms(rockyRequest.partnerOptInSMS()) .optInVolunteer(rockyRequest.optInVolunteer()) .sourceTrackingId(rockyRequest.sourceTrackingId()) .partnerTrackingId(rockyRequest.partnerTrackingId()) diff --git a/app/src/main/java/com/rockthevote/grommet/data/db/DbOpenHelper.java b/app/src/main/java/com/rockthevote/grommet/data/db/DbOpenHelper.java index b5345d22..7048d588 100644 --- a/app/src/main/java/com/rockthevote/grommet/data/db/DbOpenHelper.java +++ b/app/src/main/java/com/rockthevote/grommet/data/db/DbOpenHelper.java @@ -31,7 +31,7 @@ public class DbOpenHelper extends SQLiteOpenHelper { + RockyRequest.OPT_IN_SMS + " INTEGER DEFAULT " + Db.BOOLEAN_FALSE + "," + RockyRequest.OPT_IN_VOLUNTEER + " INTEGER DEFAULT " + Db.BOOLEAN_FALSE + "," + RockyRequest.PARTNER_OPT_IN_SMS + " INTEGER DEFAULT " + Db.BOOLEAN_FALSE + "," - + RockyRequest.PARTNER_OPT_IN_EMAIL + " INTEGER DEFAULT " + Db.BOOLEAN_FALSE + "," + + RockyRequest.PARTNER_OPT_IN_EMAIL + " INTEGER DEFAULT " + Db.BOOLEAN_TRUE + "," + RockyRequest.SOURCE_TRACKING_ID + " TEXT," + RockyRequest.PARTNER_TRACKING_ID + " TEXT," + RockyRequest.OPEN_TRACKING_ID + " TEXT," diff --git a/app/src/main/java/com/rockthevote/grommet/data/db/model/RockyRequest.java b/app/src/main/java/com/rockthevote/grommet/data/db/model/RockyRequest.java index 0cec063f..5c311c84 100644 --- a/app/src/main/java/com/rockthevote/grommet/data/db/model/RockyRequest.java +++ b/app/src/main/java/com/rockthevote/grommet/data/db/model/RockyRequest.java @@ -309,13 +309,9 @@ public static Race fromString(String race) { } public enum Party { - OTHER("Other"), DEMOCRATIC("Democratic"), - GREEN("Green"), - INDEPENDENT("Independent"), - LIBERTARIAN("Libertarian"), REPUBLICAN("Republican"), - NONE("None"); + OTHER("Other"); private final String party; diff --git a/app/src/main/java/com/rockthevote/grommet/ui/misc/ObservableValidator.java b/app/src/main/java/com/rockthevote/grommet/ui/misc/ObservableValidator.java index 37cd13e1..ed0d8dae 100644 --- a/app/src/main/java/com/rockthevote/grommet/ui/misc/ObservableValidator.java +++ b/app/src/main/java/com/rockthevote/grommet/ui/misc/ObservableValidator.java @@ -25,6 +25,7 @@ public ObservableValidator(Object controller, Context context) { public void onAllRulesPassed(View view) { if (view instanceof TextInputLayout) { ((TextInputLayout) view).setError(null); + ((TextInputLayout) view).setErrorEnabled(false); } else if (view instanceof CheckBox) { ((CheckBox) view).setError(null); } diff --git a/app/src/main/java/com/rockthevote/grommet/ui/registration/AdditionalInfoFragment.java b/app/src/main/java/com/rockthevote/grommet/ui/registration/AdditionalInfoFragment.java index f9131114..ba33c642 100644 --- a/app/src/main/java/com/rockthevote/grommet/ui/registration/AdditionalInfoFragment.java +++ b/app/src/main/java/com/rockthevote/grommet/ui/registration/AdditionalInfoFragment.java @@ -154,6 +154,7 @@ public void onViewCreated(View view, Bundle savedInstanceState) { public void onActivityCreated(@Nullable Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); phoneOptIn.setText(getString(R.string.label_receive_text, partnerNamePref.get())); + emailOptIn.setText(getString(R.string.label_receive_email, partnerNamePref.get())); } @Override @@ -243,7 +244,7 @@ public void onResume() { db.update( RockyRequest.TABLE, new RockyRequest.Builder() - .optInEmail(checked) + .partnerOptInEmail(checked) .build(), RockyRequest._ID + " = ? ", String.valueOf(rockyRequestRowId.get())); })); @@ -280,7 +281,7 @@ public void onResume() { db.update( RockyRequest.TABLE, new RockyRequest.Builder() - .optInSMS(checked) + .partnerOptInSMS(checked) .build(), RockyRequest._ID + " = ? ", String.valueOf(rockyRequestRowId.get())); })); @@ -304,7 +305,9 @@ public void onDriversLicenseChecked(boolean checked) { // disabling it prevents Saripaar from trying to validate it pennDOTTIL.setEnabled(!checked); - pennDOTTIL.setErrorEnabled(!checked); + if (checked) { + pennDOTTIL.setErrorEnabled(false); + } doesNotHavePennDOT.onNext(checked); } @@ -314,7 +317,9 @@ public void onSSNChecked(boolean checked) { // disabling it prevents Saripaar from trying to validate it ssnTIL.setEnabled(!checked); - ssnTIL.setErrorEnabled(!checked); + if (checked) { + ssnTIL.setErrorEnabled(false); + } doesNotHaveSSN.onNext(checked); } diff --git a/app/src/main/java/com/rockthevote/grommet/ui/views/AddressView.java b/app/src/main/java/com/rockthevote/grommet/ui/views/AddressView.java index 4b1a6fac..44edf794 100644 --- a/app/src/main/java/com/rockthevote/grommet/ui/views/AddressView.java +++ b/app/src/main/java/com/rockthevote/grommet/ui/views/AddressView.java @@ -185,7 +185,7 @@ protected void onAttachedToWindow() { RxTextView.afterTextChangeEvents(cityEditText), RxTextView.afterTextChangeEvents(stateSpinner.getEditText()), RxTextView.afterTextChangeEvents(zipEditText), - RxTextView.afterTextChangeEvents(stateSpinner.getEditText()), + RxTextView.afterTextChangeEvents(countySpinner.getEditText()), (street, unit, city, state, zip, county) -> new Address.Builder() .streetName(street.editable().toString()) .subAddress(unit.editable().toString()) diff --git a/app/src/main/res/layout/fragment_additional_info.xml b/app/src/main/res/layout/fragment_additional_info.xml index 67820bfa..fd2ed2b0 100644 --- a/app/src/main/res/layout/fragment_additional_info.xml +++ b/app/src/main/res/layout/fragment_additional_info.xml @@ -4,6 +4,7 @@ + android:maxLines="1" + android:text="@string/preferred_language_default"/> @@ -51,7 +53,7 @@ android:layout_marginEnd="@dimen/content_margin" android:layout_marginStart="@dimen/content_margin" android:hint="@string/section_label_race" - app:errorEnabled="true"/> + app:errorEnabled="false"/> + android:paddingBottom="@dimen/content_area_padding" + app:errorEnabled="false"/> + @@ -91,10 +103,21 @@ android:layout_width="wrap_content" android:layout_columnSpan="2" android:layout_marginStart="@dimen/content_margin" + android:gravity="bottom" android:paddingBottom="@dimen/content_area_padding" - android:paddingTop="@dimen/content_area_padding" android:text="@string/label_does_not_have_penn_dot"/> + + + + + + app:errorEnabled="false"> + tools:text="@string/label_receive_email"/> + app:errorEnabled="false"> + app:errorEnabled="false"/> + app:errorEnabled="false"> + app:errorEnabled="false"/> + app:errorEnabled="false"/> + app:errorEnabled="false"> + app:errorEnabled="false"> + app:errorEnabled="false"/> \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 7118ab3e..4de260a0 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -13,7 +13,7 @@ About Data Usage Help - Some of your canvasser information is incomplete. You must enter your name, Partner ID, Event ID and Event Zip before registering voters. + Some of your canvasser information is incomplete. You must enter your name, Partner ID, Event ID and Event Zip before registering voters No Thanks Enter Info @@ -43,11 +43,7 @@ Suffix Suffix - Email Address Birthday - Phone Number - Type - Receive email from Rock the Vote Eligibility Basic Info New Registrant @@ -75,9 +71,8 @@ I have changed my address I would like to receive a copy of my voter registration in the mail I have changed my name - I agree that %s/Pennsylvania Voice/State Voices may call and text me with important updates and reminders." + I agree that %s/Pennsylvania Voice/State Voices may call and text me with important updates and reminders County Required - Invalid phone number I have no permanent or mailing address Complete registration using paper form @@ -105,15 +100,27 @@ I do not know the last four of my SSN Preferred Language to Receive Election Materials Election Info - Check /"I do not know/" if you don\'t know your PennDOT number - Check "I do not know" if you don\'t know your SSN last four - Did someone helped you with this form? + If you have a PA driver\'s license or PennDOT ID card number, you must use it + Check \"I do not know\" if you don\'t know your PennDOT number + If you do not have a PennDOT number please enter the last 4 digits of your Social Security number + Check \"I do not know\" if you don\'t know your SSN last four + Did someone help you with this form? Helper Name Helper Address Helper Contact Info + Invalid phone number + Email Address + Phone Number + Type + "I give permission to %s to send me news and updates + English + + Submit your e-mail address to allow the PA Department of State to send you a message confirming the receipt of your voter registration application: + \n + \n + \u2022 Please note that this email may take up to 24 hours to get to you." + -\n -\n If you helped a voter complete this voter registration application, you must also sign the application. By checking the box, you are signing the application electronically. \n @@ -153,6 +160,9 @@ In doing so: \n \n \u2022 If you do not receive your Voter Registration Card within 14 days, contact your county voter registration office. +\n +\n +Deadline Alert: 10/11/2016 close of registration date of current election is the last day to register before the 11/8/2016 election.