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

[TIMOB-24988] Android: Add Ti.Network.Cookie isValid() #9230

Merged
merged 2 commits into from
Aug 15, 2017

Conversation

m1ga
Copy link
Contributor

@m1ga m1ga commented Jul 20, 2017

JIRA: https://jira.appcelerator.org/browse/TIMOB-24988

Parity with iOS

Test code

var cookie1 = Ti.Network.createCookie({
	domain: 'example.com',
	name: 'test_cookie',
	value: '12',
	path: '/'
});

var cookie2 = Ti.Network.createCookie({
	name: 'test_cookie',
	value: '12',
	path: '/'
});

console.log("is cookie valid: "+ cookie1.isValid());
console.log("is cookie valid: "+ cookie2.isValid());

@Kroll.method
public boolean isValid()
{
String name = TiConvert.toString(getProperty(TiC.PROPERTY_NAME), "");
Copy link
Contributor

Choose a reason for hiding this comment

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

No need to set a default value in this case, saves creating empty String objects:

String name = TiConvert.toString(getProperty(TiC.PROPERTY_NAME));
String value = TiConvert.toString(getProperty(TiC.PROPERTY_VALUE));
String path = TiConvert.toString(getProperty(TiC.PROPERTY_PATH));
String domain = TiConvert.toString(getProperty(TiC.PROPERTY_DOMAIN));
return (name != null && value != null && path != null && domain != null);

@garymathews garymathews changed the title [AC-5098] Android: Add Ti.Network.Cookie isValid() [TIMOB-24988] Android: Add Ti.Network.Cookie isValid() Jul 24, 2017
Copy link
Contributor

@garymathews garymathews left a comment

Choose a reason for hiding this comment

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

CR: PASS

Copy link
Contributor

@garymathews garymathews left a comment

Choose a reason for hiding this comment

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

CR: PASS

@hansemannn
Copy link
Collaborator

@m1ga Can you provide a 6_2_X PR as well? Currently this would only go into 7.0.0

@ssjsamir ssjsamir self-requested a review July 25, 2017 20:27
@lokeshchdhry
Copy link
Contributor

FR Passed.

isValid() works as expected.

Studio Ver: 4.9.1.201707200100
SDK Ver: 7.0.0 local build
OS Ver: 10.12.3
Xcode Ver: Xcode 8.3.3
Appc NPM: 4.2.9
Appc CLI: 6.2.2
Ti CLI Ver: 5.0.14
Alloy Ver: 1.9.11
Node Ver: 6.10.1
Java Ver: 1.8.0_101
Devices: Android 6.0

@ssjsamir ssjsamir removed their request for review July 25, 2017 21:25
@lokeshchdhry lokeshchdhry merged commit 0e5fe41 into tidev:master Aug 15, 2017
@m1ga m1ga deleted the cookie branch September 9, 2017 12:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants