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

Add dictionary ios #4

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open

Conversation

arribbar
Copy link

  • Add function setDictionary to iOS and rename set() by setString()
  • Update docs

@arribbar
Copy link
Author

@alinz What do you think about implementing the bucket part into react-native-share-extension?

@alinz
Copy link
Owner

alinz commented Jul 27, 2017

@arribbar thanks for this PR. The thing is share-extension is not required to this package to run. because of that I kind of let the developer decide what library they want to use with share extension.

@arribbar
Copy link
Author

Thanks for your quick reply.
I see, maybe better for now indeed

@arribbar
Copy link
Author

@alinz Do you mind to merge this PR, please ? :)

@alinz
Copy link
Owner

alinz commented Aug 10, 2017

@arribbar I have couple of name conventions which need to be resolve. I have already mentioned them in code review.


const Bucket = {
set: (key, value, groupName) => {
RNSKBucket.set(key, value, groupName)
setString: (key, value, groupName) => {
Copy link
Owner

Choose a reason for hiding this comment

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

I don't like the explicit name for it. It has to be simple enough. set, get and remove

Copy link
Author

Choose a reason for hiding this comment

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

How would you use Flow type ? Do you have any link to help me use it ?

I tried something like :

  set: (key: String, value: (String | Object), groupName: String) => {
    console.log(' _______ type is ', typeof (value));
    if (typeof (value) === 'string') {
      RNSKBucket.setString(key, value, groupName);
    } else if (typeof (value) === 'object') {
      RNSKBucket.setDictionary(key, value, groupName);
    }
  },

But, in this way, you can give any type to value (that's why I added a else if)

Copy link
Author

Choose a reason for hiding this comment

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

^ @alinz I'll need your help when you have some time :)

@@ -3,7 +3,7 @@ import { NativeModules } from 'react-native'
const { RNSKBucket } = NativeModules

const Bucket = {
set: (key, value, groupName) => {
setString: (key, value, groupName) => {
Copy link
Owner

Choose a reason for hiding this comment

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

instead of explicit about name, we can use flowtype to enforce the type

@arribbar
Copy link
Author

arribbar commented Sep 4, 2017

Can you take a look at the last changes @alinz, please ?
I am not sure on how to use correctly Flow type. Is it correct? If no, do you have any example/tuto I can look at?

AudreyBramy and others added 3 commits September 12, 2018 14:48
# |-------- 50 characters for the title --------| 
# If applied, this commit will...

# |----------------- 72 characters for the body ----------------------|
# Why is this change needed? How do you solve it ?
# |-------- 50 characters for the title --------| 
# If applied, this commit will...

# |----------------- 72 characters for the body ----------------------|
# Why is this change needed? How do you solve it ?
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.

3 participants