Skip to content

Commit

Permalink
Merge pull request #122 from Dark-Fox-PL/master
Browse files Browse the repository at this point in the history
Add support for Android 14 (API 34).
  • Loading branch information
vavadiyahiren authored Oct 3, 2024
2 parents 1bdd226 + 88da265 commit 7532355
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import android.content.Intent;
import android.content.IntentFilter;

import androidx.core.content.ContextCompat;

import org.jivesoftware.smack.ConnectionConfiguration;
import org.jivesoftware.smack.ConnectionListener;
import org.jivesoftware.smack.ReconnectionManager;
Expand Down Expand Up @@ -584,7 +586,7 @@ public void onReceive(Context context, Intent intent) {
filter.addAction(Constants.X_SEND_MESSAGE);
filter.addAction(Constants.READ_MESSAGE);
filter.addAction(Constants.GROUP_SEND_MESSAGE);
mApplicationContext.registerReceiver(uiThreadMessageReceiver, filter);
mApplicationContext.registerReceiver(uiThreadMessageReceiver, filter, Context.RECEIVER_EXPORTED);

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,18 +57,6 @@ public class FlutterXmppPlugin implements MethodCallHandler, FlutterPlugin, Acti
private BroadcastReceiver connectionBroadcastReceiver = null;
private boolean requireSSLConnection = false, autoDeliveryReceipt = false, automaticReconnection = true, useStreamManagement = true;

// public static void registerWith(Registrar registrar) {
//
// //method channel
// final MethodChannel method_channel = new MethodChannel(registrar.messenger(), CHANNEL);
// method_channel.setMethodCallHandler(new FlutterXmppPlugin(registrar.context()));
//
// //event channel
// final EventChannel event_channel = new EventChannel(registrar.messenger(), CHANNEL_STREAM);
// event_channel.setStreamHandler(new FlutterXmppPlugin(registrar.context()));
//
// }

private static BroadcastReceiver get_message(final EventChannel.EventSink events) {
return new BroadcastReceiver() {
@Override
Expand Down Expand Up @@ -305,7 +293,7 @@ public void onListen(Object args, EventChannel.EventSink events) {
successBroadcastReceiver = getSuccessBroadCast(events);
IntentFilter filter = new IntentFilter();
filter.addAction(Constants.SUCCESS_MESSAGE);
activity.registerReceiver(successBroadcastReceiver, filter);
activity.registerReceiver(successBroadcastReceiver, filter, Context.RECEIVER_EXPORTED);
}
}

Expand All @@ -328,7 +316,7 @@ public void onListen(Object args, EventChannel.EventSink errorEvents) {
errorBroadcastReceiver = getErrorBroadCast(errorEvents);
IntentFilter filter = new IntentFilter();
filter.addAction(Constants.ERROR_MESSAGE);
activity.registerReceiver(errorBroadcastReceiver, filter);
activity.registerReceiver(errorBroadcastReceiver, filter, Context.RECEIVER_EXPORTED);
}
}

Expand All @@ -351,7 +339,7 @@ public void onListen(Object args, EventChannel.EventSink connectionEvents) {
connectionBroadcastReceiver = getConnectionBroadCast(connectionEvents);
IntentFilter filter = new IntentFilter();
filter.addAction(Constants.CONNECTION_STATE_MESSAGE);
activity.registerReceiver(connectionBroadcastReceiver, filter);
activity.registerReceiver(connectionBroadcastReceiver, filter, Context.RECEIVER_EXPORTED);
}
}

Expand Down Expand Up @@ -428,7 +416,7 @@ public void onListen(Object auth, EventChannel.EventSink eventSink) {
filter.addAction(Constants.RECEIVE_MESSAGE);
filter.addAction(Constants.OUTGOING_MESSAGE);
filter.addAction(Constants.PRESENCE_MESSAGE);
activity.registerReceiver(mBroadcastReceiver, filter);
activity.registerReceiver(mBroadcastReceiver, filter, Context.RECEIVER_EXPORTED);
}

}
Expand Down Expand Up @@ -808,4 +796,4 @@ private void logout() {
}
}

}
}

0 comments on commit 7532355

Please sign in to comment.