package bj; import android.content.Context; import android.content.Intent; import android.os.Looper; import android.util.Pair; import android.view.MenuItem; import bw3.gj4; import com.tencent.mm.R; import com.tencent.mm.autogen.events.NotifyGroupTodoEvent; import com.tencent.mm.message.l; import com.tencent.mm.plugin.appbrand.config.WxaAttributes; import com.tencent.mm.plugin.appbrand.service.c1; import com.tencent.mm.sdk.platformtools.Log; import com.tencent.mm.sdk.platformtools.Util; import com.tencent.mm.storage.f4; import com.tencent.mm.storage.g4; import com.tencent.mm.storage.k1; import com.tencent.mm.storage.l1; import d60.z; import i14.d0; import i14.l0; import i14.p0; import java.util.ArrayList; import java.util.Iterator; import jh2.k0; import nf0.e6; import nf0.q0; import nf0.u0; import p64.n; import yz3.j; public class b0 { public class a implements l0 { /* renamed from: d reason: collision with root package name */ public final /* synthetic */ boolean f12951d; /* renamed from: e reason: collision with root package name */ public final /* synthetic */ Context f12952e; public a(boolean z15, Context context) { this.f12951d = z15; this.f12952e = context; } @Override // i14.l0 public void onCreateMMMenu(d0 d0Var) { if (this.f12951d) { d0Var.f(0, this.f12952e.getString(R.string.ayk)); } else { d0Var.d(0, this.f12952e.getResources().getColor(R.color.f357965ac), this.f12952e.getString(R.string.ayj)); } } } public class b implements p0 { /* renamed from: d reason: collision with root package name */ public final /* synthetic */ d f12953d; /* renamed from: e reason: collision with root package name */ public final /* synthetic */ boolean f12954e; /* renamed from: f reason: collision with root package name */ public final /* synthetic */ int f12955f; /* renamed from: g reason: collision with root package name */ public final /* synthetic */ String f12956g; /* renamed from: h reason: collision with root package name */ public final /* synthetic */ int f12957h; /* renamed from: i reason: collision with root package name */ public final /* synthetic */ int f12958i; /* renamed from: j reason: collision with root package name */ public final /* synthetic */ String f12959j; /* renamed from: n reason: collision with root package name */ public final /* synthetic */ String f12960n; public b(d dVar, boolean z15, int i15, String str, int i16, int i17, String str2, String str3) { this.f12953d = dVar; this.f12954e = z15; this.f12955f = i15; this.f12956g = str; this.f12957h = i16; this.f12958i = i17; this.f12959j = str2; this.f12960n = str3; } @Override // i14.p0 public void onMMMenuItemSelected(MenuItem menuItem, int i15) { d dVar; int i16; if (menuItem.getItemId() == 0 && (dVar = this.f12953d) != null) { if (this.f12954e) { dVar.a(); } else { dVar.b(); } int i17 = this.f12955f; if (i17 == 2) { String str = this.f12956g; int i18 = this.f12957h; if (this.f12954e) { i16 = 1; } else { i16 = 2; } c0.c(str, 2, i18, i16, this.f12958i, this.f12959j, this.f12960n); } else if (i17 == 1) { c0.b(this.f12956g, this.f12957h, 3, 2, this.f12959j, this.f12960n); } } } } public class c implements n.p { /* renamed from: a reason: collision with root package name */ public final /* synthetic */ int f12961a; /* renamed from: b reason: collision with root package name */ public final /* synthetic */ String f12962b; /* renamed from: c reason: collision with root package name */ public final /* synthetic */ int f12963c; /* renamed from: d reason: collision with root package name */ public final /* synthetic */ boolean f12964d; /* renamed from: e reason: collision with root package name */ public final /* synthetic */ int f12965e; /* renamed from: f reason: collision with root package name */ public final /* synthetic */ String f12966f; /* renamed from: g reason: collision with root package name */ public final /* synthetic */ String f12967g; public c(int i15, String str, int i16, boolean z15, int i17, String str2, String str3) { this.f12961a = i15; this.f12962b = str; this.f12963c = i16; this.f12964d = z15; this.f12965e = i17; this.f12966f = str2; this.f12967g = str3; } @Override // p64.n.p public void onDismiss() { int i15; if (this.f12961a == 2) { String str = this.f12962b; int i16 = this.f12963c; if (this.f12964d) { i15 = 1; } else { i15 = 2; } c0.c(str, 1, i16, i15, this.f12965e, this.f12966f, this.f12967g); } if (this.f12961a == 1) { c0.b(this.f12962b, this.f12963c, 3, 1, this.f12966f, this.f12967g); } } } public interface d { void a(); void b(); } public static Pair<Boolean, String> a(f4 f4Var, l.b bVar) { String str; WxaAttributes e35; if (f4Var == null) { Log.e("MicroMsg.roomTodo.RoomTodoHelp", "msginfo is null"); return new Pair<>(Boolean.FALSE, ""); } else if (bVar == null) { Log.e("MicroMsg.roomTodo.RoomTodoHelp", "content is null"); return new Pair<>(Boolean.FALSE, ""); } else { long createTime = f4Var.getCreateTime(); com.tencent.mm.message.a aVar = (com.tencent.mm.message.a) bVar.x(com.tencent.mm.message.a.class); if (Util.isNullOrNil(aVar.f76727r)) { str = "related_msgid_" + f4Var.E2(); } else { str = aVar.f76727r; } hj.c Sa = ((ej.d) j.c(ej.d.class)).XN0().Sa(f4Var.i(), str); if (Sa != null) { Log.e("MicroMsg.roomTodo.RoomTodoHelp", "addTodoAppBrandImpl %s(%s) exist", str, Integer.valueOf(Sa.field_state)); if (Sa.field_state != 2) { return new Pair<>(Boolean.TRUE, Sa.field_todoid); } Log.i("MicroMsg.roomTodo.RoomTodoHelp", "addTodoAppBrandImpl delete %s", Boolean.valueOf(((ej.d) j.c(ej.d.class)).XN0().Ga(Sa))); } hj.c cVar = new hj.c(); cVar.field_todoid = str; cVar.field_roomname = f4Var.i(); cVar.field_username = bVar.f76857f2; cVar.field_path = bVar.f76853e2; cVar.field_createtime = createTime; cVar.field_updatetime = createTime; cVar.field_custominfo = ""; String str2 = bVar.f76854f; if (Util.isNullOrNil(str2) && (e35 = ((c1) j.c(c1.class)).e3(bVar.f76857f2)) != null && !Util.isNullOrNil(e35.field_nickname)) { str2 = e35.field_nickname; } cVar.field_title = str2; cVar.field_creator = a74.n.b(f4Var); cVar.field_manager = u0.r(); cVar.field_nreply = 0; cVar.field_related_msgids = f4Var.E2() + ""; cVar.field_shareKey = bVar.f76877k2; cVar.field_shareName = f4Var.i(); boolean fb5 = ((ej.d) j.c(ej.d.class)).XN0().insert(cVar); Log.i("MicroMsg.roomTodo.RoomTodoHelp", "addTodoBySendSuccess todoId:%s result:%s", cVar.field_todoid, Boolean.valueOf(fb5)); if (fb5) { f4 ZB = ((g4) ((k0) z.q(k0.class)).WU()).ZB(f4Var.i(), f4Var.E2()); ZB.W2(cVar.field_todoid); ((g4) ((k0) z.q(k0.class)).WU()).CA0(ZB.getMsgId(), ZB); NotifyGroupTodoEvent notifyGroupTodoEvent = new NotifyGroupTodoEvent(); NotifyGroupTodoEvent.a aVar2 = notifyGroupTodoEvent.f63672d; aVar2.f63673a = 0; aVar2.f63675c = cVar.field_todoid; aVar2.f63674b = f4Var.i(); notifyGroupTodoEvent.asyncPublish(Looper.getMainLooper()); } return new Pair<>(Boolean.valueOf(fb5), cVar.field_todoid); } } public static gj4 b(hj.c cVar) { gj4 gj42 = new gj4(); gj42.f22724d = cVar.field_todoid; gj42.f22725e = cVar.field_username; gj42.f22726f = cVar.field_path; gj42.f22727g = (int) (cVar.field_createtime / 1000); gj42.f22729i = cVar.field_title; gj42.f22730j = cVar.field_creator; gj42.f22731n = cVar.r2(); gj42.f22732o = cVar.field_manager; gj42.f22728h = xv3.b.b(cVar.field_custominfo); gj42.f22733p = cVar.field_shareKey; gj42.f22734q = cVar.field_shareName; return gj42; } public static String c(f4 f4Var) { if (f4Var == null) { return ""; } if (f4Var.O3()) { return "roomannouncement@app.origin"; } l.b v15 = l.b.v(f4Var.getContent(), null); if (v15 == null) { Log.e("MicroMsg.roomTodo.RoomTodoHelp", "getAppUsernameFromMsginfo content is null"); return ""; } else if (((com.tencent.mm.message.a) v15.x(com.tencent.mm.message.a.class)) != null) { return v15.f76857f2; } else { Log.e("MicroMsg.roomTodo.RoomTodoHelp", "getAppUsernameFromMsginfo appContentAppBrandPiece is null"); return ""; } } public static void d(Context context, String str, boolean z15) { if (Util.isNullOrNil(str)) { Log.e("MicroMsg.roomTodo.RoomTodoHelp", "gotoRoomCard roomname is null"); return; } Intent intent = new Intent(); intent.putExtra("RoomInfo_Id", str); intent.putExtra("room_notice", q0.d(str)); intent.putExtra("room_notice_xml", q0.g(str)); intent.putExtra("room_notice_publish_time", q0.f(str)); intent.putExtra("room_notice_editor", q0.e(str)); intent.putExtra("from_scene", z15 ? 4 : 3); k1 Sa = ((l1) ((o61.c) z.q(o61.c.class)).VI()).Sa(str); if (Sa != null) { intent.putExtra("Is_RoomOwner", Sa.field_roomowner.equals(u0.r())); intent.putExtra("Is_RoomManager", Sa.z2(u0.r())); } intent.putExtra("room_member_count", Sa.field_memberCount); if (z15) { intent.setFlags(268435456); } ((gm0.b) j.c(gm0.b.class)).gk(context, intent); } public static boolean e(hj.c cVar) { return (cVar == null || cVar.field_state == 2) ? false : true; } public static String f(gj4 gj42) { if (gj42 == null) { return ""; } return "RoomToolsTodo{TodoId='" + gj42.f22724d + '\'' + ", Username='" + gj42.f22725e + '\'' + ", Path='" + gj42.f22726f + '\'' + ", Time=" + gj42.f22727g + ", CustomInfo=" + gj42.f22728h + ", Title='" + Util.secPrint(gj42.f22729i) + '\'' + ", Creator='" + gj42.f22730j + '\'' + ", RelatedMsgId=" + gj42.f22731n + ", Manager='" + gj42.f22732o + '\'' + '}'; } public static Pair<Boolean, String> g(long j15) { boolean z15; f4 tz4 = ((g4) ((k0) z.q(k0.class)).WU()).tz(j15); if (Util.isNullOrNil(tz4.V)) { return new Pair<>(Boolean.FALSE, ""); } hj.c Sa = ((ej.d) j.c(ej.d.class)).XN0().Sa(tz4.i(), tz4.V); if (Sa == null) { return new Pair<>(Boolean.FALSE, tz4.V); } long E2 = tz4.E2(); if (((ArrayList) Sa.S).contains(Long.valueOf(E2))) { ((ArrayList) Sa.S).remove(Long.valueOf(E2)); StringBuilder sb5 = new StringBuilder(); Iterator it = ((ArrayList) Sa.S).iterator(); while (it.hasNext()) { sb5.append(((Long) it.next()).longValue()); sb5.append(","); } if (sb5.length() - 1 >= 0) { sb5.deleteCharAt(sb5.length() - 1); } Sa.field_related_msgids = sb5.toString(); } if (((ArrayList) Sa.S).size() == 0) { z15 = ((ej.d) j.c(ej.d.class)).XN0().Ga(Sa); NotifyGroupTodoEvent notifyGroupTodoEvent = new NotifyGroupTodoEvent(); NotifyGroupTodoEvent.a aVar = notifyGroupTodoEvent.f63672d; aVar.f63673a = 1; aVar.f63674b = Sa.field_roomname; aVar.f63675c = Sa.field_todoid; if (z15) { notifyGroupTodoEvent.asyncPublish(Looper.getMainLooper()); } Log.i("MicroMsg.roomTodo.RoomTodoHelp", "recallTodoByRevokeMsg delete result:%s", Boolean.valueOf(z15)); } else { hj.d XN0 = ((ej.d) j.c(ej.d.class)).XN0(); XN0.getClass(); z15 = XN0.update(Sa.systemRowid, Sa); Log.i("MicroMsg.roomTodo.RoomTodoHelp", "recallTodoByRevokeMsg updateGroupTodo result:%s", Boolean.valueOf(z15)); } if (z15) { tz4.W2(""); ((g4) ((k0) z.q(k0.class)).WU()).CA0(tz4.getMsgId(), tz4); } return new Pair<>(Boolean.TRUE, tz4.V); } public static void h(Context context, String str, String str2, String str3, boolean z15, int i15, int i16, int i17, d dVar) { n nVar = new n(context, 1, true); if (z15) { nVar.m(context.getString(R.string.aym), 17, gy3.a.b(context, 14)); } else { nVar.m(context.getString(R.string.ayl), 17, gy3.a.b(context, 14)); } nVar.f281266t1 = true; nVar.f281245i = new a(z15, context); nVar.f281259q = new b(dVar, z15, i15, str, i16, i17, str2, str3); nVar.f281235d = new c(i15, str, i16, z15, i17, str2, str3); nVar.q(); } public static boolean i(hj.c cVar) { cVar.field_state = 2; cVar.field_updatetime = e6.c(); hj.d XN0 = ((ej.d) j.c(ej.d.class)).XN0(); XN0.getClass(); return XN0.update(cVar.systemRowid, cVar); } public static boolean j(hj.c cVar) { cVar.field_state = 1; cVar.field_updatetime = e6.c(); hj.d XN0 = ((ej.d) j.c(ej.d.class)).XN0(); XN0.getClass(); return XN0.update(cVar.systemRowid, cVar); } }