From d0fb345f9bf767e313c9992dc187e1de619c7fd3 Mon Sep 17 00:00:00 2001 From: Bill Chan Date: Fri, 16 Aug 2019 14:33:07 +0200 Subject: [PATCH 01/13] update CanvasViewController (#3583) --- .../Sketchpad/CanvasViewController.swift | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/Wire-iOS/Sources/UserInterface/Sketchpad/CanvasViewController.swift b/Wire-iOS/Sources/UserInterface/Sketchpad/CanvasViewController.swift index 3138eba6dd..3bf5ffeba9 100644 --- a/Wire-iOS/Sources/UserInterface/Sketchpad/CanvasViewController.swift +++ b/Wire-iOS/Sources/UserInterface/Sketchpad/CanvasViewController.swift @@ -29,7 +29,8 @@ import Cartography case emoji } -@objcMembers class CanvasViewController: UIViewController, UINavigationControllerDelegate { +@objcMembers +final class CanvasViewController: UIViewController, UINavigationControllerDelegate { weak var delegate : CanvasViewControllerDelegate? var canvas = Canvas() @@ -375,14 +376,18 @@ extension CanvasViewController : UIImagePickerControllerDelegate { func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey : Any]) { - UIImagePickerController.image(fromMediaInfo: info) { image in - if let image = image, let cgImage = image.cgImage { - self.canvas.referenceImage = UIImage(cgImage: cgImage, scale: 2, orientation: image.imageOrientation) - self.canvas.mode = .draw - self.updateButtonSelection() - } + defer { picker.dismiss(animated: true, completion: nil) } + + guard let image = info[.editedImage] as? UIImage ?? info[.originalImage] as? UIImage else { + + return + } + + canvas.referenceImage = image + canvas.mode = .draw + updateButtonSelection() } func imagePickerControllerDidCancel(_ picker: UIImagePickerController) { From 69e4185d52080f6e209db076a12da164c2935f87 Mon Sep 17 00:00:00 2001 From: Bill Chan Date: Mon, 19 Aug 2019 11:10:52 +0200 Subject: [PATCH 02/13] debug option --- Scripts/download-assets.sh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Scripts/download-assets.sh b/Scripts/download-assets.sh index d138428483..2ff776bcd6 100755 --- a/Scripts/download-assets.sh +++ b/Scripts/download-assets.sh @@ -40,18 +40,20 @@ usage() while [ "$1" != "" ]; do - OPTION=$1 + OPTION=$1 shift + + echo "🔘 OPTION: ${OPTION}" case $OPTION in -c | --configuration_repo ) REPO_URL=$1 - echo "Using custom configuration repository: ${REPO_URL}" + echo "🔘 Using custom configuration repository: ${REPO_URL}" ;; -o | --override_with) OVERRIDES_DIR=$1 - echo "Overriding with configuration files in: ${OVERRIDES_DIR}" + echo "🔘 Overriding with configuration files in: ${OVERRIDES_DIR}" ;; -b | --branch) BRANCH=$1 - echo "Using custom branch: ${BRANCH}" + echo "🔘 Using custom branch: ${BRANCH}" ;; -h | --help ) usage exit From f5fb5abc97c144cb3c097611a0e11ca769894d92 Mon Sep 17 00:00:00 2001 From: Bill Chan Date: Mon, 19 Aug 2019 11:20:24 +0200 Subject: [PATCH 03/13] fix space excape --- fastlane/Fastfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fastlane/Fastfile b/fastlane/Fastfile index 434d2e8d99..3fcd60a2cc 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -13,7 +13,7 @@ platform :ios do else override_folder = options[:override_folder] if override_folder.nil? - override_folder = "CI\ configuration" + override_folder = "CI\\\\ configuration" end From a615f6745dbd59152334d4c16bcab71885fae647 Mon Sep 17 00:00:00 2001 From: Bill Chan Date: Mon, 19 Aug 2019 11:25:03 +0200 Subject: [PATCH 04/13] fix space in path issue --- fastlane/Fastfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fastlane/Fastfile b/fastlane/Fastfile index 3fcd60a2cc..be0d6a9515 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -13,7 +13,7 @@ platform :ios do else override_folder = options[:override_folder] if override_folder.nil? - override_folder = "CI\\\\ configuration" + override_folder = "CI\ configuration" end @@ -31,7 +31,7 @@ platform :ios do build = Build.new(options: options) # We need to update the AVS version before running setup script build.update_avs_version() - sh "cd .. && ./setup.sh -c #{config_repo} -b #{config_branch} -o wire-ios-build-assets/#{override_folder}/#{build_type}" + sh "cd .. && ./setup.sh -c #{config_repo} -b #{config_branch} -o 'wire-ios-build-assets/#{override_folder}/#{build_type}'" # Adding extra information to the icon must be done after we check them out in setup script build.process_icon() end From 9f4e445e54dd58aaeec1312cf9830d7372997794 Mon Sep 17 00:00:00 2001 From: Bill Chan Date: Mon, 19 Aug 2019 11:32:41 +0200 Subject: [PATCH 05/13] fix space --- fastlane/Fastfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fastlane/Fastfile b/fastlane/Fastfile index be0d6a9515..3c6830326a 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -13,7 +13,7 @@ platform :ios do else override_folder = options[:override_folder] if override_folder.nil? - override_folder = "CI\ configuration" + override_folder = "CI\\\ configuration" end From 3bbd240ace2167a7ffc838755f27b225dcf6ea89 Mon Sep 17 00:00:00 2001 From: Bill Chan Date: Mon, 19 Aug 2019 11:38:05 +0200 Subject: [PATCH 06/13] use double quote --- fastlane/Fastfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fastlane/Fastfile b/fastlane/Fastfile index 3c6830326a..10bd2806bb 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -31,7 +31,7 @@ platform :ios do build = Build.new(options: options) # We need to update the AVS version before running setup script build.update_avs_version() - sh "cd .. && ./setup.sh -c #{config_repo} -b #{config_branch} -o 'wire-ios-build-assets/#{override_folder}/#{build_type}'" + sh "cd .. && ./setup.sh -c #{config_repo} -b #{config_branch} -o \"wire-ios-build-assets/#{override_folder}/#{build_type}\"" # Adding extra information to the icon must be done after we check them out in setup script build.process_icon() end From aa6fe3dceb313a089f8b3bc6ca864c554fb45071 Mon Sep 17 00:00:00 2001 From: Bill Chan Date: Mon, 19 Aug 2019 12:01:41 +0200 Subject: [PATCH 07/13] debug --- Scripts/download-assets.sh | 4 +++- fastlane/Fastfile | 7 +++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Scripts/download-assets.sh b/Scripts/download-assets.sh index 2ff776bcd6..8e8ac338ac 100755 --- a/Scripts/download-assets.sh +++ b/Scripts/download-assets.sh @@ -39,10 +39,12 @@ usage() } +echo "🔘 OPTIONs: $@" + while [ "$1" != "" ]; do OPTION=$1 shift - + echo "🔘 OPTION: ${OPTION}" case $OPTION in diff --git a/fastlane/Fastfile b/fastlane/Fastfile index 10bd2806bb..ecea269ef1 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -13,7 +13,7 @@ platform :ios do else override_folder = options[:override_folder] if override_folder.nil? - override_folder = "CI\\\ configuration" + override_folder = "CI configuration" end @@ -31,7 +31,10 @@ platform :ios do build = Build.new(options: options) # We need to update the AVS version before running setup script build.update_avs_version() - sh "cd .. && ./setup.sh -c #{config_repo} -b #{config_branch} -o \"wire-ios-build-assets/#{override_folder}/#{build_type}\"" + + setup_sctipt = "cd .. && ./setup.sh -c #{config_repo} -b #{config_branch} -o \"wire-ios-build-assets/#{override_folder}/#{build_type}\"" + puts "#{setup_sctipt}" + sh "#{setup_sctipt}" # Adding extra information to the icon must be done after we check them out in setup script build.process_icon() end From 8327e6aa63f5e4801deb8a30a65d20dd339ca4b6 Mon Sep 17 00:00:00 2001 From: Bill Chan Date: Mon, 19 Aug 2019 12:05:56 +0200 Subject: [PATCH 08/13] fix double quote --- fastlane/Fastfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fastlane/Fastfile b/fastlane/Fastfile index ecea269ef1..e75620ef7e 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -32,7 +32,7 @@ platform :ios do # We need to update the AVS version before running setup script build.update_avs_version() - setup_sctipt = "cd .. && ./setup.sh -c #{config_repo} -b #{config_branch} -o \"wire-ios-build-assets/#{override_folder}/#{build_type}\"" + setup_sctipt = "cd .. && ./setup.sh -c #{config_repo} -b #{config_branch} -o ""wire-ios-build-assets/#{override_folder}/#{build_type}""" puts "#{setup_sctipt}" sh "#{setup_sctipt}" # Adding extra information to the icon must be done after we check them out in setup script From cefcf14e45c3cbf34daf8cf62ac6f706eec3122a Mon Sep 17 00:00:00 2001 From: Bill Chan Date: Mon, 19 Aug 2019 12:14:48 +0200 Subject: [PATCH 09/13] fix quote --- fastlane/Fastfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fastlane/Fastfile b/fastlane/Fastfile index e75620ef7e..b510adcece 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -32,8 +32,8 @@ platform :ios do # We need to update the AVS version before running setup script build.update_avs_version() - setup_sctipt = "cd .. && ./setup.sh -c #{config_repo} -b #{config_branch} -o ""wire-ios-build-assets/#{override_folder}/#{build_type}""" - puts "#{setup_sctipt}" + setup_sctipt = "cd .. && ./setup.sh -c #{config_repo} -b #{config_branch} -o \'wire-ios-build-assets/#{override_folder}/#{build_type}\'" + puts "setup_sctipt: #{setup_sctipt}" sh "#{setup_sctipt}" # Adding extra information to the icon must be done after we check them out in setup script build.process_icon() From c010cdc25ac32405f0c4e43474df9540b1950520 Mon Sep 17 00:00:00 2001 From: Bill Chan Date: Mon, 19 Aug 2019 12:20:51 +0200 Subject: [PATCH 10/13] fix parameter passing --- setup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.sh b/setup.sh index 589b647106..60a9652d8c 100755 --- a/setup.sh +++ b/setup.sh @@ -50,7 +50,7 @@ echo "ℹī¸ Downloading AVS library..." echo "" echo "ℹī¸ Downloading additional assets..." -./Scripts/download-assets.sh $@ +./Scripts/download-assets.sh "$@" echo "" echo "ℹī¸ Doing additional postprocessing..." From a5849ff359e8ad11b0be4dd7737845a427d7ce3a Mon Sep 17 00:00:00 2001 From: Bill Chan Date: Mon, 19 Aug 2019 12:40:44 +0200 Subject: [PATCH 11/13] undo --- Scripts/download-assets.sh | 12 ++++-------- fastlane/Fastfile | 7 ++----- setup.sh | 2 +- 3 files changed, 7 insertions(+), 14 deletions(-) diff --git a/Scripts/download-assets.sh b/Scripts/download-assets.sh index 8e8ac338ac..d138428483 100755 --- a/Scripts/download-assets.sh +++ b/Scripts/download-assets.sh @@ -39,23 +39,19 @@ usage() } -echo "🔘 OPTIONs: $@" - while [ "$1" != "" ]; do - OPTION=$1 + OPTION=$1 shift - echo "🔘 OPTION: ${OPTION}" - case $OPTION in -c | --configuration_repo ) REPO_URL=$1 - echo "🔘 Using custom configuration repository: ${REPO_URL}" + echo "Using custom configuration repository: ${REPO_URL}" ;; -o | --override_with) OVERRIDES_DIR=$1 - echo "🔘 Overriding with configuration files in: ${OVERRIDES_DIR}" + echo "Overriding with configuration files in: ${OVERRIDES_DIR}" ;; -b | --branch) BRANCH=$1 - echo "🔘 Using custom branch: ${BRANCH}" + echo "Using custom branch: ${BRANCH}" ;; -h | --help ) usage exit diff --git a/fastlane/Fastfile b/fastlane/Fastfile index b510adcece..434d2e8d99 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -13,7 +13,7 @@ platform :ios do else override_folder = options[:override_folder] if override_folder.nil? - override_folder = "CI configuration" + override_folder = "CI\ configuration" end @@ -31,10 +31,7 @@ platform :ios do build = Build.new(options: options) # We need to update the AVS version before running setup script build.update_avs_version() - - setup_sctipt = "cd .. && ./setup.sh -c #{config_repo} -b #{config_branch} -o \'wire-ios-build-assets/#{override_folder}/#{build_type}\'" - puts "setup_sctipt: #{setup_sctipt}" - sh "#{setup_sctipt}" + sh "cd .. && ./setup.sh -c #{config_repo} -b #{config_branch} -o wire-ios-build-assets/#{override_folder}/#{build_type}" # Adding extra information to the icon must be done after we check them out in setup script build.process_icon() end diff --git a/setup.sh b/setup.sh index 60a9652d8c..589b647106 100755 --- a/setup.sh +++ b/setup.sh @@ -50,7 +50,7 @@ echo "ℹī¸ Downloading AVS library..." echo "" echo "ℹī¸ Downloading additional assets..." -./Scripts/download-assets.sh "$@" +./Scripts/download-assets.sh $@ echo "" echo "ℹī¸ Doing additional postprocessing..." From 83f800fcb53e51566dedf171df30a9cc2126ca10 Mon Sep 17 00:00:00 2001 From: Jacob Persson Date: Mon, 19 Aug 2019 13:06:48 +0200 Subject: [PATCH 12/13] Fix share extension by retrieving the the environment from the shared user defaults (#3589) --- WireCommonComponents/BackendEnvironment+Shared.swift | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/WireCommonComponents/BackendEnvironment+Shared.swift b/WireCommonComponents/BackendEnvironment+Shared.swift index 40834a8892..cc5ea0f744 100644 --- a/WireCommonComponents/BackendEnvironment+Shared.swift +++ b/WireCommonComponents/BackendEnvironment+Shared.swift @@ -18,6 +18,7 @@ import Foundation import WireTransport +import WireUtilities extension BackendEnvironment { @@ -25,11 +26,11 @@ extension BackendEnvironment { public static var shared: BackendEnvironment = { let bundle = Bundle.backendBundle - guard let environment = BackendEnvironment(userDefaults: .standard, configurationBundle: .backendBundle) else { fatalError("Malformed backend configuration data") } + guard let environment = BackendEnvironment(userDefaults: .shared(), configurationBundle: .backendBundle) else { fatalError("Malformed backend configuration data") } return environment }() { didSet { - shared.save(in: .standard) + shared.save(in: .shared()) NotificationCenter.default.post(name: backendSwitchNotification, object: shared) } } From 207ad9dff4a9e6232618c160ab35c66ebb487eef Mon Sep 17 00:00:00 2001 From: Bill Chan Date: Mon, 19 Aug 2019 13:14:13 +0200 Subject: [PATCH 13/13] quote override path (#3590) --- fastlane/Fastfile | 4 ++-- setup.sh | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/fastlane/Fastfile b/fastlane/Fastfile index 434d2e8d99..2f92e5b74f 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -13,7 +13,7 @@ platform :ios do else override_folder = options[:override_folder] if override_folder.nil? - override_folder = "CI\ configuration" + override_folder = "CI configuration" end @@ -31,7 +31,7 @@ platform :ios do build = Build.new(options: options) # We need to update the AVS version before running setup script build.update_avs_version() - sh "cd .. && ./setup.sh -c #{config_repo} -b #{config_branch} -o wire-ios-build-assets/#{override_folder}/#{build_type}" + sh "cd .. && ./setup.sh -c #{config_repo} -b #{config_branch} -o \'wire-ios-build-assets/#{override_folder}/#{build_type}\'" # Adding extra information to the icon must be done after we check them out in setup script build.process_icon() end diff --git a/setup.sh b/setup.sh index 589b647106..60a9652d8c 100755 --- a/setup.sh +++ b/setup.sh @@ -50,7 +50,7 @@ echo "ℹī¸ Downloading AVS library..." echo "" echo "ℹī¸ Downloading additional assets..." -./Scripts/download-assets.sh $@ +./Scripts/download-assets.sh "$@" echo "" echo "ℹī¸ Doing additional postprocessing..."