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-9546: BlackBerry: Implement Platform elements needed for KitchenSink #87

Merged
merged 8 commits into from Jul 9, 2012

Conversation

alexandergalstyan
Copy link

Reviewers: DavidC, DavidL

ChangeLog:

  • Update Platform.yml apidoc.
  • Added NativePlatformInterface to support native platform stuff.
  • Implemented batteryLevel, batteryState, osname, name, runtime properties.
  • Added constants describing battery states.
  • Added TiPlatform class storing all Platform properties.
  • Added methods to TiPropertyMapObject for adding properties with getter callback.

Test Cases:

  • Run tibbtest.
  • Make sure implemented properties: batteryLevel, batteryState, osname, name, runtime (as well as their getters) works succesfully.
  • Use the following app.js snippet:

////////////////////////////////////////
var win1 = Titanium.UI.createWindow({
backgroundColor:'#F00'
});

var label1 = Ti.UI.createLabel({
font: {fontSize:12},
color:'green',
top: 200
});

label1.text = Ti.Platform.batteryLevel.toString();
// label1.text = Ti.Platform.getOsname();
// label1.text = Ti.Platform.runtime;
// label1.text = Ti.Platform.getName();
// label1.text = Ti.Platform.getBatteryState().toString();

win1.add(label1);

// open window
win1.open();
////////////////////////////////////////

…nSink

Reviewers: DavidC, JP

ChangeLog:
- Update Platform.yml apidoc.
- Added NativePlatformInterface to support native platform stuff.
- Implemented batteryLevel, batteryState, osname, name, runtime properties.
- Added constants describing battery states.
- Added TiPlatform class storing all Platform properties.
- Added methods to TiPropertyMapObject for adding properties with getter callback.

Test Cases:
- Run tibbtest.
- Make sure implemented properties: batteryLevel, batteryState, osname, name, runtime (as well as their getters) works succesfully.
- Use the following app.js snippet:

////////////////////////////////////////
var win1 = Titanium.UI.createWindow({
    backgroundColor:'#F00'
});

var label1 = Ti.UI.createLabel({
	font: {fontSize:12},
	color:'green',
	top: 200
});

label1.text = Ti.Platform.batteryLevel.toString();
// label1.text = Ti.Platform.getOsname();
// label1.text = Ti.Platform.runtime;
// label1.text = Ti.Platform.getName();
// label1.text = Ti.Platform.getBatteryState().toString();

win1.add(label1);

// open window
win1.open();
////////////////////////////////////////
#Some more info....
@@ -52,6 +53,7 @@ methods:
- name: url
summary: The url to open.
type: String
platforms: [android, iphone, ipad, mobileweb]

Choose a reason for hiding this comment

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

openURL is part of this Jira task

Copy link
Author

Choose a reason for hiding this comment

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

openURL already not part of app.js and doesn't prevent us from running KS. Also we don't have browser for now. That's why it leaved for near future.

Choose a reason for hiding this comment

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

Please put a comment in the Jira

Copy link
Author

Choose a reason for hiding this comment

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

Added

@dlifshitz-maca
Copy link

Reviewed

…nSink ver2

Reviewers: DavidC, JP

ChangeLog:
- Update Platform.yml apidoc.
- Address comments.

Test Cases:
- Run tibbtest.
- Make sure implemented properties: batteryLevel, batteryState, osname, name, runtime (as well as their getters) works succesfully.
- Use the following app.js snippet:

////////////////////////////////////////
 var win1 = Titanium.UI.createWindow({
 backgroundColor:'#F00'
 });

var label1 = Ti.UI.createLabel({
 font: {fontSize:12},
 color:'green',
 top: 200
 });

label1.text = Ti.Platform.batteryLevel.toString();
 // label1.text = Ti.Platform.getOsname();
 // label1.text = Ti.Platform.runtime;
 // label1.text = Ti.Platform.getName();
 // label1.text = Ti.Platform.getBatteryState().toString();

win1.add(label1);

// open window
 win1.open();
 ////////////////////////////////////////
@alexandergalstyan
Copy link
Author

Updated

