From c8be948864da518b80bc270d1f197662cb8eb043 Mon Sep 17 00:00:00 2001 From: Fran Alarza Date: Fri, 13 Dec 2024 12:16:58 +0100 Subject: [PATCH 1/4] fix: simplify literals and remove reset token --- Applivery.podspec | 6 +- .../Interactors/StartInteractor.swift | 1 - AppliverySDK/Model/Public/TextLiterals.swift | 67 ++++++++++++------- .../VideoReport/RecordingViewController.swift | 4 +- .../Modules/VideoReport/VideoPreviewRow.swift | 1 - 5 files changed, 46 insertions(+), 33 deletions(-) diff --git a/Applivery.podspec b/Applivery.podspec index 7b6cad3..2ca719c 100644 --- a/Applivery.podspec +++ b/Applivery.podspec @@ -1,15 +1,15 @@ Pod::Spec.new do |s| s.name = "Applivery" - s.version = "3.3.0" + s.version = "4.3.0" s.summary = "Mobile App Distribution" s.homepage = "https://www.applivery.com" s.license = { :type => "MIT", :file => "LICENSE" } s.author = { "Alejandro Jiménez Agudo" => "alejandro@applivery.com" } s.social_media_url = "https://twitter.com/Applivery" s.source = { :git => "https://github.com/applivery/applivery-ios-sdk.git", :tag => "v#{s.version}" } - s.platform = :ios, "11.0" + s.platform = :ios, "13.0" s.source_files = "AppliverySDK/**/*.swift" s.exclude_files = "AppliverySDK/**/getConstants.swift" s.resource_bundle = { 'Applivery' => ["AppliverySDK/**/*.storyboard", "AppliverySDK/**/*.strings"] } - s.swift_version = "5.0" + s.swift_version = "5.5" end diff --git a/AppliverySDK/Interactors/StartInteractor.swift b/AppliverySDK/Interactors/StartInteractor.swift index bc44638..9da5fc4 100644 --- a/AppliverySDK/Interactors/StartInteractor.swift +++ b/AppliverySDK/Interactors/StartInteractor.swift @@ -58,7 +58,6 @@ class StartInteractor { // MARK: Internal Methods func start() { - try? keychain.remove(for: app.bundleId()) logInfo("Applivery is starting... ") logInfo("SDK Version: \(GlobalConfig.shared.app.getSDKVersion())") setupBindings() diff --git a/AppliverySDK/Model/Public/TextLiterals.swift b/AppliverySDK/Model/Public/TextLiterals.swift index b0b6751..6be16e8 100644 --- a/AppliverySDK/Model/Public/TextLiterals.swift +++ b/AppliverySDK/Model/Public/TextLiterals.swift @@ -150,6 +150,12 @@ public class TextLiterals: NSObject { /// "Your session has expired. Please, log in again" @objc public var loginSessionExpired: String + /// "Your session has expired. Please, log in again" + @objc public var sheetScreenshotAction: String + + /// "Your session has expired. Please, log in again" + @objc public var sheetRecordAction: String + // MARK: - Initializer /** Creates a new instance of TextLiterals. @@ -186,32 +192,35 @@ public class TextLiterals: NSObject { - Version: 2.4 */ @objc public init( - appName: String = kLocaleSdkName, - alertButtonCancel: String = kLocaleAlertButtonCancel, - alertButtonRetry: String = kLocaleAlertButtonRetry, - alertButtonOK: String = kLocaleAlertButtonOk, - errorUnexpected: String = kLocaleErrorUnexpected, - errorInvalidCredentials: String = kLocaleErrorInvalidCredentials, - errorDownloadURL: String = kLocaleErrorDownloadUrl, - otaUpdateMessage: String? = nil, - alertButtonLater: String = kLocaleAlertButtonLater, - alertButtonUpdate: String = kLocaleAlertButtonUpdate, - forceUpdateMessage: String? = nil, - buttonForceUpdate: String = kLocaleUpdateViewButtonUpdate, - feedbackButtonClose: String = kLocaleFeedbackButtonClose, - feedbackButtonAdd: String = kLocaleFeedbackButtonAdd, - feedbackButtonSend: String = kLocaleFeedbackButtonSend, - feedbackSelectType: String = kLocaleFeedbackLabelSelectType, - feedbackTypeBug: String = kLocaleFeedbackButtonBug, - feedbackTypeFeedback: String = kLocaleFeedbackButtonFeedback, - feedbackMessagePlaceholder: String = kLocaleFeedbackTextMessagePlaceholder, - feedbackAttach: String = kLocaleFeedbackLabelAttach, - loginInputUser: String = kLocaleLoginInputUser, - loginInputPassword: String = kLocaleLoginInputPassword, - loginButton: String = kLocaleLoginButton, - loginMessage: String = kLocaleLoginAlertMessage, - loginInvalidCredentials: String = kLocaleLoginAlertMessageInvalidCredentials, - loginSessionExpired: String = kLocaleLoginAlertMessageExpired) { + appName: String = "Applivery", + alertButtonCancel: String = "Cancel", + alertButtonRetry: String = "Retry", + alertButtonOK: String = "OK", + errorUnexpected: String = "Unexpected error", + errorInvalidCredentials: String = "Invalid credentials", + errorDownloadURL: String = "Couldn't start download. Invalid url", + otaUpdateMessage: String? = "There is a new version available for download. Do you want to update to the latest version?", + alertButtonLater: String = "Later", + alertButtonUpdate: String = "Update", + forceUpdateMessage: String? = "Sorry this App is outdated. Please, update the App to continue using it", + buttonForceUpdate: String = "Update now", + feedbackButtonClose: String = "Close", + feedbackButtonAdd: String = "Add Feedback", + feedbackButtonSend: String = "Send Feedback", + feedbackSelectType: String = "Select type", + feedbackTypeBug: String = "Bug", + feedbackTypeFeedback: String = "Feedback", + feedbackMessagePlaceholder: String = "Add a message", + feedbackAttach: String = "Attach Screenshot", + loginInputUser: String = "user", + loginInputPassword: String = "password", + loginButton: String = "Login", + loginMessage: String = "Login is required!", + loginInvalidCredentials: String = "Wrong user or password, please, try again", + loginSessionExpired: String = "Your session has expired. Please, log in again", + sheetScreenshotAction: String = "Take Screenshoot", + sheetRecordAction: String = "Record Screen" + ) { self.appName = appName self.alertButtonCancel = alertButtonCancel @@ -239,6 +248,8 @@ public class TextLiterals: NSObject { self.loginMessage = loginMessage self.loginInvalidCredentials = loginInvalidCredentials self.loginSessionExpired = loginSessionExpired + self.sheetScreenshotAction = sheetScreenshotAction + self.sheetRecordAction = sheetRecordAction } } @@ -269,6 +280,8 @@ enum Literal: CustomStringConvertible { case loginMessage case loginInvalidCredentials case loginSessionExpired + case sheetScreenshotAction + case sheetRecordAction var description: String { return literal(self) ?? String(self.hashValue) @@ -306,6 +319,8 @@ func literal(_ literal: Literal) -> String? { case .loginMessage: return literals.loginMessage case .loginInvalidCredentials: return literals.loginInvalidCredentials case .loginSessionExpired: return literals.loginSessionExpired + case .sheetScreenshotAction: return literals.sheetScreenshotAction + case .sheetRecordAction: return literals.sheetRecordAction } } // swiftlint:enable cyclomatic_complexity diff --git a/AppliverySDK/Modules/VideoReport/RecordingViewController.swift b/AppliverySDK/Modules/VideoReport/RecordingViewController.swift index 6afea6c..d472a43 100644 --- a/AppliverySDK/Modules/VideoReport/RecordingViewController.swift +++ b/AppliverySDK/Modules/VideoReport/RecordingViewController.swift @@ -114,11 +114,11 @@ class RecordingViewController: UIViewController { func presentActionSheet() { actionSheet = UIAlertController() - let screenshotAction = UIAlertAction(title: localize("sheet_screenshoot_action"), style: .default) { _ in + let screenshotAction = UIAlertAction(title: literal(.sheetScreenshotAction), style: .default) { _ in ScreenRecorderManager.shared.presentPreviewWithScreenshoot() } - let screenRecordingAction = UIAlertAction(title: localize("sheet_record_action"), style: .default) { _ in + let screenRecordingAction = UIAlertAction(title: literal(.sheetRecordAction), style: .default) { _ in ScreenRecorderManager.shared.startClipBuffering() } diff --git a/AppliverySDK/Modules/VideoReport/VideoPreviewRow.swift b/AppliverySDK/Modules/VideoReport/VideoPreviewRow.swift index 274d4b9..f87640a 100644 --- a/AppliverySDK/Modules/VideoReport/VideoPreviewRow.swift +++ b/AppliverySDK/Modules/VideoReport/VideoPreviewRow.swift @@ -71,7 +71,6 @@ struct VideoPreviewRow: View { let imageGenerator = AVAssetImageGenerator(asset: asset) imageGenerator.appliesPreferredTrackTransform = true - // Extraer el primer segundo del video (puedes ajustar el tiempo si es necesario) let time = CMTime(seconds: 1, preferredTimescale: 60) DispatchQueue.global().async { do { From 076278bc2f79654b50ed47c1f924457e71442257 Mon Sep 17 00:00:00 2001 From: Fran Alarza Date: Fri, 13 Dec 2024 13:31:24 +0100 Subject: [PATCH 2/4] feat: disable record screen for lower versions than ios 15 --- .../VideoReport/RecordingViewController.swift | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/AppliverySDK/Modules/VideoReport/RecordingViewController.swift b/AppliverySDK/Modules/VideoReport/RecordingViewController.swift index d472a43..a93766c 100644 --- a/AppliverySDK/Modules/VideoReport/RecordingViewController.swift +++ b/AppliverySDK/Modules/VideoReport/RecordingViewController.swift @@ -17,7 +17,10 @@ class RecordingViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() view.backgroundColor = .clear - addRecordButton() + if #available(iOS 15.0, *) { + addRecordButton() + } else { + } } @@ -124,9 +127,14 @@ class RecordingViewController: UIViewController { let cancelAction = UIAlertAction(title: "Cancel", style: .cancel, handler: nil) - actionSheet.addAction(screenshotAction) - actionSheet.addAction(screenRecordingAction) - actionSheet.addAction(cancelAction) + if #available(iOS 15.0, *) { + actionSheet.addAction(screenshotAction) + actionSheet.addAction(screenRecordingAction) + actionSheet.addAction(cancelAction) + } else { + actionSheet.addAction(screenshotAction) + actionSheet.addAction(cancelAction) + } if let popoverController = actionSheet.popoverPresentationController { popoverController.sourceView = self.view From 7a067d2a9d4cc0a4f922820b8348f1d1e46a5da9 Mon Sep 17 00:00:00 2001 From: Fran Alarza Date: Fri, 13 Dec 2024 13:34:39 +0100 Subject: [PATCH 3/4] delete else --- AppliverySDK/Modules/VideoReport/RecordingViewController.swift | 1 - 1 file changed, 1 deletion(-) diff --git a/AppliverySDK/Modules/VideoReport/RecordingViewController.swift b/AppliverySDK/Modules/VideoReport/RecordingViewController.swift index a93766c..72808e8 100644 --- a/AppliverySDK/Modules/VideoReport/RecordingViewController.swift +++ b/AppliverySDK/Modules/VideoReport/RecordingViewController.swift @@ -19,7 +19,6 @@ class RecordingViewController: UIViewController { view.backgroundColor = .clear if #available(iOS 15.0, *) { addRecordButton() - } else { } } From 2c8f8da51447ef768ede1c9163e762846830518e Mon Sep 17 00:00:00 2001 From: Fran Alarza Date: Fri, 13 Dec 2024 14:01:04 +0100 Subject: [PATCH 4/4] feat: delete strings files --- .../Resources/en.lproj/Localizable.strings | 54 ------------ AppliverySDK/Resources/getConstants.swift | 87 ------------------- Package.swift | 2 +- 3 files changed, 1 insertion(+), 142 deletions(-) delete mode 100644 AppliverySDK/Resources/en.lproj/Localizable.strings delete mode 100755 AppliverySDK/Resources/getConstants.swift diff --git a/AppliverySDK/Resources/en.lproj/Localizable.strings b/AppliverySDK/Resources/en.lproj/Localizable.strings deleted file mode 100644 index c8585bb..0000000 --- a/AppliverySDK/Resources/en.lproj/Localizable.strings +++ /dev/null @@ -1,54 +0,0 @@ -/* - Localizable.strings - AppliverySDK - - Created by Alejandro Jiménez on 18/1/16. - Copyright © 2016 Applivery S.L. All rights reserved. -*/ - - -// GENERAL -"sdk_name" = "Applivery"; -"alert_button_cancel" = "Cancel"; -"alert_button_retry" = "Retry"; -"alert_button_ok" = "OK"; - -// ERRORS -"error_unexpected" = "Unexpected error"; -"error_invalid_credentials" = "Invalid credentials!! Please, check your appToken as described on https://github.com/applivery/applivery-ios-sdk#get-your-credentials"; -"error_empty_credentials" = "You must set the app token"; -"error_subscription_plan" = "SDK usage is not allowed under your current subscription plan. Please upgrade or contact us at support@applivery.com."; -"error_download_limit" = "Installations limit exceeded."; -"error_download_limit_month" = "Installations limit exceeded. Limit: %s / month"; -"error_download_url" = "Couldn't start download. Invalid url"; - -// OTA Update -"ota_update_message" = "There is a new version available for download. Do you want to update to the latest version?"; -"alert_button_later" = "Later"; -"alert_button_update" = "Update"; - -// UPDATE VIEW -"force_update_message" = "Sorry this App is outdated. Please, update the App to continue using it"; -"update_view_button_update" = "Update now"; - -// FEEDBACK VIEW -"feedback_button_close" = "Close"; -"feedback_button_add" = "Add Feedback"; -"feedback_button_send" = "Send Feedback"; -"feedback_label_select_type" = "Select type"; -"feedback_button_bug" = "Bug"; -"feedback_button_feedback" = "Feedback"; -"feedback_text_message_placeholder" = "Add a message"; -"feedback_label_attach" = "Attach Screenshot"; - -// LOGIN -"login_input_user" = "user"; -"login_input_password" = "password"; -"login_button" = "Login"; -"login_alert_message" = "Login is required!"; -"login_alert_message_invalid_credentials" = "Wrong user or password, please, try again"; -"login_alert_message_expired" = "Your session has expired. Please, log in again"; - -// MAIN SHEET -"sheet_screenshoot_action" = "Take Screenshot"; -"sheet_record_action" = "Record Screen"; diff --git a/AppliverySDK/Resources/getConstants.swift b/AppliverySDK/Resources/getConstants.swift deleted file mode 100755 index 1c535cf..0000000 --- a/AppliverySDK/Resources/getConstants.swift +++ /dev/null @@ -1,87 +0,0 @@ -//#!/usr/bin/swift -// -//import Foundation -//import Darwin -// -//extension String { -// func toUpperCase() -> String { -// return self.split(separator: "_").map {$0.capitalized}.joined() -// } -// func firstWord() -> String { -// let words = self.split(separator: "_") -// return String(words.first ?? "") -// } -//} -// -//var content = """ -//// This file is automatically generated by a script. Do not modify.\n -//// -//// LocalizableConstants.swift -//// Applivery SDK -//// -//// Created by Alejandro Jiménez -//// -// -//import Foundation -// -//// swiftlint:disable identifier_name -// -//""" -// -//// Load -// -//func loadLocalizablePlist() -> [String: String] { -// let file = "./en.lproj/Localizable.strings" -// guard let dictionary = NSDictionary(contentsOfFile: file) as? [String: String] else { -// fputs("❌ Wrong Localization URL: \(file)\n", stderr) -// exit(-1) -// } -// return dictionary -//} -// -//let dictionary = loadLocalizablePlist() -// -//// Generate Content -// -//var section = "" -// -//let sortedKeys = Array(dictionary.keys).sorted() -// -//for key in sortedKeys { -// -// let firstWord = key.firstWord() -// if firstWord != section { -// section = firstWord -// content += "\n// \(section.capitalized)\n" -// } -// content += "public let kLocale\(key.toUpperCase()): String = localize(\"\(key)\")\n" -// fputs("\n Adding constant: \(key)\n", stderr) -//} -// -//content += """ -// -//// swiftlint:enable identifier_name -// -//""" -// -//// Save -// -//func save(_ content: String) { -// -// func getDocumentsDirectory() -> URL { -// let paths = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask) -// return paths[0] -// } -// -// let filename = URL(fileURLWithPath: "./LocalizableConstants.swift") -// -// do { -// try content.write(to: filename, atomically: false, encoding: .utf8) -// } catch let error as NSError { -// fputs("❌ \(error)", stderr) -// exit(-1) -// } -//} -// -//save(content) -//fputs("\n Finished 👍\n\n", stderr) diff --git a/Package.swift b/Package.swift index cd4343a..4d1f992 100644 --- a/Package.swift +++ b/Package.swift @@ -23,7 +23,7 @@ let package = Package( name: "Applivery", dependencies: [], path: "AppliverySDK", - exclude: ["Info.plist", "Resources/getConstants.swift"], + exclude: ["Info.plist"], resources: [.process("Resources/Assets")]), .testTarget(