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

ability to have text fields in your RedAlert alerts... works in iOS 7… and 8. enjoy :) #9

Closed
wants to merge 1 commit into from

Conversation

mixflame
Copy link

@mixflame mixflame commented Jul 5, 2015

yo all.

I saw #8 and I needed this feature. And while we use Bubblewrap, I didn't want to, when I already have a dedicated library for alerts (RedAlert.) Also, BW didn't seem to support iOS 8 fully. And I don't want the warning.

So I wrote this for ya. I tried to share the API as much as possible between 7 and 8, but truth is the style is a bit different... anyway I'm happy with what I did. There's 2 tests I added as well. Couldn't figure out how to test if the text is returned, but I hand tested it. But don't take my word for it.

iOS 7

# textfield_style may also be "secure" which is simply a password field, or omitted for just a single plain text field
# in iOS7 there is no way to add more than 2 textfields...
# tho since I shared API, "placeholder" is optional, but actually having elements in "textfields" is not. change to your liking. it is just designed to keep the API similar between the 7 and 8
rmq.app.alert(message: "Plz login", textfield_style: :login, textfields: [placeholder: "User", placeholder: "Password"]) do |action, text|
# you know how to use action.
# "text" will be an array of textfield values.
p text
end

iOS8

# textfield_style is not used here
# "secure" is optional
# "placeholder" is also optional, but something must be in the array or fields won't be created. placeholder is recommended, as nothing else will do anything... also helpful to user.
rmq.app.alert(message: "Plz login", textfields: [{placeholder: "User"}, {placeholder: "Password", secure: true}]) do |action, text|
# same as above. text is array of field values.
p text
end

Thanks, and good luck! - @jsilverMDX

edit: I forgot to say. Happy 4th of July! 🎆

@GantMan
Copy link
Owner

GantMan commented Jul 5, 2015

Hey! I love this. Funny, is that I JUST had an API syntax conversation with @derekgreenberg on the best way to implement #8

I checked in with him and he says he's nearly done with a very nice API which will be shared in iOS7 and iOS8. He's going to massage your logic in with his PR which will give us a unified syntax, and TEMPLATES! I hope that's ok, I plan to credit you both in the README docs. 😃

@mixflame
Copy link
Author

mixflame commented Jul 5, 2015

@GantMan yeah, totally. up to you. 👍 for now, this serves my purposes, but when @derekgreenberg's work is merged (and published) I will upgrade my app to the new style. :) thanks!

@GantMan
Copy link
Owner

GantMan commented Jul 23, 2015

closing this now. Derek has finalized his PR. Both of you are mentioned in the readme 👍

@GantMan GantMan closed this Jul 23, 2015
@mixflame
Copy link
Author

wooohooo!!!! yaaaay!!!! thanks @GantMan :D

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.

2 participants