Toggle navigation
Toggle navigation
This project
Loading...
Sign in
open-source
/
warply_android_sdk_maven_plugin
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
thkouk00
2022-03-28 15:40:06 +0300
Browse Files
Options
Browse Files
Download
Plain Diff
Commit
356cca44dafba7fb49b2c759871ba5a3da98a85e
356cca44
2 parents
1a2fca41
22731d91
Merge branch 'cosmote' of
https://git.warp.ly/open-source/warply_android_sdk_mav…
…en_plugin into cosmote
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
0 deletions
warply_android_sdk/src/main/java/ly/warp/sdk/fragments/BaseFragment.java
warply_android_sdk/src/main/java/ly/warp/sdk/fragments/BaseFragment.java
View file @
356cca4
...
...
@@ -4,13 +4,21 @@ import android.os.Bundle;
import
androidx.fragment.app.Fragment
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
ly.warp.sdk.Warply
;
import
ly.warp.sdk.io.callbacks.CallbackReceiver
;
import
ly.warp.sdk.io.models.Campaign
;
import
ly.warp.sdk.io.models.CampaignList
;
import
ly.warp.sdk.io.models.Consumer
;
import
ly.warp.sdk.io.request.WarplyConsumerRequest
;
import
ly.warp.sdk.io.request.WarplyInboxRequest
;
import
ly.warp.sdk.utils.managers.WarplyManager
;
public
class
BaseFragment
extends
Fragment
{
private
static
Consumer
mConsumer
;
private
static
HashMap
mUniqueCampaignList
=
new
HashMap
<
String
,
CampaignList
>();
@Override
public
void
onCreate
(
Bundle
savedInstanceState
)
{
...
...
@@ -21,6 +29,12 @@ public class BaseFragment extends Fragment {
WarplyManager
.
getConsumer
(
new
WarplyConsumerRequest
(),
mConsumerReceiver
);
}
}).
start
();
new
Thread
(()
->
{
if
(!
Thread
.
currentThread
().
isInterrupted
())
{
Warply
.
getInbox
(
new
WarplyInboxRequest
().
setUseCache
(
false
),
mInboxReceiver
);
}
}).
start
();
}
...
...
@@ -45,4 +59,30 @@ public class BaseFragment extends Fragment {
Thread
.
currentThread
().
interrupt
();
}
};
private
final
CallbackReceiver
<
CampaignList
>
mInboxReceiver
=
new
CallbackReceiver
<
CampaignList
>()
{
@Override
public
void
onSuccess
(
CampaignList
result
)
{
for
(
Campaign
campaign
:
result
)
{
if
(
mUniqueCampaignList
.
containsKey
(
campaign
.
getOfferCategory
().
trim
()))
{
CampaignList
tempCampaignList
=
(
CampaignList
)
mUniqueCampaignList
.
get
(
campaign
.
getOfferCategory
().
trim
());
tempCampaignList
.
add
(
campaign
);
mUniqueCampaignList
.
put
(
campaign
.
getOfferCategory
().
trim
(),
tempCampaignList
);
}
else
{
CampaignList
tempCampaignList
=
new
CampaignList
();
tempCampaignList
.
add
(
campaign
);
mUniqueCampaignList
.
put
(
campaign
.
getOfferCategory
().
trim
(),
tempCampaignList
);
}
}
Thread
.
currentThread
().
interrupt
();
}
@Override
public
void
onFailure
(
int
errorCode
)
{
Thread
.
currentThread
().
interrupt
();
}
};
}
\ No newline at end of file
...
...
Please
register
or
login
to post a comment