Page MenuHomePhabricator

D12743.id42539.diff
No OneTemporary

D12743.id42539.diff

diff --git a/lib/types/sqlite-types.js b/lib/types/sqlite-types.js
--- a/lib/types/sqlite-types.js
+++ b/lib/types/sqlite-types.js
@@ -35,6 +35,7 @@
+plaintext: string,
+ciphertext: string,
+status: OutboundP2PMessageStatuses,
+ +supportsAutoRetry: boolean,
};
export type SQLiteAPI = {
diff --git a/native/cpp/CommonCpp/DatabaseManagers/SQLiteQueryExecutor.cpp b/native/cpp/CommonCpp/DatabaseManagers/SQLiteQueryExecutor.cpp
--- a/native/cpp/CommonCpp/DatabaseManagers/SQLiteQueryExecutor.cpp
+++ b/native/cpp/CommonCpp/DatabaseManagers/SQLiteQueryExecutor.cpp
@@ -2302,8 +2302,8 @@
static std::string addMessage =
"REPLACE INTO outbound_p2p_messages ("
" message_id, device_id, user_id, timestamp,"
- " plaintext, ciphertext, status) "
- "VALUES (?, ?, ?, ?, ?, ?, ?);";
+ " plaintext, ciphertext, status, supports_auto_retry) "
+ "VALUES (?, ?, ?, ?, ?, ?, ?, ?);";
for (const OutboundP2PMessage &clientMessage : messages) {
SQLiteOutboundP2PMessage message =
diff --git a/native/cpp/CommonCpp/DatabaseManagers/entities/OutboundP2PMessage.h b/native/cpp/CommonCpp/DatabaseManagers/entities/OutboundP2PMessage.h
--- a/native/cpp/CommonCpp/DatabaseManagers/entities/OutboundP2PMessage.h
+++ b/native/cpp/CommonCpp/DatabaseManagers/entities/OutboundP2PMessage.h
@@ -16,6 +16,7 @@
std::string plaintext;
std::string ciphertext;
std::string status;
+ int supports_auto_retry;
static SQLiteOutboundP2PMessage fromSQLResult(sqlite3_stmt *sqlRow, int idx) {
return SQLiteOutboundP2PMessage{
@@ -26,6 +27,7 @@
getStringFromSQLRow(sqlRow, idx + 4),
getStringFromSQLRow(sqlRow, idx + 5),
getStringFromSQLRow(sqlRow, idx + 6),
+ getIntFromSQLRow(sqlRow, idx + 7),
};
}
@@ -36,7 +38,8 @@
bindInt64ToSQL(timestamp, sql, idx + 3);
bindStringToSQL(plaintext, sql, idx + 4);
bindStringToSQL(ciphertext, sql, idx + 5);
- return bindStringToSQL(status, sql, idx + 6);
+ bindStringToSQL(status, sql, idx + 6);
+ return bindIntToSQL(supports_auto_retry, sql, idx + 7);
}
};
@@ -48,6 +51,7 @@
std::string plaintext;
std::string ciphertext;
std::string status;
+ bool supports_auto_retry;
OutboundP2PMessage() = default;
@@ -58,14 +62,16 @@
const std::string &timestamp,
const std::string &plaintext,
const std::string &ciphertext,
- const std::string &status)
+ const std::string &status,
+ const bool &supports_auto_retry)
: message_id(message_id),
device_id(device_id),
user_id(user_id),
timestamp(timestamp),
plaintext(plaintext),
ciphertext(ciphertext),
- status(status) {
+ status(status),
+ supports_auto_retry(supports_auto_retry) {
}
OutboundP2PMessage(const SQLiteOutboundP2PMessage &msg) {
@@ -76,6 +82,7 @@
plaintext = msg.plaintext;
ciphertext = msg.ciphertext;
status = msg.status;
+ supports_auto_retry = msg.supports_auto_retry == 1;
}
SQLiteOutboundP2PMessage toSQLiteOutboundP2PMessage() const {
@@ -87,6 +94,7 @@
msg.plaintext = plaintext;
msg.ciphertext = ciphertext;
msg.status = status;
+ msg.supports_auto_retry = supports_auto_retry;
return msg;
}
};
diff --git a/native/cpp/CommonCpp/NativeModules/CommCoreModule.cpp b/native/cpp/CommonCpp/NativeModules/CommCoreModule.cpp
--- a/native/cpp/CommonCpp/NativeModules/CommCoreModule.cpp
+++ b/native/cpp/CommonCpp/NativeModules/CommCoreModule.cpp
@@ -476,6 +476,8 @@
msgObj.getProperty(rt, "ciphertext").asString(rt).utf8(rt);
std::string status =
msgObj.getProperty(rt, "status").asString(rt).utf8(rt);
+ bool supports_auto_retry =
+ msgObj.getProperty(rt, "supportsAutoRetry").asBool();
OutboundP2PMessage outboundMessage{
messageID,
@@ -484,7 +486,8 @@
timestamp,
plaintext,
ciphertext,
- status};
+ status,
+ supports_auto_retry};
messages.push_back(outboundMessage);
}
}
@@ -2453,6 +2456,8 @@
jsiMsg.setProperty(innerRt, "plaintext", msg.plaintext);
jsiMsg.setProperty(innerRt, "ciphertext", msg.ciphertext);
jsiMsg.setProperty(innerRt, "status", msg.status);
+ jsiMsg.setProperty(
+ innerRt, "supportsAutoRetry", msg.supports_auto_retry);
jsiMessages.setValueAtIndex(innerRt, writeIdx++, jsiMsg);
}
diff --git a/web/cpp/SQLiteQueryExecutorBindings.cpp b/web/cpp/SQLiteQueryExecutorBindings.cpp
--- a/web/cpp/SQLiteQueryExecutorBindings.cpp
+++ b/web/cpp/SQLiteQueryExecutorBindings.cpp
@@ -128,7 +128,8 @@
.field("timestamp", &OutboundP2PMessage::timestamp)
.field("plaintext", &OutboundP2PMessage::plaintext)
.field("ciphertext", &OutboundP2PMessage::ciphertext)
- .field("status", &OutboundP2PMessage::status);
+ .field("status", &OutboundP2PMessage::status)
+ .field("supportsAutoRetry", &OutboundP2PMessage::supports_auto_retry);
value_object<InboundP2PMessage>("InboundP2PMessage")
.field("messageID", &InboundP2PMessage::message_id)
diff --git a/web/shared-worker/_generated/comm-query-executor.js b/web/shared-worker/_generated/comm-query-executor.js
--- a/web/shared-worker/_generated/comm-query-executor.js
+++ b/web/shared-worker/_generated/comm-query-executor.js
@@ -116,7 +116,7 @@
V.prototype.xd=function(a){this.Tc&&(a=this.Tc(a));return a};V.prototype.Hc=function(a){this.pb&&this.pb(a)};V.prototype.argPackAdvance=8;V.prototype.readValueFromPointer=lb;V.prototype.deleteObject=function(a){if(null!==a)a["delete"]()};
V.prototype.fromWireType=function(a){function b(){return this.Vb?Jb(this.Ta.Eb,{Xa:this.Md,Sa:c,fb:this,ab:a}):Jb(this.Ta.Eb,{Xa:this,Sa:a})}var c=this.xd(a);if(!c)return this.Hc(a),null;var d=Ib(this.Ta,c);if(void 0!==d){if(0===d.Na.count.value)return d.Na.Sa=c,d.Na.ab=a,d.clone();d=d.clone();this.Hc(a);return d}d=this.Ta.vd(c);d=Db[d];if(!d)return b.call(this);d=this.Tb?d.jd:d.pointerType;var f=Cb(c,this.Ta,d.Ta);return null===f?b.call(this):this.Vb?Jb(d.Ta.Eb,{Xa:d,Sa:f,fb:this,ab:a}):Jb(d.Ta.Eb,
{Xa:d,Sa:f})};Wb=e.UnboundTypeError=rb("UnboundTypeError");e.count_emval_handles=function(){for(var a=0,b=5;b<Y.length;++b)void 0!==Y[b]&&++a;return a};e.get_first_emval=function(){for(var a=5;a<Y.length;++a)if(void 0!==Y[a])return Y[a];return null};
-var Lc={b:function(a){return wc(a+24)+24},c:function(a,b,c){(new Oa(a)).Db(b,c);Pa++;throw a;},_:function(a,b){try{return a=y(a),N.chmod(a,b),0}catch(c){if("undefined"==typeof N||!(c instanceof N.Ma))throw c;return-c.Ra}},da:function(a,b,c){try{b=y(b);b=P(a,b);if(c&-8)return-28;var d=N.Ua(b,{eb:!0}).node;if(!d)return-44;a="";c&4&&(a+="r");c&2&&(a+="w");c&1&&(a+="x");return a&&N.sb(d,a)?-2:0}catch(f){if("undefined"==typeof N||!(f instanceof N.Ma))throw f;return-f.Ra}},$:function(a,b){try{return N.fchmod(a,
+var Lc={b:function(a){return wc(a+24)+24},d:function(a,b,c){(new Oa(a)).Db(b,c);Pa++;throw a;},_:function(a,b){try{return a=y(a),N.chmod(a,b),0}catch(c){if("undefined"==typeof N||!(c instanceof N.Ma))throw c;return-c.Ra}},da:function(a,b,c){try{b=y(b);b=P(a,b);if(c&-8)return-28;var d=N.Ua(b,{eb:!0}).node;if(!d)return-44;a="";c&4&&(a+="r");c&2&&(a+="w");c&1&&(a+="x");return a&&N.sb(d,a)?-2:0}catch(f){if("undefined"==typeof N||!(f instanceof N.Ma))throw f;return-f.Ra}},$:function(a,b){try{return N.fchmod(a,
b),0}catch(c){if("undefined"==typeof N||!(c instanceof N.Ma))throw c;return-c.Ra}},Z:function(a,b,c){try{return N.fchown(a,b,c),0}catch(d){if("undefined"==typeof N||!(d instanceof N.Ma))throw d;return-d.Ra}},i:function(a,b,c){gb=c;try{var d=Q(a);switch(b){case 0:var f=hb();return 0>f?-28:N.Fc(d,f).fd;case 1:case 2:return 0;case 3:return d.flags;case 4:return f=hb(),d.flags|=f,0;case 5:return f=hb(),D[f+0>>1]=2,0;case 6:case 7:return 0;case 16:case 8:return-28;case 9:return E[Kc()>>2]=28,-1;default:return-28}}catch(g){if("undefined"==
typeof N||!(g instanceof N.Ma))throw g;return-g.Ra}},X:function(a,b){try{var c=Q(a);return fb(N.stat,c.path,b)}catch(d){if("undefined"==typeof N||!(d instanceof N.Ma))throw d;return-d.Ra}},E:function(a,b,c){try{b=c+2097152>>>0<4194305-!!b?(b>>>0)+4294967296*c:NaN;if(isNaN(b))return-61;N.ud(a,b);return 0}catch(d){if("undefined"==typeof N||!(d instanceof N.Ma))throw d;return-d.Ra}},S:function(a,b){try{if(0===b)return-28;var c=N.cwd(),d=ta(c)+1;if(b<d)return-68;A(c,z,a,b);return d}catch(f){if("undefined"==
typeof N||!(f instanceof N.Ma))throw f;return-f.Ra}},M:function(a,b,c){try{var d=Q(a);d.ub||(d.ub=N.readdir(d.path));a=0;for(var f=N.bb(d,0,1),g=Math.floor(f/280);g<d.ub.length&&a+280<=c;){var k=d.ub[g];if("."===k){var h=d.node.id;var n=4}else if(".."===k)h=N.Ua(d.path,{parent:!0}).node.id,n=4;else{var q=N.kb(d.node,k);h=q.id;n=N.Jb(q.mode)?2:N.Ya(q.mode)?4:N.vb(q.mode)?10:8}J=[h>>>0,(G=h,1<=+Math.abs(G)?0<G?(Math.min(+Math.floor(G/4294967296),4294967295)|0)>>>0:~~+Math.ceil((G-+(~~G>>>0))/4294967296)>>>
@@ -135,7 +135,7 @@
h=>h;if(0===d){var k=32-8*c;g=h=>h<<k>>>k}c=b.includes("unsigned")?function(h,n){return n>>>0}:function(h,n){return n};R(a,{name:b,fromWireType:g,toWireType:c,argPackAdvance:8,readValueFromPointer:gc(b,f,0!==d),ib:null})},g:function(a,b,c){function d(g){g>>=2;var k=F;return new f(ua,k[g+1],k[g])}var f=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][b];c=S(c);R(a,{name:c,fromWireType:d,argPackAdvance:8,readValueFromPointer:d},{Ad:!0})},y:function(a,b){b=
S(b);var c="std::string"===b;R(a,{name:b,fromWireType:function(d){var f=F[d>>2],g=d+4;if(c)for(var k=g,h=0;h<=f;++h){var n=g+h;if(h==f||0==z[n]){k=y(k,n-k);if(void 0===q)var q=k;else q+=String.fromCharCode(0),q+=k;k=n+1}}else{q=Array(f);for(h=0;h<f;++h)q[h]=String.fromCharCode(z[g+h]);q=q.join("")}X(d);return q},toWireType:function(d,f){f instanceof ArrayBuffer&&(f=new Uint8Array(f));var g="string"==typeof f;g||f instanceof Uint8Array||f instanceof Uint8ClampedArray||f instanceof Int8Array||T("Cannot pass non-string to std::string");
var k=c&&g?ta(f):f.length;var h=wc(4+k+1),n=h+4;F[h>>2]=k;if(c&&g)A(f,z,n,k+1);else if(g)for(g=0;g<k;++g){var q=f.charCodeAt(g);255<q&&(X(n),T("String has UTF-16 code units that do not fit in 8 bits"));z[n+g]=q}else for(g=0;g<k;++g)z[n+g]=f[g];null!==d&&d.push(X,h);return h},argPackAdvance:8,readValueFromPointer:lb,ib:function(d){X(d)}})},p:function(a,b,c){c=S(c);if(2===b){var d=ic;var f=jc;var g=kc;var k=()=>va;var h=1}else 4===b&&(d=lc,f=mc,g=nc,k=()=>F,h=2);R(a,{name:c,fromWireType:function(n){for(var q=
-F[n>>2],p=k(),t,x=n+4,l=0;l<=q;++l){var u=n+4+l*b;if(l==q||0==p[u>>h])x=d(x,u-x),void 0===t?t=x:(t+=String.fromCharCode(0),t+=x),x=u+b}X(n);return t},toWireType:function(n,q){"string"!=typeof q&&T("Cannot pass non-string to C++ string type "+c);var p=g(q),t=wc(4+p+b);F[t>>2]=p>>h;f(q,t+4,p+b);null!==n&&n.push(X,t);return t},argPackAdvance:8,readValueFromPointer:lb,ib:function(n){X(n)}})},f:function(a,b,c,d,f,g){jb[a]={name:S(b),rc:W(c,d),pb:W(f,g),Lc:[]}},d:function(a,b,c,d,f,g,k,h,n,q){jb[a].Lc.push({rd:S(b),
+F[n>>2],p=k(),t,x=n+4,l=0;l<=q;++l){var u=n+4+l*b;if(l==q||0==p[u>>h])x=d(x,u-x),void 0===t?t=x:(t+=String.fromCharCode(0),t+=x),x=u+b}X(n);return t},toWireType:function(n,q){"string"!=typeof q&&T("Cannot pass non-string to C++ string type "+c);var p=g(q),t=wc(4+p+b);F[t>>2]=p>>h;f(q,t+4,p+b);null!==n&&n.push(X,t);return t},argPackAdvance:8,readValueFromPointer:lb,ib:function(n){X(n)}})},f:function(a,b,c,d,f,g){jb[a]={name:S(b),rc:W(c,d),pb:W(f,g),Lc:[]}},c:function(a,b,c,d,f,g,k,h,n,q){jb[a].Lc.push({rd:S(b),
zd:c,Sb:W(d,f),yd:g,Sd:k,Rd:W(h,n),Td:q})},ga:function(a,b){b=S(b);R(a,{Dd:!0,name:b,argPackAdvance:0,fromWireType:function(){},toWireType:function(){}})},o:function(){return Date.now()},aa:function(){return!0},k:function(a,b,c){a=ec(a);b=oc(b,"emval::as");var d=[],f=Sb(d);F[c>>2]=f;return b.toWireType(d,a)},A:function(a,b,c,d){a=rc[a];b=ec(b);c=qc(c);a(b,c,null,d)},na:dc,oa:function(a,b){var c=tc(a,b),d=c[0];b=d.name+"_$"+c.slice(1).map(function(p){return p.name}).join("_")+"$";var f=uc[b];if(void 0!==
f)return f;f=["retType"];for(var g=[d],k="",h=0;h<a-1;++h)k+=(0!==h?", ":"")+"arg"+h,f.push("argType"+h),g.push(c[1+h]);var n="return function "+pb("methodCaller_"+b)+"(handle, name, destructors, args) {\n",q=0;for(h=0;h<a-1;++h)n+=" var arg"+h+" = argType"+h+".readValueFromPointer(args"+(q?"+"+q:"")+");\n",q+=c[h+1].argPackAdvance;n+=" var rv = handle[name]("+k+");\n";for(h=0;h<a-1;++h)c[h+1].deleteObject&&(n+=" argType"+h+".deleteObject(arg"+h+");\n");d.Dd||(n+=" return retType.toWireType(destructors, rv);\n");
f.push(n+"};\n");a=ac(f).apply(null,g);f=sc(a);return uc[b]=f},z:function(a,b){a=ec(a);b=ec(b);return Sb(a[b])},C:function(a){4<a&&(Y[a].uc+=1)},B:function(){return Sb([])},ma:function(a){return Sb(qc(a))},la:function(a){var b=ec(a);kb(b);dc(a)},h:function(a,b){a=oc(a,"_emval_take_value");a=a.readValueFromPointer(b);return Sb(a)},ba:function(a,b){a=new Date(1E3*ib(a));E[b>>2]=a.getSeconds();E[b+4>>2]=a.getMinutes();E[b+8>>2]=a.getHours();E[b+12>>2]=a.getDate();E[b+16>>2]=a.getMonth();E[b+20>>2]=a.getFullYear()-
diff --git a/web/shared-worker/_generated/comm_query_executor.wasm b/web/shared-worker/_generated/comm_query_executor.wasm
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
GIT binary patch
literal 0
Hc$@<O00001
literal 0
Hc$@<O00001
diff --git a/web/shared-worker/queries/outbound-p2p-message-queries.test.js b/web/shared-worker/queries/outbound-p2p-message-queries.test.js
--- a/web/shared-worker/queries/outbound-p2p-message-queries.test.js
+++ b/web/shared-worker/queries/outbound-p2p-message-queries.test.js
@@ -25,6 +25,7 @@
plaintext: 'decrypted-1',
ciphertext: 'encrypted-1',
status: 'encrypted',
+ supportsAutoRetry: false,
};
const TEST_MSG_2: OutboundP2PMessage = {
messageID: 'id-2',
@@ -34,6 +35,7 @@
plaintext: 'decrypted-2',
ciphertext: 'encrypted-2',
status: 'encrypted',
+ supportsAutoRetry: false,
};
const TEST_MSG_3: OutboundP2PMessage = {
@@ -44,6 +46,7 @@
plaintext: 'decrypted-3',
ciphertext: 'encrypted-3',
status: 'encrypted',
+ supportsAutoRetry: false,
};
const TEST_MSG_4: OutboundP2PMessage = {
@@ -54,6 +57,7 @@
plaintext: 'decrypted-4',
ciphertext: '',
status: 'encrypted',
+ supportsAutoRetry: false,
};
const messagesOrdered = [TEST_MSG_3, TEST_MSG_1, TEST_MSG_2, TEST_MSG_4];

File Metadata

Mime Type
text/plain
Expires
Sat, Oct 19, 10:28 AM (20 h, 8 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2322632
Default Alt Text
D12743.id42539.diff (14 KB)

Event Timeline