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
TIMOB-9546: BlackBerry: Implement Platform elements needed for KitchenSink #87
Conversation
…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] |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added
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(); ////////////////////////////////////////
Updated |
static vector<NATIVE_PROPGET_CALLBACK> initFunctionMap() | ||
{ | ||
vector<NATIVE_PROPGET_CALLBACK> vect; | ||
vect.resize(N_PLATFORM_PROP_LAST); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fewer memory allocations
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
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(); ////////////////////////////////////////
Updated. |
approved |
PROP_GETTER(getBatteryLevel) | ||
Handle<Value> NativePlatformInterface::getBatteryLevel() | ||
{ | ||
return v8::Integer::New(NativePlatformInterface::instance()->batteryInfo_.level()); |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
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(); ////////////////////////////////////////
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
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(); ////////////////////////////////////////
Fixing conflicts with GET_PROPERTY_CALLBACK |
Approved |
1 similar comment
Approved |
TIMOB-9546: BlackBerry: Implement Platform elements needed for KitchenSink
Reviewers: DavidC, DavidL
ChangeLog:
Test Cases:
////////////////////////////////////////
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();
////////////////////////////////////////