private bool AddFriendViaIconButton(ProfileMessage profile, Filter filter) { ZaloHelper.Output($"!tiến hành gửi yêu cầu kết bạn: {profile.Name}"); //Wait to navigate to profiles TouchAtIconBottomRight(); //Touch to AddFriends //Wait to Navigate to new windows Delay(3000); var proccessedDialog = ProcessIfShowDialogWaitRequestedFriendConfirm(); if (proccessedDialog) { ZaloHelper.Output($"!yêu cầu kết bạn: {profile.Name} bị từ chối. Lý do: đã gửi yêu cầu rồi"); TouchAtIconTopLeft(); //GoBack to friendList return(false); } TouchAt(Screen.AddFriendScreenGreetingTextField); var textGreeting = ZaloHelper.GetZalomessages(profile, filter)?.FirstOrDefault(x => x.Type == ZaloMessageType.Text)?.Value; if (!string.IsNullOrWhiteSpace(textGreeting)) { ZaloHelper.Output($"!gửi: {textGreeting}"); SendText(textGreeting); if (Settings.IsDebug) { TouchAtIconTopLeft(); } else { TouchAt(Screen.AddFriendScreenOkButton); //TouchToAddFriend, zalo auto goto profile after sent } } else { TouchAtIconTopLeft(); //GoBack to profile } Delay(300); TouchAtIconTopLeft(); //GoBack to friendList DbContext.LogAddFriend(profile, Settings.User.Username, textGreeting); return(true); }
private bool Chat(ChatRequest profile, Filter filter) { TouchAt(Screen.ChatScreenTextField); Delay(300); var messages = ZaloHelper.GetZalomessages(profile.Profile, filter); foreach (var message in messages) { DeleteWordInFocusedTextField(20); if (message.Type == ZaloMessageType.Text) { SendText(message.Value); Delay(500); if (!IsDebug) { //TouchAt(Screen.ChatScreenSendButton); SendKey(KeyCode.AkeycodeEnter); } ZaloHelper.Output($"Gửi tin nhắn chữ '{message.Value}' tới bạn '{profile.Profile.Name}' thành công"); } else { UpImageChat(new System.IO.FileInfo(message.Value)); Delay(500); TouchAt(Screen.ChatScreenOpenMoreWindowButton); Delay(500); TouchAt(Screen.ChatScreenAddImageButton); Delay(500); TouchAt(Screen.UploadAlbumDCimFolter); Delay(500); TouchAt(Screen.UploadAlbumFirstImageCheckBox); if (!Settings.IsDebug) { Delay(500); TouchAt(Screen.UploadAlbumSendButton); } else { Delay(500); TouchAtIconTopLeft(); Delay(500); TouchAtIconTopLeft(); } ZaloHelper.Output($"Gửi tin nhắn hình '{message.Value}' tới bạn '{profile.Profile.Name}' thành công"); Delay(900); TouchAt(Screen.ChatScreenCloseMoreWindowButton); Delay(100); } Delay(1000); switch (profile.Objective) { case ChatObjective.FriendInContactList: DbContext.AddLogMessageSentToFriend(profile.Profile, Settings.User.Username, message.Value); break; case ChatObjective.StrangerByPhone: case ChatObjective.StrangerNearBy: DbContext.AddLogMessageSentToStranger(profile.Profile, Settings.User.Username, message.Value); break; } } return(true); }