Skip to content

Commit

Permalink
Update AmityUIKit v4.0.0-beta26
Browse files Browse the repository at this point in the history
  • Loading branch information
ZayYarHtun committed Oct 18, 2024
1 parent 30ed61b commit 7e15ef1
Show file tree
Hide file tree
Showing 18 changed files with 187 additions and 85 deletions.
8 changes: 4 additions & 4 deletions UpstraUIKit/AmityUIKit.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@
68B30A7C2B70E38B006A4102 /* AmityStoryCommentSettingsScreenViewModelProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 68B30A752B70E38B006A4102 /* AmityStoryCommentSettingsScreenViewModelProtocol.swift */; };
68B30A7D2B70E38B006A4102 /* AmityStoryCommentSettingsScreenViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 68B30A762B70E38B006A4102 /* AmityStoryCommentSettingsScreenViewModel.swift */; };
68B30A7E2B70E38B006A4102 /* AmityStoryCommentSettingsItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 68B30A782B70E38B006A4102 /* AmityStoryCommentSettingsItem.swift */; };
68BDD1802CC24EE1001B0D1E /* SharedFrameworks in Frameworks */ = {isa = PBXBuildFile; productRef = 68BDD17F2CC24EE1001B0D1E /* SharedFrameworks */; };
68F0EE062BC6BBDF004B3AA4 /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = 68F0EE052BC6BBDF004B3AA4 /* PrivacyInfo.xcprivacy */; };
68F5D9FA2B481E4000A9FA0D /* AmityUIKit4.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 68F5D9F92B481E4000A9FA0D /* AmityUIKit4.framework */; };
720D599A2525BDB1009734EF /* DispatchGroupWrapper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 720D59992525BDB1009734EF /* DispatchGroupWrapper.swift */; };
Expand Down Expand Up @@ -371,7 +372,6 @@
78DA0324263C715C007C11CE /* AmityMyCommunityPreviewViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 78DA0320263C715C007C11CE /* AmityMyCommunityPreviewViewController.xib */; };
78DA0325263C715C007C11CE /* AmityMyCommunityPreviewViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 78DA0321263C715C007C11CE /* AmityMyCommunityPreviewViewController.swift */; };
921C3FCB2C379FDB00BF403E /* AmitySocialV4Compatible.swift in Sources */ = {isa = PBXBuildFile; fileRef = 921C3FCA2C379FDB00BF403E /* AmitySocialV4Compatible.swift */; };
926C52372CB92F750085CA64 /* SharedFrameworks in Frameworks */ = {isa = PBXBuildFile; productRef = 926C52362CB92F750085CA64 /* SharedFrameworks */; };
970E784726429FA500E5FCEE /* ChatSettingsTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 970E784526429FA500E5FCEE /* ChatSettingsTableViewCell.swift */; };
970E784826429FA500E5FCEE /* ChatSettingsTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 970E784626429FA500E5FCEE /* ChatSettingsTableViewCell.xib */; };
970E784E26429FB300E5FCEE /* AmityChatSettingsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 970E784C26429FB300E5FCEE /* AmityChatSettingsViewController.swift */; };
Expand Down Expand Up @@ -1340,7 +1340,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
926C52372CB92F750085CA64 /* SharedFrameworks in Frameworks */,
68BDD1802CC24EE1001B0D1E /* SharedFrameworks in Frameworks */,
68F5D9FA2B481E4000A9FA0D /* AmityUIKit4.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down Expand Up @@ -4507,7 +4507,7 @@
);
name = AmityUIKit;
packageProductDependencies = (
926C52362CB92F750085CA64 /* SharedFrameworks */,
68BDD17F2CC24EE1001B0D1E /* SharedFrameworks */,
);
productName = UpstraUIKit;
productReference = 72A3503024EA811500DA9D46 /* AmityUIKit.framework */;
Expand Down Expand Up @@ -5523,7 +5523,7 @@
/* End XCConfigurationList section */

