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

Fetching one or more adverts currently not possible as described in the documentation #25

Closed
dhaydl opened this issue Oct 22, 2023 · 3 comments

Comments

@dhaydl
Copy link
Contributor

dhaydl commented Oct 22, 2023

based on the current documentation, it should be possible to fetch an ad via BillboardViewModel like this:

let newAdvert = try? await viewModel.fetchRandomAd()
advertisement = newAdvert

but there are two difference to what is actually implemented in code:

  • fetchRandomAd needs an URL parameter
  • fetchRandomAd is static

current workaround:

guard  let adsURL = BillboardConfiguration().adsJSONURL else {
    return
}

Task {
    try await BillboardViewModel.fetchRandomAd(from: adsURL)
}

a good solution would be to merge showAdvertisement and fetchRandomAd somehow. what would you say to this?

@hiddevdploeg
Copy link
Owner

Task {
    try await BillboardViewModel.fetchRandomAd(from: adsURL)
}

Should now work :) thanks for letting me know

@dhaydl
Copy link
Contributor Author

dhaydl commented Oct 31, 2023

okay, if this is the way it should work and documentation will be updated, this issue can be closed I think :)

@dhaydl dhaydl closed this as completed Oct 31, 2023
@hiddevdploeg
Copy link
Owner

I'm sorry I mean it works without the URL now :)

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

No branches or pull requests

2 participants