From b4af872b576b245325d7ee26e73452a5f1b4a08a Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Tue, 10 Dec 2019 10:54:26 +0300 Subject: Drop CocoaPods --- .gitmodules | 3 + Juick.xcodeproj/project.pbxproj | 98 +++++++++++------------------- Juick.xcworkspace/contents.xcworkspacedata | 10 --- Juick/Helpers/NSDate+TimeAgo.h | 19 ++++++ Juick/Helpers/NSDate+TimeAgo.m | 46 ++++++++++++++ Juick/Supporting Files/Juick-Prefix.pch | 3 +- Juick/Views/MessageCell.m | 4 +- Podfile | 8 --- Podfile.lock | 20 ------ Vendor/UIView-Shimmer | 1 + 10 files changed, 109 insertions(+), 103 deletions(-) create mode 100644 .gitmodules delete mode 100644 Juick.xcworkspace/contents.xcworkspacedata create mode 100644 Juick/Helpers/NSDate+TimeAgo.h create mode 100644 Juick/Helpers/NSDate+TimeAgo.m delete mode 100644 Podfile delete mode 100644 Podfile.lock create mode 160000 Vendor/UIView-Shimmer diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..c434860 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "Vendor/UIView-Shimmer"] + path = Vendor/UIView-Shimmer + url = https://github.com/markiv/UIView-Shimmer.git diff --git a/Juick.xcodeproj/project.pbxproj b/Juick.xcodeproj/project.pbxproj index 750a15e..9392ccb 100644 --- a/Juick.xcodeproj/project.pbxproj +++ b/Juick.xcodeproj/project.pbxproj @@ -7,7 +7,6 @@ objects = { /* Begin PBXBuildFile section */ - 706F9651FDACFE30A8DDC1DF /* libPods-Juick.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 22EE2B61A53B73723D255877 /* libPods-Juick.a */; }; 772B4E6C2199811E0029706E /* Entity.m in Sources */ = {isa = PBXBuildFile; fileRef = 772B4E6B2199811E0029706E /* Entity.m */; }; 77317BAC181BBE8500D60005 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 77317BAB181BBE8500D60005 /* Foundation.framework */; }; 77317BAE181BBE8500D60005 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 77317BAD181BBE8500D60005 /* CoreGraphics.framework */; }; @@ -32,6 +31,8 @@ 774153CE1F92A61500A19A50 /* UserNotifications.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 774153CD1F92A61500A19A50 /* UserNotifications.framework */; }; 77418CBD182FB9B6004111B7 /* ImageIO.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 77418CBC182FB9B6004111B7 /* ImageIO.framework */; }; 774528C21F930C06004D110B /* Attachment.m in Sources */ = {isa = PBXBuildFile; fileRef = 774528C11F930C06004D110B /* Attachment.m */; }; + 774746AD239F82A10001C7F9 /* NSDate+TimeAgo.m in Sources */ = {isa = PBXBuildFile; fileRef = 774746AC239F82A10001C7F9 /* NSDate+TimeAgo.m */; }; + 774746B0239F858B0001C7F9 /* UIView+Shimmer.m in Sources */ = {isa = PBXBuildFile; fileRef = 774746AE239F858B0001C7F9 /* UIView+Shimmer.m */; }; 7761133821766A3000D350CD /* ContentLoadingCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 7761133621766A3000D350CD /* ContentLoadingCell.m */; }; 7761133921766A3000D350CD /* ContentLoadingCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 7761133721766A3000D350CD /* ContentLoadingCell.xib */; }; 7761135921790B0300D350CD /* NotificationService.m in Sources */ = {isa = PBXBuildFile; fileRef = 7761135821790B0300D350CD /* NotificationService.m */; }; @@ -89,7 +90,6 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ - 22EE2B61A53B73723D255877 /* libPods-Juick.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Juick.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 770A428F1E8881CB000B206A /* DeviceRegistration.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DeviceRegistration.h; sourceTree = ""; }; 772B4E6A2199811E0029706E /* Entity.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Entity.h; sourceTree = ""; }; 772B4E6B2199811E0029706E /* Entity.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Entity.m; sourceTree = ""; }; @@ -130,6 +130,10 @@ 774528C91F93EE83004D110B /* AssetsLibrary.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AssetsLibrary.framework; path = System/Library/Frameworks/AssetsLibrary.framework; sourceTree = SDKROOT; }; 774528CB1F93EE9F004D110B /* libz.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libz.tbd; path = usr/lib/libz.tbd; sourceTree = SDKROOT; }; 774528CD1F96B39C004D110B /* Juick.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Juick.entitlements; sourceTree = ""; }; + 774746AB239F82A10001C7F9 /* NSDate+TimeAgo.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "NSDate+TimeAgo.h"; sourceTree = ""; }; + 774746AC239F82A10001C7F9 /* NSDate+TimeAgo.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "NSDate+TimeAgo.m"; sourceTree = ""; }; + 774746AE239F858B0001C7F9 /* UIView+Shimmer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "UIView+Shimmer.m"; path = "../Vendor/UIView-Shimmer/Classes/UIView+Shimmer.m"; sourceTree = ""; }; + 774746AF239F858B0001C7F9 /* UIView+Shimmer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "UIView+Shimmer.h"; path = "../Vendor/UIView-Shimmer/Classes/UIView+Shimmer.h"; sourceTree = ""; }; 7761133521766A3000D350CD /* ContentLoadingCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ContentLoadingCell.h; sourceTree = ""; }; 7761133621766A3000D350CD /* ContentLoadingCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ContentLoadingCell.m; sourceTree = ""; }; 7761133721766A3000D350CD /* ContentLoadingCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = ContentLoadingCell.xib; sourceTree = ""; }; @@ -183,9 +187,6 @@ 77E61A5D1FD4682B00B4E304 /* QuoteView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = QuoteView.m; sourceTree = ""; }; 77FCADDE1D6A50DA00CBA649 /* APIClient.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = APIClient.m; sourceTree = ""; }; 77FCADE01D6A50EC00CBA649 /* APIClient.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = APIClient.h; sourceTree = ""; }; - 93A66B462A2F0D663DFD7F9A /* Pods-Juick.debug (local).xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Juick.debug (local).xcconfig"; path = "Pods/Target Support Files/Pods-Juick/Pods-Juick.debug (local).xcconfig"; sourceTree = ""; }; - B3271B16DFB6247972806713 /* Pods-Juick.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Juick.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Juick/Pods-Juick.debug.xcconfig"; sourceTree = ""; }; - FE68EEE5B0A1ABE0D063F54A /* Pods-Juick.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Juick.release.xcconfig"; path = "Pods/Target Support Files/Pods-Juick/Pods-Juick.release.xcconfig"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -201,7 +202,6 @@ 77317BAE181BBE8500D60005 /* CoreGraphics.framework in Frameworks */, 77317BB0181BBE8500D60005 /* UIKit.framework in Frameworks */, 77317BAC181BBE8500D60005 /* Foundation.framework in Frameworks */, - 706F9651FDACFE30A8DDC1DF /* libPods-Juick.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -218,11 +218,11 @@ 77317B9F181BBE8500D60005 = { isa = PBXGroup; children = ( + 774746B1239F85920001C7F9 /* Vendor */, 7761135621790B0300D350CD /* JuickPush */, 77317BAA181BBE8500D60005 /* Frameworks */, 77317BB1181BBE8500D60005 /* Juick */, 77317BA9181BBE8500D60005 /* Products */, - F5489793EBFBBE7FFA7ABC1E /* Pods */, ); sourceTree = ""; }; @@ -248,7 +248,6 @@ 77317BAB181BBE8500D60005 /* Foundation.framework */, 77317BAD181BBE8500D60005 /* CoreGraphics.framework */, 77317BAF181BBE8500D60005 /* UIKit.framework */, - 22EE2B61A53B73723D255877 /* libPods-Juick.a */, 7761136821790C2D00D350CD /* UserNotificationsUI.framework */, ); name = Frameworks; @@ -292,6 +291,31 @@ path = "Supporting Files"; sourceTree = ""; }; + 774746B1239F85920001C7F9 /* Vendor */ = { + isa = PBXGroup; + children = ( + 774746B2239F85A60001C7F9 /* UIView-Shimmer */, + ); + name = Vendor; + sourceTree = ""; + }; + 774746B2239F85A60001C7F9 /* UIView-Shimmer */ = { + isa = PBXGroup; + children = ( + 774746B3239F85B70001C7F9 /* Classes */, + ); + path = "UIView-Shimmer"; + sourceTree = ""; + }; + 774746B3239F85B70001C7F9 /* Classes */ = { + isa = PBXGroup; + children = ( + 774746AF239F858B0001C7F9 /* UIView+Shimmer.h */, + 774746AE239F858B0001C7F9 /* UIView+Shimmer.m */, + ); + name = Classes; + sourceTree = ""; + }; 774DD45D1D735DDD00C7F290 /* Model */ = { isa = PBXGroup; children = ( @@ -349,6 +373,8 @@ 77B09993189D0B9900A84F59 /* UIImage+Utils.m */, 7785605E2343D24E00BB37A2 /* NSData+Hex.h */, 7785605F2343D24E00BB37A2 /* NSData+Hex.m */, + 774746AB239F82A10001C7F9 /* NSDate+TimeAgo.h */, + 774746AC239F82A10001C7F9 /* NSDate+TimeAgo.m */, ); path = Helpers; sourceTree = ""; @@ -388,16 +414,6 @@ path = Views; sourceTree = ""; }; - F5489793EBFBBE7FFA7ABC1E /* Pods */ = { - isa = PBXGroup; - children = ( - B3271B16DFB6247972806713 /* Pods-Juick.debug.xcconfig */, - FE68EEE5B0A1ABE0D063F54A /* Pods-Juick.release.xcconfig */, - 93A66B462A2F0D663DFD7F9A /* Pods-Juick.debug (local).xcconfig */, - ); - name = Pods; - sourceTree = ""; - }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -405,11 +421,9 @@ isa = PBXNativeTarget; buildConfigurationList = 77317BDD181BBE8500D60005 /* Build configuration list for PBXNativeTarget "Juick" */; buildPhases = ( - 293EFEC37D8DBE9B969C71AB /* [CP] Check Pods Manifest.lock */, 77317BA4181BBE8500D60005 /* Sources */, 77317BA5181BBE8500D60005 /* Frameworks */, 77317BA6181BBE8500D60005 /* Resources */, - 6F2FFD38EF490A735BDA88E5 /* [CP] Copy Pods Resources */, 7761136121790B0300D350CD /* Embed App Extensions */, ); buildRules = ( @@ -520,51 +534,13 @@ }; /* End PBXResourcesBuildPhase section */ -/* Begin PBXShellScriptBuildPhase section */ - 293EFEC37D8DBE9B969C71AB /* [CP] Check Pods Manifest.lock */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - "${PODS_PODFILE_DIR_PATH}/Podfile.lock", - "${PODS_ROOT}/Manifest.lock", - ); - name = "[CP] Check Pods Manifest.lock"; - outputPaths = ( - "$(DERIVED_FILE_DIR)/Pods-Juick-checkManifestLockResult.txt", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; - showEnvVarsInLog = 0; - }; - 6F2FFD38EF490A735BDA88E5 /* [CP] Copy Pods Resources */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-Juick/Pods-Juick-resources.sh", - "${PODS_ROOT}/DateTools/DateTools/DateTools/DateTools.bundle", - ); - name = "[CP] Copy Pods Resources"; - outputPaths = ( - "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/DateTools.bundle", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Juick/Pods-Juick-resources.sh\"\n"; - showEnvVarsInLog = 0; - }; -/* End PBXShellScriptBuildPhase section */ - /* Begin PBXSourcesBuildPhase section */ 77317BA4181BBE8500D60005 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( 77C36498224417FC0017522C /* DiscussionsController.m in Sources */, + 774746B0239F858B0001C7F9 /* UIView+Shimmer.m in Sources */, 7761133821766A3000D350CD /* ContentLoadingCell.m in Sources */, 77E61A5E1FD4682B00B4E304 /* QuoteView.m in Sources */, 77317BBC181BBE8500D60005 /* AppDelegate.m in Sources */, @@ -582,6 +558,7 @@ 77C6ADE41F7717BC000AEA8C /* ThreadViewController.m in Sources */, 773E63A3204BE036008B8F8D /* BubbleMessageCell.m in Sources */, 77975A1D182B6E9A00410C2B /* NewPostViewController.m in Sources */, + 774746AD239F82A10001C7F9 /* NSDate+TimeAgo.m in Sources */, 77C36495224417E90017522C /* DiscoverViewController.m in Sources */, 77C67EE51828342000427098 /* NSURL+PathParameters.m in Sources */, 77E35A82189A5B5A00B2D216 /* LoginViewController.m in Sources */, @@ -734,7 +711,6 @@ }; 77317BDE181BBE8500D60005 /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = B3271B16DFB6247972806713 /* Pods-Juick.debug.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_ENTITLEMENTS = Juick/Juick.entitlements; @@ -756,7 +732,6 @@ }; 77317BDF181BBE8500D60005 /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = FE68EEE5B0A1ABE0D063F54A /* Pods-Juick.release.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_ENTITLEMENTS = Juick/Juick.entitlements; @@ -889,7 +864,6 @@ }; 77D40ABD218B70570074E14F /* Debug (local) */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 93A66B462A2F0D663DFD7F9A /* Pods-Juick.debug (local).xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_ENTITLEMENTS = Juick/Juick.entitlements; diff --git a/Juick.xcworkspace/contents.xcworkspacedata b/Juick.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index bf1e00d..0000000 --- a/Juick.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - diff --git a/Juick/Helpers/NSDate+TimeAgo.h b/Juick/Helpers/NSDate+TimeAgo.h new file mode 100644 index 0000000..5ba31a7 --- /dev/null +++ b/Juick/Helpers/NSDate+TimeAgo.h @@ -0,0 +1,19 @@ +// +// TimeAgo.h +// Juick +// +// Created by Vitaly Takmazov on 10.12.2019. +// Copyright © 2019 com.juick. All rights reserved. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface NSDate(TimeAgo) + +- (NSString *)timeAgo; + +@end + +NS_ASSUME_NONNULL_END diff --git a/Juick/Helpers/NSDate+TimeAgo.m b/Juick/Helpers/NSDate+TimeAgo.m new file mode 100644 index 0000000..860e1bc --- /dev/null +++ b/Juick/Helpers/NSDate+TimeAgo.m @@ -0,0 +1,46 @@ +// +// TimeAgo.m +// Juick +// +// Created by Vitaly Takmazov on 10.12.2019. +// Copyright © 2019 com.juick. All rights reserved. +// + +#import "NSDate+TimeAgo.h" + +@implementation NSDate(TimeAgo) + +- (NSString *)timeAgo { + NSDateComponentsFormatter *formatter = [[NSDateComponentsFormatter alloc] init]; + formatter.unitsStyle = NSDateComponentsFormatterUnitsStyleFull; + + NSDate *now = [NSDate date]; + + NSCalendar *calendar = [NSCalendar currentCalendar]; + NSDateComponents *components = [calendar components:(NSCalendarUnitYear|NSCalendarUnitMonth|NSCalendarUnitWeekOfMonth|NSCalendarUnitDay|NSCalendarUnitHour|NSCalendarUnitMinute|NSCalendarUnitSecond) + fromDate:self + toDate:now + options:0]; + + if (components.year > 0) { + formatter.allowedUnits = NSCalendarUnitYear; + } else if (components.month > 0) { + formatter.allowedUnits = NSCalendarUnitMonth; + } else if (components.weekOfMonth > 0) { + formatter.allowedUnits = NSCalendarUnitWeekOfMonth; + } else if (components.day > 0) { + formatter.allowedUnits = NSCalendarUnitDay; + } else if (components.hour > 0) { + formatter.allowedUnits = NSCalendarUnitHour; + } else if (components.minute > 0) { + formatter.allowedUnits = NSCalendarUnitMinute; + } else { + formatter.allowedUnits = NSCalendarUnitSecond; + } + + NSString *formatString = NSLocalizedString(@"%@ ago", @"Used to say how much time has passed. e.g. '2 hours ago'"); + + return [NSString stringWithFormat:formatString, [formatter stringFromDateComponents:components]]; +} + +@end diff --git a/Juick/Supporting Files/Juick-Prefix.pch b/Juick/Supporting Files/Juick-Prefix.pch index 2e32df2..7278b52 100644 --- a/Juick/Supporting Files/Juick-Prefix.pch +++ b/Juick/Supporting Files/Juick-Prefix.pch @@ -18,6 +18,5 @@ #import #import "UIImage+Utils.h" - #import - #import + #import "UIView+Shimmer.h" #endif diff --git a/Juick/Views/MessageCell.m b/Juick/Views/MessageCell.m index c3a8afd..a64b7c3 100644 --- a/Juick/Views/MessageCell.m +++ b/Juick/Views/MessageCell.m @@ -10,6 +10,8 @@ #import "APIClient.h" #import "Entity.h" +#import "NSDate+TimeAgo.h" + @interface MessageCell() @property(nonatomic, readonly) NSMutableParagraphStyle *quoteStyle; @property(nonatomic, readonly) UIFont *boldFont; @@ -80,7 +82,7 @@ const NSString *unreadMarker = @"●"; } self.title.text = msg.user.uname; - self.timestamp.text = [[[APIClient sharedClient].dateFormatter dateFromString:msg.timestamp] timeAgoSinceNow]; + self.timestamp.text = [[[APIClient sharedClient].dateFormatter dateFromString:msg.timestamp] timeAgo]; NSUInteger count = [msg.repliesCount unsignedIntegerValue]; if (count > 0) { if ([msg.repliesBy length] > 0) { diff --git a/Podfile b/Podfile deleted file mode 100644 index 50575b1..0000000 --- a/Podfile +++ /dev/null @@ -1,8 +0,0 @@ -source 'https://cdn.cocoapods.org' -platform :ios, "11.1" - -target "Juick" do - pod 'DateTools' - pod 'UIView+Shimmer' -end - diff --git a/Podfile.lock b/Podfile.lock deleted file mode 100644 index 226f0fe..0000000 --- a/Podfile.lock +++ /dev/null @@ -1,20 +0,0 @@ -PODS: - - DateTools (2.0.0) - - "UIView+Shimmer (1.0.0)" - -DEPENDENCIES: - - DateTools - - "UIView+Shimmer" - -SPEC REPOS: - trunk: - - DateTools - - "UIView+Shimmer" - -SPEC CHECKSUMS: - DateTools: 933ac9c490f21f92127cf690ccd8c397e0126caf - "UIView+Shimmer": ed634f95e8f4bda666b28b47bd85a4336a4117d8 - -PODFILE CHECKSUM: a4ef27310741a24901c5df7d68a4bb8cbf35cea9 - -COCOAPODS: 1.8.4 diff --git a/Vendor/UIView-Shimmer b/Vendor/UIView-Shimmer new file mode 160000 index 0000000..721b4f6 --- /dev/null +++ b/Vendor/UIView-Shimmer @@ -0,0 +1 @@ +Subproject commit 721b4f64513139e9f9406a2a07cca13217f487e3 -- cgit v1.2.3