Panagiotis Triantafyllou

more additions

...@@ -46,4 +46,4 @@ LoginType=msisdn ...@@ -46,4 +46,4 @@ LoginType=msisdn
46 46
47 # The deeplink url scheme for react native campaigns: 47 # The deeplink url scheme for react native campaigns:
48 # Example visit.greece.gr 48 # Example visit.greece.gr
49 -#DL_URL_SCHEME=
...\ No newline at end of file ...\ No newline at end of file
49 +DL_URL_SCHEME=demo
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -2,7 +2,7 @@ apply plugin: 'com.android.library' ...@@ -2,7 +2,7 @@ apply plugin: 'com.android.library'
2 2
3 ext { 3 ext {
4 PUBLISH_GROUP_ID = 'ly.warp' 4 PUBLISH_GROUP_ID = 'ly.warp'
5 - PUBLISH_VERSION = '4.5.4-cos2' 5 + PUBLISH_VERSION = '4.5.4-cos3'
6 PUBLISH_ARTIFACT_ID = 'warply-android-sdk' 6 PUBLISH_ARTIFACT_ID = 'warply-android-sdk'
7 } 7 }
8 8
......
...@@ -66,6 +66,11 @@ ...@@ -66,6 +66,11 @@
66 <data 66 <data
67 android:host="cosmoteapp.gr" 67 android:host="cosmoteapp.gr"
68 android:scheme="demo" /> 68 android:scheme="demo" />
69 +
70 + <data
71 + android:host="cosmoteapp.gr"
72 + android:pathPrefix="/payment"
73 + android:scheme="demo" />
69 </intent-filter> 74 </intent-filter>
70 </activity> 75 </activity>
71 76
......
...@@ -126,6 +126,10 @@ public class BaseFragmentActivity extends FragmentActivity implements Navigation ...@@ -126,6 +126,10 @@ public class BaseFragmentActivity extends FragmentActivity implements Navigation
126 String parameter = String.valueOf(intent.getData().getQueryParameter("participations")); 126 String parameter = String.valueOf(intent.getData().getQueryParameter("participations"));
127 showDialog(parameter); 127 showDialog(parameter);
128 } 128 }
129 + if (data.getPath().equals("/payment")) {
130 + Intent intentBill = new Intent(BaseFragmentActivity.this, BillPaymentActivity.class);
131 + startActivity(intentBill);
132 + }
129 } 133 }
130 } 134 }
131 135
......
...@@ -2,8 +2,20 @@ package ly.warp.sdk.activities; ...@@ -2,8 +2,20 @@ package ly.warp.sdk.activities;
2 2
3 import android.app.Activity; 3 import android.app.Activity;
4 import android.app.Dialog; 4 import android.app.Dialog;
5 +import android.app.Notification;
6 +import android.app.NotificationChannel;
7 +import android.app.NotificationManager;
8 +import android.app.PendingIntent;
9 +import android.content.Context;
10 +import android.content.Intent;
11 +import android.content.pm.PackageManager;
12 +import android.graphics.BitmapFactory;
5 import android.graphics.Typeface; 13 import android.graphics.Typeface;
14 +import android.net.Uri;
15 +import android.os.Build;
6 import android.os.Bundle; 16 import android.os.Bundle;
17 +import android.os.Handler;
18 +import android.os.Looper;
7 import android.text.Spannable; 19 import android.text.Spannable;
8 import android.text.SpannableString; 20 import android.text.SpannableString;
9 import android.text.SpannableStringBuilder; 21 import android.text.SpannableStringBuilder;
...@@ -14,6 +26,8 @@ import android.widget.ImageView; ...@@ -14,6 +26,8 @@ import android.widget.ImageView;
14 import android.widget.LinearLayout; 26 import android.widget.LinearLayout;
15 import android.widget.TextView; 27 import android.widget.TextView;
16 28
29 +import androidx.core.app.NotificationCompat;
30 +
17 import ly.warp.sdk.R; 31 import ly.warp.sdk.R;
18 import ly.warp.sdk.db.WarplyDBHelper; 32 import ly.warp.sdk.db.WarplyDBHelper;
19 import ly.warp.sdk.utils.WarpUtils; 33 import ly.warp.sdk.utils.WarpUtils;
...@@ -54,14 +68,41 @@ public class BillPaymentActivity extends Activity implements View.OnClickListene ...@@ -54,14 +68,41 @@ public class BillPaymentActivity extends Activity implements View.OnClickListene
54 } 68 }
55 69
56 @Override 70 @Override
71 + protected void onNewIntent(Intent intent) {
72 + super.onNewIntent(intent);
73 + if (intent.hasExtra("channel")) {
74 + String tempUrl = BaseFragmentActivity.getUniqueCampaignList().get("lucky_draw").get(0).getIndexUrl();
75 +
76 + tempUrl = tempUrl
77 + + "?web_id=" + WarpUtils.getWebId(this)
78 + + "&app_uuid=" + WarplyProperty.getAppUuid(this)
79 + + "&api_key=" + WarpUtils.getApiKey(this)
80 + + "&session_uuid=" + BaseFragmentActivity.getUniqueCampaignList().get("lucky_draw").get(0).getSessionUUID()
81 + + "&access_token=" + WarplyDBHelper.getInstance(this).getAuthValue("access_token")
82 + + "&refresh_token=" + WarplyDBHelper.getInstance(this).getAuthValue("refresh_token")
83 + + "&client_id=" + WarplyDBHelper.getInstance(this).getClientValue("client_id")
84 + + "&client_secret=" + WarplyDBHelper.getInstance(this).getClientValue("client_secret");
85 +
86 + if (BaseFragmentActivity.getConsumer() != null)
87 + tempUrl = tempUrl + "&auth_token=" + (BaseFragmentActivity.getConsumer().getUuid());
88 + else
89 + tempUrl = tempUrl + "&auth_token=";
90 +
91 + startActivity(WarpViewActivity.createIntentFromURL(this, tempUrl));
92 + }
93 + }
94 +
95 + @Override
57 public void onClick(View view) { 96 public void onClick(View view) {
58 if (view.getId() == R.id.iv_bill_payment_close) { 97 if (view.getId() == R.id.iv_bill_payment_close) {
59 onBackPressed(); 98 onBackPressed();
60 return; 99 return;
61 } 100 }
62 if (view.getId() == R.id.button_pay) { 101 if (view.getId() == R.id.button_pay) {
63 - // open dialog
64 showDialog(); 102 showDialog();
103 + new Handler(Looper.getMainLooper()).postDelayed(
104 + () -> createLocalNotification(BillPaymentActivity.this),
105 + 3000);
65 } 106 }
66 } 107 }
67 108
...@@ -69,6 +110,50 @@ public class BillPaymentActivity extends Activity implements View.OnClickListene ...@@ -69,6 +110,50 @@ public class BillPaymentActivity extends Activity implements View.OnClickListene
69 // Methods 110 // Methods
70 // =========================================================== 111 // ===========================================================
71 112
113 + private void createLocalNotification(Context context) {
114 + PendingIntent pendingIntent;
115 + Intent notifyIntent;
116 + notifyIntent = new Intent(this, BillPaymentActivity.class).putExtra("channel", "paymentNotify");
117 + notifyIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
118 +
119 + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
120 + pendingIntent = PendingIntent.getActivity(context, 1001, notifyIntent, PendingIntent.FLAG_ONE_SHOT | PendingIntent.FLAG_MUTABLE);
121 + } else {
122 + pendingIntent = PendingIntent.getActivity(context, 1001, notifyIntent, PendingIntent.FLAG_ONE_SHOT);
123 + }
124 +
125 + NotificationCompat.Builder b = new NotificationCompat.Builder(this, "paymentNotify")
126 + .setSmallIcon(R.drawable.gift_icon)
127 + .setLargeIcon(BitmapFactory.decodeResource(getApplicationContext().getResources(), R.drawable.ic_launcher))
128 + .setContentTitle("Συγχαρητήρια!")
129 + .setContentText("Ξεκλείδωσες το My Lucky Draw με την πληρωμή του λογαριασμού σου! Πάρε μέρος στις κληρώσεις!")
130 + .setStyle(new NotificationCompat.BigTextStyle()
131 + .bigText("Ξεκλείδωσες το My Lucky Draw με την πληρωμή του λογαριασμού σου! Πάρε μέρος στις κληρώσεις!"))
132 + .setAutoCancel(true)
133 + .setVibrate(new long[0])
134 + .setDefaults(Notification.DEFAULT_ALL)
135 + .setChannelId("paymentNotify")
136 + .setPriority(Notification.PRIORITY_HIGH)
137 + .setContentIntent(pendingIntent);
138 +
139 + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
140 + NotificationChannel notificationChannel = new NotificationChannel("paymentNotify", "paymentNotify", NotificationManager.IMPORTANCE_HIGH);
141 + notificationChannel.setLockscreenVisibility(Notification.VISIBILITY_PUBLIC);
142 + notificationChannel.setDescription("Ξεκλείδωσες το My Lucky Draw με την πληρωμή του λογαριασμού σου! Πάρε μέρος στις κληρώσεις!");
143 + notificationChannel.setShowBadge(true);
144 + NotificationManager nm = getSystemService(NotificationManager.class);
145 + nm.createNotificationChannel(notificationChannel);
146 + Notification notification_build = b.setChannelId("paymentNotify").build();
147 + notification_build.flags = Notification.FLAG_AUTO_CANCEL;
148 + nm.notify(1001, notification_build);
149 + } else {
150 + NotificationManager nm = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
151 + Notification notification_build = b.build();
152 + notification_build.flags = Notification.FLAG_AUTO_CANCEL;
153 + nm.notify(1001, notification_build);
154 + }
155 + }
156 +
72 private void initViews() { 157 private void initViews() {
73 mIvBack.setOnClickListener(this); 158 mIvBack.setOnClickListener(this);
74 mPayBtn.setOnClickListener(this); 159 mPayBtn.setOnClickListener(this);
......