diff --git a/build/iOS/MultiCraft/MultiCraft.xcodeproj/project.pbxproj b/build/iOS/MultiCraft/MultiCraft.xcodeproj/project.pbxproj index 51d30486..3c75beec 100644 --- a/build/iOS/MultiCraft/MultiCraft.xcodeproj/project.pbxproj +++ b/build/iOS/MultiCraft/MultiCraft.xcodeproj/project.pbxproj @@ -43,9 +43,9 @@ 84A4380425535BA5002571D4 /* soft_oal.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 84A4380325535BA5002571D4 /* soft_oal.framework */; }; 84A4380525535BA5002571D4 /* soft_oal.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 84A4380325535BA5002571D4 /* soft_oal.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 84A608A425F0A02900D79FCD /* Sentry in Frameworks */ = {isa = PBXBuildFile; productRef = 84A608A325F0A02900D79FCD /* Sentry */; }; + 84B1647F27988B92002A670A /* Bundle+AppIcon.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84B1647E27988B92002A670A /* Bundle+AppIcon.swift */; }; 84B9C11724A4D82400016BCE /* ConsentAlertViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84B9C11524A4D82400016BCE /* ConsentAlertViewController.swift */; }; 84B9C11824A4D82400016BCE /* ConsentAlertViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 84B9C11624A4D82400016BCE /* ConsentAlertViewController.xib */; }; - 84C32A3724AF7A4500445E92 /* Nantes in Frameworks */ = {isa = PBXBuildFile; productRef = 84C32A3624AF7A4500445E92 /* Nantes */; }; 84C32A3924AF7DDE00445E92 /* UITextViewPlaceholder.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84C32A3824AF7DDE00445E92 /* UITextViewPlaceholder.swift */; }; 84C67B1E25D5E06B002E2735 /* AppTrackingTransparency.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 84C67B1D25D5E06B002E2735 /* AppTrackingTransparency.framework */; }; 84CD4A64248782720019B81D /* MainWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84CD4A59248782720019B81D /* MainWindow.swift */; }; @@ -323,6 +323,7 @@ 8473ED8325C0562C0053293B /* unidata.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = unidata.h; path = ../../../../lib/luautf8/unidata.h; sourceTree = ""; }; 849C4F85209656D2005EB041 /* ru.lproj */ = {isa = PBXFileReference; lastKnownFileType = folder; path = ru.lproj; sourceTree = ""; }; 84A4380325535BA5002571D4 /* soft_oal.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = soft_oal.framework; path = ../deps/soft_oal.framework; sourceTree = ""; }; + 84B1647E27988B92002A670A /* Bundle+AppIcon.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Bundle+AppIcon.swift"; sourceTree = ""; }; 84B9C11524A4D82400016BCE /* ConsentAlertViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ConsentAlertViewController.swift; sourceTree = ""; }; 84B9C11624A4D82400016BCE /* ConsentAlertViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = ConsentAlertViewController.xib; sourceTree = ""; }; 84C32A3824AF7DDE00445E92 /* UITextViewPlaceholder.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UITextViewPlaceholder.swift; sourceTree = ""; }; @@ -748,7 +749,6 @@ F8E6C7D51DCA476800F64426 /* libIrrlicht.a in Frameworks */, 84A608A425F0A02900D79FCD /* Sentry in Frameworks */, 843F4C3126617D0D005277FA /* ZipArchive in Frameworks */, - 84C32A3724AF7A4500445E92 /* Nantes in Frameworks */, F8E6C7C91DCA430300F64426 /* OpenGLES.framework in Frameworks */, 8E0FFE3234B35EC9603EC82A /* Pods_MultiCraft.framework in Frameworks */, F8E6C7C51DCA42F300F64426 /* QuartzCore.framework in Frameworks */, @@ -800,6 +800,22 @@ name = irrlicht_changes; sourceTree = ""; }; + 84B1647C27988B92002A670A /* Extensions */ = { + isa = PBXGroup; + children = ( + 84B1647D27988B92002A670A /* Bundle */, + ); + path = Extensions; + sourceTree = ""; + }; + 84B1647D27988B92002A670A /* Bundle */ = { + isa = PBXGroup; + children = ( + 84B1647E27988B92002A670A /* Bundle+AppIcon.swift */, + ); + path = Bundle; + sourceTree = ""; + }; 84CD4A56248782720019B81D /* Main */ = { isa = PBXGroup; children = ( @@ -882,6 +898,7 @@ F8E6C4DC1DCA3B7900F64426 /* Supporting Files */ = { isa = PBXGroup; children = ( + 84B1647C27988B92002A670A /* Extensions */, 84CD4A56248782720019B81D /* Main */, 84CD4A5A248782720019B81D /* UI */, 84CD4A55248781420019B81D /* Bridge-Header.h */, @@ -1451,7 +1468,6 @@ ); name = MultiCraft; packageProductDependencies = ( - 84C32A3624AF7A4500445E92 /* Nantes */, 84A608A325F0A02900D79FCD /* Sentry */, 843F4C3026617D0D005277FA /* ZipArchive */, ); @@ -1491,7 +1507,6 @@ ); mainGroup = F8E6C4D01DCA3B7900F64426; packageReferences = ( - 84C32A3524AF7A4500445E92 /* XCRemoteSwiftPackageReference "Nantes" */, 84A608A225F0A02900D79FCD /* XCRemoteSwiftPackageReference "sentry-cocoa" */, 843F4C2F26617D0D005277FA /* XCRemoteSwiftPackageReference "ZipArchive" */, ); @@ -1663,6 +1678,7 @@ F8E6C6F61DCA41DB00F64426 /* c_content.cpp in Sources */, 4B35A9EA1EEE010D00274961 /* l_metadata.cpp in Sources */, F8E6C6551DCA3F9900F64426 /* shader.cpp in Sources */, + 84B1647F27988B92002A670A /* Bundle+AppIcon.swift in Sources */, F8E6C7491DCA420A00F64426 /* l_env.cpp in Sources */, F8E6C6381DCA3F9900F64426 /* mapsector.cpp in Sources */, F8E6C7B81DCA428800F64426 /* auth.cpp in Sources */, @@ -2073,14 +2089,6 @@ minimumVersion = 7.5.0; }; }; - 84C32A3524AF7A4500445E92 /* XCRemoteSwiftPackageReference "Nantes" */ = { - isa = XCRemoteSwiftPackageReference; - repositoryURL = "https://github.com/instacart/Nantes"; - requirement = { - kind = upToNextMinorVersion; - minimumVersion = 0.1.2; - }; - }; /* End XCRemoteSwiftPackageReference section */ /* Begin XCSwiftPackageProductDependency section */ @@ -2094,11 +2102,6 @@ package = 84A608A225F0A02900D79FCD /* XCRemoteSwiftPackageReference "sentry-cocoa" */; productName = Sentry; }; - 84C32A3624AF7A4500445E92 /* Nantes */ = { - isa = XCSwiftPackageProductDependency; - package = 84C32A3524AF7A4500445E92 /* XCRemoteSwiftPackageReference "Nantes" */; - productName = Nantes; - }; /* End XCSwiftPackageProductDependency section */ }; rootObject = F8E6C4D11DCA3B7900F64426 /* Project object */; diff --git a/build/iOS/MultiCraft/MultiCraft/Extensions/Bundle/Bundle+AppIcon.swift b/build/iOS/MultiCraft/MultiCraft/Extensions/Bundle/Bundle+AppIcon.swift new file mode 100644 index 00000000..eb87fe7e --- /dev/null +++ b/build/iOS/MultiCraft/MultiCraft/Extensions/Bundle/Bundle+AppIcon.swift @@ -0,0 +1,14 @@ +import UIKit + +extension Bundle { + var appIcon: UIImage? { + if let icons = infoDictionary?["CFBundleIcons"] as? [String: Any], + let primaryIcon = icons["CFBundlePrimaryIcon"] as? [String: Any], + let iconFiles = primaryIcon["CFBundleIconFiles"] as? [String], + let lastIcon = iconFiles.last { + return UIImage(named: lastIcon) + } + return nil + } +} + diff --git a/build/iOS/MultiCraft/MultiCraft/UI/ConsentAlertViewController.swift b/build/iOS/MultiCraft/MultiCraft/UI/ConsentAlertViewController.swift index 6fb9f26a..1fbf0afa 100644 --- a/build/iOS/MultiCraft/MultiCraft/UI/ConsentAlertViewController.swift +++ b/build/iOS/MultiCraft/MultiCraft/UI/ConsentAlertViewController.swift @@ -1,16 +1,15 @@ import UIKit -import Nantes private enum Constants { static let oldInfoStatusKey = "personalized_ad_status" static let newInfoStatusKey = "new_personalized_ad_status" } -final class ConsentAlertViewController: BasePresentViewController, NantesLabelDelegate { +final class ConsentAlertViewController: BasePresentViewController { @IBOutlet private weak var buttonRelevant: UIButton! @IBOutlet private weak var buttonAllow: UIButton! @IBOutlet private weak var viewContainer: UIView! - @IBOutlet private weak var labelPrivacy: NantesLabel! + @IBOutlet private weak var privacyTextView: UITextView! @IBOutlet private weak var viewFirst: UIView! @IBOutlet private weak var viewSecond: UIView! @IBOutlet private weak var buttonAgree: UIButton! @@ -26,6 +25,8 @@ final class ConsentAlertViewController: BasePresentViewController, NantesLabelDe var finishTapped: (() -> Void)? + let screenWidth = UIScreen.main.bounds.size.width + private enum Status: String, Codable { case unknown case personalized @@ -50,8 +51,13 @@ final class ConsentAlertViewController: BasePresentViewController, NantesLabelDe override func viewWillLayoutSubviews() { super.viewWillLayoutSubviews() - + imageAppIcon.layer.cornerRadius = imageAppIcon.frame.size.height * 0.22 setupContentHeight() + + if (isShowFirstPage && screenWidth <= 568.0) { + buttonAllow.titleLabel?.font = .boldSystemFont(ofSize: 15) + buttonRelevant.titleLabel?.font = .boldSystemFont(ofSize: 15) + } } private func setupContentHeight() { @@ -60,12 +66,16 @@ final class ConsentAlertViewController: BasePresentViewController, NantesLabelDe } private func setupUI() { - if UIScreen.main.bounds.size.width <= 667 { - leftPadding.constant = 30 - rightPadding.constant = 30 + var widthMultiplierValue: CGFloat = 0.7 + if screenWidth <= 568.0 { + widthMultiplierValue = 0.95 + } else if screenWidth <= 667.0 { + widthMultiplierValue = 0.91 } - imageAppIcon.image = Bundle.main.icon + viewContainer.widthAnchor.constraint(equalTo: view.widthAnchor, multiplier: widthMultiplierValue).isActive = true + + imageAppIcon.image = Bundle.main.appIcon buttonAgree.layer.cornerRadius = 6 buttonBack.layer.borderWidth = 1 @@ -75,12 +85,10 @@ final class ConsentAlertViewController: BasePresentViewController, NantesLabelDe buttonAllow.layer.cornerRadius = 8 buttonAllow.layer.borderWidth = 3 buttonAllow.layer.borderColor = UIColor(220, 220, 220).cgColor - buttonAllow.titleLabel?.numberOfLines = 2 buttonRelevant.layer.cornerRadius = 8 buttonRelevant.layer.borderWidth = 3 buttonRelevant.layer.borderColor = UIColor(220, 220, 220).cgColor - buttonRelevant.titleLabel?.numberOfLines = 2 viewContainer.layer.shadowColor = UIColor.black.cgColor viewContainer.layer.shadowRadius = 6 @@ -88,20 +96,27 @@ final class ConsentAlertViewController: BasePresentViewController, NantesLabelDe viewContainer.layer.shadowOffset = .init(width: 0, height: 3) viewContainer.layer.cornerRadius = 8 - labelPrivacy.delegate = self - let text = "Our partners will collect data and use a unique identifier on your device to show you ads. By agreeing, you confirm that you are 16 years old. You can learn how we and our partners collect and use data on Privacy Policy." - labelPrivacy.text = text + setupTextView() + } - labelPrivacy.linkAttributes = [NSAttributedString.Key.underlineColor: NSUnderlineStyle.single.rawValue, - NSAttributedString.Key.foregroundColor: UIColor(0, 98, 232)] + private func setupTextView() { + privacyTextView.delegate = self + privacyTextView.backgroundColor = .clear + privacyTextView.textContainerInset = UIEdgeInsets(top: 0.0, left: privacyTextView.textContainerInset.left, bottom: 0.0, right: privacyTextView.textContainerInset.right) + privacyTextView.textContainer.lineFragmentPadding = 0 + let paragraphStyle = NSMutableParagraphStyle() + paragraphStyle.alignment = .center + privacyTextView.linkTextAttributes = [NSAttributedString.Key.foregroundColor : UIColor.blue] - labelPrivacy.activeLinkAttributes = [NSAttributedString.Key.backgroundColor: UIColor(white: 0.5, alpha: 0.5), - NSAttributedString.Key.underlineColor: NSUnderlineStyle.single.rawValue] + let attributedString = NSMutableAttributedString(string: "Our partners will collect data and use a unique identifier on your device to show you ads. By agreeing, you confirm that you are 16 years old. You can learn how we and our partners collect and use data on ", attributes: [NSAttributedString.Key.paragraphStyle : paragraphStyle, NSAttributedString.Key.foregroundColor : UIColor.darkGray]) - labelPrivacy.lineSpacing = 3 - labelPrivacy.textColor = .lightGray - labelPrivacy.addLink(to: privacyURL, withRange: (text as NSString).range(of: "Privacy Policy")) + let linkAttrString = NSMutableAttributedString(string: "Privacy Policy", attributes: [NSAttributedString.Key.link : privacyURL.absoluteString]) + + attributedString.append(linkAttrString) + attributedString.append(NSMutableAttributedString(string: ".")) + + privacyTextView.attributedText = attributedString } @IBAction private func showMulticraftUses(_ sender: Any) { @@ -120,12 +135,6 @@ final class ConsentAlertViewController: BasePresentViewController, NantesLabelDe } } - @IBAction private func showPrivacy(_ sender: Any) { - if UIApplication.shared.canOpenURL(privacyURL) { - UIApplication.shared.open(privacyURL) - } - } - @IBAction private func allowTapped(_ sender: Any) { Self.setPersonalizedConsentStatus(.personalized) finishTapped?() @@ -147,12 +156,6 @@ final class ConsentAlertViewController: BasePresentViewController, NantesLabelDe self.view.layoutIfNeeded() } } - - func attributedLabel(_ label: NantesLabel, didSelectLink link: URL) { - if UIApplication.shared.canOpenURL(link) { - UIApplication.shared.open(link) - } - } } extension ConsentAlertViewController { @@ -215,14 +218,8 @@ extension ConsentAlertViewController { } } -extension Bundle { - var icon: UIImage? { - if let icons = infoDictionary?["CFBundleIcons"] as? [String: Any], - let primaryIcon = icons["CFBundlePrimaryIcon"] as? [String: Any], - let iconFiles = primaryIcon["CFBundleIconFiles"] as? [String], - let lastIcon = iconFiles.last { - return UIImage(named: lastIcon) - } - return nil +extension ConsentAlertViewController: UITextViewDelegate { + func textViewDidChangeSelection(_ textView: UITextView) { + textView.selectedTextRange = nil } } diff --git a/build/iOS/MultiCraft/MultiCraft/UI/ConsentAlertViewController.xib b/build/iOS/MultiCraft/MultiCraft/UI/ConsentAlertViewController.xib index 0c3d09a0..7e2236fe 100644 --- a/build/iOS/MultiCraft/MultiCraft/UI/ConsentAlertViewController.xib +++ b/build/iOS/MultiCraft/MultiCraft/UI/ConsentAlertViewController.xib @@ -1,8 +1,11 @@ - + + - + + + @@ -14,9 +17,7 @@ - - - + @@ -29,146 +30,191 @@ - + - + - + - - + + + + - + + - + - + - - - + + - + + + - - - - - - + - - - - - - + + - - - + + + - - + + - + - - + - -