/* Begin XCSwiftPackageProductDependency section */
926C52362CB92F750085CA64 /* SharedFrameworks */ = {
68BDD17F2CC24EE1001B0D1E /* SharedFrameworks */ = {
isa = XCSwiftPackageProductDependency;
productName = SharedFrameworks;
};
Expand Down
17 changes: 9 additions & 8 deletions UpstraUIKit/AmityUIKit4/AmityUIKit4.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@
68BD2D042CB4EF3600FF0A19 /* TabBarView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 68BD2D032CB4EF3200FF0A19 /* TabBarView.swift */; };
68BD2D5F2CB5119F00FF0A19 /* PreviewLinkView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 68BD2D5E2CB5119B00FF0A19 /* PreviewLinkView.swift */; };
68BD2D612CB51AB400FF0A19 /* AmityReactionListViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 68BD2D602CB51AB400FF0A19 /* AmityReactionListViewModel.swift */; };
68BDD17E2CC24ED8001B0D1E /* SharedFrameworks in Frameworks */ = {isa = PBXBuildFile; productRef = 68BDD17D2CC24ED8001B0D1E /* SharedFrameworks */; };
68BECE6C2BEA097500D1AA36 /* AmityPostModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 68BECE6B2BEA097500D1AA36 /* AmityPostModel.swift */; };
68BECE6E2BEA09FF00D1AA36 /* AmityMedia.swift in Sources */ = {isa = PBXBuildFile; fileRef = 68BECE6D2BEA09FF00D1AA36 /* AmityMedia.swift */; };
68BECE702BEA0C2300D1AA36 /* FeedManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 68BECE6F2BEA0C2300D1AA36 /* FeedManager.swift */; };
Expand Down Expand Up @@ -353,7 +354,6 @@
926894402C474A49004CECF8 /* AmityCommunityPinnedPostComponent.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9268943F2C474A49004CECF8 /* AmityCommunityPinnedPostComponent.swift */; };
926894422C474A6A004CECF8 /* EmptyCommunityFeedView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 926894412C474A6A004CECF8 /* EmptyCommunityFeedView.swift */; };
926C520D2CB7190B0085CA64 /* AmityLivestreamPlayerPage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 926C520C2CB7190B0085CA64 /* AmityLivestreamPlayerPage.swift */; };
926C52352CB92F5B0085CA64 /* SharedFrameworks in Frameworks */ = {isa = PBXBuildFile; productRef = 926C52342CB92F5B0085CA64 /* SharedFrameworks */; };
926F079C2BB4DDB9000806CB /* Shimmer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 926F079B2BB4DDB9000806CB /* Shimmer.swift */; };
926F079E2BB4E25B000806CB /* LiveChatMessageBubble.swift in Sources */ = {isa = PBXBuildFile; fileRef = 926F079D2BB4E25B000806CB /* LiveChatMessageBubble.swift */; };
9280FDAA2C3C8A390052F01A /* AmityCommunityProfilePage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9280FDA92C3C8A380052F01A /* AmityCommunityProfilePage.swift */; };
Expand Down Expand Up @@ -682,8 +682,8 @@
686830232C915DFC009B1694 /* TimeInterval+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "TimeInterval+Extension.swift"; sourceTree = "<group>"; };
6868302B2C92EBE4009B1694 /* AmityCommunityMembershipPageBehavior.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AmityCommunityMembershipPageBehavior.swift; sourceTree = "<group>"; };
686830322C993D52009B1694 /* AmityUserProfilePage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AmityUserProfilePage.swift; sourceTree = "<group>"; };
6869148D2CB7FB6100D64409 /* AmityVideoPlayerKit.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = AmityVideoPlayerKit.xcframework; path = /Users/zayar/Desktop/Amity/EkoMessagingSDKUIKitIOS/UpstraUIKit/SampleApp/../Shared/AmityVideoPlayerKit.xcframework; sourceTree = "<absolute>"; };
686914912CB7FBBC00D64409 /* MobileVLCKit.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = MobileVLCKit.xcframework; path = /Users/zayar/Desktop/Amity/EkoMessagingSDKUIKitIOS/UpstraUIKit/AmityUIKitLiveStream/../Shared/MobileVLCKit.xcframework; sourceTree = "<absolute>"; };
6869148D2CB7FB6100D64409 /* AmityVideoPlayerKit.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = AmityVideoPlayerKit.xcframework; path = ../Shared/AmityVideoPlayerKit.xcframework; sourceTree = "<group>"; };
686914912CB7FBBC00D64409 /* MobileVLCKit.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = MobileVLCKit.xcframework; path = ../Shared/MobileVLCKit.xcframework; sourceTree = "<group>"; };
686D173B2B1452A7007AEF59 /* AmityStoryTabComponent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AmityStoryTabComponent.swift; sourceTree = "<group>"; };
686D173D2B1496D2007AEF59 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
686D173F2B149F63007AEF59 /* AmityIcon.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AmityIcon.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -868,6 +868,8 @@
9268943F2C474A49004CECF8 /* AmityCommunityPinnedPostComponent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AmityCommunityPinnedPostComponent.swift; sourceTree = "<group>"; };
926894412C474A6A004CECF8 /* EmptyCommunityFeedView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmptyCommunityFeedView.swift; sourceTree = "<group>"; };
926C520C2CB7190B0085CA64 /* AmityLivestreamPlayerPage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AmityLivestreamPlayerPage.swift; sourceTree = "<group>"; };
926C522D2CB91DA40085CA64 /* MobileVLCKit.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = MobileVLCKit.xcframework; path = ../Shared/MobileVLCKit.xcframework; sourceTree = "<group>"; };
926C52312CB91DAA0085CA64 /* AmityVideoPlayerKit.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = AmityVideoPlayerKit.xcframework; path = ../Shared/AmityVideoPlayerKit.xcframework; sourceTree = "<group>"; };
926F079B2BB4DDB9000806CB /* Shimmer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Shimmer.swift; sourceTree = "<group>"; };
926F079D2BB4E25B000806CB /* LiveChatMessageBubble.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LiveChatMessageBubble.swift; sourceTree = "<group>"; };
9280FDA92C3C8A380052F01A /* AmityCommunityProfilePage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AmityCommunityProfilePage.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1016,7 +1018,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
926C52352CB92F5B0085CA64 /* SharedFrameworks in Frameworks */,
68BDD17E2CC24ED8001B0D1E /* SharedFrameworks in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -1454,6 +1456,8 @@
684AE10D2B0C5D2000FD7270 /* Frameworks */ = {
isa = PBXGroup;
children = (
926C52312CB91DAA0085CA64 /* AmityVideoPlayerKit.xcframework */,
926C522D2CB91DA40085CA64 /* MobileVLCKit.xcframework */,
686914912CB7FBBC00D64409 /* MobileVLCKit.xcframework */,
6869148D2CB7FB6100D64409 /* AmityVideoPlayerKit.xcframework */,
689EE69A2BECC07800927D51 /* AmityUIKit.framework */,
Expand Down Expand Up @@ -2751,9 +2755,6 @@
dependencies = (
);
name = AmityUIKit4;
packageProductDependencies = (
926C52342CB92F5B0085CA64 /* SharedFrameworks */,
);
productName = AmityUIKit4;
productReference = 684AE0F12B0C5B0200FD7270 /* AmityUIKit4.framework */;
productType = "com.apple.product-type.framework";
Expand Down Expand Up @@ -3605,7 +3606,7 @@
/* End XCConfigurationList section */

/* Begin XCSwiftPackageProductDependency section */
926C52342CB92F5B0085CA64 /* SharedFrameworks */ = {
68BDD17D2CC24ED8001B0D1E /* SharedFrameworks */ = {
isa = XCSwiftPackageProductDependency;
productName = SharedFrameworks;
};
Expand Down
4 changes: 4 additions & 0 deletions UpstraUIKit/AmityUIKit4/AmityUIKit4/AmityUIKit4.swift
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,10 @@ final class AmityUIKitManagerInternal: NSObject {
let globalFeedComponentBehavior = AmityGlobalFeedComponentBehavior()
behavior.globalFeedComponentBehavior = globalFeedComponentBehavior

// PostContentComponent
let postContentComponentBehavior = AmityPostContentComponentBehavior()
behavior.postContentComponentBehavior = postContentComponentBehavior

// CreatePostMenuComponent
let createPostMenuComponentBehavior = AmityCreatePostMenuComponentBehavior()
behavior.createPostMenuComponentBehavior = createPostMenuComponentBehavior
Expand Down
2 changes: 1 addition & 1 deletion UpstraUIKit/AmityUIKit4/AmityUIKit4/AmityUIKitConfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"preferred_theme": "default",
"preferred_theme": "light",
"theme": {
"light": {
"primary_color": "#1054DE",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,53 +47,143 @@ struct MultiSelectionMediaPicker: UIViewControllerRepresentable {

final class Coordinator: NSObject, PHPickerViewControllerDelegate {
var parent: MultiSelectionMediaPicker
var loadingOverlay: LoadingOverlayView?

init(_ parent: MultiSelectionMediaPicker) {
self.parent = parent
}

func picker(_ picker: PHPickerViewController, didFinishPicking results: [PHPickerResult]) {
parent.presentationMode.wrappedValue.dismiss()
let identifiers = results.compactMap(\.assetIdentifier)

let dispatchGroup = DispatchGroup()
var images: [UIImage] = []
var videos: [URL] = []

DispatchQueue.main.async {
self.showLoadingOverlay(on: picker.view, message: "Processing media...")
}

for result in results {

// load image from item provider
if result.itemProvider.canLoadObject(ofClass: UIImage.self) {

result.itemProvider.loadObject(ofClass: UIImage.self) { [weak self] newImage, error in
if let error = error {
} else if let image = newImage as? UIImage {
DispatchQueue.main.async {
self?.parent.viewModel.selectedImages.append(image)
}
}
dispatchGroup.enter()
result.itemProvider.loadObject(ofClass: UIImage.self) { newImage, error in
defer { dispatchGroup.leave() }
guard error == nil, let image = newImage as? UIImage else { return }
images.append(image)
}
} else {

guard let assetId = result.assetIdentifier else { continue }

let fetchResult = PHAsset.fetchAssets(withLocalIdentifiers: [assetId], options: nil)
guard let asset = fetchResult.firstObject else { continue }

// load video as avasset
if asset.mediaType == .video {

let options = PHVideoRequestOptions()
options.version = .original
options.isNetworkAccessAllowed = true

dispatchGroup.enter()
PHImageManager.default().requestAVAsset(forVideo: asset, options: options) { avAsset, audioMix, info in
defer { dispatchGroup.leave() }
if let urlAsset = avAsset as? AVURLAsset {
let fileUrl = urlAsset.url
DispatchQueue.main.async {
self.parent.viewModel.selectedVidoesURLs.append(fileUrl)
}
videos.append(urlAsset.url)
}
}
}
}

}

dispatchGroup.notify(queue: .main) {
self.hideLoadingOverlay()

if self.parent.mediaType == .images {
self.parent.viewModel.selectedImages.append(contentsOf: images)
} else {
self.parent.viewModel.selectedVidoesURLs.append(contentsOf: videos)
}

self.parent.presentationMode.wrappedValue.dismiss()
}
}

private func showLoadingOverlay(on view: UIView, message: String) {
loadingOverlay = LoadingOverlayView(message: message)
guard let overlay = loadingOverlay else { return }

view.addSubview(overlay)
overlay.translatesAutoresizingMaskIntoConstraints = false

NSLayoutConstraint.activate([
overlay.topAnchor.constraint(equalTo: view.topAnchor),
overlay.leadingAnchor.constraint(equalTo: view.leadingAnchor),
overlay.trailingAnchor.constraint(equalTo: view.trailingAnchor),
overlay.bottomAnchor.constraint(equalTo: view.bottomAnchor)
])
}

private func hideLoadingOverlay() {
loadingOverlay?.removeFromSuperview()
loadingOverlay = nil
}
}
}


class LoadingOverlayView: UIView {
private let containerView: UIView
private let activityIndicator: UIActivityIndicatorView
private let messageLabel: UILabel

init(message: String) {
containerView = UIView()
containerView.backgroundColor = UIColor.systemBackground
containerView.layer.cornerRadius = 10
containerView.layer.shadowColor = UIColor.black.cgColor
containerView.layer.shadowOffset = CGSize(width: 0, height: 2)
containerView.layer.shadowRadius = 4
containerView.layer.shadowOpacity = 0.1

activityIndicator = UIActivityIndicatorView(style: .medium)

messageLabel = UILabel()
messageLabel.text = message
messageLabel.textAlignment = .center
messageLabel.numberOfLines = 0

super.init(frame: .zero)

backgroundColor = UIColor.black.withAlphaComponent(0.4)

addSubview(containerView)
containerView.addSubview(activityIndicator)
containerView.addSubview(messageLabel)

containerView.translatesAutoresizingMaskIntoConstraints = false
activityIndicator.translatesAutoresizingMaskIntoConstraints = false
messageLabel.translatesAutoresizingMaskIntoConstraints = false

NSLayoutConstraint.activate([
containerView.centerXAnchor.constraint(equalTo: centerXAnchor),
containerView.centerYAnchor.constraint(equalTo: centerYAnchor),
containerView.widthAnchor.constraint(equalToConstant: 200),
containerView.heightAnchor.constraint(greaterThanOrEqualToConstant: 100),

activityIndicator.topAnchor.constraint(equalTo: containerView.topAnchor, constant: 20),
activityIndicator.centerXAnchor.constraint(equalTo: containerView.centerXAnchor),

messageLabel.topAnchor.constraint(equalTo: activityIndicator.bottomAnchor, constant: 16),
messageLabel.leadingAnchor.constraint(equalTo: containerView.leadingAnchor, constant: 16),
messageLabel.trailingAnchor.constraint(equalTo: containerView.trailingAnchor, constant: -16),
messageLabel.bottomAnchor.constraint(equalTo: containerView.bottomAnchor, constant: -20)
])

activityIndicator.startAnimating()
}

required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ public struct AmityCommunityHeaderComponent: AmityComponentView {

Text(community.description)
.font(.system(size: 15))
.foregroundColor(Color(viewConfig.theme.baseColor))
.lineLimit(4)
.isHidden(community.description.isEmpty || viewConfig.isHidden(elementId: .communityDescription))
.padding(.all, 16)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ public struct AmityMediaAttachmentComponent: AmityComponentView {
.renderingMode(.template)
.resizable()
.scaledToFill()
.foregroundColor(isDisable ? Color(viewConfig.theme.baseColorShade3) : nil)
.foregroundColor(isDisable ? Color(viewConfig.theme.baseColor) : nil)
.frame(width: 20, height: 20)
)
.clipShape(Circle())
Expand Down
Loading

0 comments on commit 7e15ef1

Please sign in to comment.