Permalink
Browse files

Added Reset First Use functionality

  • Loading branch information...
1 parent d5bc0c8 commit f22eead7b4c275f4c8907902ecd34b3939b92c85 @rwhitby committed Mar 26, 2011
View
@@ -0,0 +1,17 @@
+APPID = org.webosinternals.impostah
+
+package: clean
+ palm-package .
+ ar q ${APPID}_*.ipk pmPostInstall.script
+ ar q ${APPID}_*.ipk pmPreRemove.script
+
+test: package
+ - palm-install -r ${APPID}
+ palm-install ${APPID}_*.ipk
+ palm-launch ${APPID}
+
+clean:
+ find . -name '*~' -delete
+ rm -f ipkgtmp*.tar.gz ${APPID}_*.ipk
+
+clobber: clean
@@ -16,13 +16,23 @@ function DeviceExploreAssistant()
]
};
+ this.telephonyPlatformButtonModel = {
+ label: $L("Telephony Platform"),
+ disabled: true
+ };
+
this.deviceProfileButtonModel = {
label: $L("Device Profile"),
disabled: true
};
- this.telephonyPlatformButtonModel = {
- label: $L("Telephony Platform"),
+ this.palmProfileButtonModel = {
+ label: $L("Palm Profile"),
+ disabled: true
+ };
+
+ this.resetFirstUseButtonModel = {
+ label: $L("Reset First Use"),
disabled: true
};
@@ -37,14 +47,21 @@ DeviceExploreAssistant.prototype.setup = function()
this.iconElement = this.controller.get('icon');
this.iconElement.style.display = 'none';
this.spinnerElement = this.controller.get('spinner');
- this.deviceProfileButton = this.controller.get('deviceProfileButton');
this.telephonyPlatformButton = this.controller.get('telephonyPlatformButton');
+ this.deviceProfileButton = this.controller.get('deviceProfileButton');
+ this.palmProfileButton = this.controller.get('palmProfileButton');
+ this.resetFirstUseButton = this.controller.get('resetFirstUseButton');
// setup handlers
- this.getDeviceProfileHandler = this.getDeviceProfile.bindAsEventListener(this);
- this.deviceProfileTapHandler = this.deviceProfileTap.bindAsEventListener(this);
this.getTelephonyPlatformHandler = this.getTelephonyPlatform.bindAsEventListener(this);
this.telephonyPlatformTapHandler = this.telephonyPlatformTap.bindAsEventListener(this);
+ this.getDeviceProfileHandler = this.getDeviceProfile.bindAsEventListener(this);
+ this.deviceProfileTapHandler = this.deviceProfileTap.bindAsEventListener(this);
+ this.getPalmProfileHandler = this.getPalmProfile.bindAsEventListener(this);
+ this.palmProfileTapHandler = this.palmProfileTap.bindAsEventListener(this);
+ this.resetFirstUseTapHandler = this.resetFirstUseTap.bindAsEventListener(this);
+ this.palmProfileDeletedHandler = this.palmProfileDeleted.bindAsEventListener(this);
+ this.palmProfileDeletionAckHandler = this.palmProfileDeletionAck.bind(this);
// setup wigets
this.spinnerModel = {spinning: true};
@@ -53,16 +70,24 @@ DeviceExploreAssistant.prototype.setup = function()
this.controller.listen(this.telephonyPlatformButton, Mojo.Event.tap, this.telephonyPlatformTapHandler);
this.controller.setupWidget('deviceProfileButton', { }, this.deviceProfileButtonModel);
this.controller.listen(this.deviceProfileButton, Mojo.Event.tap, this.deviceProfileTapHandler);
+ this.controller.setupWidget('palmProfileButton', { }, this.palmProfileButtonModel);
+ this.controller.listen(this.palmProfileButton, Mojo.Event.tap, this.palmProfileTapHandler);
+ this.controller.setupWidget('resetFirstUseButton', { }, this.resetFirstUseButtonModel);
+ this.controller.listen(this.resetFirstUseButton, Mojo.Event.tap, this.resetFirstUseTapHandler);
this.telephonyPlatform = false;
this.deviceProfile = false;
+ this.palmProfile = false;
this.request1 = ImpostahService.impersonate(this.getTelephonyPlatformHandler, "com.palm.configurator",
"com.palm.telephony",
"platformQuery", {});
this.request2 = ImpostahService.impersonate(this.getDeviceProfileHandler, "com.palm.configurator",
"com.palm.deviceprofile",
"getDeviceProfile", {});
+ this.request3 = ImpostahService.impersonate(this.getPalmProfileHandler, "com.palm.configurator",
+ "com.palm.db",
+ "get", {"ids":["com.palm.palmprofile.token"]});
};
DeviceExploreAssistant.prototype.getTelephonyPlatform = function(payload)
@@ -72,9 +97,11 @@ DeviceExploreAssistant.prototype.getTelephonyPlatform = function(payload)
return;
}
+ if (this.request1) this.request1.cancel();
+
this.telephonyPlatform = payload.extended;
- if (this.telephonyPlatform && this.deviceProfile) {
+ if (this.telephonyPlatform && this.deviceProfile && this.palmProfile) {
this.iconElement.style.display = 'inline';
this.spinnerModel.spinning = false;
this.controller.modelChanged(this.spinnerModel);
@@ -98,9 +125,11 @@ DeviceExploreAssistant.prototype.getDeviceProfile = function(payload)
return;
}
+ if (this.request2) this.request2.cancel();
+
this.deviceProfile = payload.deviceInfo;
- if (this.telephonyPlatform && this.deviceProfile) {
+ if (this.telephonyPlatform && this.deviceProfile && this.palmProfile) {
this.iconElement.style.display = 'inline';
this.spinnerModel.spinning = false;
this.controller.modelChanged(this.spinnerModel);
@@ -117,6 +146,80 @@ DeviceExploreAssistant.prototype.deviceProfileTap = function(event)
}
};
+DeviceExploreAssistant.prototype.getPalmProfile = function(payload)
+{
+ if (payload.returnValue === false) {
+ this.errorMessage('<b>Service Error (getPalmProfile):</b><br>'+payload.errorText);
+ return;
+ }
+
+ if (this.request3) this.request3.cancel();
+
+ this.palmProfile = payload.results[0];
+
+ if (this.telephonyPlatform && this.deviceProfile && this.palmProfile) {
+ this.iconElement.style.display = 'inline';
+ this.spinnerModel.spinning = false;
+ this.controller.modelChanged(this.spinnerModel);
+ }
+
+ this.palmProfileButtonModel.disabled = false;
+ this.controller.modelChanged(this.palmProfileButtonModel);
+
+ this.resetFirstUseButtonModel.disabled = false;
+ this.controller.modelChanged(this.resetFirstUseButtonModel);
+};
+
+DeviceExploreAssistant.prototype.palmProfileTap = function(event)
+{
+ if (this.palmProfile) {
+ this.controller.stageController.pushScene("item", "Palm Profile", this.palmProfile);
+ }
+};
+
+DeviceExploreAssistant.prototype.resetFirstUseTap = function(event)
+{
+ this.palmProfileButtonModel.disabled = true;
+ this.controller.modelChanged(this.palmProfileButtonModel);
+
+ this.resetFirstUseButtonModel.disabled = true;
+ this.controller.modelChanged(this.resetFirstUseButtonModel);
+
+ this.iconElement.style.display = 'none';
+ this.spinnerModel.spinning = true;
+ this.controller.modelChanged(this.spinnerModel);
+
+ this.request4 = ImpostahService.impersonate(this.palmProfileDeletedHandler, "com.palm.configurator",
+ "com.palm.db",
+ "del", {"ids":["com.palm.palmprofile.token"]});
+};
+
+DeviceExploreAssistant.prototype.palmProfileDeleted = function(payload)
+{
+ if (payload.returnValue === false) {
+ this.errorMessage('<b>Service Error (palmProfileDeleted):</b><br>'+payload.errorText);
+ return;
+ }
+
+ if (this.request4) this.request4.cancel();
+
+ this.controller.showAlertDialog({
+ allowHTMLMessage: true,
+ preventCancel: true,
+ title: 'Impostah',
+ message: "Palm Profile token deleted",
+ choices: [{label:$L("Ok"), value:'ok'}],
+ onChoose: this.palmProfileDeletionAckHandler
+ });
+};
+
+DeviceExploreAssistant.prototype.palmProfileDeletionAck = function(value)
+{
+ this.request3 = ImpostahService.impersonate(this.getPalmProfileHandler, "com.palm.configurator",
+ "com.palm.db",
+ "get", {"ids":["com.palm.palmprofile.token"]});
+};
+
DeviceExploreAssistant.prototype.errorMessage = function(msg)
{
this.controller.showAlertDialog({
@@ -150,6 +253,8 @@ DeviceExploreAssistant.prototype.cleanup = function(event)
this.telephonyPlatformTapHandler);
this.controller.stopListening(this.deviceProfileButton, Mojo.Event.tap,
this.deviceProfileTapHandler);
+ this.controller.stopListening(this.palmProfileButton, Mojo.Event.tap,
+ this.palmProfileTapHandler);
};
// Local Variables:
@@ -11,6 +11,7 @@ function StartupAssistant(changelog)
this.newMessages =
[
// Don't forget the comma on all but the last entry
+ { version: '0.4.4', log: [ 'Added Palm Profile to Device Info scene' ] },
{ version: '0.4.3', log: [ 'Removed allowed character restrictions on impersonate method parameters' ] },
{ version: '0.4.2', log: [ 'Added support for better display of app cookies' ] },
{ version: '0.4.1', log: [ 'Implemented access authorisation checking' ] },
@@ -16,7 +16,7 @@
<div x-mojo-element="Button" id="palmProfileButton"></div>
- <div x-mojo-element="Button" id="testButton"></div>
+ <div x-mojo-element="Button" id="resetFirstUseButton"></div>
<div class="scene-fade-bottom" x-mojo-scroll-fade="bottom"></div>
View
@@ -1,8 +1,8 @@
{
"title": "Impostah",
"id": "org.webosinternals.impostah",
- "version": "0.4.3",
- "release_date": "14-Feb-2011",
+ "version": "0.4.4",
+ "release_date": "27-Mar-2011",
"vendor": "WebOS Internals",
"vendor_email": "support@webos-internals.org",
"vendor_url": "http://www.webos-internals.org/wiki/Application:Impostah",
View

0 comments on commit f22eead

Please sign in to comment.