static vector<NATIVE_PROPGET_CALLBACK> initFunctionMap()
{
vector<NATIVE_PROPGET_CALLBACK> vect;
vect.resize(N_PLATFORM_PROP_LAST);

Choose a reason for hiding this comment

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

Pass the size in the constructor.

Copy link
Author

Choose a reason for hiding this comment

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

Why we would need that?

Choose a reason for hiding this comment

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

Fewer memory allocations

Copy link
Author

Choose a reason for hiding this comment

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

We use it just ones. Nothing we achieve from that rather, than have extra unusable variable.

Choose a reason for hiding this comment

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

Maybe we're talking about different things :) This is what I mean:

vector<NATIVE_PROPGET_CALLBACK> vect(N_PLATFORM_PROP_LAST);

Copy link
Author

Choose a reason for hiding this comment

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

Done

@dlifshitz-maca
Copy link

Reviewed

…nSink ver3

Reviewers: DavidC, DavidL

ChangeLog:
- Address comments.
- Make BatteryInfo class member.
- Rename TiPlatform to TiPlatformObject.

Test Cases:
- Run tibbtest.
- Make sure implemented properties: batteryLevel, batteryState, osname, name, runtime (as well as their getters) works succesfully.
- Use the following app.js snippet:

////////////////////////////////////////
 var win1 = Titanium.UI.createWindow({
 backgroundColor:'#F00'
 });

var label1 = Ti.UI.createLabel({
 font: {fontSize:12},
 color:'green',
 top: 200
 });

label1.text = Ti.Platform.batteryLevel.toString();
 // label1.text = Ti.Platform.getOsname();
 // label1.text = Ti.Platform.runtime;
 // label1.text = Ti.Platform.getName();
 // label1.text = Ti.Platform.getBatteryState().toString();

win1.add(label1);

// open window
 win1.open();
 ////////////////////////////////////////
@alexandergalstyan
Copy link
Author

Updated.

@dcampbell-macadamian
Copy link

approved

PROP_GETTER(getBatteryLevel)
Handle<Value> NativePlatformInterface::getBatteryLevel()
{
return v8::Integer::New(NativePlatformInterface::instance()->batteryInfo_.level());

Choose a reason for hiding this comment

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

No need for NativePlatformInterface::, you can call instance() directly

Copy link
Author

Choose a reason for hiding this comment

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

Done

@dlifshitz-maca
Copy link

Approved with comments

…nSink ver4

Reviewers: DavidC, DavidL

ChangeLog:
- Address comments.

Test Cases:
- Run tibbtest.
- Make sure implemented properties: batteryLevel, batteryState, osname, name, runtime (as well as their getters) works succesfully.
- Use the following app.js snippet:

////////////////////////////////////////
 var win1 = Titanium.UI.createWindow({
 backgroundColor:'#F00'
 });

var label1 = Ti.UI.createLabel({
 font: {fontSize:12},
 color:'green',
 top: 200
 });

label1.text = Ti.Platform.batteryLevel.toString();
 // label1.text = Ti.Platform.getOsname();
 // label1.text = Ti.Platform.runtime;
 // label1.text = Ti.Platform.getName();
 // label1.text = Ti.Platform.getBatteryState().toString();

win1.add(label1);

// open window
 win1.open();
 ////////////////////////////////////////
@alexandergalstyan
Copy link
Author

Updated.

…nSink ver5

Reviewers: DavidC, DavidL

ChangeLog:
- Address comments.

Test Cases:
- Run tibbtest.
- Make sure implemented properties: batteryLevel, batteryState, osname, name, runtime (as well as their getters) works succesfully.
- Use the following app.js snippet:

////////////////////////////////////////
 var win1 = Titanium.UI.createWindow({
 backgroundColor:'#F00'
 });

var label1 = Ti.UI.createLabel({
 font: {fontSize:12},
 color:'green',
 top: 200
 });

label1.text = Ti.Platform.batteryLevel.toString();
 // label1.text = Ti.Platform.getOsname();
 // label1.text = Ti.Platform.runtime;
 // label1.text = Ti.Platform.getName();
 // label1.text = Ti.Platform.getBatteryState().toString();

win1.add(label1);

// open window
 win1.open();
 ////////////////////////////////////////
…berry' into platformBranch

#Some more info....
…berry' into platformBranch

Conflicts:
	blackberry/tibb/TiTitaniumObject.cpp
@alexandergalstyan
Copy link
Author

Updated and merged.

…nSink ver5

Reviewers: DavidC, DavidL

ChangeLog:
- Fix conflicts with GET_PROPERTY_CALLBACK.

Test Cases:
- Run tibbtest.
- Make sure implemented properties: batteryLevel, batteryState, osname, name, runtime (as well as their getters) works succesfully.
- Use the following app.js snippet:

////////////////////////////////////////
 var win1 = Titanium.UI.createWindow({
 backgroundColor:'#F00'
 });

var label1 = Ti.UI.createLabel({
 font: {fontSize:12},
 color:'green',
 top: 200
 });

label1.text = Ti.Platform.batteryLevel.toString();
 // label1.text = Ti.Platform.getOsname();
 // label1.text = Ti.Platform.runtime;
 // label1.text = Ti.Platform.getName();
 // label1.text = Ti.Platform.getBatteryState().toString();

win1.add(label1);

// open window
 win1.open();
 ////////////////////////////////////////
@alexandergalstyan
Copy link
Author

Fixing conflicts with GET_PROPERTY_CALLBACK

@dlifshitz-maca
Copy link

Approved

1 similar comment
@dcampbell-macadamian
Copy link

Approved

Larochelle added a commit that referenced this pull request Jul 9, 2012
TIMOB-9546: BlackBerry: Implement Platform elements needed for KitchenSink
@Larochelle Larochelle merged commit 66e06fd into Macadamian:blackberry Jul 9, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants