Panagiotis Triantafyllou

dl gift

No preview for this file type
......@@ -55,8 +55,19 @@
<activity
android:name="ly.warp.sdk.activities.BaseFragmentActivity"
android:exported="false"
android:screenOrientation="portrait" />
android:exported="true"
android:screenOrientation="portrait">
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:host="cosmoteapp.gr"
android:scheme="demo" />
</intent-filter>
</activity>
<!-- Service used for updating user's location. -->
<service
......
package ly.warp.sdk.activities;
import android.app.Dialog;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.view.MenuItem;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
......@@ -12,12 +17,11 @@ import androidx.fragment.app.FragmentActivity;
import com.google.android.material.bottomnavigation.BottomNavigationView;
import com.google.android.material.navigation.NavigationBarView;
import org.json.JSONException;
import java.util.HashMap;
import ly.warp.sdk.R;
import ly.warp.sdk.Warply;
import ly.warp.sdk.db.WarplyDBHelper;
import ly.warp.sdk.fragments.HomeFragment;
import ly.warp.sdk.fragments.LoyaltyFragment;
import ly.warp.sdk.io.callbacks.CallbackReceiver;
......@@ -32,6 +36,7 @@ import ly.warp.sdk.io.request.WarplyConsumerRequest;
import ly.warp.sdk.io.request.WarplyGetCouponsetsRequest;
import ly.warp.sdk.io.request.WarplyInboxRequest;
import ly.warp.sdk.io.request.WarplyUserCouponsRequest;
import ly.warp.sdk.utils.WarpUtils;
import ly.warp.sdk.utils.WarplyProperty;
import ly.warp.sdk.utils.managers.WarplyManager;
import ly.warp.sdk.utils.managers.WarplySessionManager;
......@@ -49,7 +54,7 @@ public class BaseFragmentActivity extends FragmentActivity implements Navigation
private BottomNavigationView mBottomNavigationView;
private Fragment mFragmentToSet = null;
private static Consumer mConsumer;
private static HashMap mUniqueCampaignList = new HashMap<String, CampaignList>();
private static HashMap<String, CampaignList> mUniqueCampaignList = new HashMap<String, CampaignList>();
private static CouponList mCouponList = new CouponList();
private CouponsetsList mCouponsetsList;
......@@ -114,6 +119,54 @@ public class BaseFragmentActivity extends FragmentActivity implements Navigation
// Methods
// ===========================================================
private void handleIntent(Intent intent) {
Uri data = intent.getData();
if (data != null) {
if (intent.getData().getQueryParameterNames().size() > 0 && intent.getData().getQueryParameterNames().contains("participations")) {
String parameter = String.valueOf(intent.getData().getQueryParameter("participations"));
showDialog(parameter);
}
}
}
private void showDialog(String parameter) {
Dialog dialog = new Dialog(this, R.style.PopUpDialog);
dialog.setContentView(R.layout.dl_dialog);
dialog.getWindow().setBackgroundDrawableResource(R.drawable.banner_border_white);
dialog.show();
TextView mTvDlTitle = dialog.findViewById(R.id.tv_dl_subtitle);
LinearLayout mLlRedeem = dialog.findViewById(R.id.ll_dl_redeem);
mTvDlTitle.setText(String.format(getResources().getString(R.string.cos_dl_title), parameter));
mLlRedeem.setOnClickListener(view -> {
if (mUniqueCampaignList != null && !mUniqueCampaignList.isEmpty()) {
if (mUniqueCampaignList.containsKey("lucky_draw") && mUniqueCampaignList.get("lucky_draw").size() > 0) {
String tempUrl = mUniqueCampaignList.get("lucky_draw").get(0).getIndexUrl();
tempUrl = tempUrl
+ "?web_id=" + WarpUtils.getWebId(this)
+ "&app_uuid=" + WarplyProperty.getAppUuid(this)
+ "&api_key=" + WarpUtils.getApiKey(this)
+ "&session_uuid=" + mUniqueCampaignList.get("lucky_draw").get(0).getSessionUUID()
+ "&access_token=" + WarplyDBHelper.getInstance(this).getAuthValue("access_token")
+ "&refresh_token=" + WarplyDBHelper.getInstance(this).getAuthValue("refresh_token")
+ "&client_id=" + WarplyDBHelper.getInstance(this).getClientValue("client_id")
+ "&client_secret=" + WarplyDBHelper.getInstance(this).getClientValue("client_secret");
if (mConsumer != null)
tempUrl = tempUrl + "&auth_token=" + (mConsumer.getUuid());
else
tempUrl = tempUrl + "&auth_token=";
startActivity(WarpViewActivity.createIntentFromURL(this, tempUrl));
dialog.dismiss();
}
}
});
}
public static Consumer getConsumer() {
return mConsumer;
}
......@@ -127,6 +180,7 @@ public class BaseFragmentActivity extends FragmentActivity implements Navigation
}
private void initViews() {
handleIntent(getIntent());
mBottomNavigationView.setOnItemSelectedListener(this);
mFragmentToSet = HomeFragment.newInstance();
getSupportFragmentManager().beginTransaction().add(R.id.fl_fragment, mFragmentToSet).commit();
......
......@@ -119,7 +119,6 @@ public class BillPaymentActivity extends Activity implements View.OnClickListene
}
}
});
}
// ===========================================================
// Inner and Anonymous Classes
......
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:paddingHorizontal="16dp"
android:paddingVertical="56dp">
<TextView
android:id="@+id/tv_dl_title"
android:layout_width="match_parent"
android:layout_height="55dp"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_alignParentEnd="true"
android:layout_marginHorizontal="48dp"
android:gravity="center"
android:text="Έλαβες δώρο!"
android:textColor="#0072C9"
android:textSize="25sp"
android:textStyle="bold"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/tv_dl_subtitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/tv_dl_title"
android:layout_alignParentStart="true"
android:layout_alignParentEnd="true"
android:layout_marginHorizontal="48dp"
android:layout_marginTop="16dp"
android:layout_marginBottom="24dp"
android:gravity="center"
android:textColor="#5B5B5B"
android:textFontWeight="500"
android:textSize="18sp"
tools:text="@string/cos_dl_title" />
<LinearLayout
android:id="@+id/ll_dl_redeem"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_below="@+id/tv_dl_subtitle"
android:layout_marginHorizontal="32dp"
android:layout_marginTop="24dp"
android:background="@drawable/shape_cos_gradient2"
android:gravity="center"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="Εξαργύρωσε τώρα!"
android:textColor="@color/white"
android:textSize="17dp"
android:textStyle="bold" />
</LinearLayout>
</RelativeLayout>
\ No newline at end of file
......@@ -26,6 +26,7 @@
<string name="cos_coupons_loyalty_title">Ενεργά κουπόνια</string>
<string name="cos_coupon_info_title">Εκπτωτικό κουπόνι</string>
<string name="cos_coupon_date">Το κουπόνι ισχύει έως %1$s</string>
<string name="cos_dl_title">Μόλις έλαβες δώρο %1$s συμμετοχές στο My Lucky Day Draw!</string>
<string-array name="coupons_array">
<item>Κουπόνια</item>
......