Skip to content

Commit

Permalink
Merge tag 'Ent_TestFlight_8.4.2113'
Browse files Browse the repository at this point in the history
  • Loading branch information
FrPellissier committed May 27, 2023
2 parents 67425d6 + 9c6a6dd commit dd2ed34
Show file tree
Hide file tree
Showing 44 changed files with 646 additions and 96 deletions.
2 changes: 1 addition & 1 deletion entourage.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -2228,7 +2228,7 @@
isa = XCBuildConfiguration;
baseConfigurationReference = BFFEEE559B5D831168F2302C /* Pods-entourage.debug.xcconfig */;
buildSettings = {
APP_URL_SCHEME = "entourage-staging";
APP_URL_SCHEME = "api-preprod.entourage.social";
ASSETCATALOG_COMPILER_APPICON_NAME = AppIconDebug;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
BUNDLE_ID_SUFFIX = .beta;
Expand Down
83 changes: 83 additions & 0 deletions entourage/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,89 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
func applicationDidBecomeActive(_ application: UIApplication) {
}

//Universal links
func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool {

guard let incomingURL = userActivity.webpageURL else { return false }
guard let components = URLComponents(url: incomingURL, resolvingAgainstBaseURL: true) else { return false }

// extract the path components from the incoming URL
let pathComponents = components.path.components(separatedBy: "/")

// check if the incoming URL matches any of the URLs you want to handle
if components.host == "entourage-webapp-preprod.herokuapp.com" {
print("eho pathComponents " , pathComponents)
if pathComponents.contains("outings") && pathComponents.contains("chat_messages"){
}
if pathComponents.contains("neighborhoods") && pathComponents.contains("chat_messages"){

}
if pathComponents.contains("conversations") && pathComponents.contains("chat_messages"){

}
if pathComponents.contains("outings") {

}
if pathComponents.contains("neighborhoods") {

}
if pathComponents.contains("conversations") {

}
if pathComponents.contains("solicitations") {

}
if pathComponents.contains("contributions") {

}
if pathComponents.contains("resources") {

}

}
return true
}

//Deeplinks
func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
handleDeepLink(url: url)
return true
}

private func handleDeepLink(url: URL) {
print("eho opened deeplink")
guard let components = NSURLComponents(url: url, resolvingAgainstBaseURL: true),
let pathComponents = components.path?.split(separator: "/") else { return }

var pathIterator = pathComponents.makeIterator()

while let pathComponent = pathIterator.next() {
switch pathComponent {
case "outings":
guard let outingUUID = pathIterator.next() else { break }
// Handle outings
case "neighborhoods":
guard let neighborhoodUUID = pathIterator.next() else { break }
// Handle neighborhoods
case "conversations":
guard let conversationUUID = pathIterator.next() else { break }
// Handle conversations
case "solicitations":
guard let solicitationUUID = pathIterator.next() else { break }
// Handle solicitations
case "contributions":
guard let contributionUUID = pathIterator.next() else { break }
// Handle contributions
case "resources":
guard let resourceUUID = pathIterator.next() else { break }
// Handle resources
default:
break
}
}
}


func handleNotification(userInfos:[String:Any]?, isFromBackground:Bool, isFromStart:Bool) {
Logger.print("***** handle notifs \(userInfos)")
Logger.print("***** isFrom BG : \(isFromBackground)")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0xE3",
"green" : "0xE5",
"red" : "0xE8"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0xA5",
"green" : "0xA5",
"red" : "0xA7"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
28 changes: 26 additions & 2 deletions entourage/Assets/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -536,17 +536,41 @@
"report_user_message_error" = "Veuillez saisir votre message. Merci";
"report_user_message_success" = "Utilisateur signalé";
"parameter_publication" = "Paramètres de la publication";
"parameter_message" = "Paramètres du message";
"parameter_comment" = "Paramètres du commentaire";
"supress_button_title" = "Supprimer";
"supress_alert_title" = "Supprimer la publication";
"supress_alert_text" = "Souhaitez-vous supprimer cette publication ?";
"supress_alert_title_publi" = "Supprimer la publication";
"supress_alert_text_publi" = "Souhaitez-vous supprimer cette publication ?";

"supress_alert_title_message" = "Supprimer le message";
"supress_alert_text_message" = "Souhaitez-vous supprimer ce message de la conversation ?";

"supress_alert_title_comment" = "Supprimer le commentaire";
"supress_alert_text_comment" = "Souhaitez-vous supprimer ce commentaire ?";


"deleted_post_text" = "Cette publication a été supprimée";

//REPORT AND SUPPRESS POPUP
"report_post_cell_title" = "Signaler";
"suppress_post_cell_title" = "Supprimer ma publication";
"report_post_cell_subtitle" = "Signaler cette publication à l'équipe Entourage";

"report_comment_cell_title" = "Signaler";
"suppress_comment_cell_title" = "Supprimer mon commentaire";
"report_comment_cell_subtitle" = "Signaler ce commentaire à l'équipe Entourage";

"report_message_cell_title" = "Signaler";
"suppress_message_cell_title" = "Supprimer mon message";
"report_message_cell_subtitle" = "Signaler ce message à l'équipe Entourage";


"suppress_post_cell_subtitle" = "";
"suppress_message_cell_subtitle" = "";
"suppress_comment_cell_subtitle" = "";

"deleted_message" = " Ce message a été supprimé";
"deleted_comment" = " Ce commentaire a été supprimé";

/********
GROUP
Expand Down
6 changes: 6 additions & 0 deletions entourage/Assets/Neighborhood.xcassets/deleted/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"images" : [
{
"filename" : "Avion Copy 4.svg",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"template-rendering-intent" : "template"
}
}
47 changes: 47 additions & 0 deletions entourage/Managers/DeeplinkManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,43 @@ struct DeepLinkManager {
}
}

static func presentActionFromDeeplink(notification:NotificationPushData) {
switch notification.instanceType {
case .users:
showUser(userId: notification.instanceId)
case .pois:
showPoi(id: notification.instanceId)
case .conversations:
showConversation(conversationId: notification.instanceId)
case .neighborhoods:
showNeighborhoodDetail(id: notification.instanceId)
case .outings:
showOuting(id: notification.instanceId)
case .partners:
showPartner(partnerId: notification.instanceId)
case .resources:
showResource(id: notification.instanceId)
case .contributions:
showAction(id: notification.instanceId, isContrib: true)
case .solicitations:
showAction(id: notification.instanceId, isContrib: false)
case .neighborhood_post:
if let _postId = notification.postId{
showNeighborhoodDetailMessage(instanceId: notification.instanceId, postId: _postId)
}else{
showNeighborhoodDetail(id: notification.instanceId)
}
case .outing_post:
if let _postId = notification.postId{
showEventDetailMessage(instanceId: notification.instanceId, postId: _postId)
}else{
showOuting(id: notification.instanceId)
}
case .none:
break
}
}

static func setImage(notificationInstanceType:InstanceType) -> String {
switch notificationInstanceType {
case .users:
Expand Down Expand Up @@ -180,3 +217,13 @@ struct DeepLinkManager {
}

}

enum RedirectionType {
case outingsChatMessage(chatMessageId:Int, outingsId:Int)
case outings(outingsId:Int)
case neighborhoodsChatMessage(chatMessageId:Int, groupId:Int)
case neighborhood(groupId:Int)
case solicitation(id:Int)
case contributions(id:Int)
case conversation(id:Int)
}
4 changes: 4 additions & 0 deletions entourage/Network Managers/Endpoints.swift
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,10 @@ let kAPIConversationPostCreateConversation = "conversations?token=%@"
let kAPIConversationReportConversation = "conversations/%@/report?token=%@"
let kAPIConversationQuitConversation = "conversations/%@/users?token=%@"
let kAPIConversationGetDetailConversation = "conversations/%@?token=%@"

//Chat message
let kAPIChatMessageDelete = "/chat_messages/%d?token=%@"

//Block / unblock user
let kAPIBlockUser = "user_blocked_users/?token=%@"
let kAPIUnBlockUsers = "user_blocked_users/?token=%@"
Expand Down
14 changes: 14 additions & 0 deletions entourage/Network Managers/MessagingService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,20 @@ struct MessagingService:ParsingDataCodable {
}
}

static func deletetCommentFor(chatMessageId:Int, completion: @escaping (_ error:EntourageNetworkError?) -> Void) {
guard let token = UserDefaults.token else {return}
var endpoint = kAPIChatMessageDelete
endpoint = String.init(format: endpoint, chatMessageId, token)

NetworkManager.sharedInstance.requestDelete(endPoint: endpoint, headers: nil, body: nil) { data, resp, error in
guard let data = data, error == nil, let _response = resp as? HTTPURLResponse, _response.statusCode < 300 else {
DispatchQueue.main.async { completion(error) }
return
}
DispatchQueue.main.async { completion(nil) }
}
}

static func createOrGetConversation(userId:String, completion: @escaping (_ conversation:Conversation?,_ error:EntourageNetworkError?) -> Void) {
guard let token = UserDefaults.token else {return}
var endpoint = kAPIConversationPostCreateConversation
Expand Down
1 change: 0 additions & 1 deletion entourage/Network Managers/NeighborhoodService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ struct NeighborhoodService:ParsingDataCodable {
endpoint = String.init(format: endpoint,"\(id)", token)

Logger.print("***** url get detail group : \(endpoint)")

NetworkManager.sharedInstance.requestGet(endPoint: endpoint, headers: nil, params: nil) { data, resp, error in

guard let data = data,error == nil,let _response = resp as? HTTPURLResponse, _response.statusCode < 300 else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,17 @@ extension ConversationDetailMessagesViewController: UITextViewDelegate {

//MARK: - MessageCellSignalDelegate -
extension ConversationDetailMessagesViewController:MessageCellSignalDelegate {
func signalMessage(messageId: Int) {}
func signalMessage(messageId: Int, userId:Int) {
if let navvc = UIStoryboard.init(name: StoryboardName.neighborhoodReport, bundle: nil).instantiateViewController(withIdentifier: "reportNavVC") as? UINavigationController, let vc = navvc.topViewController as? ReportGroupMainViewController {
vc.parentDelegate = self
vc.messageId = messageId
vc.signalType = .comment
vc.userId = userId
vc.conversationId = conversationId
self.present(navvc, animated: true)
}

}

func retrySend(message: String,positionForRetry:Int) {
self.sendMessage(messageStr: message, isRetry: true, positionForRetry: positionForRetry)
Expand Down Expand Up @@ -524,3 +534,25 @@ extension ConversationDetailMessagesViewController:MessageCellSignalDelegate {
protocol UpdateUnreadCountDelegate:AnyObject {
func updateUnreadCount(conversationId:Int, currentIndexPathSelected:IndexPath?)
}

extension ConversationDetailMessagesViewController:GroupDetailDelegate{
func showMessage(signalType: GroupDetailSignalType) {
let alertVC = MJAlertController()
let buttonCancel = MJAlertButtonType(title: "OK".localized, titleStyle:ApplicationTheme.getFontCourantRegularNoir(size: 18, color: .white), bgColor: .appOrange, cornerRadius: -1)
let title = signalType == .comment ? "report_comment_title".localized : "report_publication_title".localized

alertVC.configureAlert(alertTitle: title, message: "report_group_message_success".localized, buttonrightType: buttonCancel, buttonLeftType: nil, titleStyle: ApplicationTheme.getFontCourantBoldOrange(), messageStyle: ApplicationTheme.getFontCourantRegularNoir(), mainviewBGColor: .white, mainviewRadius: 35, isButtonCloseHidden: true)

DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 0.1) {
alertVC.show()
}
}

func publicationDeleted() {
DispatchQueue.main.async {
self.getMessages()
}
}


}
8 changes: 5 additions & 3 deletions entourage/Scenes/Conversations/ConversationListMainCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@
//

import UIKit
import ActiveLabel

class ConversationListMainCell: UITableViewCell {


@IBOutlet weak var ui_image: UIImageView!
@IBOutlet weak var ui_username: UILabel!
@IBOutlet weak var ui_detail_message: UILabel!
@IBOutlet weak var ui_detail_message: ActiveLabel!
@IBOutlet weak var ui_role: UILabel!
@IBOutlet weak var ui_view_separator: UIView!

Expand Down Expand Up @@ -46,8 +47,9 @@ class ConversationListMainCell: UITableViewCell {
ui_username.text = message.title
ui_role.text = message.getRolesWithPartnerFormated()
if let _message = message.getLastMessage {
ui_detail_message.setTextWithLinksDetected(_message) { url in
delegate.showWebUrl(url:url)
ui_detail_message.text = _message
ui_detail_message.handleURLTap { url in
delegate.showWebUrl(url: url)
}
}
ui_detail_message.text = message.getLastMessage
Expand Down
Loading

0 comments on commit dd2ed34

Please sign in to comment.