Showing
6 changed files
with
134 additions
and
6 deletions
keystore/warplydemo.jks
deleted
100644 → 0
No preview for this file type
... | @@ -55,8 +55,19 @@ | ... | @@ -55,8 +55,19 @@ |
55 | 55 | ||
56 | <activity | 56 | <activity |
57 | android:name="ly.warp.sdk.activities.BaseFragmentActivity" | 57 | android:name="ly.warp.sdk.activities.BaseFragmentActivity" |
58 | - android:exported="false" | 58 | + android:exported="true" |
59 | - android:screenOrientation="portrait" /> | 59 | + android:screenOrientation="portrait"> |
60 | + <intent-filter android:autoVerify="true"> | ||
61 | + <action android:name="android.intent.action.VIEW" /> | ||
62 | + | ||
63 | + <category android:name="android.intent.category.DEFAULT" /> | ||
64 | + <category android:name="android.intent.category.BROWSABLE" /> | ||
65 | + | ||
66 | + <data | ||
67 | + android:host="cosmoteapp.gr" | ||
68 | + android:scheme="demo" /> | ||
69 | + </intent-filter> | ||
70 | + </activity> | ||
60 | 71 | ||
61 | <!-- Service used for updating user's location. --> | 72 | <!-- Service used for updating user's location. --> |
62 | <service | 73 | <service | ... | ... |
1 | package ly.warp.sdk.activities; | 1 | package ly.warp.sdk.activities; |
2 | 2 | ||
3 | +import android.app.Dialog; | ||
4 | +import android.content.Intent; | ||
5 | +import android.net.Uri; | ||
3 | import android.os.Bundle; | 6 | import android.os.Bundle; |
4 | import android.os.Handler; | 7 | import android.os.Handler; |
5 | import android.os.Looper; | 8 | import android.os.Looper; |
6 | import android.view.MenuItem; | 9 | import android.view.MenuItem; |
10 | +import android.widget.LinearLayout; | ||
11 | +import android.widget.TextView; | ||
7 | 12 | ||
8 | import androidx.annotation.NonNull; | 13 | import androidx.annotation.NonNull; |
9 | import androidx.fragment.app.Fragment; | 14 | import androidx.fragment.app.Fragment; |
... | @@ -12,12 +17,11 @@ import androidx.fragment.app.FragmentActivity; | ... | @@ -12,12 +17,11 @@ import androidx.fragment.app.FragmentActivity; |
12 | import com.google.android.material.bottomnavigation.BottomNavigationView; | 17 | import com.google.android.material.bottomnavigation.BottomNavigationView; |
13 | import com.google.android.material.navigation.NavigationBarView; | 18 | import com.google.android.material.navigation.NavigationBarView; |
14 | 19 | ||
15 | -import org.json.JSONException; | ||
16 | - | ||
17 | import java.util.HashMap; | 20 | import java.util.HashMap; |
18 | 21 | ||
19 | import ly.warp.sdk.R; | 22 | import ly.warp.sdk.R; |
20 | import ly.warp.sdk.Warply; | 23 | import ly.warp.sdk.Warply; |
24 | +import ly.warp.sdk.db.WarplyDBHelper; | ||
21 | import ly.warp.sdk.fragments.HomeFragment; | 25 | import ly.warp.sdk.fragments.HomeFragment; |
22 | import ly.warp.sdk.fragments.LoyaltyFragment; | 26 | import ly.warp.sdk.fragments.LoyaltyFragment; |
23 | import ly.warp.sdk.io.callbacks.CallbackReceiver; | 27 | import ly.warp.sdk.io.callbacks.CallbackReceiver; |
... | @@ -32,6 +36,7 @@ import ly.warp.sdk.io.request.WarplyConsumerRequest; | ... | @@ -32,6 +36,7 @@ import ly.warp.sdk.io.request.WarplyConsumerRequest; |
32 | import ly.warp.sdk.io.request.WarplyGetCouponsetsRequest; | 36 | import ly.warp.sdk.io.request.WarplyGetCouponsetsRequest; |
33 | import ly.warp.sdk.io.request.WarplyInboxRequest; | 37 | import ly.warp.sdk.io.request.WarplyInboxRequest; |
34 | import ly.warp.sdk.io.request.WarplyUserCouponsRequest; | 38 | import ly.warp.sdk.io.request.WarplyUserCouponsRequest; |
39 | +import ly.warp.sdk.utils.WarpUtils; | ||
35 | import ly.warp.sdk.utils.WarplyProperty; | 40 | import ly.warp.sdk.utils.WarplyProperty; |
36 | import ly.warp.sdk.utils.managers.WarplyManager; | 41 | import ly.warp.sdk.utils.managers.WarplyManager; |
37 | import ly.warp.sdk.utils.managers.WarplySessionManager; | 42 | import ly.warp.sdk.utils.managers.WarplySessionManager; |
... | @@ -49,7 +54,7 @@ public class BaseFragmentActivity extends FragmentActivity implements Navigation | ... | @@ -49,7 +54,7 @@ public class BaseFragmentActivity extends FragmentActivity implements Navigation |
49 | private BottomNavigationView mBottomNavigationView; | 54 | private BottomNavigationView mBottomNavigationView; |
50 | private Fragment mFragmentToSet = null; | 55 | private Fragment mFragmentToSet = null; |
51 | private static Consumer mConsumer; | 56 | private static Consumer mConsumer; |
52 | - private static HashMap mUniqueCampaignList = new HashMap<String, CampaignList>(); | 57 | + private static HashMap<String, CampaignList> mUniqueCampaignList = new HashMap<String, CampaignList>(); |
53 | private static CouponList mCouponList = new CouponList(); | 58 | private static CouponList mCouponList = new CouponList(); |
54 | private CouponsetsList mCouponsetsList; | 59 | private CouponsetsList mCouponsetsList; |
55 | 60 | ||
... | @@ -114,6 +119,54 @@ public class BaseFragmentActivity extends FragmentActivity implements Navigation | ... | @@ -114,6 +119,54 @@ public class BaseFragmentActivity extends FragmentActivity implements Navigation |
114 | // Methods | 119 | // Methods |
115 | // =========================================================== | 120 | // =========================================================== |
116 | 121 | ||
122 | + private void handleIntent(Intent intent) { | ||
123 | + Uri data = intent.getData(); | ||
124 | + if (data != null) { | ||
125 | + if (intent.getData().getQueryParameterNames().size() > 0 && intent.getData().getQueryParameterNames().contains("participations")) { | ||
126 | + String parameter = String.valueOf(intent.getData().getQueryParameter("participations")); | ||
127 | + showDialog(parameter); | ||
128 | + } | ||
129 | + } | ||
130 | + } | ||
131 | + | ||
132 | + private void showDialog(String parameter) { | ||
133 | + Dialog dialog = new Dialog(this, R.style.PopUpDialog); | ||
134 | + dialog.setContentView(R.layout.dl_dialog); | ||
135 | + dialog.getWindow().setBackgroundDrawableResource(R.drawable.banner_border_white); | ||
136 | + dialog.show(); | ||
137 | + | ||
138 | + TextView mTvDlTitle = dialog.findViewById(R.id.tv_dl_subtitle); | ||
139 | + LinearLayout mLlRedeem = dialog.findViewById(R.id.ll_dl_redeem); | ||
140 | + | ||
141 | + mTvDlTitle.setText(String.format(getResources().getString(R.string.cos_dl_title), parameter)); | ||
142 | + | ||
143 | + mLlRedeem.setOnClickListener(view -> { | ||
144 | + if (mUniqueCampaignList != null && !mUniqueCampaignList.isEmpty()) { | ||
145 | + if (mUniqueCampaignList.containsKey("lucky_draw") && mUniqueCampaignList.get("lucky_draw").size() > 0) { | ||
146 | + String tempUrl = mUniqueCampaignList.get("lucky_draw").get(0).getIndexUrl(); | ||
147 | + | ||
148 | + tempUrl = tempUrl | ||
149 | + + "?web_id=" + WarpUtils.getWebId(this) | ||
150 | + + "&app_uuid=" + WarplyProperty.getAppUuid(this) | ||
151 | + + "&api_key=" + WarpUtils.getApiKey(this) | ||
152 | + + "&session_uuid=" + mUniqueCampaignList.get("lucky_draw").get(0).getSessionUUID() | ||
153 | + + "&access_token=" + WarplyDBHelper.getInstance(this).getAuthValue("access_token") | ||
154 | + + "&refresh_token=" + WarplyDBHelper.getInstance(this).getAuthValue("refresh_token") | ||
155 | + + "&client_id=" + WarplyDBHelper.getInstance(this).getClientValue("client_id") | ||
156 | + + "&client_secret=" + WarplyDBHelper.getInstance(this).getClientValue("client_secret"); | ||
157 | + | ||
158 | + if (mConsumer != null) | ||
159 | + tempUrl = tempUrl + "&auth_token=" + (mConsumer.getUuid()); | ||
160 | + else | ||
161 | + tempUrl = tempUrl + "&auth_token="; | ||
162 | + | ||
163 | + startActivity(WarpViewActivity.createIntentFromURL(this, tempUrl)); | ||
164 | + dialog.dismiss(); | ||
165 | + } | ||
166 | + } | ||
167 | + }); | ||
168 | + } | ||
169 | + | ||
117 | public static Consumer getConsumer() { | 170 | public static Consumer getConsumer() { |
118 | return mConsumer; | 171 | return mConsumer; |
119 | } | 172 | } |
... | @@ -127,6 +180,7 @@ public class BaseFragmentActivity extends FragmentActivity implements Navigation | ... | @@ -127,6 +180,7 @@ public class BaseFragmentActivity extends FragmentActivity implements Navigation |
127 | } | 180 | } |
128 | 181 | ||
129 | private void initViews() { | 182 | private void initViews() { |
183 | + handleIntent(getIntent()); | ||
130 | mBottomNavigationView.setOnItemSelectedListener(this); | 184 | mBottomNavigationView.setOnItemSelectedListener(this); |
131 | mFragmentToSet = HomeFragment.newInstance(); | 185 | mFragmentToSet = HomeFragment.newInstance(); |
132 | getSupportFragmentManager().beginTransaction().add(R.id.fl_fragment, mFragmentToSet).commit(); | 186 | getSupportFragmentManager().beginTransaction().add(R.id.fl_fragment, mFragmentToSet).commit(); | ... | ... |
... | @@ -119,7 +119,6 @@ public class BillPaymentActivity extends Activity implements View.OnClickListene | ... | @@ -119,7 +119,6 @@ public class BillPaymentActivity extends Activity implements View.OnClickListene |
119 | } | 119 | } |
120 | } | 120 | } |
121 | }); | 121 | }); |
122 | - | ||
123 | } | 122 | } |
124 | // =========================================================== | 123 | // =========================================================== |
125 | // Inner and Anonymous Classes | 124 | // Inner and Anonymous Classes | ... | ... |
1 | +<?xml version="1.0" encoding="utf-8"?> | ||
2 | +<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
3 | + xmlns:app="http://schemas.android.com/apk/res-auto" | ||
4 | + xmlns:tools="http://schemas.android.com/tools" | ||
5 | + android:layout_width="match_parent" | ||
6 | + android:layout_height="wrap_content" | ||
7 | + android:layout_gravity="center_horizontal" | ||
8 | + android:paddingHorizontal="16dp" | ||
9 | + android:paddingVertical="56dp"> | ||
10 | + | ||
11 | + <TextView | ||
12 | + android:id="@+id/tv_dl_title" | ||
13 | + android:layout_width="match_parent" | ||
14 | + android:layout_height="55dp" | ||
15 | + android:layout_alignParentStart="true" | ||
16 | + android:layout_alignParentTop="true" | ||
17 | + android:layout_alignParentEnd="true" | ||
18 | + android:layout_marginHorizontal="48dp" | ||
19 | + android:gravity="center" | ||
20 | + android:text="Έλαβες δώρο!" | ||
21 | + android:textColor="#0072C9" | ||
22 | + android:textSize="25sp" | ||
23 | + android:textStyle="bold" | ||
24 | + app:layout_constraintTop_toTopOf="parent" /> | ||
25 | + | ||
26 | + <TextView | ||
27 | + android:id="@+id/tv_dl_subtitle" | ||
28 | + android:layout_width="match_parent" | ||
29 | + android:layout_height="wrap_content" | ||
30 | + android:layout_below="@+id/tv_dl_title" | ||
31 | + android:layout_alignParentStart="true" | ||
32 | + android:layout_alignParentEnd="true" | ||
33 | + android:layout_marginHorizontal="48dp" | ||
34 | + android:layout_marginTop="16dp" | ||
35 | + android:layout_marginBottom="24dp" | ||
36 | + android:gravity="center" | ||
37 | + android:textColor="#5B5B5B" | ||
38 | + android:textFontWeight="500" | ||
39 | + android:textSize="18sp" | ||
40 | + tools:text="@string/cos_dl_title" /> | ||
41 | + | ||
42 | + <LinearLayout | ||
43 | + android:id="@+id/ll_dl_redeem" | ||
44 | + android:layout_width="match_parent" | ||
45 | + android:layout_height="50dp" | ||
46 | + android:layout_below="@+id/tv_dl_subtitle" | ||
47 | + android:layout_marginHorizontal="32dp" | ||
48 | + android:layout_marginTop="24dp" | ||
49 | + android:background="@drawable/shape_cos_gradient2" | ||
50 | + android:gravity="center" | ||
51 | + android:orientation="horizontal"> | ||
52 | + | ||
53 | + <TextView | ||
54 | + android:layout_width="wrap_content" | ||
55 | + android:layout_height="wrap_content" | ||
56 | + android:gravity="center" | ||
57 | + android:text="Εξαργύρωσε τώρα!" | ||
58 | + android:textColor="@color/white" | ||
59 | + android:textSize="17dp" | ||
60 | + android:textStyle="bold" /> | ||
61 | + </LinearLayout> | ||
62 | + | ||
63 | +</RelativeLayout> | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
... | @@ -26,6 +26,7 @@ | ... | @@ -26,6 +26,7 @@ |
26 | <string name="cos_coupons_loyalty_title">Ενεργά κουπόνια</string> | 26 | <string name="cos_coupons_loyalty_title">Ενεργά κουπόνια</string> |
27 | <string name="cos_coupon_info_title">Εκπτωτικό κουπόνι</string> | 27 | <string name="cos_coupon_info_title">Εκπτωτικό κουπόνι</string> |
28 | <string name="cos_coupon_date">Το κουπόνι ισχύει έως %1$s</string> | 28 | <string name="cos_coupon_date">Το κουπόνι ισχύει έως %1$s</string> |
29 | + <string name="cos_dl_title">Μόλις έλαβες δώρο %1$s συμμετοχές στο My Lucky Day Draw!</string> | ||
29 | 30 | ||
30 | <string-array name="coupons_array"> | 31 | <string-array name="coupons_array"> |
31 | <item>Κουπόνια</item> | 32 | <item>Κουπόνια</item> | ... | ... |
-
Please register or login to post a comment