diff --git a/CHANGELOG.md b/CHANGELOG.md index d49e520d7..61f818076 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +# 2020-04-24 - v5.5.2 + +#### Fixes + +* Fix potential NPE when presenting a survey without terms and conditions. + # 2020-04-14 - v5.5.1 #### Improvements diff --git a/README.md b/README.md index 6531beb97..0f824f19d 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ use your app, to talk to them at the right time, and in the right way. ##### [Release Notes](https://learn.apptentive.com/knowledge-base/android-sdk-release-notes/) -##### Binary releases are hosted for Maven [here](http://search.maven.org/#artifactdetails|com.apptentive|apptentive-android|5.5.1|aar) +##### Binary releases are hosted for Maven [here](http://search.maven.org/#artifactdetails|com.apptentive|apptentive-android|5.5.2|aar) #### Reporting Bugs diff --git a/apptentive/src/main/java/com/apptentive/android/sdk/module/engagement/interaction/fragment/SurveyFragment.java b/apptentive/src/main/java/com/apptentive/android/sdk/module/engagement/interaction/fragment/SurveyFragment.java index 07519f612..72f66ab77 100644 --- a/apptentive/src/main/java/com/apptentive/android/sdk/module/engagement/interaction/fragment/SurveyFragment.java +++ b/apptentive/src/main/java/com/apptentive/android/sdk/module/engagement/interaction/fragment/SurveyFragment.java @@ -221,12 +221,14 @@ protected void execute() { } private void updateTermsAndConditions(View v) { - updateTermsAndConditionsBody(v); - updateTermsAndConditionsLink(v); + TermsAndConditions termsAndConditions = ApptentiveInternal.getInstance().getSurveyTermsAndConditions(); + if (termsAndConditions != null){ + updateTermsAndConditionsBody(v, termsAndConditions); + updateTermsAndConditionsLink(v, termsAndConditions); + } } - private void updateTermsAndConditionsBody(View v) { - TermsAndConditions termsAndConditions = ApptentiveInternal.getInstance().getSurveyTermsAndConditions(); + private void updateTermsAndConditionsBody(View v, TermsAndConditions termsAndConditions) { final TextView termsAndConditionsBodyTv = v.findViewById(R.id.terms_and_conditions_body); final String termsAndConditionsBodyText = termsAndConditions.getBodyText(); final boolean isTermsAndConditionsBodyTextValid = !StringUtils.isNullOrBlank(termsAndConditionsBodyText); @@ -238,8 +240,7 @@ private void updateTermsAndConditionsBody(View v) { } } - private void updateTermsAndConditionsLink(View v) { - TermsAndConditions termsAndConditions = ApptentiveInternal.getInstance().getSurveyTermsAndConditions(); + private void updateTermsAndConditionsLink(View v, TermsAndConditions termsAndConditions) { final TextView termsAndConditionsLinkTv = v.findViewById(R.id.terms_and_conditions_link); final String termsAndConditionsLinkUrl = termsAndConditions.getLinkURL(); final String termsAndConditionsLinkText = termsAndConditions.getLinkText(); diff --git a/apptentive/src/main/java/com/apptentive/android/sdk/util/Constants.java b/apptentive/src/main/java/com/apptentive/android/sdk/util/Constants.java index 2ef414b72..ad3cdfdf9 100644 --- a/apptentive/src/main/java/com/apptentive/android/sdk/util/Constants.java +++ b/apptentive/src/main/java/com/apptentive/android/sdk/util/Constants.java @@ -9,7 +9,7 @@ public class Constants { public static final int API_VERSION = 9; - private static final String APPTENTIVE_SDK_VERSION = "5.5.1"; + private static final String APPTENTIVE_SDK_VERSION = "5.5.2"; public static final int DEFAULT_CONNECT_TIMEOUT_MILLIS = 45000; public static final int DEFAULT_READ_TIMEOUT_MILLIS = 45000; diff --git a/apptentive/src/main/res/layout/apptentive_survey.xml b/apptentive/src/main/res/layout/apptentive_survey.xml index 775ea8d50..64f76e57c 100644 --- a/apptentive/src/main/res/layout/apptentive_survey.xml +++ b/apptentive/src/main/res/layout/apptentive_survey.xml @@ -91,7 +91,8 @@ android:gravity="center" android:layout_marginStart="10dp" android:layout_marginEnd="10dp" - android:layout_marginBottom="8dp" /> + android:layout_marginBottom="8dp" + android:visibility="gone"/> + android:layout_marginEnd="10dp" + android:visibility="gone"/>