Panagiotis Triantafyllou

post message from campaign

......@@ -70,20 +70,6 @@ public class BaseFragmentActivity extends FragmentActivity implements Navigation
WarplyManager.getConsumer(new WarplyConsumerRequest(), mConsumerReceiver);
}
}).start();
// new Thread(() -> {
// if (!Thread.currentThread().isInterrupted()) {
// Warply.getInbox(new WarplyInboxRequest().setUseCache(false), mInboxReceiver);
// }
// }).start();
//
// new Thread(() -> {
// if (!Thread.currentThread().isInterrupted()) {
// WarplyManager.getUserCoupons(new WarplyUserCouponsRequest(), mUserCouponsReceiver);
// }
// }).start();
// initViews();
}
@Override
......
......@@ -81,13 +81,13 @@ public class HomeFragment extends Fragment implements View.OnClickListener {
mRecyclerCampaigns.setAdapter(mAdapterCampaigns);
mAdapterCampaigns.getPositionClicks()
.doOnNext(campaign -> {
String tempUrl = BaseFragmentActivity.getUniqueCampaignList().get("lucky_draw").get(0).getIndexUrl();
String tempUrl = campaign.getIndexUrl();
tempUrl = tempUrl
+ "?web_id=" + WarpUtils.getWebId(getContext())
+ "&app_uuid=" + WarplyProperty.getAppUuid(getContext())
+ "&api_key=" + WarpUtils.getApiKey(getContext())
+ "&session_uuid=" + BaseFragmentActivity.getUniqueCampaignList().get("lucky_draw").get(0).getSessionUUID()
+ "&session_uuid=" + campaign.getSessionUUID()
+ "&access_token=" + WarplyDBHelper.getInstance(getContext()).getAuthValue("access_token")
+ "&refresh_token=" + WarplyDBHelper.getInstance(getContext()).getAuthValue("refresh_token")
+ "&client_id=" + WarplyDBHelper.getInstance(getContext()).getClientValue("client_id")
......
......@@ -73,13 +73,13 @@ public class LoyaltyFragment extends Fragment implements View.OnClickListener {
mRecyclerDeals.setAdapter(mAdapterDeals);
mAdapterDeals.getPositionClicks()
.doOnNext(deal -> {
String tempUrl = BaseFragmentActivity.getUniqueCampaignList().get("lucky_draw").get(0).getIndexUrl();
String tempUrl = deal.getIndexUrl();
tempUrl = tempUrl
+ "?web_id=" + WarpUtils.getWebId(getContext())
+ "&app_uuid=" + WarplyProperty.getAppUuid(getContext())
+ "&api_key=" + WarpUtils.getApiKey(getContext())
+ "&session_uuid=" + BaseFragmentActivity.getUniqueCampaignList().get("lucky_draw").get(0).getSessionUUID()
+ "&session_uuid=" + deal.getSessionUUID()
+ "&access_token=" + WarplyDBHelper.getInstance(getContext()).getAuthValue("access_token")
+ "&refresh_token=" + WarplyDBHelper.getInstance(getContext()).getAuthValue("refresh_token")
+ "&client_id=" + WarplyDBHelper.getInstance(getContext()).getClientValue("client_id")
......@@ -102,13 +102,13 @@ public class LoyaltyFragment extends Fragment implements View.OnClickListener {
mRecyclerGifts.setAdapter(mAdapterGifts);
mAdapterGifts.getPositionClicks()
.doOnNext(gift -> {
String tempUrl = BaseFragmentActivity.getUniqueCampaignList().get("lucky_draw").get(0).getIndexUrl();
String tempUrl = gift.getIndexUrl();
tempUrl = tempUrl
+ "?web_id=" + WarpUtils.getWebId(getContext())
+ "&app_uuid=" + WarplyProperty.getAppUuid(getContext())
+ "&api_key=" + WarpUtils.getApiKey(getContext())
+ "&session_uuid=" + BaseFragmentActivity.getUniqueCampaignList().get("lucky_draw").get(0).getSessionUUID()
+ "&session_uuid=" + gift.getSessionUUID()
+ "&access_token=" + WarplyDBHelper.getInstance(getContext()).getAuthValue("access_token")
+ "&refresh_token=" + WarplyDBHelper.getInstance(getContext()).getAuthValue("refresh_token")
+ "&client_id=" + WarplyDBHelper.getInstance(getContext()).getClientValue("client_id")
......@@ -131,13 +131,13 @@ public class LoyaltyFragment extends Fragment implements View.OnClickListener {
mRecyclerMore.setAdapter(mAdapterMore);
mAdapterMore.getPositionClicks()
.doOnNext(more -> {
String tempUrl = BaseFragmentActivity.getUniqueCampaignList().get("lucky_draw").get(0).getIndexUrl();
String tempUrl = more.getIndexUrl();
tempUrl = tempUrl
+ "?web_id=" + WarpUtils.getWebId(getContext())
+ "&app_uuid=" + WarplyProperty.getAppUuid(getContext())
+ "&api_key=" + WarpUtils.getApiKey(getContext())
+ "&session_uuid=" + BaseFragmentActivity.getUniqueCampaignList().get("lucky_draw").get(0).getSessionUUID()
+ "&session_uuid=" + more.getSessionUUID()
+ "&access_token=" + WarplyDBHelper.getInstance(getContext()).getAuthValue("access_token")
+ "&refresh_token=" + WarplyDBHelper.getInstance(getContext()).getAuthValue("refresh_token")
+ "&client_id=" + WarplyDBHelper.getInstance(getContext()).getClientValue("client_id")
......
......@@ -40,7 +40,9 @@ import androidx.core.content.ContextCompat;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.util.Log;
import android.webkit.GeolocationPermissions.Callback;
import android.webkit.JavascriptInterface;
import android.webkit.SslErrorHandler;
import android.webkit.WebChromeClient;
import android.webkit.WebSettings;
......@@ -124,6 +126,7 @@ public class WarpView extends WebView {
settings.setGeolocationDatabasePath(getContext().getCacheDir().getAbsolutePath());
settings.setGeolocationEnabled(true);
settings.setBuiltInZoomControls(true);
WarpView.this.addJavascriptInterface(new JSInterface(), "Cosmote");
setBackgroundColor(ContextCompat.getColor(getContext(), android.R.color.transparent));
setWebViewClient(new WarplyWebViewClient());
setWebChromeClient(new WarplyWebChromeClient());
......@@ -356,6 +359,16 @@ public class WarpView extends WebView {
// Inner and Anonymous Classes
// ===========================================================
public class JSInterface {
@JavascriptInterface
public void sendMessage(String message) {
Intent intent = new Intent(android.content.Intent.ACTION_SEND);
intent.setType("text/plain");
intent.putExtra(android.content.Intent.EXTRA_TEXT, message);
getContext().startActivity(Intent.createChooser(intent, "Άνοιγμα με"));
}
}
public interface ProgressChangeListener {
void onProgressChanged(WebView view, int newProgress);
}
......