mirror of
https://github.com/oxen-io/session-android.git
synced 2025-08-12 07:17:45 +00:00
Resolve various loose ends
This commit is contained in:
@@ -32,6 +32,7 @@ import androidx.multidex.MultiDexApplication;
|
||||
import org.conscrypt.Conscrypt;
|
||||
import org.session.libsession.messaging.MessagingModuleConfiguration;
|
||||
import org.session.libsession.messaging.avatars.AvatarHelper;
|
||||
import org.session.libsession.messaging.file_server.FileServerAPI;
|
||||
import org.session.libsession.messaging.jobs.JobQueue;
|
||||
import org.session.libsession.messaging.mentions.MentionsManager;
|
||||
import org.session.libsession.messaging.open_groups.OpenGroupAPI;
|
||||
@@ -93,6 +94,7 @@ import org.webrtc.voiceengine.WebRtcAudioUtils;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.security.SecureRandom;
|
||||
import java.security.Security;
|
||||
import java.util.Date;
|
||||
import java.util.HashSet;
|
||||
@@ -420,7 +422,7 @@ public class ApplicationContext extends MultiDexApplication implements Dependenc
|
||||
}
|
||||
byte[] userPrivateKey = IdentityKeyUtil.getIdentityKeyPair(this).getPrivateKey().serialize();
|
||||
LokiAPIDatabaseProtocol apiDB = DatabaseFactory.getLokiAPIDatabase(this);
|
||||
org.session.libsession.messaging.file_server.FileServerAPI.Companion.configure(userPublicKey, userPrivateKey, apiDB);
|
||||
FileServerAPI.Companion.configure(userPublicKey, userPrivateKey, apiDB);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -492,13 +494,12 @@ public class ApplicationContext extends MultiDexApplication implements Dependenc
|
||||
try {
|
||||
File profilePicture = AvatarHelper.getAvatarFile(this, Address.fromSerialized(userPublicKey));
|
||||
StreamDetails stream = new StreamDetails(new FileInputStream(profilePicture), "image/jpeg", profilePicture.length());
|
||||
throw new IOException();
|
||||
// FileServerAPI.uploadProfilePicture(FileServerAPI.shared.getServer(), profileKey, stream, () -> {
|
||||
// TextSecurePreferences.setLastProfilePictureUpload(this, new Date().getTime());
|
||||
// TextSecurePreferences.setProfileAvatarId(this, new SecureRandom().nextInt());
|
||||
// ProfileKeyUtil.setEncodedProfileKey(this, encodedProfileKey);
|
||||
// return Unit.INSTANCE;
|
||||
// });
|
||||
FileServerAPI.shared.uploadProfilePicture(FileServerAPI.shared.getServer(), profileKey, stream, () -> {
|
||||
TextSecurePreferences.setLastProfilePictureUpload(this, new Date().getTime());
|
||||
TextSecurePreferences.setProfileAvatarId(this, new SecureRandom().nextInt());
|
||||
ProfileKeyUtil.setEncodedProfileKey(this, encodedProfileKey);
|
||||
return Unit.INSTANCE;
|
||||
});
|
||||
} catch (Exception exception) {
|
||||
// Do nothing
|
||||
}
|
||||
|
@@ -7,6 +7,7 @@ import androidx.work.*
|
||||
import nl.komponents.kovenant.Promise
|
||||
import nl.komponents.kovenant.all
|
||||
import nl.komponents.kovenant.functional.map
|
||||
import org.session.libsession.messaging.jobs.MessageReceiveJob
|
||||
import org.session.libsession.messaging.open_groups.OpenGroup
|
||||
import org.session.libsession.messaging.sending_receiving.pollers.OpenGroupPoller
|
||||
import org.session.libsession.snode.SnodeAPI
|
||||
@@ -71,10 +72,9 @@ class BackgroundPollWorker(val context: Context, params: WorkerParameters) : Wor
|
||||
// Private chats
|
||||
val userPublicKey = TextSecurePreferences.getLocalNumber(context)!!
|
||||
val privateChatsPromise = SnodeAPI.getMessages(userPublicKey).map { envelopes ->
|
||||
throw IOException()
|
||||
// envelopes.map { envelope ->
|
||||
// MessageReceiveJob(envelope.toByteArray(), false).executeAsync()
|
||||
// }
|
||||
envelopes.map { envelope ->
|
||||
MessageReceiveJob(envelope.toByteArray(), false).executeAsync()
|
||||
}
|
||||
}
|
||||
promises.addAll(privateChatsPromise.get())
|
||||
|
||||
|
@@ -27,7 +27,7 @@ class PushNotificationService : FirebaseMessagingService() {
|
||||
val data = base64EncodedData?.let { Base64.decode(it) }
|
||||
if (data != null) {
|
||||
try {
|
||||
JobQueue.shared.add(MessageReceiveJob(MessageWrapper.unwrap(data),true))
|
||||
JobQueue.shared.add(MessageReceiveJob(MessageWrapper.unwrap(data).toByteArray(),true))
|
||||
} catch (e: Exception) {
|
||||
Log.d("Loki", "Failed to unwrap data for message due to error: $e.")
|
||||
}
|
||||
|
Reference in New Issue
Block a user