
package com.cooleshow.teacher.push;

import android.content.Context;
import android.os.Build;


import io.rong.push.PushType;
import io.rong.push.notification.PushMessageReceiver;
import io.rong.push.notification.PushNotificationMessage;

public class SealNotificationReceiver extends PushMessageReceiver {

    @Override
    public boolean onNotificationMessageArrived(Context context, PushType pushType, PushNotificationMessage pushNotificationMessage) {
        return false;// 返回 false, 会弹出融云 SDK 默认通知; 返回 true, 融云 SDK 不会弹通知, 通知需要由您自定义。
    }

    @Override
    public boolean onNotificationMessageClicked(Context context, PushType pushType, PushNotificationMessage notificationMessage) {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
            return false;
        }
        try {
//            if (ActivityManager.getInstance().isOpenActivity(MainActivity.class)) {
//                MainActivity mainActivity = MainActivity.instance;
//                if (mainActivity != null) {
//                    mainActivity.startActivity("rongIM");
//                }
//            } else {
//                Intent i = new Intent(context, HtmlActivity.class);
//                i.putExtra("memo", "rongIM");
//                i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
//                context.startActivity(i);
//            }
        } catch (Exception e) {
            e.printStackTrace();
        }

        return false;// 返回 false, 会走融云 SDK 默认处理逻辑, 即点击该通知会打开会话列表或会话界面; 返回 true, 则由您自定义处理逻辑。
    }
}