Skip to content

Conversation

@abanoubdev
Copy link
Contributor

Fix Hybid Demo and validate showing banner

Abanoub and others added 26 commits February 4, 2021 12:05
Add button for loading banner
Add script for new banner
Add onclick method and button
Modify scence to have 2 buttons :
one to show on top
another one to show on bottom
Save MainDemoScence inside assets
update UnityPlayerActivity.java
Add HybidViewViewBridge inside mainDemoScene
link button clicks with methods inside mono behaviour class
Remove unused update method
dummy commit
Add HybidBridge and button clicks in the same main scence
fix crash of demo app
export new android project with 4 buttons showing
add HybidBridge to validate clicking loadHybidAdTop and loadHybidAdBottom
Export new android project inside Android folder
Update gradle and revert UnitPlayerActivity
add ad initialization after app is initialized
Add Location permission in start of application
Add try catch for whole loading method of banner
Export new androidlib folder with new configurations
Fix looping issue
clean up build files
Update .gitignore
Dummy commit
private void loadBanner(String appToken, final String placementId, int position) {
final HyBidAdView.Position bannerPosition;

if (position == getTopPosition()) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can be replaced with ternary operator to shorten

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool ,will do this

HyBid.initialize(appToken, UnityPlayer.currentActivity.getApplication(), new HyBid.InitialisationListener() {
@Override
public void onInitialisationFinished(boolean b) {
hyBidAdView = new HyBidAdView(UnityPlayer.currentActivity);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

code duplication. You could move it into a separate func and to call it then

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is only 1 method loadBanner and it is called in all cases
I already did it in last commit

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was talking about those lines:

hyBidAdView = new HyBidAdView(UnityPlayer.currentActivity);
hyBidAdView.setAdSize(AdSize.SIZE_320x50);
hyBidAdView.load(placementId, bannerPosition, HyBidAdViewWrapper.this);

private void loadBanner(String appToken, final String placementId, int position) {
final HyBidAdView.Position bannerPosition;

if (position == getTopPosition()) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ternary here might be applied

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool ,will do this

HyBid.initialize(appToken, UnityPlayer.currentActivity.getApplication(), new HyBid.InitialisationListener() {
@Override
public void onInitialisationFinished(boolean b) {
hyBidAdView = new HyBidAdView(UnityPlayer.currentActivity);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

duplication here also with line #96

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above :)

@@ -8,52 +8,30 @@ public abstract class HyBidAdView : MonoBehaviour
{
public string appToken;
public string placement;
protected string adID = "";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why did you remove listeners?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because once ad is loaded ,its callbacks is inside native code and send response to virtual methods inside unity

Copy link
Contributor

@orkhanalizada2020 orkhanalizada2020 Feb 15, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would double check that moment. Those changes might break one of the platform side functionality

@@ -19,6 +19,8 @@ public HyBidAndroidBanner ()

public override void Load (int position)
{
appToken = "dde3c298b47648459f8ada4a982fa92d";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why did you hardcoded appToken and placementID here?


void Start()
{
banner = HyBidAdViewFactory.createHyBidAdView(this);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will all your changes break the iOS-ready functionality? Have you checked that?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm creating a merge branch to fix these conflicts. I'll mix the commits and then merge into the PR branch to solve the issues

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the thing is there some point which might not cause conflicts. For example, listeners removal will not cause any conflict, I believe, but can break the functionality

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes for sure. I meant conflicts in the functionality in this case. But no worries I'll mix it without breaking the functionality.

Revert all changes of sample to working demo with all banner showing top and bottom
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants