Skip to content

Commit 9abfa0f

Browse files
committed
Autoreply conditions applied
1 parent 072bb08 commit 9abfa0f

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

android/src/main/java/com/devsonflutter/reflex/notification/NotificationUtils.java

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,11 @@
2222
import androidx.core.app.RemoteInput;
2323

2424
import com.devsonflutter.reflex.ReflexPlugin;
25-
import com.devsonflutter.reflex.notification.model.App;
2625
import com.devsonflutter.reflex.notification.model.NotificationWear;
2726

2827
import java.util.ArrayList;
29-
import java.util.HashSet;
3028
import java.util.List;
3129
import java.util.Map;
32-
import java.util.Set;
3330
import java.util.UUID;
3431

3532
public class NotificationUtils {
@@ -135,9 +132,18 @@ static boolean canReply(StatusBarNotification notification) {
135132

136133
private static boolean checkListeningAndReplyPackages(String notificationPackageName,
137134
List<String> replyPackageNameList) {
138-
// TODO: check Listening and Replying PackageNames also debugPrint if necessary
139-
// Use listeningPackageNameList & listeningExceptionPackageNameList
140-
return true;
135+
if(listeningPackageNameList == null && listeningExceptionPackageNameList == null && replyPackageNameList == null){
136+
return true;
137+
}else if(listeningPackageNameList == null && listeningExceptionPackageNameList == null){
138+
return replyPackageNameList.contains(notificationPackageName);
139+
}
140+
else if(listeningPackageNameList == null ){
141+
142+
return !listeningExceptionPackageNameList.contains(notificationPackageName);
143+
}
144+
else {
145+
return true;
146+
}
141147
}
142148

143149
@RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN_MR2)

example/lib/main.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class _MyAppState extends State<MyApp> {
2525
Reflex reflex = Reflex(
2626
debug: true,
2727
packageNameList: ["com.whatsapp", "com.tyup"],
28-
packageNameExceptionList: ["com.miui.securitycenter"],
28+
packageNameExceptionList: ["com.android.systemui"],
2929
autoReply: AutoReply(
3030
packageNameList: ["com.whatsapp"],
3131
message: "[Reflex] This is an automated reply.",

0 commit comments

Comments
 (0)