Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate combined Javadoc documentation #791

Merged
merged 22 commits into from
Oct 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
6437fb7
feat: generate combined Javadoc documentation
ValentinPostindustria Aug 6, 2024
594f87b
feat: add Circle CI step with documentation
ValentinPostindustria Aug 6, 2024
231a56b
feat: config corrections 1
ValentinPostindustria Aug 6, 2024
25f3f93
feat: publishing to docs branch
ValentinPostindustria Aug 6, 2024
4da6a9d
feat: config corrections 2
ValentinPostindustria Aug 6, 2024
adbd3b3
feat: config corrections 3
ValentinPostindustria Aug 6, 2024
7849c84
feat: config corrections 4
ValentinPostindustria Aug 6, 2024
13783de
feat: config corrections 5
ValentinPostindustria Aug 6, 2024
5521a49
feat: add custom title
ValentinPostindustria Aug 6, 2024
66916d0
feat: add package info for all public packages
ValentinPostindustria Aug 6, 2024
d540fbf
feat: add header documentation to the public classes
ValentinPostindustria Aug 7, 2024
0004b15
feat: add documentation to the main public methods
ValentinPostindustria Aug 7, 2024
8b0d75f
fix: header
ValentinPostindustria Aug 7, 2024
d666fb0
feat: upload docs with GitHub actions
ValentinPostindustria Aug 22, 2024
3ca3e2c
fix: uploading #1
ValentinPostindustria Aug 22, 2024
1697f26
fix: uploading #2
ValentinPostindustria Aug 22, 2024
810b482
fix: uploading #3
ValentinPostindustria Aug 22, 2024
b443f2c
fix: uploading #4
ValentinPostindustria Aug 22, 2024
0e30d73
fix: uploading #5
ValentinPostindustria Aug 22, 2024
f8e557a
doc: update description
YuriyVelichkoPI Sep 24, 2024
c1c74c8
fix: disable publishing with Circle CI
ValentinPostindustria Sep 24, 2024
aa5415c
feat: check docs size before commiting
ValentinPostindustria Sep 30, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions .github/workflows/upload-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Upload Docs Android

on:
push:
tags:
- '[0-9]+.[0-9]+.[0-9]+'
- 'test-doc-*'

jobs:
upload-docs:

runs-on: macos-latest

steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
- name: Generate docs
run: |
./gradlew :PrebidMobile:combinedJavadoc
cp -r PrebidMobile/build/combinedJavadoc docs_new
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: docs
clean: false
- name: Commit documentation changes
run: |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
ValentinPostindustria marked this conversation as resolved.
Show resolved Hide resolved
git config --local user.name "github-actions[bot]"
git status
TAG_NAME=${{ github.ref }}
TAG_NAME=${TAG_NAME#refs/tags/}
echo "Current tag: $TAG_NAME"
ls -l

MIN_SIZE=5120
if [ -d docs_new ] && [ "$(du -s docs_new | cut -f1)" -ge "$MIN_SIZE" ]; then
rm -rf docs
cp -r docs_new docs
rm -rf docs_new
else
echo "docs_new directory either does not exist or is too small."
exit 1
fi
git add docs
git commit -m "Generate docs - $TAG_NAME"
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: docs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@

import android.os.Bundle;
import android.util.Log;

import androidx.annotation.Nullable;

import com.google.android.gms.ads.AdView;

import org.prebid.mobile.LogUtil;
import org.prebid.mobile.rendering.bidding.data.bid.BidResponse;
import org.prebid.mobile.rendering.bidding.display.PrebidMediationDelegate;
Expand All @@ -14,6 +17,9 @@
import java.lang.ref.WeakReference;
import java.util.HashMap;

/**
* Banner mediation delegate.
*/
public class AdMobMediationBannerUtils implements PrebidMediationDelegate {

private static final String TAG = "BannerMediationUtils";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
package org.prebid.mobile.admob;

import android.os.Bundle;

import androidx.annotation.Nullable;

import org.prebid.mobile.rendering.bidding.data.bid.BidResponse;
import org.prebid.mobile.rendering.bidding.display.PrebidMediationDelegate;

import java.util.HashMap;

/**
* Internal mediation delegate.
*/
public class AdMobMediationInterstitialUtils implements PrebidMediationDelegate {

private final Bundle extras;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
package org.prebid.mobile.admob;

import android.os.Bundle;

import androidx.annotation.Nullable;

import org.prebid.mobile.rendering.bidding.data.bid.BidResponse;
import org.prebid.mobile.rendering.bidding.display.PrebidMediationDelegate;

import java.util.HashMap;

/**
* Internal mediation delegate.
*/
public class AdMobMediationRewardedUtils implements PrebidMediationDelegate {

private final Bundle extras;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
import org.prebid.mobile.rendering.bidding.display.BidResponseCache;
import org.prebid.mobile.rendering.bidding.listeners.DisplayViewListener;

/**
* Prebid banner adapter for AdMob integration.
*/
public class PrebidBannerAdapter extends PrebidBaseAdapter {

public static final String EXTRA_RESPONSE_ID = "PrebidBannerAdapterExtraId";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
import java.util.HashMap;
import java.util.List;

/**
* Base Prebid adapter for all ad types.
*/
public abstract class PrebidBaseAdapter extends Adapter {

private final VersionInfo prebidVersion = getPrebidVersion();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
import org.prebid.mobile.rendering.bidding.display.InterstitialController;
import org.prebid.mobile.rendering.bidding.interfaces.InterstitialControllerListener;

/**
* Prebid interstitial adapter for AdMob integration.
*/
public class PrebidInterstitialAdapter extends PrebidBaseAdapter {

public static final String EXTRA_RESPONSE_ID = "PrebidInterstitialAdapterExtraId";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@
import java.util.ArrayList;
import java.util.Map;

/**
* Prebid native ad mapper for converting to AdMob native ad.
*/
public class PrebidNativeAdMapper extends UnifiedNativeAdMapper {

private final PrebidNativeAd prebidAd;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
import java.util.HashMap;
import java.util.Set;

/**
* Prebid native adapter for AdMob integration.
*/
public class PrebidNativeAdapter extends PrebidBaseAdapter {

private static final String TAG = "PrebidNative";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
import org.prebid.mobile.rendering.bidding.display.InterstitialController;
import org.prebid.mobile.rendering.bidding.interfaces.InterstitialControllerListener;

/**
* Prebid rewarded adapter for AdMob integration.
*/
@Keep
public class PrebidRewardedAdapter extends PrebidBaseAdapter {

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/**
* Adapters for AdMob mediation integration of the Prebid SDK.
*/
package org.prebid.mobile.admob;
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@
import java.util.Map;
import java.util.Set;

/**
* Base ad unit for the original API.
*/
public abstract class AdUnit {

protected AdUnitConfiguration configuration = new AdUnitConfiguration();
Expand Down Expand Up @@ -84,26 +87,38 @@ public void setAutoRefreshPeriodMillis(
configuration.setAutoRefreshDelay(periodMillis / 1000);
}

/**
* Auto refresh interval for banner ad.
*/
public void setAutoRefreshInterval(
@IntRange(from = AUTO_REFRESH_DELAY_MIN / 1000, to = AUTO_REFRESH_DELAY_MAX / 1000) int seconds
) {
configuration.setAutoRefreshDelay(seconds);
}

/**
* Resumes auto refresh interval after stopping.
*/
public void resumeAutoRefresh() {
LogUtil.verbose("Resuming auto refresh...");
if (bidLoader != null) {
bidLoader.setupRefreshTimer();
}
}

/**
* Stops auto refresh interval.
*/
public void stopAutoRefresh() {
LogUtil.verbose("Stopping auto refresh...");
if (bidLoader != null) {
bidLoader.cancelRefresh();
}
}

/**
* Destroy ad unit and stop downloading.
*/
public void destroy() {
if (bidLoader != null) {
bidLoader.destroy();
Expand All @@ -124,7 +139,14 @@ public void fetchDemand(@NonNull final OnCompleteListener2 listener) {
});
}

public void fetchDemand(Object adObj, @NonNull OnCompleteListener listener) {
/**
* Loads ad and applies keywords to the ad object.
*
* @param adObject AdMob's ({@code AdManagerAdRequest} or {@code AdManagerAdRequest.Builder})
* or AppLovin's ({@code MaxNativeAdLoader}) ad object
* @param listener callback when operation is completed (success or fail)
*/
public void fetchDemand(Object adObject, @NonNull OnCompleteListener listener) {
if (TextUtils.isEmpty(PrebidMobile.getPrebidServerAccountId())) {
LogUtil.error("Empty account id.");
listener.onComplete(ResultCode.INVALID_ACCOUNT_ID);
Expand Down Expand Up @@ -167,8 +189,8 @@ public void fetchDemand(Object adObj, @NonNull OnCompleteListener listener) {
return;
}

if (Util.supportedAdObject(adObj) || allowNullableAdObject) {
adObject = adObj;
if (Util.supportedAdObject(adObject) || allowNullableAdObject) {
this.adObject = adObject;
bidLoader = new BidLoader(
configuration,
createBidListener(listener)
Expand All @@ -185,12 +207,17 @@ public void fetchDemand(Object adObj, @NonNull OnCompleteListener listener) {

bidLoader.load();
} else {
adObject = null;
this.adObject = null;
listener.onComplete(ResultCode.INVALID_AD_OBJECT);
}

}

/**
* Loads ad and saves it to cache.
*
* @param listener callback when operation is completed (success or fail)
*/
public void fetchDemand(OnFetchDemandResult listener) {
if (listener == null) {
LogUtil.error("Parameter OnFetchDemandResult in fetchDemand() must be not null.");
Expand Down Expand Up @@ -307,6 +334,7 @@ public void addContextKeywords(Set<String> keywords) {

/**
* This method allows to remove specific context keyword from adunit context targeting
*
* @deprecated Use removeExtKeyword
*/
@Deprecated
Expand Down Expand Up @@ -404,9 +432,13 @@ public void setGpid(@Nullable String gpid) {
}

@Nullable
public String getOrtbConfig() { return configuration.getOrtbConfig();}
public String getOrtbConfig() {
return configuration.getOrtbConfig();
}

public void setOrtbConfig(@Nullable String ortbConfig) {configuration.setOrtbConfig(ortbConfig);}
public void setOrtbConfig(@Nullable String ortbConfig) {
configuration.setOrtbConfig(ortbConfig);
}

protected BidRequesterListener createBidListener(OnCompleteListener originalListener) {
return new BidRequesterListener() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,26 +25,41 @@
import java.util.EnumSet;
import java.util.HashSet;

/**
* Original API banner ad unit for displaying banner ad.
*/
public class BannerAdUnit extends BannerBaseAdUnit {

/**
* Default constructor for banner ad.
*
* @param configId config id
* @param width ad width
* @param height ad height
*/
public BannerAdUnit(@NonNull String configId, int width, int height) {
super(configId, EnumSet.of(AdFormat.BANNER));
configuration.addSize(new AdSize(width, height));
}

/**
* Constructor for multi-format or video banner request.
* Constructor with ad formats.
*
* @param adUnitFormats <p>
* for multi-format request `EnumSet.of(AdUnitFormat.DISPLAY, AdUnitFormat.VIDEO);`
* <p>
* for video banner `EnumSet.of(AdUnitFormat.VIDEO);`
* @param configId config id
* @param width ad width
* @param height ad height
* @param adUnitFormats ad formats ({@link AdUnitFormat}). <br>
* For multi-format request {@code EnumSet.of(AdUnitFormat.DISPLAY, AdUnitFormat.VIDEO);} <br>
* For only video request {@code EnumSet.of(AdUnitFormat.VIDEO);}
*/
public BannerAdUnit(@NonNull String configId, int width, int height, EnumSet<AdUnitFormat> adUnitFormats) {
super(configId, AdFormat.fromSet(adUnitFormats, false));
configuration.addSize(new AdSize(width, height));
}

/**
* Add additional size.
*/
public void addAdditionalSize(int width, int height) {
configuration.addSize(new AdSize(width, height));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import java.util.List;

/**
* Contains Banner and Video parameters.
* Base banner ad unit with banner and video parameters.
*/
public abstract class BannerBaseAdUnit extends AdUnit {

Expand Down Expand Up @@ -89,6 +89,7 @@ public void setOrtbConfig(@Nullable String ortbConfig) {
}

/**
* Banner parameters.
* Describes an <a href="https://www.iab.com/wp-content/uploads/2016/03/OpenRTB-API-Specification-Version-2-5-FINAL.pdf">OpenRTB</a> banner object
*/
@Deprecated
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
import java.util.Set;

/**
* Describes an <a href="https://www.iab.com/wp-content/uploads/2016/03/OpenRTB-API-Specification-Version-2-5-FINAL.pdf">OpenRTB</a> banner object
* Banner parameters for the
* <a href="https://www.iab.com/wp-content/uploads/2016/03/OpenRTB-API-Specification-Version-2-5-FINAL.pdf">OpenRTB</a>
* banner object.
*/
public class BannerParameters {

Expand Down
Loading