Skip to content

Commit

Permalink
Add option to hide 'powered by InMoment'
Browse files Browse the repository at this point in the history
  • Loading branch information
Diego Serrano committed Jan 31, 2023
1 parent 3dafb29 commit 3f92118
Show file tree
Hide file tree
Showing 8 changed files with 62 additions and 19 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 2.22.0 (2023-01-31)

- Add option to hide "powered by InMoment"

## 2.21.3 (2023-01-12)

- Fix thank_you_button color being overriden by colorPrimary
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ If you use Maven, you can include this library as a dependency:
<dependency>
<groupId>com.wootric</groupId>
<artifactId>wootric-sdk-android</artifactId>
<version>2.21.3</version>
<version>2.22.0</version>
</dependency>
```

### Using Gradle

```xml
implementation 'com.wootric:wootric-sdk-android:2.21.3'
implementation 'com.wootric:wootric-sdk-android:2.22.0'
```

## Initializing Wootric
Expand Down
4 changes: 2 additions & 2 deletions androidsdk/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
VERSION_NAME=2.21.3
VERSION_CODE=2213
VERSION_NAME=2.22.0
VERSION_CODE=2220
GROUP=com.wootric

POM_DESCRIPTION=WootricSDK Android
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ public class Settings implements Parcelable {
private boolean surveyedDefault = true;
private boolean surveyImmediately;
private boolean showOptOut;
private boolean showPoweredBy;
private boolean skipFollowupScreenForPromoters;
private boolean skipFeedbackScreen;

Expand Down Expand Up @@ -101,6 +102,7 @@ public Settings(Settings settings) {
this.surveyedDefault = settings.surveyedDefault;
this.surveyImmediately = settings.surveyImmediately;
this.showOptOut = settings.showOptOut;
this.showPoweredBy = settings.showPoweredBy;
this.skipFollowupScreenForPromoters = settings.skipFollowupScreenForPromoters;
this.skipFeedbackScreen = settings.skipFeedbackScreen;
this.dailyResponseCap = settings.dailyResponseCap;
Expand Down Expand Up @@ -171,6 +173,8 @@ public void setShowOptOut(boolean showOptOut) {

public boolean isShowOptOut() { return showOptOut; }

public boolean isShowPoweredBy() { return showPoweredBy; }

public boolean isSurveyImmediately() {
return surveyImmediately;
}
Expand Down Expand Up @@ -739,6 +743,8 @@ public void writeToParcel(Parcel dest, int flags) {
dest.writeInt(this.timeDelay);
dest.writeByte(surveyImmediately ? (byte) 1 : (byte) 0);
dest.writeByte(surveyedDefault ? (byte) 1 : (byte) 0);
dest.writeByte(showPoweredBy ? (byte) 1 : (byte) 0);
dest.writeByte(showOptOut ? (byte) 1 : (byte) 0);
dest.writeValue(this.dailyResponseCap);
dest.writeValue(this.registeredPercent);
dest.writeValue(this.visitorPercent);
Expand Down Expand Up @@ -767,6 +773,8 @@ private Settings(Parcel in) {
this.timeDelay = in.readInt();
this.surveyImmediately = in.readByte() != 0;
this.surveyedDefault = in.readByte() != 0;
this.showPoweredBy = in.readByte() != 0;
this.showOptOut = in.readByte() != 0;
this.dailyResponseCap = (Integer) in.readValue(Integer.class.getClassLoader());
this.registeredPercent = (Integer) in.readValue(Integer.class.getClassLoader());
this.visitorPercent = (Integer) in.readValue(Integer.class.getClassLoader());
Expand Down Expand Up @@ -798,6 +806,7 @@ public static Settings fromJson(JSONObject settingsObject) throws JSONException
settings.setSurveyType(settingsObject.optString("survey_type", "NPS"));
settings.firstSurvey = settingsObject.optLong("first_survey");
settings.adminPanelTimeDelay = settingsObject.optInt("time_delay");
settings.showPoweredBy = settingsObject.optBoolean("powered_by");

if (settingsObject.has("account_token")) {
settings.accountToken = settingsObject.optString("account_token");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,10 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle sa
mBtnOptOut = (TextView) view.findViewById(R.id.wootric_btn_opt_out);
mBtnOptOut.setText(mSettings.getBtnOptOut());

if (!mSettings.isShowPoweredBy()) {
mPoweredBy.setVisibility(View.GONE);
}

if (mSettings.isShowOptOut()) {
mBtnOptOut.setVisibility(View.VISIBLE);
mBtnOptOut.setOnClickListener(new View.OnClickListener() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,10 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle sa
mBtnOptOut = (TextView) view.findViewById(R.id.wootric_btn_opt_out);
mBtnOptOut.setText(mSettings.getBtnOptOut());

if (!mSettings.isShowPoweredBy() && mPoweredBy != null) {
mPoweredBy.setVisibility(View.GONE);
}

if (mSettings.isShowOptOut()) {
mBtnOptOut.setVisibility(View.VISIBLE);
mBtnOptOut.setOnClickListener(new View.OnClickListener() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ public class SurveyLayoutTablet extends LinearLayout
private TextView mBtnDismiss;

private RelativeLayout mThankYouLayout;
private LinearLayout mPoweredByLayout;
private TextView mPoweredByTv;
private TextView mInMomentTv;
private TextView mDotSeparatorTv;

private Button mBtnFacebookLike;
private Button mBtnTwitter;
Expand Down Expand Up @@ -150,7 +154,6 @@ public boolean onKey(View view, int keyCode, KeyEvent keyevent) {
}
});


mBtnSubmit = (Button) mLayoutFollowup.findViewById(R.id.wootric_btn_submit);
mBtnSubmit.setOnClickListener(new OnClickListener() {
@Override
Expand Down Expand Up @@ -223,6 +226,11 @@ public void onClick(View v) {

mThankYouLayout = (RelativeLayout) findViewById(R.id.wootric_thank_you_layout_body);

mPoweredByLayout = (LinearLayout) findViewById(R.id.wootric_layout_powered_by);
mPoweredByTv = (TextView) findViewById(R.id.wootric_tv_powered_by);
mInMomentTv = (TextView) findViewById(R.id.wootric_tv_im);
mDotSeparatorTv = (TextView) findViewById(R.id.footer_dot_separator);

setPadding(CONTAINER_PADDING, CONTAINER_PADDING, CONTAINER_PADDING, CONTAINER_PADDING);

initScoreLayout();
Expand Down Expand Up @@ -263,6 +271,11 @@ public void initWithSettings(Settings settings, String email) {

mScore = new Score(mCurrentScore, mSurveyType, mSettings.getSurveyTypeScale());

if (!mSettings.isShowPoweredBy() && mPoweredByLayout != null) {
mPoweredByLayout.setVisibility(View.GONE);
mDotSeparatorTv.setVisibility(View.GONE);
}

initResources();
initScoreLayout();
updateState(mCurrentState);
Expand Down Expand Up @@ -323,8 +336,6 @@ private void setupThankYouState() {
mSurveyLayout.setVisibility(GONE);
setKeyboardVisibility(false);

boolean shouldShowThankYouAction = mSettings.isThankYouActionConfigured(mCurrentEmail, mCurrentScore, feedback) ;

initThankYouActionBtn();
initSocialLinks();

Expand All @@ -350,6 +361,9 @@ private void setupThankYouState() {

mThankYouLayout.setAlpha(0);
mThankYouLayout.setVisibility(VISIBLE);
if (!mSettings.isShowPoweredBy() && mThankYouLayout != null) {
mThankYouLayout.findViewById(R.id.wootric_layout_powered_by).setVisibility(View.GONE);
}
fadeInView(mThankYouLayout);
}

Expand Down
32 changes: 20 additions & 12 deletions androidsdk/src/main/res/layout-sw600dp/wootric_footer.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,28 @@
xmlns:android="http://schemas.android.com/apk/res/android"
android:layoutDirection="ltr">

<TextView
android:id="@+id/wootric_tv_powered_by"
<LinearLayout
android:id="@+id/wootric_layout_powered_by"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@font/ibmplexsans"
android:text="@string/wootric_powered_by"
android:textColor="@color/wootric_tablet_text_score_color"/>
android:layout_height="match_parent"
android:visibility="visible">

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@font/ibmplexsans"
android:text="@string/wootric"
android:textColor="@color/wootric_tablet_text_score_color" />
<TextView
android:id="@+id/wootric_tv_powered_by"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@font/ibmplexsans"
android:text="@string/wootric_powered_by"
android:textColor="@color/wootric_tablet_text_score_color"/>

<TextView
android:id="@+id/wootric_tv_im"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@font/ibmplexsans"
android:text="@string/wootric"
android:textColor="@color/wootric_tablet_text_score_color"/>
</LinearLayout>

<TextView
android:id="@+id/footer_dot_separator"
Expand Down

0 comments on commit 3f92118

Please sign in to comment.