Skip to content

Commit

Permalink
Some fixes
Browse files Browse the repository at this point in the history
- Fixed issues with decryption sometimes when using local network
- Fixed issue acknowledging sent SMS
- Fixed bug in media screen
  • Loading branch information
joaomgcd committed Nov 25, 2020
1 parent 6526147 commit 3c7d3ad
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 5 deletions.
5 changes: 4 additions & 1 deletion appdashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,10 @@ export class AppDashboard extends App{
async onWebSocketGCM(webSocketGCM){
const gcmRaw = webSocketGCM.gcmRaw;
//await GCMBase.executeGcmFromJson(gcmRaw.type,gcmRaw.json);
window.api.send("gcm",webSocketGCM.gcmRaw);
//Need to decrypt possible encrypted fields so convert to gcm first
const gcm = await GCMBase.getGCMFromJson(webSocketGCM.gcmRaw.type,webSocketGCM.gcmRaw.json)
const raw = await gcm.gcmRaw;
window.api.send("gcm",raw);
}
async onDevices(devices){
devices = JSON.stringify(devices);
Expand Down
3 changes: 2 additions & 1 deletion server/gcmserver.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,4 +213,5 @@ class GCMAutoClipboard extends GCMServer{}
class GCMNotificationAction extends GCMServer{}
class GCMNotificationClear extends GCMServer{}
class GCMNewSmsReceived extends GCMServer{}
export class GCMLocalNetworkRequest extends GCMServer{}
export class GCMLocalNetworkRequest extends GCMServer{}
class GCMSmsSentResult extends GCMServer{}
11 changes: 9 additions & 2 deletions v2/device/device.js
Original file line number Diff line number Diff line change
Expand Up @@ -543,6 +543,8 @@ export class Device{
smsMessage.mmsfile = await this.uploadFile({file:smsMessage.mmsfile,token})
this.reportStatus(null);
}
const sentResult = EventBus.waitFor(GCMSmsSentResult,15000);
var gcm = null;
try{
await this.sendPush({
senderId,
Expand All @@ -554,10 +556,15 @@ export class Device{
requestId:"SMS",
responseType: GCMPush.RESPONSE_TYPE_PUSH
});
const gcm = await EventBus.waitFor(GCMSmsSentResult,15000);
gcm = await sentResult;
return gcm;
}catch(e){
const gcm = new GCMSmsSentResult();
try{
gcm = await sentResult;
}catch(error){}
if(gcm != null) return gcm;

gcm = new GCMSmsSentResult();
gcm.success = false;
if(!e){
e = "Timed out while waiting to send";
Expand Down
2 changes: 1 addition & 1 deletion v2/media/mediainfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ export class MediaInfos extends Array{
}
}
matches(otherMediaInfos){
if(!his.device) return;
if(!this.device) return;

return this.device.deviceId == otherMediaInfos.device.deviceId
}
Expand Down
4 changes: 4 additions & 0 deletions v2/sms/apphelpersms.js
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,10 @@ export class AppHelperSMS extends AppHelperBase{
async onRequestSendSMS(request){
console.log("Sending SMS!",request);
const senderId = await this.senderId;
if(!request.contact){
app.showToast({text:"Error: no contact to send message to.",isError:true,time:3000});
return;
}
const address = request.contact.address;
const text = request.text;
let attachment = request.attachment;
Expand Down

0 comments on commit 3c7d3ad

Please sign in to comment.