From b7e7b9607fd49604eee2be3c6275b364459bfecd Mon Sep 17 00:00:00 2001 From: marcosrdz Date: Thu, 19 Mar 2020 19:39:10 -0400 Subject: [PATCH] FIX: Allow use of Today extension on iOS 10. --- ios/BlueWallet.xcodeproj/project.pbxproj | 54 +++++++++++++++++++- ios/TodayExtension/TodayViewController.swift | 37 +++++++++++--- 2 files changed, 83 insertions(+), 8 deletions(-) diff --git a/ios/BlueWallet.xcodeproj/project.pbxproj b/ios/BlueWallet.xcodeproj/project.pbxproj index e40ae967a..ae82db707 100644 --- a/ios/BlueWallet.xcodeproj/project.pbxproj +++ b/ios/BlueWallet.xcodeproj/project.pbxproj @@ -572,6 +572,7 @@ B40D4E2D225841C300428FCC /* Embed Watch Content */, 2130DE983D1D45AC8FC45F7E /* Upload Debug Symbols to Sentry */, 3271B0B6236E2E0700DA766F /* Embed App Extensions */, + C18D00A61007A84C9887DEDE /* [CP] Copy Pods Resources */, ); buildRules = ( ); @@ -690,6 +691,7 @@ TestTargetID = 13B07F861A680F5B00A75B9A; }; 13B07F861A680F5B00A75B9A = { + DevelopmentTeam = A7W54YZ4WU; LastSwiftMigration = 1030; ProvisioningStyle = Automatic; SystemCapabilities = { @@ -946,6 +948,54 @@ 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; }; + C18D00A61007A84C9887DEDE /* [CP] Copy Pods Resources */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-BlueWallet/Pods-BlueWallet-resources.sh", + "${PODS_ROOT}/../../node_modules/react-native-vector-icons/Fonts/AntDesign.ttf", + "${PODS_ROOT}/../../node_modules/react-native-vector-icons/Fonts/Entypo.ttf", + "${PODS_ROOT}/../../node_modules/react-native-vector-icons/Fonts/EvilIcons.ttf", + "${PODS_ROOT}/../../node_modules/react-native-vector-icons/Fonts/Feather.ttf", + "${PODS_ROOT}/../../node_modules/react-native-vector-icons/Fonts/FontAwesome.ttf", + "${PODS_ROOT}/../../node_modules/react-native-vector-icons/Fonts/FontAwesome5_Brands.ttf", + "${PODS_ROOT}/../../node_modules/react-native-vector-icons/Fonts/FontAwesome5_Regular.ttf", + "${PODS_ROOT}/../../node_modules/react-native-vector-icons/Fonts/FontAwesome5_Solid.ttf", + "${PODS_ROOT}/../../node_modules/react-native-vector-icons/Fonts/Fontisto.ttf", + "${PODS_ROOT}/../../node_modules/react-native-vector-icons/Fonts/Foundation.ttf", + "${PODS_ROOT}/../../node_modules/react-native-vector-icons/Fonts/Ionicons.ttf", + "${PODS_ROOT}/../../node_modules/react-native-vector-icons/Fonts/MaterialCommunityIcons.ttf", + "${PODS_ROOT}/../../node_modules/react-native-vector-icons/Fonts/MaterialIcons.ttf", + "${PODS_ROOT}/../../node_modules/react-native-vector-icons/Fonts/Octicons.ttf", + "${PODS_ROOT}/../../node_modules/react-native-vector-icons/Fonts/SimpleLineIcons.ttf", + "${PODS_ROOT}/../../node_modules/react-native-vector-icons/Fonts/Zocial.ttf", + ); + name = "[CP] Copy Pods Resources"; + outputPaths = ( + "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/AntDesign.ttf", + "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/Entypo.ttf", + "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/EvilIcons.ttf", + "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/Feather.ttf", + "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/FontAwesome.ttf", + "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/FontAwesome5_Brands.ttf", + "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/FontAwesome5_Regular.ttf", + "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/FontAwesome5_Solid.ttf", + "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/Fontisto.ttf", + "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/Foundation.ttf", + "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/Ionicons.ttf", + "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/MaterialCommunityIcons.ttf", + "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/MaterialIcons.ttf", + "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/Octicons.ttf", + "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/SimpleLineIcons.ttf", + "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/Zocial.ttf", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-BlueWallet/Pods-BlueWallet-resources.sh\"\n"; + showEnvVarsInLog = 0; + }; /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ @@ -1476,7 +1526,7 @@ DEVELOPMENT_TEAM = A7W54YZ4WU; GCC_C_LANGUAGE_STANDARD = gnu11; INFOPLIST_FILE = TodayExtension/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 13.0; + IPHONEOS_DEPLOYMENT_TARGET = 10.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks"; MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; MTL_FAST_MATH = YES; @@ -1508,7 +1558,7 @@ DEVELOPMENT_TEAM = A7W54YZ4WU; GCC_C_LANGUAGE_STANDARD = gnu11; INFOPLIST_FILE = TodayExtension/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 13.0; + IPHONEOS_DEPLOYMENT_TARGET = 10.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks"; MTL_FAST_MATH = YES; PRODUCT_BUNDLE_IDENTIFIER = io.bluewallet.bluewallet.TodayExtension; diff --git a/ios/TodayExtension/TodayViewController.swift b/ios/TodayExtension/TodayViewController.swift index 576b2c0a3..de4017132 100644 --- a/ios/TodayExtension/TodayViewController.swift +++ b/ios/TodayExtension/TodayViewController.swift @@ -59,11 +59,25 @@ class TodayViewController: UIViewController, NCWidgetProviding { if newPriceDoubleValue > cachedPriceNumberDoubleValue { - self.lastPriceArrowImage.image = UIImage(systemName: "arrow.up") - self.setLastPriceOutletsHidden(isHidden: false) + if #available(iOSApplicationExtension 13.0, *) { + self.setLastPriceOutletsHidden(isHidden: false) + self.lastPriceArrowImage.image = UIImage(systemName: "arrow.up") + } else { + self.setLastPriceOutletsHidden(isHidden: true) + self.lastPriceFromLabel.text = "up from" + lastPriceFromLabel.isHidden = false + // Fallback on earlier versions + } } else { - self.lastPriceArrowImage.image = UIImage(systemName: "arrow.down") - self.setLastPriceOutletsHidden(isHidden: false) + if #available(iOSApplicationExtension 13.0, *) { + self.setLastPriceOutletsHidden(isHidden: false) + self.lastPriceArrowImage.image = UIImage(systemName: "arrow.down") + } else { + self.setLastPriceOutletsHidden(isHidden: true) + lastPriceFromLabel.isHidden = false + self.lastPriceFromLabel.text = "down from" + // Fallback on earlier versions + } } } @@ -108,10 +122,21 @@ class TodayViewController: UIViewController, NCWidgetProviding { if let latestRateDataStore = latestRateDataStore.rateDoubleValue, let lastStoredPriceNumber = priceRiceAndLastUpdate?.rateDoubleValue, API.getLastSelectedCurrency() == userPreferredCurrency { if latestRateDataStore > lastStoredPriceNumber { - self.lastPriceArrowImage.image = UIImage(systemName: "arrow.up") + if #available(iOSApplicationExtension 13.0, *) { + self.lastPriceArrowImage.image = UIImage(systemName: "arrow.up") + } else { + self.lastPriceFromLabel.isHidden = false + self.lastPriceFromLabel.text = "up from" + } self.setLastPriceOutletsHidden(isHidden: false) } else { - self.lastPriceArrowImage.image = UIImage(systemName: "arrow.down") + if #available(iOSApplicationExtension 13.0, *) { + self.lastPriceArrowImage.image = UIImage(systemName: "arrow.down") + } else { + // Fallback on earlier versions + self.lastPriceFromLabel.isHidden = false + self.lastPriceFromLabel.text = "down from" + } self.setLastPriceOutletsHidden(isHidden: false) } self.lastPrice.text = priceRiceAndLastUpdate?.formattedRate