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

Dynamic endpoint #141

Open
droidizer opened this issue May 4, 2016 · 4 comments
Open

Dynamic endpoint #141

droidizer opened this issue May 4, 2016 · 4 comments

Comments

@droidizer
Copy link

droidizer commented May 4, 2016

Hello,

Is there a way I could dynamically set the endpoint instead of hard coded base url?

Like @url annotation? I see setEndpoint is not optional.

@cutiko
Copy link

cutiko commented May 4, 2016

Greeting @droidizer
I really like WASP, so I try to help each time I can, please excuse me if Im not getting this, but, maybe you are looking for:

Hope to help

@droidizer
Copy link
Author

I have just one endpoint but imagine I need to ask the user to enter the
url.
In that case I do not have a base url. I want to pass the user entered url
to the api call.

Kind Regards,
Sowmya.

On Wed, May 4, 2016 at 5:54 PM, Erick Navarro [email protected]
wrote:

Greeting @droidizer https://github.com/droidizer
I really like WASP, so I try to help each time I can, please excuse me if
Im not getting this, but, maybe you are looking for:

Hope to help


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
#141 (comment)

@cutiko
Copy link

cutiko commented May 4, 2016

That doesnt seem hard:

  1. In whatever activity you are gonna ask the user to set the endpoint, create a simple EditText and a Button as a trigger, in the layout.
    2.- Then in the .java file the behaviour you have to code is; when the user press the button you get the EditText view, get the text (yes, toString) and then save that string in a SharedPrefference (documentation for that http://www.sgoliver.net/blog/preferencias-en-android-i-shared-preferences/). You want to use SharedPreference to store the URL user input, otherwise you will have to ask it each time.
    3.- Dont forget to validate correct format and not empty url, etc.
    4.- Create an interceptor which will get the endpoint from the Shared preference memory.
    5.- Invoke the interceptor wherever you need it.

If for any reason the user is not gonna do this once, but several times during the use of the app (the user will have to type several urls as in a web explorer), then the most usable approach is to create a storable model. Store every model in the app database and use an autocomplete edit text for inputing the urls suggesting the matches from previous url to the user.

Hope to help, any other question I could help I will be glad :)

@droidizer
Copy link
Author

droidizer commented May 6, 2016

Oh ok. So, it overrides the base url. Missed that. Thanks for the detailed explanation. Tbh I like wasp too. :)

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