Panagiotis Triantafyllou

added event for to go back

......@@ -5,6 +5,7 @@ import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.text.SpannableStringBuilder;
import android.text.Spanned;
import android.view.View;
......@@ -13,6 +14,7 @@ import android.widget.RelativeLayout;
import android.widget.TextView;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import java.util.Locale;
......@@ -75,6 +77,19 @@ public class LoyaltyHistoryActivity extends Activity implements View.OnClickList
}
@Override
public void onStart() {
super.onStart();
if (!EventBus.getDefault().isRegistered(this))
EventBus.getDefault().register(this);
}
@Override
public void onDestroy() {
super.onDestroy();
EventBus.getDefault().unregister(this);
}
@Override
public void onResume() {
super.onResume();
WarplyAnalyticsManager.logTrackersEvent(this, "screen", "HistoryScreen");
......@@ -106,6 +121,13 @@ public class LoyaltyHistoryActivity extends Activity implements View.OnClickList
}
}
@Subscribe()
public void onMessageEvent(WarplyEventBusManager event) {
if (event.getNavigateBackEventModel() != null) {
onBackPressed();
}
}
@Override
public void onClick(View view) {
if (view.getId() == R.id.iv_loyalty_history_close) {
......
/*
* Copyright 2010-2013 Warply Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE WARPLY LTD ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
* EVENT SHALL WARPLY LTD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package ly.warp.sdk.io.models;
/**
* Created by Panagiotis Triantafyllou on 11-Apr-24.
*/
public class WarplyNavigateBackEventModel {
private boolean goBack;
public WarplyNavigateBackEventModel() {
this.goBack = true;
}
public boolean isGoBack() {
return goBack;
}
public void setGoBack(boolean goBack) {
this.goBack = goBack;
}
}
......@@ -24,6 +24,7 @@ import ly.warp.sdk.io.models.VouchersServiceUnavailableEventModel;
import ly.warp.sdk.io.models.WarplyCCMSEnabledModel;
import ly.warp.sdk.io.models.WarplyCouponsChangedEventModel;
import ly.warp.sdk.io.models.WarplyDealsAnalysisEventModel;
import ly.warp.sdk.io.models.WarplyNavigateBackEventModel;
import ly.warp.sdk.io.models.WarplyPacingCardEventModel;
import ly.warp.sdk.io.models.WarplyPacingCardServiceEnabledModel;
import ly.warp.sdk.io.models.WarplyPacingEventModel;
......@@ -56,6 +57,7 @@ public class WarplyEventBusManager {
private RefreshVouchersEventModel vouchersRefreshed;
private UnifiedCouponsEventModel unifiedCouponsAdded;
private RefreshUnifiedCouponsEventModel refreshUnifiedCouponsAdded;
private WarplyNavigateBackEventModel navigateBackEvent;
private LoyaltyEventModel campaignsAdded;
private HealthEventModel healthAdded;
private WarplyCouponsChangedEventModel couponsChanged;
......@@ -127,6 +129,10 @@ public class WarplyEventBusManager {
this.refreshUnifiedCouponsAdded = refreshUnifiedCouponsAdded;
}
public WarplyEventBusManager(WarplyNavigateBackEventModel navigateBackEvent) {
this.navigateBackEvent = navigateBackEvent;
}
public WarplyEventBusManager(WarplyPacingCardEventModel widgetChanged) {
this.widgetChanged = widgetChanged;
}
......@@ -321,6 +327,10 @@ public class WarplyEventBusManager {
return serviceUnavailable;
}
public WarplyNavigateBackEventModel getNavigateBackEventModel() {
return navigateBackEvent;
}
public RefreshVouchersEventModel getRefreshVouchersEventModel() {
return vouchersRefreshed;
}
......