Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7f6c41765e | ||
|
|
518cb6aba3 | ||
|
|
6094506ec5 |
No files matched your search
@@ -1,2 +1,5 @@
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
|
||||
palm-run $DIR/../
|
||||
palm-package simplechat-app simplechat-service simplechat-package
|
||||
palm-install com.jonandnic.simplechat_2.0.0_all.ipk
|
||||
palm-launch com.jonandnic.simplechat
|
||||
palm-log -f com.jonandnic.simplechat.app
|
||||
@@ -70,15 +70,64 @@ AppAssistant.prototype.handleLaunch = function(params) {
|
||||
return;
|
||||
} else //If parameters were passed, this is a launch from a system alarm
|
||||
{
|
||||
Mojo.Log.info("This is an alarm launch: " + JSON.stringify(params));
|
||||
var stageArguments = { name: MainStageName, lightweight: true };
|
||||
this.controller.createStageWithCallback(stageArguments, function(stageController) {
|
||||
Mojo.Controller.appController.closeStage("main");
|
||||
|
||||
}.bind(this));
|
||||
systemModel.ShowNotificationStage("dashboard", "dashboard/dashboard-scene", 60, false, false);
|
||||
return;
|
||||
Mojo.Log.info("This is an alarm launch: " + JSON.stringify(params));
|
||||
/*
|
||||
|
||||
return;*/
|
||||
|
||||
var pushClass0AlertScene = function(stageController) {
|
||||
stageController.pushScene('dashboard', "dashboard/dashboard-scene");
|
||||
}.bind(this);
|
||||
|
||||
Mojo.Controller.getAppController().showBanner("New messages in the chat!", { source: 'notification' });
|
||||
//var stageArguments = { name: MainStageName, lightweight: true };
|
||||
//this.controller.createStageWithCallback(stageArguments, function(stageController) {
|
||||
// Mojo.Controller.appController.closeStage("main");
|
||||
|
||||
//}.bind(this));
|
||||
|
||||
this.controller.createStageWithCallback({
|
||||
name: 'dashboard',
|
||||
lightweight: true,
|
||||
height: 100,
|
||||
soundclass: "assets/silent.mp3"
|
||||
}, pushClass0AlertScene, 'popupalert');
|
||||
|
||||
//systemModel.ShowNotificationStage("dashboard", "dashboard/dashboard-scene", 60, false, false);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
};
|
||||
/*
|
||||
SystemModel.prototype.ShowNotificationStage = function(stageName, sceneName, heightToUse, sound, vibrate) {
|
||||
Mojo.Log.info("Showing notification stage.");
|
||||
//Determine what sound to use
|
||||
var soundToUse;
|
||||
if (!sound)
|
||||
soundToUse = "assets/silent.mp3";
|
||||
else if (sound == true || sound == "")
|
||||
soundToUse = "/media/internal/ringtones/Dulcimer (short).mp3"
|
||||
else
|
||||
soundToUse = sound;
|
||||
if (vibrate)
|
||||
this.Vibrate(vibrate);
|
||||
|
||||
var stageCallBack = function(stageController) {
|
||||
stageController.pushScene({ name: stageName, sceneTemplate: sceneName });
|
||||
}.bind(this);
|
||||
var appController = Mojo.Controller.getAppController();
|
||||
var stageController = appController.getStageController(stageName);
|
||||
if (stageController) {
|
||||
stageCallBack(stageController);
|
||||
} else {
|
||||
Mojo.Controller.getAppController().createStageWithCallback({
|
||||
name: stageName,
|
||||
lightweight: true,
|
||||
height: heightToUse,
|
||||
sound: soundToUse,
|
||||
clickableWhenLocked: true
|
||||
}, stageCallBack, 'dashboard');
|
||||
}
|
||||
}
|
||||
*/
|
||||
@@ -56,7 +56,9 @@ EmoticonPickerDialogAssistant.prototype.setup = function(widget) {
|
||||
|
||||
EmoticonPickerDialogAssistant.prototype.insertCell = function(row, emoticon) {
|
||||
var cell = row.insertCell(0);
|
||||
cell.innerHTML = Mojo.Format.runTextIndexer(emoticon.escapeHTML());
|
||||
var MojoHTML = Mojo.Format.runTextIndexer(emoticon.escapeHTML());
|
||||
MojoHTML = MojoHTML.replace("file:///usr/palm/", "");
|
||||
cell.innerHTML = MojoHTML;
|
||||
cell.setAttribute("emo", emoticon);
|
||||
cell.style.height = "40px";
|
||||
};
|
||||
@@ -421,11 +421,14 @@ MainAssistant.prototype.postMessageToService = function(newMessage) {
|
||||
Mojo.Log.info("Message accepted by server: " + responseObj.posted); //{ "posted": "604529e19fb7f", "senderKey": "604529e19fb99" }
|
||||
if (responseObj.posted) {
|
||||
Mojo.Log.info("responseObj: " + JSON.stringify(responseObj));
|
||||
var MojoHTML = Mojo.Format.runTextIndexer(newMessage);
|
||||
MojoHTML = MojoHTML.replace("file:///usr/palm/", "");
|
||||
|
||||
var newMsg = {
|
||||
uid: responseObj.posted,
|
||||
sender: appModel.AppSettingsCurrent["SenderName"],
|
||||
message: newMessage,
|
||||
formattedMessage: Mojo.Format.runTextIndexer(newMessage),
|
||||
formattedMessage: MojoHTML,
|
||||
timestamp: this.convertTimeStamp(new Date(), false),
|
||||
color: "gray"
|
||||
};
|
||||
@@ -472,7 +475,11 @@ MainAssistant.prototype.editMessageToService = function(newMessage) {
|
||||
for (var i = 0; i < thisWidgetSetup.model.items.length; i++) {
|
||||
if (thisWidgetSetup.model.items[i].uid == appModel.LastMessageSelected.uid) {
|
||||
thisWidgetSetup.model.items[i].message = newMessage;
|
||||
thisWidgetSetup.model.items[i].formattedMessage = Mojo.Format.runTextIndexer(newMessage);
|
||||
|
||||
var MojoHTML = Mojo.Format.runTextIndexer(newMessage);
|
||||
MojoHTML = MojoHTML.replace("file:///usr/palm/", "");
|
||||
|
||||
thisWidgetSetup.model.items[i].formattedMessage = MojoHTML;
|
||||
thisWidgetSetup.model.items[i].color = "gray";
|
||||
this.controller.get('chatList').mojo.noticeUpdatedItems(i, [thisWidgetSetup.model.items[i]]);
|
||||
}
|
||||
@@ -521,6 +528,7 @@ MainAssistant.prototype.likeMessageToService = function() {
|
||||
MainAssistant.prototype.getChats = function() {
|
||||
if (this.serverRetries <= this.serverGiveUp) {
|
||||
serviceModel.getChats(this.serviceEndpointBase, function(response) {
|
||||
//Mojo.Log.info("getChat response: " + response);
|
||||
if (response != null && response != "") {
|
||||
var responseObj = JSON.parse(response);
|
||||
if (responseObj.status == "error") {
|
||||
@@ -555,11 +563,14 @@ MainAssistant.prototype.updateChatsList = function(results) {
|
||||
//now make the new list
|
||||
var newMessages = [];
|
||||
for (var i = 0; i < results.length; i++) {
|
||||
var MojoHTML = Mojo.Format.runTextIndexer(results[i].message);
|
||||
MojoHTML = MojoHTML.replace("file:///usr/palm/", "");
|
||||
|
||||
newMessages.push({
|
||||
uid: results[i].uid,
|
||||
sender: results[i].sender,
|
||||
message: results[i].message,
|
||||
formattedMessage: Mojo.Format.runTextIndexer(results[i].message),
|
||||
formattedMessage: MojoHTML,
|
||||
postedFrom: results[i].postedFrom,
|
||||
links: this.detectURLs(results[i].message),
|
||||
timestamp: this.convertTimeStamp(results[i].timestamp, true),
|
||||
@@ -699,30 +710,15 @@ MainAssistant.prototype.toggleCommandMenu = function(show) {
|
||||
/* Helper Functions */
|
||||
MainAssistant.prototype.checkForUpdates = function() {
|
||||
if (!appModel.UpdateCheckDone) {
|
||||
//First check for old version
|
||||
var oldFound = false;
|
||||
systemModel.GetInstalledApps(function(response) {
|
||||
if (response && response.apps) {
|
||||
for (var a = 0; a < response.apps.length; a++) {
|
||||
if (response.apps[a].id == "com.jonandnic.simplechat") {
|
||||
oldFound = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (oldFound) {
|
||||
Mojo.Additions.ShowDialogBox("Deprecated App Found", "It looks like you have both the old and the new SimpleChat apps installed. This will cause problems with notifications. It is strongly recommended that you delete the old version of SimpleChat -- the old icon looks like this:<p align='center' style='margin:0px'><img src='assets/oldicon.png'></p>");
|
||||
} else {
|
||||
appModel.UpdateCheckDone = true;
|
||||
updaterModel.CheckForUpdate("webOS SimpleChat", function(responseObj) {
|
||||
if (responseObj && responseObj.updateFound) {
|
||||
updaterModel.PromptUserForUpdate(function(response) {
|
||||
if (response)
|
||||
updaterModel.InstallUpdate();
|
||||
}.bind(this));
|
||||
}
|
||||
appModel.UpdateCheckDone = true;
|
||||
updaterModel.CheckForUpdate("webOS SimpleChat", function(responseObj) {
|
||||
if (responseObj && responseObj.updateFound) {
|
||||
updaterModel.PromptUserForUpdate(function(response) {
|
||||
if (response)
|
||||
updaterModel.InstallUpdate();
|
||||
}.bind(this));
|
||||
}
|
||||
}.bind(this))
|
||||
}.bind(this));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -734,7 +730,7 @@ MainAssistant.prototype.getUsername = function() {
|
||||
template: 'user/user-scene',
|
||||
preventCancel: true,
|
||||
assistant: new UserAssistant(this, function(val) {
|
||||
Mojo.Log.error("got value from dialog: " + val);
|
||||
Mojo.Log.info("got value from dialog: " + val);
|
||||
}.bind(this)) //since this will be a dialog, not a scene, it must be defined in sources.json without a 'scenes' member
|
||||
});
|
||||
}
|
||||
@@ -194,6 +194,13 @@ PreferencesAssistant.prototype.handleValueChange = function(event) {
|
||||
if (event.value)
|
||||
this.controller.get('txtEndpointURL').mojo.focus();
|
||||
break;
|
||||
case "txtEndpointURL":
|
||||
var lastChar = event.value[event.value.length - 1]
|
||||
if (lastChar != "/") {
|
||||
event.value = event.value + "/";
|
||||
Mojo.Log.warn("Custom end point URL was missing trailing slash, it has been added. Value is now: " + event.value);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
//We stashed the preference name in the title of the HTML element, so we don't have to use a case statement
|
||||
@@ -6,6 +6,11 @@ function VersionAssistant(startup) {
|
||||
|
||||
//New Features
|
||||
this.changelog = [{
|
||||
version: "Version 1.1.3",
|
||||
detail: [
|
||||
"Bug fixes and general maintenance"
|
||||
]
|
||||
}, {
|
||||
version: "Version 1.1.2",
|
||||
detail: [
|
||||
"Show/Hide the Command menu buttons by tapping the Compose area title bar",
|
||||
@@ -4,6 +4,7 @@ var ServiceModel = function() {
|
||||
|
||||
ServiceModel.prototype.getChats = function(serviceBase, callback) {
|
||||
serviceURL = serviceBase + "get-chat.php";
|
||||
Mojo.Log.info("Trying to get chats from: " + serviceURL);
|
||||
this.retVal = "";
|
||||
if (callback)
|
||||
callback = callback.bind(this);
|
||||
@@ -1,7 +1,7 @@
|
||||
<div class="palm-page-header">
|
||||
<div class="header-icon preferences"></div>
|
||||
<div class="header-text">
|
||||
<span x-mojo-loc='' style="text-transform:none;">webOS SimpleChat</span>
|
||||
<span x-mojo-loc='' style="text-transform:none;">webOS SimpleChat 2</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
</div>
|
||||
|
||||
<div class="palm-group" style="min-height:64px">
|
||||
<div class="palm-group-title" id="divComposeTitle"><span x-mojo-loc='' id="spanCompose">Compose <img src="assets/twisty-down.png" id="imgTwisty"></span></div>
|
||||
<div class="palm-group-title" id="divComposeTitle"><span x-mojo-loc='' id="spanCompose">Compose</span> <img src="assets/twisty-down.png" id="imgTwisty"></div>
|
||||
<div x-mojo-element="TextField" id="txtMessage" class="textFieldClass" name="txtMessage" style="min-height:56px; background-color:white;border: 1px solid dimgray"></div>
|
||||
<div id="divSpinnerContainer" style="width: 30px;margin-left: auto;margin-right: auto; align-items: center; margin-top:-25px;">
|
||||
<div x-mojo-element="Spinner" class="spinnerClass" id="workingSpinner" name="workingSpinner"></div>
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"id": "com.palm.app.jonandnic.simplechat",
|
||||
"version": "1.1.2",
|
||||
"id": "com.jonandnic.simplechat.app",
|
||||
"version": "2.0.0",
|
||||
"vendor": "Jon Wise",
|
||||
"type": "web",
|
||||
"main": "index.html",
|
||||
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 1.5 KiB |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 1.5 KiB |
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 1.3 KiB |
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"logLevel": 0,
|
||||
"debuggingEnabled": false,
|
||||
"logLevel": 99,
|
||||
"debuggingEnabled": true,
|
||||
"timingEnabled": false,
|
||||
"logEvents": false,
|
||||
"escapeHTMLInTemplates": true
|
||||
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"id": "com.jonandnic.simplechat",
|
||||
"package_format_version": 2,
|
||||
"loc_name": "SimpleChat",
|
||||
"version": "2.0.0",
|
||||
"icon": "icon.png",
|
||||
"miniicon": "icon.png",
|
||||
"vendor": "Jon Wise",
|
||||
"vendorurl": "www.jonandnic.com",
|
||||
"app": "com.jonandnic.simplechat.app",
|
||||
"services": ["com.jonandnic.simplechat.service"]
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
var libraries = MojoLoader.require({ name: "foundations", version: "1.0" });
|
||||
var Future = libraries["foundations"].Control.Future;
|
||||
var PalmCall = libraries["foundations"].Comms.PalmCall;
|
||||
var AjaxCall = libraries["foundations"].Comms.AjaxCall;
|
||||
|
||||
var AlarmAssistant = function() {}
|
||||
|
||||
AlarmAssistant.prototype.run = function(future) {
|
||||
console.log("***************Hello " + this.controller.args.name);
|
||||
if (this.controller.args.name == "silent") {
|
||||
var outputVal = 0;
|
||||
for (var i = 0; i < 1000; i++) {
|
||||
outputVal = outputVal++;
|
||||
}
|
||||
|
||||
future.result = { reply: "*********** Hello quietly! Output val is:" + outputVal };
|
||||
|
||||
} else {
|
||||
|
||||
console.log("********* Trying to get data");
|
||||
/*var options = { "bodyEncoding": "utf8" };
|
||||
var future1 = AjaxCall.get("http://chat.webosarchive.com/get-chat.php", options);
|
||||
future1.then(function(future2) {
|
||||
console.log("********* Ajax result " + JSON.stringify(future2.result))
|
||||
if (future2.result.status == 200) { // 200 = Success
|
||||
console.log('********* Ajax get success ' + JSON.stringify(future2.result));
|
||||
} else console.log('Ajax get fail');
|
||||
});*/
|
||||
|
||||
var options = { "bodyEncoding": "utf8" };
|
||||
var future1 = AjaxCall.get("http://chat.webosarchive.com/get-chat.php", options);
|
||||
future1.then(function(future) {
|
||||
var result = future.result;
|
||||
//if (result.returnValue == true) {
|
||||
console.log("********* Launch Success = " + JSON.stringify(result));
|
||||
//} else Mojo.Log.info("********* Launch Failure = " + JSON.stringify(result));
|
||||
future.result = { reply: "*********** Hello noisily!" };
|
||||
});
|
||||
|
||||
|
||||
|
||||
/*
|
||||
var future1 = PalmCall.call("palm://com.palm.applicationManager", "open", { "id": "com.jonandnic.simplechat.app", "params": { "action": "alarm" } });
|
||||
future1.then(function(future) {
|
||||
var result = future.result;
|
||||
if (result.returnValue == true) {
|
||||
Mojo.Log.info("********* Launch Success = " + JSON.stringify(result));
|
||||
} else Mojo.Log.info("********* Launch Failure = " + JSON.stringify(result));
|
||||
});
|
||||
*/
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"id": "com.jonandnic.simplechat.service",
|
||||
"description": "SimpleChat Background Service",
|
||||
"activityTimeout": 30,
|
||||
"services": [{
|
||||
"name": "com.jonandnic.simplechat.service",
|
||||
"description": "helloworld example",
|
||||
"commands": [{
|
||||
"name": "alarm",
|
||||
"assistant": "AlarmAssistant",
|
||||
"public": true
|
||||
}]
|
||||
}]
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
[{
|
||||
"library": {
|
||||
"name": "foundations",
|
||||
"version": "1.0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"source": "AlarmAssistant.js"
|
||||
}
|
||||
]
|
||||