Showing
4 changed files
with
21 additions
and
22 deletions
| ... | @@ -70,20 +70,6 @@ public class BaseFragmentActivity extends FragmentActivity implements Navigation | ... | @@ -70,20 +70,6 @@ public class BaseFragmentActivity extends FragmentActivity implements Navigation |
| 70 | WarplyManager.getConsumer(new WarplyConsumerRequest(), mConsumerReceiver); | 70 | WarplyManager.getConsumer(new WarplyConsumerRequest(), mConsumerReceiver); |
| 71 | } | 71 | } |
| 72 | }).start(); | 72 | }).start(); |
| 73 | - | ||
| 74 | -// new Thread(() -> { | ||
| 75 | -// if (!Thread.currentThread().isInterrupted()) { | ||
| 76 | -// Warply.getInbox(new WarplyInboxRequest().setUseCache(false), mInboxReceiver); | ||
| 77 | -// } | ||
| 78 | -// }).start(); | ||
| 79 | -// | ||
| 80 | -// new Thread(() -> { | ||
| 81 | -// if (!Thread.currentThread().isInterrupted()) { | ||
| 82 | -// WarplyManager.getUserCoupons(new WarplyUserCouponsRequest(), mUserCouponsReceiver); | ||
| 83 | -// } | ||
| 84 | -// }).start(); | ||
| 85 | - | ||
| 86 | -// initViews(); | ||
| 87 | } | 73 | } |
| 88 | 74 | ||
| 89 | @Override | 75 | @Override | ... | ... |
| ... | @@ -81,13 +81,13 @@ public class HomeFragment extends Fragment implements View.OnClickListener { | ... | @@ -81,13 +81,13 @@ public class HomeFragment extends Fragment implements View.OnClickListener { |
| 81 | mRecyclerCampaigns.setAdapter(mAdapterCampaigns); | 81 | mRecyclerCampaigns.setAdapter(mAdapterCampaigns); |
| 82 | mAdapterCampaigns.getPositionClicks() | 82 | mAdapterCampaigns.getPositionClicks() |
| 83 | .doOnNext(campaign -> { | 83 | .doOnNext(campaign -> { |
| 84 | - String tempUrl = BaseFragmentActivity.getUniqueCampaignList().get("lucky_draw").get(0).getIndexUrl(); | 84 | + String tempUrl = campaign.getIndexUrl(); |
| 85 | 85 | ||
| 86 | tempUrl = tempUrl | 86 | tempUrl = tempUrl |
| 87 | + "?web_id=" + WarpUtils.getWebId(getContext()) | 87 | + "?web_id=" + WarpUtils.getWebId(getContext()) |
| 88 | + "&app_uuid=" + WarplyProperty.getAppUuid(getContext()) | 88 | + "&app_uuid=" + WarplyProperty.getAppUuid(getContext()) |
| 89 | + "&api_key=" + WarpUtils.getApiKey(getContext()) | 89 | + "&api_key=" + WarpUtils.getApiKey(getContext()) |
| 90 | - + "&session_uuid=" + BaseFragmentActivity.getUniqueCampaignList().get("lucky_draw").get(0).getSessionUUID() | 90 | + + "&session_uuid=" + campaign.getSessionUUID() |
| 91 | + "&access_token=" + WarplyDBHelper.getInstance(getContext()).getAuthValue("access_token") | 91 | + "&access_token=" + WarplyDBHelper.getInstance(getContext()).getAuthValue("access_token") |
| 92 | + "&refresh_token=" + WarplyDBHelper.getInstance(getContext()).getAuthValue("refresh_token") | 92 | + "&refresh_token=" + WarplyDBHelper.getInstance(getContext()).getAuthValue("refresh_token") |
| 93 | + "&client_id=" + WarplyDBHelper.getInstance(getContext()).getClientValue("client_id") | 93 | + "&client_id=" + WarplyDBHelper.getInstance(getContext()).getClientValue("client_id") | ... | ... |
| ... | @@ -73,13 +73,13 @@ public class LoyaltyFragment extends Fragment implements View.OnClickListener { | ... | @@ -73,13 +73,13 @@ public class LoyaltyFragment extends Fragment implements View.OnClickListener { |
| 73 | mRecyclerDeals.setAdapter(mAdapterDeals); | 73 | mRecyclerDeals.setAdapter(mAdapterDeals); |
| 74 | mAdapterDeals.getPositionClicks() | 74 | mAdapterDeals.getPositionClicks() |
| 75 | .doOnNext(deal -> { | 75 | .doOnNext(deal -> { |
| 76 | - String tempUrl = BaseFragmentActivity.getUniqueCampaignList().get("lucky_draw").get(0).getIndexUrl(); | 76 | + String tempUrl = deal.getIndexUrl(); |
| 77 | 77 | ||
| 78 | tempUrl = tempUrl | 78 | tempUrl = tempUrl |
| 79 | + "?web_id=" + WarpUtils.getWebId(getContext()) | 79 | + "?web_id=" + WarpUtils.getWebId(getContext()) |
| 80 | + "&app_uuid=" + WarplyProperty.getAppUuid(getContext()) | 80 | + "&app_uuid=" + WarplyProperty.getAppUuid(getContext()) |
| 81 | + "&api_key=" + WarpUtils.getApiKey(getContext()) | 81 | + "&api_key=" + WarpUtils.getApiKey(getContext()) |
| 82 | - + "&session_uuid=" + BaseFragmentActivity.getUniqueCampaignList().get("lucky_draw").get(0).getSessionUUID() | 82 | + + "&session_uuid=" + deal.getSessionUUID() |
| 83 | + "&access_token=" + WarplyDBHelper.getInstance(getContext()).getAuthValue("access_token") | 83 | + "&access_token=" + WarplyDBHelper.getInstance(getContext()).getAuthValue("access_token") |
| 84 | + "&refresh_token=" + WarplyDBHelper.getInstance(getContext()).getAuthValue("refresh_token") | 84 | + "&refresh_token=" + WarplyDBHelper.getInstance(getContext()).getAuthValue("refresh_token") |
| 85 | + "&client_id=" + WarplyDBHelper.getInstance(getContext()).getClientValue("client_id") | 85 | + "&client_id=" + WarplyDBHelper.getInstance(getContext()).getClientValue("client_id") |
| ... | @@ -102,13 +102,13 @@ public class LoyaltyFragment extends Fragment implements View.OnClickListener { | ... | @@ -102,13 +102,13 @@ public class LoyaltyFragment extends Fragment implements View.OnClickListener { |
| 102 | mRecyclerGifts.setAdapter(mAdapterGifts); | 102 | mRecyclerGifts.setAdapter(mAdapterGifts); |
| 103 | mAdapterGifts.getPositionClicks() | 103 | mAdapterGifts.getPositionClicks() |
| 104 | .doOnNext(gift -> { | 104 | .doOnNext(gift -> { |
| 105 | - String tempUrl = BaseFragmentActivity.getUniqueCampaignList().get("lucky_draw").get(0).getIndexUrl(); | 105 | + String tempUrl = gift.getIndexUrl(); |
| 106 | 106 | ||
| 107 | tempUrl = tempUrl | 107 | tempUrl = tempUrl |
| 108 | + "?web_id=" + WarpUtils.getWebId(getContext()) | 108 | + "?web_id=" + WarpUtils.getWebId(getContext()) |
| 109 | + "&app_uuid=" + WarplyProperty.getAppUuid(getContext()) | 109 | + "&app_uuid=" + WarplyProperty.getAppUuid(getContext()) |
| 110 | + "&api_key=" + WarpUtils.getApiKey(getContext()) | 110 | + "&api_key=" + WarpUtils.getApiKey(getContext()) |
| 111 | - + "&session_uuid=" + BaseFragmentActivity.getUniqueCampaignList().get("lucky_draw").get(0).getSessionUUID() | 111 | + + "&session_uuid=" + gift.getSessionUUID() |
| 112 | + "&access_token=" + WarplyDBHelper.getInstance(getContext()).getAuthValue("access_token") | 112 | + "&access_token=" + WarplyDBHelper.getInstance(getContext()).getAuthValue("access_token") |
| 113 | + "&refresh_token=" + WarplyDBHelper.getInstance(getContext()).getAuthValue("refresh_token") | 113 | + "&refresh_token=" + WarplyDBHelper.getInstance(getContext()).getAuthValue("refresh_token") |
| 114 | + "&client_id=" + WarplyDBHelper.getInstance(getContext()).getClientValue("client_id") | 114 | + "&client_id=" + WarplyDBHelper.getInstance(getContext()).getClientValue("client_id") |
| ... | @@ -131,13 +131,13 @@ public class LoyaltyFragment extends Fragment implements View.OnClickListener { | ... | @@ -131,13 +131,13 @@ public class LoyaltyFragment extends Fragment implements View.OnClickListener { |
| 131 | mRecyclerMore.setAdapter(mAdapterMore); | 131 | mRecyclerMore.setAdapter(mAdapterMore); |
| 132 | mAdapterMore.getPositionClicks() | 132 | mAdapterMore.getPositionClicks() |
| 133 | .doOnNext(more -> { | 133 | .doOnNext(more -> { |
| 134 | - String tempUrl = BaseFragmentActivity.getUniqueCampaignList().get("lucky_draw").get(0).getIndexUrl(); | 134 | + String tempUrl = more.getIndexUrl(); |
| 135 | 135 | ||
| 136 | tempUrl = tempUrl | 136 | tempUrl = tempUrl |
| 137 | + "?web_id=" + WarpUtils.getWebId(getContext()) | 137 | + "?web_id=" + WarpUtils.getWebId(getContext()) |
| 138 | + "&app_uuid=" + WarplyProperty.getAppUuid(getContext()) | 138 | + "&app_uuid=" + WarplyProperty.getAppUuid(getContext()) |
| 139 | + "&api_key=" + WarpUtils.getApiKey(getContext()) | 139 | + "&api_key=" + WarpUtils.getApiKey(getContext()) |
| 140 | - + "&session_uuid=" + BaseFragmentActivity.getUniqueCampaignList().get("lucky_draw").get(0).getSessionUUID() | 140 | + + "&session_uuid=" + more.getSessionUUID() |
| 141 | + "&access_token=" + WarplyDBHelper.getInstance(getContext()).getAuthValue("access_token") | 141 | + "&access_token=" + WarplyDBHelper.getInstance(getContext()).getAuthValue("access_token") |
| 142 | + "&refresh_token=" + WarplyDBHelper.getInstance(getContext()).getAuthValue("refresh_token") | 142 | + "&refresh_token=" + WarplyDBHelper.getInstance(getContext()).getAuthValue("refresh_token") |
| 143 | + "&client_id=" + WarplyDBHelper.getInstance(getContext()).getClientValue("client_id") | 143 | + "&client_id=" + WarplyDBHelper.getInstance(getContext()).getClientValue("client_id") | ... | ... |
| ... | @@ -40,7 +40,9 @@ import androidx.core.content.ContextCompat; | ... | @@ -40,7 +40,9 @@ import androidx.core.content.ContextCompat; |
| 40 | 40 | ||
| 41 | import android.text.TextUtils; | 41 | import android.text.TextUtils; |
| 42 | import android.util.AttributeSet; | 42 | import android.util.AttributeSet; |
| 43 | +import android.util.Log; | ||
| 43 | import android.webkit.GeolocationPermissions.Callback; | 44 | import android.webkit.GeolocationPermissions.Callback; |
| 45 | +import android.webkit.JavascriptInterface; | ||
| 44 | import android.webkit.SslErrorHandler; | 46 | import android.webkit.SslErrorHandler; |
| 45 | import android.webkit.WebChromeClient; | 47 | import android.webkit.WebChromeClient; |
| 46 | import android.webkit.WebSettings; | 48 | import android.webkit.WebSettings; |
| ... | @@ -124,6 +126,7 @@ public class WarpView extends WebView { | ... | @@ -124,6 +126,7 @@ public class WarpView extends WebView { |
| 124 | settings.setGeolocationDatabasePath(getContext().getCacheDir().getAbsolutePath()); | 126 | settings.setGeolocationDatabasePath(getContext().getCacheDir().getAbsolutePath()); |
| 125 | settings.setGeolocationEnabled(true); | 127 | settings.setGeolocationEnabled(true); |
| 126 | settings.setBuiltInZoomControls(true); | 128 | settings.setBuiltInZoomControls(true); |
| 129 | + WarpView.this.addJavascriptInterface(new JSInterface(), "Cosmote"); | ||
| 127 | setBackgroundColor(ContextCompat.getColor(getContext(), android.R.color.transparent)); | 130 | setBackgroundColor(ContextCompat.getColor(getContext(), android.R.color.transparent)); |
| 128 | setWebViewClient(new WarplyWebViewClient()); | 131 | setWebViewClient(new WarplyWebViewClient()); |
| 129 | setWebChromeClient(new WarplyWebChromeClient()); | 132 | setWebChromeClient(new WarplyWebChromeClient()); |
| ... | @@ -356,6 +359,16 @@ public class WarpView extends WebView { | ... | @@ -356,6 +359,16 @@ public class WarpView extends WebView { |
| 356 | // Inner and Anonymous Classes | 359 | // Inner and Anonymous Classes |
| 357 | // =========================================================== | 360 | // =========================================================== |
| 358 | 361 | ||
| 362 | + public class JSInterface { | ||
| 363 | + @JavascriptInterface | ||
| 364 | + public void sendMessage(String message) { | ||
| 365 | + Intent intent = new Intent(android.content.Intent.ACTION_SEND); | ||
| 366 | + intent.setType("text/plain"); | ||
| 367 | + intent.putExtra(android.content.Intent.EXTRA_TEXT, message); | ||
| 368 | + getContext().startActivity(Intent.createChooser(intent, "Άνοιγμα με")); | ||
| 369 | + } | ||
| 370 | + } | ||
| 371 | + | ||
| 359 | public interface ProgressChangeListener { | 372 | public interface ProgressChangeListener { |
| 360 | void onProgressChanged(WebView view, int newProgress); | 373 | void onProgressChanged(WebView view, int newProgress); |
| 361 | } | 374 | } | ... | ... |
-
Please register or login to post a comment