mirror of
https://github.com/oxen-io/session-android.git
synced 2024-12-24 16:57:50 +00:00
feat: add no op push manager for de-googled
This commit is contained in:
parent
8d4f2445f2
commit
7762d534bb
@ -1,5 +1,7 @@
|
||||
package org.thoughtcrime.securesms.linkpreview;
|
||||
|
||||
import static org.session.libsession.utilities.Util.readFully;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
@ -8,8 +10,6 @@ import android.net.Uri;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.google.android.gms.common.util.IOUtils;
|
||||
|
||||
import org.session.libsession.messaging.sending_receiving.attachments.Attachment;
|
||||
import org.session.libsession.messaging.sending_receiving.attachments.AttachmentTransferProgress;
|
||||
import org.session.libsession.messaging.sending_receiving.attachments.UriAttachment;
|
||||
@ -148,7 +148,7 @@ public class LinkPreviewRepository {
|
||||
InputStream bodyStream = response.body().byteStream();
|
||||
controller.setStream(bodyStream);
|
||||
|
||||
byte[] data = IOUtils.readInputStreamFully(bodyStream);
|
||||
byte[] data = readFully(bodyStream);
|
||||
Bitmap bitmap = BitmapFactory.decodeByteArray(data, 0, data.length);
|
||||
Optional<Attachment> thumbnail = bitmapToAttachment(bitmap, Bitmap.CompressFormat.JPEG, MediaTypes.IMAGE_JPEG);
|
||||
|
||||
|
@ -28,6 +28,13 @@ class PushNotificationService : FirebaseMessagingService() {
|
||||
|
||||
override fun onMessageReceived(message: RemoteMessage) {
|
||||
Log.d("Loki", "Received a push notification.")
|
||||
if (message.data.containsKey("spns")) {
|
||||
// assume this is the new push notification content
|
||||
// deal with the enc payload (probably decrypting through the PushManager?
|
||||
Log.d("Loki", "TODO: deal with the enc_payload\n${message.data["enc_payload"]}")
|
||||
pushManager.decrypt(message.data)
|
||||
return
|
||||
}
|
||||
val base64EncodedData = message.data?.get("ENCRYPTED_DATA")
|
||||
val data = base64EncodedData?.let { Base64.decode(it) }
|
||||
if (data != null) {
|
@ -0,0 +1,14 @@
|
||||
package org.thoughtcrime.securesms.notifications
|
||||
|
||||
import org.session.libsignal.utilities.Log
|
||||
|
||||
class NoOpPushManager: PushManager {
|
||||
|
||||
override fun register(force: Boolean) {
|
||||
Log.d("NoOpPushManager", "Push notifications not supported, not registering for push notifications")
|
||||
}
|
||||
|
||||
override fun unregister(token: String) {
|
||||
Log.d("NoOpPushManager", "Push notifications not supported, not unregistering for push notifications")
|
||||
}
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
package org.thoughtcrime.securesms.notifications
|
||||
|
||||
import dagger.Module
|
||||
import dagger.Provides
|
||||
import dagger.hilt.InstallIn
|
||||
import dagger.hilt.components.SingletonComponent
|
||||
import javax.inject.Singleton
|
||||
|
||||
@Module
|
||||
@InstallIn(SingletonComponent::class)
|
||||
class NoOpPushModule {
|
||||
@Provides
|
||||
@Singleton
|
||||
fun provideNoOpManager(): PushManager = NoOpPushManager()
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user