diff --git a/.slather.yml b/.slather.yml index 4deb590b..09a00c51 100644 --- a/.slather.yml +++ b/.slather.yml @@ -4,6 +4,6 @@ workspace: Example/Leanplum-SDK.xcworkspace scheme: Leanplum-SDK-Example source_directory: Leanplum-SDK/ output_directory: coverage-report -binary_file: /DerivedData/Build/Products/Debug-iphonesimulator/Leanplum-SDK_Example.app/PlugIns/Leanplum-SDK_Tests.xctest/Frameworks/Leanplum.framework/Leanplum +binary_file: DerivedData/Build/Products/Debug-iphonesimulator/Leanplum-SDK_Example.app/PlugIns/Leanplum-SDK_Tests.xctest/Frameworks/Leanplum.framework/Leanplum ignore: - Leanplum-SDK/Classes/Vendor/** \ No newline at end of file diff --git a/Example/Leanplum-SDK.xcodeproj/project.pbxproj b/Example/Leanplum-SDK.xcodeproj/project.pbxproj index 5cf1722a..a4d32006 100644 --- a/Example/Leanplum-SDK.xcodeproj/project.pbxproj +++ b/Example/Leanplum-SDK.xcodeproj/project.pbxproj @@ -74,6 +74,7 @@ 07E5C8F41F052DD000A4B092 /* SingleMessage.json in Resources */ = {isa = PBXBuildFile; fileRef = 07E5C8A81F052B7800A4B092 /* SingleMessage.json */; }; 07E5C8F51F052DD000A4B092 /* TiedPriorities1.json in Resources */ = {isa = PBXBuildFile; fileRef = 07E5C8A91F052B7800A4B092 /* TiedPriorities1.json */; }; 07E5C8F61F052DD000A4B092 /* TiedPriorities2.json in Resources */ = {isa = PBXBuildFile; fileRef = 07E5C8AA1F052B7800A4B092 /* TiedPriorities2.json */; }; + 31A2B64CA6C62A4A59D1FC14 /* libPods-Leanplum-tvOS-SDK_Example.a in Frameworks */ = {isa = PBXBuildFile; fileRef = B30CAD752CAE14DC2DAD8C2B /* libPods-Leanplum-tvOS-SDK_Example.a */; }; 6003F58E195388D20070C39A /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F58D195388D20070C39A /* Foundation.framework */; }; 6003F590195388D20070C39A /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F58F195388D20070C39A /* CoreGraphics.framework */; }; 6003F592195388D20070C39A /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F591195388D20070C39A /* UIKit.framework */; }; @@ -86,18 +87,19 @@ 6003F5B1195388D20070C39A /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F58D195388D20070C39A /* Foundation.framework */; }; 6003F5B2195388D20070C39A /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F591195388D20070C39A /* UIKit.framework */; }; 6003F5BA195388D20070C39A /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 6003F5B8195388D20070C39A /* InfoPlist.strings */; }; - 7EB62201F9933A5796D4A2FE /* Pods_Leanplum_SDK_Example.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 66C5FAC1828A41289CE29EF5 /* Pods_Leanplum_SDK_Example.framework */; }; 873B8AEB1B1F5CCA007FD442 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 873B8AEA1B1F5CCA007FD442 /* Main.storyboard */; }; + 956357650097271FEDD4FCD2 /* libPods-Leanplum-SDK_Tests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D1597BF680DA0D633F15869D /* libPods-Leanplum-SDK_Tests.a */; }; 9CB691DE1F15FFF5002D83D8 /* batch_response.json in Resources */ = {isa = PBXBuildFile; fileRef = 9CB691DD1F15FFF5002D83D8 /* batch_response.json */; }; 9CB691DF1F15FFFF002D83D8 /* batch_response.json in Resources */ = {isa = PBXBuildFile; fileRef = 9CB691DD1F15FFF5002D83D8 /* batch_response.json */; }; 9CB691E11F1601BA002D83D8 /* EventCallbackManagerTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 9CB691E01F1601BA002D83D8 /* EventCallbackManagerTest.m */; }; - B08587C9AF0FCE5835E853EA /* Pods_Leanplum_SDK_Tests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7849230A3D5C6DE5929ED1C8 /* Pods_Leanplum_SDK_Tests.framework */; }; + 9CD04D941F8EE7E30033AB4A /* variables_with_newsfeed_response.json in Resources */ = {isa = PBXBuildFile; fileRef = 9CD04D931F8EB6190033AB4A /* variables_with_newsfeed_response.json */; }; + 9CD04D951F8EE7E30033AB4A /* variables_with_newsfeed_response.json in Resources */ = {isa = PBXBuildFile; fileRef = 9CD04D931F8EB6190033AB4A /* variables_with_newsfeed_response.json */; }; + 9E032A24A42D2042C4B62505 /* libPods-Leanplum-SDK_Example.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 066C8918F2744DE47AAC8F77 /* libPods-Leanplum-SDK_Example.a */; }; B5CCCA2D1D74B64D005ADEE1 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = B5CCCA2C1D74B64D005ADEE1 /* main.m */; }; B5CCCA301D74B64D005ADEE1 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = B5CCCA2F1D74B64D005ADEE1 /* AppDelegate.m */; }; B5CCCA331D74B64D005ADEE1 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = B5CCCA321D74B64D005ADEE1 /* ViewController.m */; }; B5CCCA361D74B64D005ADEE1 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = B5CCCA341D74B64D005ADEE1 /* Main.storyboard */; }; B5CCCA381D74B64D005ADEE1 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = B5CCCA371D74B64D005ADEE1 /* Assets.xcassets */; }; - E1B1B1940FC870B25684ED7D /* Pods_Leanplum_tvOS_SDK_Example.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9EE2D840C30124E373ADF721 /* Pods_Leanplum_tvOS_SDK_Example.framework */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -111,6 +113,7 @@ /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ + 066C8918F2744DE47AAC8F77 /* libPods-Leanplum-SDK_Example.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Leanplum-SDK_Example.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 0723D6CA1ED8CCAA004AE3A5 /* Leanplum-iOS-SDK-source.podspec */ = {isa = PBXFileReference; lastKnownFileType = text; name = "Leanplum-iOS-SDK-source.podspec"; path = "../Leanplum-iOS-SDK-source.podspec"; sourceTree = ""; }; 0723D6CB1ED8CCAA004AE3A5 /* Leanplum-iOS-SDK.podspec */ = {isa = PBXFileReference; lastKnownFileType = text; name = "Leanplum-iOS-SDK.podspec"; path = "../Leanplum-iOS-SDK.podspec"; sourceTree = ""; }; 0723D6CC1ED8CCAA004AE3A5 /* Leanplum-tvOS-SDK.podspec */ = {isa = PBXFileReference; lastKnownFileType = text; name = "Leanplum-tvOS-SDK.podspec"; path = "../Leanplum-tvOS-SDK.podspec"; sourceTree = ""; }; @@ -165,7 +168,6 @@ 07E5C8AA1F052B7800A4B092 /* TiedPriorities2.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = TiedPriorities2.json; sourceTree = ""; }; 1982CE36FE54461D3A24D6B5 /* Pods-Leanplum-tvOS-SDK_Example.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Leanplum-tvOS-SDK_Example.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Leanplum-tvOS-SDK_Example/Pods-Leanplum-tvOS-SDK_Example.debug.xcconfig"; sourceTree = ""; }; 29ABF5FA9E1826C5BBE433C9 /* Pods-Leanplum-SDK_Tests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Leanplum-SDK_Tests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Leanplum-SDK_Tests/Pods-Leanplum-SDK_Tests.debug.xcconfig"; sourceTree = ""; }; - 4D30EC90BF70F6ACCD15929C /* Pods_Leanplum_SDK_Example.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Leanplum_SDK_Example.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 6003F58A195388D20070C39A /* Leanplum-SDK_Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Leanplum-SDK_Example.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 6003F58D195388D20070C39A /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 6003F58F195388D20070C39A /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; @@ -184,16 +186,15 @@ 6003F5B7195388D20070C39A /* Tests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "Tests-Info.plist"; sourceTree = ""; }; 6003F5B9195388D20070C39A /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 606FC2411953D9B200FFA9A0 /* Tests-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Tests-Prefix.pch"; sourceTree = ""; }; - 66C5FAC1828A41289CE29EF5 /* Pods_Leanplum_SDK_Example.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Leanplum_SDK_Example.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 73B565AA61D6B6A4E92607C4 /* Pods-Leanplum-SDK_Tests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Leanplum-SDK_Tests.release.xcconfig"; path = "Pods/Target Support Files/Pods-Leanplum-SDK_Tests/Pods-Leanplum-SDK_Tests.release.xcconfig"; sourceTree = ""; }; 74C2EA3F2D53CAE77A03BFFA /* Pods-Leanplum-tvOS-SDK_Example.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Leanplum-tvOS-SDK_Example.release.xcconfig"; path = "Pods/Target Support Files/Pods-Leanplum-tvOS-SDK_Example/Pods-Leanplum-tvOS-SDK_Example.release.xcconfig"; sourceTree = ""; }; - 7849230A3D5C6DE5929ED1C8 /* Pods_Leanplum_SDK_Tests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Leanplum_SDK_Tests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 84A3C33C701600A874B8C63F /* README.md */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = net.daringfireball.markdown; name = README.md; path = ../README.md; sourceTree = ""; }; 873B8AEA1B1F5CCA007FD442 /* Main.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = Main.storyboard; sourceTree = ""; }; 9CB691DD1F15FFF5002D83D8 /* batch_response.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = batch_response.json; sourceTree = ""; }; 9CB691E01F1601BA002D83D8 /* EventCallbackManagerTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EventCallbackManagerTest.m; sourceTree = ""; }; - 9EE2D840C30124E373ADF721 /* Pods_Leanplum_tvOS_SDK_Example.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Leanplum_tvOS_SDK_Example.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 9CD04D931F8EB6190033AB4A /* variables_with_newsfeed_response.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = variables_with_newsfeed_response.json; sourceTree = ""; }; A54ACCFCB36AE8C874708A7F /* libPods-Leanplum-SDK_Example-Leanplum-SDK_Tests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Leanplum-SDK_Example-Leanplum-SDK_Tests.a"; sourceTree = BUILT_PRODUCTS_DIR; }; + B30CAD752CAE14DC2DAD8C2B /* libPods-Leanplum-tvOS-SDK_Example.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Leanplum-tvOS-SDK_Example.a"; sourceTree = BUILT_PRODUCTS_DIR; }; B5CCCA291D74B64D005ADEE1 /* Leanplum-tvOS-SDK_Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Leanplum-tvOS-SDK_Example.app"; sourceTree = BUILT_PRODUCTS_DIR; }; B5CCCA2C1D74B64D005ADEE1 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; B5CCCA2E1D74B64D005ADEE1 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; @@ -203,6 +204,7 @@ B5CCCA351D74B64D005ADEE1 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; B5CCCA371D74B64D005ADEE1 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; B5CCCA391D74B64D005ADEE1 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + D1597BF680DA0D633F15869D /* libPods-Leanplum-SDK_Tests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Leanplum-SDK_Tests.a"; sourceTree = BUILT_PRODUCTS_DIR; }; D2BDBCD86C8BEA8BF5B15B99 /* Pods-Leanplum-SDK_Example.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Leanplum-SDK_Example.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Leanplum-SDK_Example/Pods-Leanplum-SDK_Example.debug.xcconfig"; sourceTree = ""; }; ED67DCDB70EA6598AF12284A /* Pods-Leanplum-SDK_Example.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Leanplum-SDK_Example.release.xcconfig"; path = "Pods/Target Support Files/Pods-Leanplum-SDK_Example/Pods-Leanplum-SDK_Example.release.xcconfig"; sourceTree = ""; }; F5CF859C9DD307380E6F9A30 /* LICENSE */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = LICENSE; path = ../LICENSE; sourceTree = ""; }; @@ -216,7 +218,7 @@ 6003F590195388D20070C39A /* CoreGraphics.framework in Frameworks */, 6003F592195388D20070C39A /* UIKit.framework in Frameworks */, 6003F58E195388D20070C39A /* Foundation.framework in Frameworks */, - 7EB62201F9933A5796D4A2FE /* Pods_Leanplum_SDK_Example.framework in Frameworks */, + 9E032A24A42D2042C4B62505 /* libPods-Leanplum-SDK_Example.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -227,7 +229,7 @@ 6003F5B0195388D20070C39A /* XCTest.framework in Frameworks */, 6003F5B2195388D20070C39A /* UIKit.framework in Frameworks */, 6003F5B1195388D20070C39A /* Foundation.framework in Frameworks */, - B08587C9AF0FCE5835E853EA /* Pods_Leanplum_SDK_Tests.framework in Frameworks */, + 956357650097271FEDD4FCD2 /* libPods-Leanplum-SDK_Tests.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -235,7 +237,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - E1B1B1940FC870B25684ED7D /* Pods_Leanplum_tvOS_SDK_Example.framework in Frameworks */, + 31A2B64CA6C62A4A59D1FC14 /* libPods-Leanplum-tvOS-SDK_Example.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -325,6 +327,7 @@ 07E5C89C1F052B7800A4B092 /* state_response.json */, 07E5C89E1F052B7800A4B092 /* track_event_response.json */, 07E5C89F1F052B7800A4B092 /* variables_response.json */, + 9CD04D931F8EB6190033AB4A /* variables_with_newsfeed_response.json */, ); path = Responses; sourceTree = ""; @@ -385,10 +388,10 @@ 6003F58F195388D20070C39A /* CoreGraphics.framework */, 6003F591195388D20070C39A /* UIKit.framework */, 6003F5AF195388D20070C39A /* XCTest.framework */, - 7849230A3D5C6DE5929ED1C8 /* Pods_Leanplum_SDK_Tests.framework */, A54ACCFCB36AE8C874708A7F /* libPods-Leanplum-SDK_Example-Leanplum-SDK_Tests.a */, - 66C5FAC1828A41289CE29EF5 /* Pods_Leanplum_SDK_Example.framework */, - 9EE2D840C30124E373ADF721 /* Pods_Leanplum_tvOS_SDK_Example.framework */, + 066C8918F2744DE47AAC8F77 /* libPods-Leanplum-SDK_Example.a */, + D1597BF680DA0D633F15869D /* libPods-Leanplum-SDK_Tests.a */, + B30CAD752CAE14DC2DAD8C2B /* libPods-Leanplum-tvOS-SDK_Example.a */, ); name = Frameworks; sourceTree = ""; @@ -605,6 +608,7 @@ 07E5C8DE1F052DC400A4B092 /* newsfeed_response.json in Resources */, 07E5C8F61F052DD000A4B092 /* TiedPriorities2.json in Resources */, 07E5C8DF1F052DC400A4B092 /* registration_response.json in Resources */, + 9CD04D951F8EE7E30033AB4A /* variables_with_newsfeed_response.json in Resources */, 9CB691DF1F15FFFF002D83D8 /* batch_response.json in Resources */, 07E5C8EA1F052DCC00A4B092 /* MainAppIcon.png in Resources */, 07E5C8E21F052DC400A4B092 /* start_variables_response.json in Resources */, @@ -649,6 +653,7 @@ 07E5C8D61F052B7800A4B092 /* regionData.json in Resources */, 07E5C8D81F052B7800A4B092 /* SingleMessage.json in Resources */, 07E5C8CB1F052B7800A4B092 /* simple_start_response.json in Resources */, + 9CD04D941F8EE7E30033AB4A /* variables_with_newsfeed_response.json in Resources */, 07E5C8C01F052B7800A4B092 /* MainAppIcon.png in Resources */, 07E5C8C11F052B7800A4B092 /* test.file in Resources */, 07E5C8CF1F052B7800A4B092 /* track_event_response.json in Resources */, @@ -682,13 +687,16 @@ files = ( ); inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", ); name = "[CP] Check Pods Manifest.lock"; outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-Leanplum-SDK_Tests-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"; + 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; }; 6F8E78CD5A8A5D2F0677A4AC /* [CP] Check Pods Manifest.lock */ = { @@ -697,13 +705,16 @@ files = ( ); inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", ); name = "[CP] Check Pods Manifest.lock"; outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-Leanplum-tvOS-SDK_Example-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"; + 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; }; 81DD9F917F8C0494E1D79789 /* [CP] Copy Pods Resources */ = { @@ -727,9 +738,12 @@ files = ( ); inputPaths = ( + "${SRCROOT}/Pods/Target Support Files/Pods-Leanplum-SDK_Example/Pods-Leanplum-SDK_Example-frameworks.sh", + "${BUILT_PRODUCTS_DIR}/Leanplum-iOS-SDK-source/Leanplum.framework", ); name = "[CP] Embed Pods Frameworks"; outputPaths = ( + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Leanplum.framework", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; @@ -772,13 +786,16 @@ files = ( ); inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", ); name = "[CP] Check Pods Manifest.lock"; outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-Leanplum-SDK_Example-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"; + 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; }; CE1D3D9B6CE96DE8989631BA /* [CP] Embed Pods Frameworks */ = { @@ -787,9 +804,12 @@ files = ( ); inputPaths = ( + "${SRCROOT}/Pods/Target Support Files/Pods-Leanplum-tvOS-SDK_Example/Pods-Leanplum-tvOS-SDK_Example-frameworks.sh", + "${BUILT_PRODUCTS_DIR}/Leanplum-tvOS-SDK-source/LeanplumTV.framework", ); name = "[CP] Embed Pods Frameworks"; outputPaths = ( + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/LeanplumTV.framework", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; @@ -802,9 +822,16 @@ files = ( ); inputPaths = ( + "${SRCROOT}/Pods/Target Support Files/Pods-Leanplum-SDK_Tests/Pods-Leanplum-SDK_Tests-frameworks.sh", + "${BUILT_PRODUCTS_DIR}/Leanplum-iOS-SDK-source/Leanplum.framework", + "${BUILT_PRODUCTS_DIR}/OCMock/OCMock.framework", + "${BUILT_PRODUCTS_DIR}/OHHTTPStubs/OHHTTPStubs.framework", ); name = "[CP] Embed Pods Frameworks"; outputPaths = ( + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Leanplum.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/OCMock.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/OHHTTPStubs.framework", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; @@ -1077,9 +1104,9 @@ MTL_ENABLE_DEBUG_INFO = YES; PRODUCT_BUNDLE_IDENTIFIER = "com.leanplum.Leanplum-tvOS-SDK-Example"; PRODUCT_NAME = "$(TARGET_NAME)"; - SDKROOT = appletvos9.2; + SDKROOT = appletvos; TARGETED_DEVICE_FAMILY = 3; - TVOS_DEPLOYMENT_TARGET = 9.2; + TVOS_DEPLOYMENT_TARGET = 9.0; }; name = Debug; }; @@ -1100,9 +1127,9 @@ MTL_ENABLE_DEBUG_INFO = NO; PRODUCT_BUNDLE_IDENTIFIER = "com.leanplum.Leanplum-tvOS-SDK-Example"; PRODUCT_NAME = "$(TARGET_NAME)"; - SDKROOT = appletvos9.2; + SDKROOT = appletvos; TARGETED_DEVICE_FAMILY = 3; - TVOS_DEPLOYMENT_TARGET = 9.2; + TVOS_DEPLOYMENT_TARGET = 9.0; }; name = Release; }; diff --git a/Example/Leanplum-tvOS-SDK_Example/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Back.imagestacklayer/Content.imageset/Contents.json b/Example/Leanplum-tvOS-SDK_Example/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Back.imagestacklayer/Content.imageset/Contents.json index b1f59617..16a370df 100644 --- a/Example/Leanplum-tvOS-SDK_Example/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Back.imagestacklayer/Content.imageset/Contents.json +++ b/Example/Leanplum-tvOS-SDK_Example/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Back.imagestacklayer/Content.imageset/Contents.json @@ -3,10 +3,14 @@ { "idiom" : "tv", "scale" : "1x" + }, + { + "idiom" : "tv", + "scale" : "2x" } ], "info" : { "version" : 1, "author" : "xcode" } -} +} \ No newline at end of file diff --git a/Example/Leanplum-tvOS-SDK_Example/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Front.imagestacklayer/Content.imageset/Contents.json b/Example/Leanplum-tvOS-SDK_Example/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Front.imagestacklayer/Content.imageset/Contents.json index b1f59617..16a370df 100644 --- a/Example/Leanplum-tvOS-SDK_Example/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Front.imagestacklayer/Content.imageset/Contents.json +++ b/Example/Leanplum-tvOS-SDK_Example/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Front.imagestacklayer/Content.imageset/Contents.json @@ -3,10 +3,14 @@ { "idiom" : "tv", "scale" : "1x" + }, + { + "idiom" : "tv", + "scale" : "2x" } ], "info" : { "version" : 1, "author" : "xcode" } -} +} \ No newline at end of file diff --git a/Example/Leanplum-tvOS-SDK_Example/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json b/Example/Leanplum-tvOS-SDK_Example/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json index b1f59617..16a370df 100644 --- a/Example/Leanplum-tvOS-SDK_Example/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json +++ b/Example/Leanplum-tvOS-SDK_Example/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json @@ -3,10 +3,14 @@ { "idiom" : "tv", "scale" : "1x" + }, + { + "idiom" : "tv", + "scale" : "2x" } ], "info" : { "version" : 1, "author" : "xcode" } -} +} \ No newline at end of file diff --git a/Example/Leanplum-tvOS-SDK_Example/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Back.imagestacklayer/Content.imageset/Contents.json b/Example/Leanplum-tvOS-SDK_Example/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Back.imagestacklayer/Content.imageset/Contents.json index b1f59617..16a370df 100644 --- a/Example/Leanplum-tvOS-SDK_Example/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Back.imagestacklayer/Content.imageset/Contents.json +++ b/Example/Leanplum-tvOS-SDK_Example/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Back.imagestacklayer/Content.imageset/Contents.json @@ -3,10 +3,14 @@ { "idiom" : "tv", "scale" : "1x" + }, + { + "idiom" : "tv", + "scale" : "2x" } ], "info" : { "version" : 1, "author" : "xcode" } -} +} \ No newline at end of file diff --git a/Example/Leanplum-tvOS-SDK_Example/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Front.imagestacklayer/Content.imageset/Contents.json b/Example/Leanplum-tvOS-SDK_Example/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Front.imagestacklayer/Content.imageset/Contents.json index b1f59617..16a370df 100644 --- a/Example/Leanplum-tvOS-SDK_Example/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Front.imagestacklayer/Content.imageset/Contents.json +++ b/Example/Leanplum-tvOS-SDK_Example/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Front.imagestacklayer/Content.imageset/Contents.json @@ -3,10 +3,14 @@ { "idiom" : "tv", "scale" : "1x" + }, + { + "idiom" : "tv", + "scale" : "2x" } ], "info" : { "version" : 1, "author" : "xcode" } -} +} \ No newline at end of file diff --git a/Example/Leanplum-tvOS-SDK_Example/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json b/Example/Leanplum-tvOS-SDK_Example/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json index b1f59617..16a370df 100644 --- a/Example/Leanplum-tvOS-SDK_Example/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json +++ b/Example/Leanplum-tvOS-SDK_Example/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json @@ -3,10 +3,14 @@ { "idiom" : "tv", "scale" : "1x" + }, + { + "idiom" : "tv", + "scale" : "2x" } ], "info" : { "version" : 1, "author" : "xcode" } -} +} \ No newline at end of file diff --git a/Example/Leanplum-tvOS-SDK_Example/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Top Shelf Image Wide.imageset/Contents.json b/Example/Leanplum-tvOS-SDK_Example/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Top Shelf Image Wide.imageset/Contents.json index 0564959f..16a370df 100644 --- a/Example/Leanplum-tvOS-SDK_Example/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Top Shelf Image Wide.imageset/Contents.json +++ b/Example/Leanplum-tvOS-SDK_Example/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Top Shelf Image Wide.imageset/Contents.json @@ -3,6 +3,10 @@ { "idiom" : "tv", "scale" : "1x" + }, + { + "idiom" : "tv", + "scale" : "2x" } ], "info" : { diff --git a/Example/Leanplum-tvOS-SDK_Example/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Top Shelf Image.imageset/Contents.json b/Example/Leanplum-tvOS-SDK_Example/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Top Shelf Image.imageset/Contents.json index b1f59617..16a370df 100644 --- a/Example/Leanplum-tvOS-SDK_Example/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Top Shelf Image.imageset/Contents.json +++ b/Example/Leanplum-tvOS-SDK_Example/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Top Shelf Image.imageset/Contents.json @@ -3,10 +3,14 @@ { "idiom" : "tv", "scale" : "1x" + }, + { + "idiom" : "tv", + "scale" : "2x" } ], "info" : { "version" : 1, "author" : "xcode" } -} +} \ No newline at end of file diff --git a/Example/Leanplum-tvOS-SDK_Example/Assets.xcassets/LaunchImage.launchimage/Contents.json b/Example/Leanplum-tvOS-SDK_Example/Assets.xcassets/LaunchImage.launchimage/Contents.json index 9fead862..d746a609 100644 --- a/Example/Leanplum-tvOS-SDK_Example/Assets.xcassets/LaunchImage.launchimage/Contents.json +++ b/Example/Leanplum-tvOS-SDK_Example/Assets.xcassets/LaunchImage.launchimage/Contents.json @@ -1,5 +1,12 @@ { "images" : [ + { + "orientation" : "landscape", + "idiom" : "tv", + "extent" : "full-screen", + "minimum-system-version" : "11.0", + "scale" : "2x" + }, { "orientation" : "landscape", "idiom" : "tv", @@ -12,4 +19,4 @@ "version" : 1, "author" : "xcode" } -} +} \ No newline at end of file diff --git a/Example/Podfile b/Example/Podfile index 385cafa3..f8befeb1 100644 --- a/Example/Podfile +++ b/Example/Podfile @@ -17,7 +17,7 @@ target 'Leanplum-SDK_Example' do end target 'Leanplum-tvOS-SDK_Example' do - platform :tvos, '8.0' + platform :tvos, '9.0' - pod 'Leanplum-tvOS-SDK', :path => '../' + pod 'Leanplum-tvOS-SDK-source', :path => '../' end diff --git a/Example/Tests/Classes/MessagesTest.m b/Example/Tests/Classes/MessagesTest.m index 653883a4..926ecf53 100644 --- a/Example/Tests/Classes/MessagesTest.m +++ b/Example/Tests/Classes/MessagesTest.m @@ -160,7 +160,7 @@ - (void) test_no_priorities NSDictionary *messageConfigs = [LPJSON JSONFromString:jsonString]; [self runInAppMessagePrioritizationTest:messageConfigs - withExpectedMessageIds:[NSSet setWithObjects:@"1", @"2", @"3", nil]]; + withExpectedMessageIds:[NSSet setWithObjects:@"1", nil]]; } - (void) test_different_priorities @@ -189,14 +189,14 @@ - (void) test_tied_priorities NSDictionary *messageConfigs = [LPJSON JSONFromString:jsonString]; [self runInAppMessagePrioritizationTest:messageConfigs - withExpectedMessageIds:[NSSet setWithObjects:@"1", @"3", nil]]; + withExpectedMessageIds:[NSSet setWithObjects:@"1", nil]]; // Testing three messages with the same priority. jsonString = [LeanplumHelper retrieve_string_from_file:@"TiedPriorities2" ofType:@"json"]; messageConfigs = [LPJSON JSONFromString:jsonString]; [self runInAppMessagePrioritizationTest:messageConfigs - withExpectedMessageIds:[NSSet setWithObjects:@"1", @"2" ,@"3", nil]]; + withExpectedMessageIds:[NSSet setWithObjects:@"1", nil]]; } - (void) test_different_priorities_with_missing_values diff --git a/Example/Tests/Classes/NewsfeedTest.m b/Example/Tests/Classes/NewsfeedTest.m index 1a058b0f..dc94f002 100644 --- a/Example/Tests/Classes/NewsfeedTest.m +++ b/Example/Tests/Classes/NewsfeedTest.m @@ -374,4 +374,73 @@ - (void)test_disableFetching XCTAssertTrue(timedOut == 0); } +- (void)test_onForceContentUpdate { + XCTAssertTrue([LeanplumHelper start_development_test]); + + // FCU without sync + id stub = [OHHTTPStubs stubRequestsPassingTest: + ^BOOL(NSURLRequest * _Nonnull request) { + return [request.URL.host isEqualToString:API_HOST]; + } withStubResponse:^OHHTTPStubsResponse * _Nonnull(NSURLRequest *request) { + NSString *response_file = OHPathForFile(@"variables_response.json", + self.class); + return [OHHTTPStubsResponse responseWithFileAtPath:response_file + statusCode:200 + headers:@{@"Content-Type":@"application/json"}]; + }]; + + XCTestExpectation *responseExpectation1 = [self expectationWithDescription:@"response1"]; + [[Leanplum inbox] onForceContentUpdate:^void(BOOL success){ + XCTAssertTrue(success); + [responseExpectation1 fulfill]; + }]; + + [Leanplum forceContentUpdate:nil]; + [self waitForExpectationsWithTimeout:2 handler:nil]; + [OHHTTPStubs removeStub:stub]; + [[Leanplum inbox] reset]; + + // FCU with sync + stub = [OHHTTPStubs stubRequestsPassingTest:^BOOL(NSURLRequest * _Nonnull request) { + return [request.URL.host isEqualToString:API_HOST]; + } withStubResponse:^OHHTTPStubsResponse * _Nonnull(NSURLRequest *request) { + NSString *response_file = OHPathForFile(@"variables_with_newsfeed_response.json", + self.class); + return [OHHTTPStubsResponse responseWithFileAtPath:response_file + statusCode:200 + headers:@{@"Content-Type":@"application/json"}]; + }]; + + XCTestExpectation *responseExpectation2 = [self expectationWithDescription:@"response2"]; + [[Leanplum inbox] onForceContentUpdate:^void(BOOL success){ + XCTAssertTrue(success); + [responseExpectation2 fulfill]; + }]; + + [Leanplum forceContentUpdate:nil]; + [self waitForExpectationsWithTimeout:2 handler:nil]; + [OHHTTPStubs removeStub:stub]; + [[Leanplum inbox] reset]; + + // FCU without internet connection + stub = [OHHTTPStubs stubRequestsPassingTest:^BOOL(NSURLRequest *request) { + return [request.URL.host isEqualToString:API_HOST];; + } withStubResponse:^OHHTTPStubsResponse * _Nonnull(NSURLRequest * _Nonnull request) { + NSError *error = [NSError errorWithDomain:NSURLErrorDomain + code:NSURLErrorBadServerResponse userInfo:nil]; + return [OHHTTPStubsResponse responseWithError:error]; + }]; + + XCTestExpectation *responseExpectation3 = [self expectationWithDescription:@"response3"]; + [[Leanplum inbox] onForceContentUpdate:^void(BOOL success){ + XCTAssertFalse(success); + [responseExpectation3 fulfill]; + }]; + + [Leanplum forceContentUpdate:nil]; + [self waitForExpectationsWithTimeout:2 handler:nil]; + [OHHTTPStubs removeStub:stub]; + [[Leanplum inbox] reset]; +} + @end diff --git a/Example/Tests/Resources/Responses/variables_with_newsfeed_response.json b/Example/Tests/Resources/Responses/variables_with_newsfeed_response.json new file mode 100644 index 00000000..290c6f70 --- /dev/null +++ b/Example/Tests/Resources/Responses/variables_with_newsfeed_response.json @@ -0,0 +1,28 @@ +{ + "response": [{ + "success": true + }, { + "success": true + }, { + "vars": { + + }, + "interfaceRules": [ + + ], + "variants": [ + + ], + "regions": { + + }, + "syncNewsfeed": true, + "success": true, + "messages": { + + }, + "interfaceEvents": [ + + ] + }] +} \ No newline at end of file diff --git a/Leanplum-SDK/Classes/Constants.h b/Leanplum-SDK/Classes/Constants.h index fcff7739..01c928f9 100644 --- a/Leanplum-SDK/Classes/Constants.h +++ b/Leanplum-SDK/Classes/Constants.h @@ -45,7 +45,7 @@ #define IS_NOOP ((!IS_SUPPORTED_IOS_VERSION) || IS_JAILBROKEN || [LPConstantsState sharedState].isTestMode || [LPConstantsState sharedState].isInPermanentFailureState) #define RETURN_IF_NOOP if (IS_NOOP) return -#define LEANPLUM_SDK_VERSION @"2.0.3" +#define LEANPLUM_SDK_VERSION @"2.0.4" #define LEANPLUM_CLIENT @"ios" // Can upload up to 100 files or 50 MB per request. diff --git a/Leanplum-SDK/Classes/LPInbox.h b/Leanplum-SDK/Classes/LPInbox.h index 426392a6..a2339e5d 100644 --- a/Leanplum-SDK/Classes/LPInbox.h +++ b/Leanplum-SDK/Classes/LPInbox.h @@ -96,6 +96,7 @@ * This block is used when you define a callback. */ typedef void (^LeanplumInboxChangedBlock)(void); +typedef void (^LeanplumInboxSyncedBlock)(BOOL success); @interface LPInbox : NSObject @@ -150,6 +151,13 @@ typedef void (^LeanplumInboxChangedBlock)(void); */ - (void)onChanged:(LeanplumInboxChangedBlock)block; +/** + * Block to call when forceContentUpdate was called. + * Returns true if syncing was successful. + * Note: use onChanged: for UI. + */ +- (void)onForceContentUpdate:(LeanplumInboxSyncedBlock)block; + /** @{ * Adds a responder to be executed when an event happens. diff --git a/Leanplum-SDK/Classes/LPInbox.m b/Leanplum-SDK/Classes/LPInbox.m index e1eec5da..9669d812 100644 --- a/Leanplum-SDK/Classes/LPInbox.m +++ b/Leanplum-SDK/Classes/LPInbox.m @@ -386,6 +386,7 @@ - (void)reset _didLoad = NO; _inboxChangedBlocks = nil; _inboxChangedResponders = nil; + _inboxSyncedBlocks = nil; updatingLock = [[NSObject alloc] init]; _downloadedImageUrls = [NSMutableSet new]; } @@ -403,6 +404,15 @@ - (void)triggerInboxChanged LP_END_USER_CODE } +- (void)triggerInboxSyncedWithStatus:(BOOL)success +{ + LP_BEGIN_USER_CODE + for (LeanplumInboxSyncedBlock block in _inboxSyncedBlocks.copy) { + block(success); + } + LP_END_USER_CODE +} + #pragma mark - LPInbox methods - (void)downloadMessages @@ -450,13 +460,18 @@ - (void)downloadMessages [Leanplum onceVariablesChangedAndNoDownloadsPending:^{ LP_END_USER_CODE [self updateMessages:messages unreadCount:unreadCount]; + [self triggerInboxSyncedWithStatus:YES]; LP_BEGIN_USER_CODE }]; } else { [self updateMessages:messages unreadCount:unreadCount]; + [self triggerInboxSyncedWithStatus:YES]; } LP_END_TRY }]; + [req onError:^(NSError *error) { + [self triggerInboxSyncedWithStatus:NO]; + }]; [req sendIfConnected]; LP_END_TRY } @@ -521,6 +536,10 @@ - (LPInboxMessage *)messageForId:(NSString *)messageId - (void)onChanged:(LeanplumInboxChangedBlock)block { + if (!block) { + return; + } + LP_TRY if (!_inboxChangedBlocks) { _inboxChangedBlocks = [NSMutableArray array]; @@ -532,6 +551,20 @@ - (void)onChanged:(LeanplumInboxChangedBlock)block } } +- (void)onForceContentUpdate:(LeanplumInboxSyncedBlock)block +{ + if (!block) { + return; + } + + LP_TRY + if (!_inboxSyncedBlocks) { + _inboxSyncedBlocks = [NSMutableArray array]; + } + [_inboxSyncedBlocks addObject:[block copy]]; + LP_END_TRY +} + - (void)addInboxChangedResponder:(id)responder withSelector:(SEL)selector { if (!_inboxChangedResponders) { diff --git a/Leanplum-SDK/Classes/LPMessageTemplates.m b/Leanplum-SDK/Classes/LPMessageTemplates.m index 0c9e6598..fb46eabc 100644 --- a/Leanplum-SDK/Classes/LPMessageTemplates.m +++ b/Leanplum-SDK/Classes/LPMessageTemplates.m @@ -955,7 +955,7 @@ - (void)updatePopupLayout BOOL isWeb = [context.actionName isEqualToString:LPMT_WEB_INTERSTITIAL_NAME] || [context.actionName isEqualToString:LPMT_HTML_NAME]; - int statusBarHeight = ([[UIApplication sharedApplication] isStatusBarHidden] || !fullscreen) ? 0 + CGFloat statusBarHeight = ([[UIApplication sharedApplication] isStatusBarHidden] || !fullscreen) ? 0 : MIN([UIApplication sharedApplication].statusBarFrame.size.height, [UIApplication sharedApplication].statusBarFrame.size.width); @@ -990,57 +990,67 @@ - (void)updatePopupLayout CGSize screenSize = window.screen.bounds.size; _popupGroup.frame = CGRectMake(0, 0, screenSize.width, screenSize.height); - int screenWidth; - int screenHeight; + CGFloat screenWidth = screenSize.width; + CGFloat screenHeight = screenSize.height; if (orientation == UIDeviceOrientationLandscapeLeft || orientation == UIDeviceOrientationLandscapeRight) { screenWidth = screenSize.height; screenHeight = screenSize.width; - } else { - screenWidth = screenSize.width; - screenHeight = screenSize.height; } - CGRect popupFrame; - if (fullscreen) { - popupFrame = CGRectMake(0, 0, screenWidth, screenHeight); - } else { - popupFrame = CGRectMake(0, 0, - [[context numberNamed:LPMT_ARG_LAYOUT_WIDTH] doubleValue], - [[context numberNamed:LPMT_ARG_LAYOUT_HEIGHT] doubleValue]); + + _popupView.frame = CGRectMake(0, 0, screenWidth, screenHeight); + if (!fullscreen) { + _popupView.frame = CGRectMake(0, 0, [[context numberNamed:LPMT_ARG_LAYOUT_WIDTH] doubleValue], + [[context numberNamed:LPMT_ARG_LAYOUT_HEIGHT] doubleValue]); } - _popupView.frame = popupFrame; _popupView.center = CGPointMake(screenWidth / 2.0, screenHeight / 2.0); if ([context.actionName isEqualToString:LPMT_HTML_NAME]) { - // Calculate the height. Fullscreen by default. - CGFloat contextArgHeight = [[context numberNamed:LPMT_ARG_HTML_HEIGHT] doubleValue]; - CGFloat htmlHeight = contextArgHeight; - if (htmlHeight < 1) { - htmlHeight = screenHeight; - } - - // Status bar offset. - CGFloat statusBarOffset = 0; -#if LP_NOT_TV - UIApplication *app = [UIApplication sharedApplication]; - if (!app.statusBarHidden) { - statusBarOffset = app.statusBarFrame.size.height; - } -#endif - + [self updateHtmlLayoutWithContext:context + statusBarHeight:statusBarHeight + screenWidth:screenWidth + screenHeight:screenHeight]; + } + + if (!isWeb) { + [self updateNonWebPopupLayout:statusBarHeight]; + _overlayView.frame = CGRectMake(0, 0, screenWidth, screenHeight); + } + + CGFloat dismissButtonX = screenWidth - _dismissButton.frame.size.width - LPMT_ACCEPT_BUTTON_MARGIN / 2; + CGFloat dismissButtonY = statusBarHeight + LPMT_ACCEPT_BUTTON_MARGIN / 2; + if (!fullscreen) { + dismissButtonX = _popupView.frame.origin.x + _popupView.frame.size.width - 3 * _dismissButton.frame.size.width / 4; + dismissButtonY = _popupView.frame.origin.y - _dismissButton.frame.size.height / 4; + } + _dismissButton.frame = CGRectMake(dismissButtonX, dismissButtonY, _dismissButton.frame.size.width, + _dismissButton.frame.size.height); +} + +- (void)updateHtmlLayoutWithContext:(LPActionContext *)context + statusBarHeight:(CGFloat)statusBarHeight + screenWidth:(CGFloat)screenWidth + screenHeight:(CGFloat)screenHeight +{ + // Calculate the height. Fullscreen by default. + CGFloat htmlHeight = [[context numberNamed:LPMT_ARG_HTML_HEIGHT] doubleValue]; + BOOL isFullscreen = htmlHeight < 1; + + // Banner logic. + if (!isFullscreen) { // Calculate Y Offset. CGFloat yOffset = 0; NSString *contextArgYOffset = [context stringNamed:LPMT_ARG_HTML_Y_OFFSET]; if (contextArgYOffset && [contextArgYOffset length] > 0) { - CGFloat percentRange = screenHeight - htmlHeight - statusBarOffset; + CGFloat percentRange = screenHeight - htmlHeight - statusBarHeight; yOffset = [self valueFromHtmlString:contextArgYOffset percentRange:percentRange]; } // HTML banner logic to support top/bottom alignment with dynamic size. - CGFloat htmlY = yOffset + statusBarOffset; + CGFloat htmlY = yOffset + statusBarHeight; NSString *htmlAlign = [context stringNamed:LPMT_ARG_HTML_ALIGN]; if ([htmlAlign isEqualToString:LPMT_ARG_HTML_ALIGN_BOTTOM]) { - htmlY = screenHeight - htmlHeight - yOffset - statusBarOffset; + htmlY = screenHeight - htmlHeight - yOffset - statusBarHeight; } // Calculate HTML width by percentage or px (it parses any suffix for extra protection). @@ -1056,35 +1066,18 @@ - (void)updatePopupLayout [self dismiss]; [_closePopupView removeFromSuperview]; }]; - _closePopupView.frame = CGRectMake(0, 0, screenSize.width, screenSize.height); + _closePopupView.frame = CGRectMake(0, 0, screenWidth, screenHeight); [[UIApplication sharedApplication].keyWindow addSubview:_closePopupView]; [[UIApplication sharedApplication].keyWindow bringSubviewToFront:_popupGroup]; } - + CGFloat htmlX = (screenWidth - htmlWidth) / 2.; _popupGroup.frame = CGRectMake(htmlX, htmlY, htmlWidth, htmlHeight); - _popupView.frame = _popupGroup.bounds; - } - - if (!isWeb) { - [self updateNonWebPopupLayout:statusBarHeight]; - } - - if (fullscreen) { - _dismissButton.frame = CGRectMake(screenWidth - _dismissButton.frame.size.width - LPMT_ACCEPT_BUTTON_MARGIN / 2, - statusBarHeight + LPMT_ACCEPT_BUTTON_MARGIN / 2, - _dismissButton.frame.size.width, - _dismissButton.frame.size.height); - } else { - _dismissButton.frame = CGRectMake(_popupView.frame.origin.x + _popupView.frame.size.width - 3 * _dismissButton.frame.size.width / 4, - _popupView.frame.origin.y - _dismissButton.frame.size.height / 4, - _dismissButton.frame.size.width, - _dismissButton.frame.size.height); + } else if (statusBarHeight > 40) { // iPhone X + _popupGroup.frame = CGRectMake(0, -statusBarHeight, screenWidth, screenHeight+2*statusBarHeight); } - if (!isWeb) { - _overlayView.frame = CGRectMake(0, 0, screenWidth, screenHeight); - } + _popupView.frame = _popupGroup.bounds; } /** diff --git a/Leanplum-SDK/Classes/Leanplum.h b/Leanplum-SDK/Classes/Leanplum.h index a34c6111..322df6dc 100644 --- a/Leanplum-SDK/Classes/Leanplum.h +++ b/Leanplum-SDK/Classes/Leanplum.h @@ -1,6 +1,6 @@ // // Leanplum.h -// Leanplum iOS SDK Version 2.0.3 +// Leanplum iOS SDK Version 2.0.4 // // Copyright (c) 2012 Leanplum, Inc. All rights reserved. // diff --git a/Leanplum-SDK/Classes/Leanplum.m b/Leanplum-SDK/Classes/Leanplum.m index 530138ed..c40c9e1c 100644 --- a/Leanplum-SDK/Classes/Leanplum.m +++ b/Leanplum-SDK/Classes/Leanplum.m @@ -2259,6 +2259,8 @@ + (void)forceContentUpdate:(LeanplumVariablesChangedBlock)block } if ([response[LP_KEY_SYNC_INBOX] boolValue]) { [[self inbox] downloadMessages]; + } else { + [[self inbox] triggerInboxSyncedWithStatus:YES]; } LP_END_TRY if (block) { @@ -2269,6 +2271,7 @@ + (void)forceContentUpdate:(LeanplumVariablesChangedBlock)block if (block) { block(); } + [[self inbox] triggerInboxSyncedWithStatus:NO]; }]; [req sendIfConnected]; LP_END_TRY diff --git a/Leanplum-SDK/Classes/LeanplumInternal.h b/Leanplum-SDK/Classes/LeanplumInternal.h index 9c2375dd..21a355b6 100644 --- a/Leanplum-SDK/Classes/LeanplumInternal.h +++ b/Leanplum-SDK/Classes/LeanplumInternal.h @@ -164,6 +164,7 @@ typedef void (^LeanplumInboxCacheUpdateBlock)(void); @property(strong, nonatomic) NSMutableDictionary *messages; @property(strong, nonatomic) NSMutableArray *inboxChangedBlocks; @property(strong, nonatomic) NSMutableSet *inboxChangedResponders; +@property(strong, nonatomic) NSMutableArray *inboxSyncedBlocks; @property(strong, nonatomic) NSMutableSet *downloadedImageUrls; #pragma mark - LPInbox method declaration @@ -178,6 +179,7 @@ typedef void (^LeanplumInboxCacheUpdateBlock)(void); - (void)removeMessageForId:(NSString *)messageId; - (void)reset; - (void)triggerInboxChanged; +- (void)triggerInboxSyncedWithStatus:(BOOL)success; @end diff --git a/Leanplum-SDK/Classes/LeanplumRequest.m b/Leanplum-SDK/Classes/LeanplumRequest.m index c2df77d9..c5003882 100644 --- a/Leanplum-SDK/Classes/LeanplumRequest.m +++ b/Leanplum-SDK/Classes/LeanplumRequest.m @@ -305,6 +305,7 @@ - (void)sendRequests:(BOOL)async __weak NSBlockOperation *weakOperation = requestOperation; void (^operationBlock)(void) = ^void() { + LP_TRY if ([weakOperation isCancelled]) { return; } @@ -340,6 +341,7 @@ - (void)sendRequests:(BOOL)async // Request callbacks. [op addCompletionHandler:^(id operation, id json) { + LP_TRY if ([weakOperation isCancelled]) { dispatch_semaphore_signal(semaphore); return; @@ -364,14 +366,15 @@ - (void)sendRequests:(BOOL)async operation:operation]; } dispatch_semaphore_signal(semaphore); + LP_END_TRY } errorHandler:^(id completedOperation, NSError *err) { + LP_TRY if ([weakOperation isCancelled]) { dispatch_semaphore_signal(semaphore); return; } - LP_TRY // Retry on 500 and other network failures. NSInteger httpStatusCode = completedOperation.HTTPStatusCode; if (httpStatusCode == 408 @@ -429,6 +432,7 @@ - (void)sendRequests:(BOOL)async [[LeanplumRequest sendNowQueue] cancelAllOperations]; LP_END_TRY } + LP_END_TRY }; // Send. operationBlock will run synchronously. diff --git a/Leanplum-iOS-SDK-source.podspec b/Leanplum-iOS-SDK-source.podspec index 3beebb39..f8c2f19a 100644 --- a/Leanplum-iOS-SDK-source.podspec +++ b/Leanplum-iOS-SDK-source.podspec @@ -8,7 +8,7 @@ Pod::Spec.new do |s| s.name = 'Leanplum-iOS-SDK-source' - s.version = '2.0.3' + s.version = '2.0.4' s.summary = 'Mobile Marketing Platform. Integrated. ROI Engine.' s.description = <<-DESC Leanplum’s integrated solution delivers meaningful engagement across messaging and the in-app diff --git a/Leanplum-tvOS-SDK-source.podspec b/Leanplum-tvOS-SDK-source.podspec new file mode 100644 index 00000000..d56a22b0 --- /dev/null +++ b/Leanplum-tvOS-SDK-source.podspec @@ -0,0 +1,28 @@ +# +# Be sure to run `pod lib lint Leanplum-SDK.podspec' to ensure this is a +# valid spec before submitting. +# +# Any lines starting with a # are optional, but their use is encouraged +# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html +# + +Pod::Spec.new do |s| + s.name = 'Leanplum-tvOS-SDK-source' + s.version = '2.0.3-SNAPSHOT' + s.summary = 'Mobile Marketing Platform. Integrated. ROI Engine.' + s.description = 'Leanplum delivers meaningful engagement across channels through Automation, Personalization, A/B Testing, and Analytics.' + s.homepage = 'https://www.leanplum.com' + s.license = { :type => 'Commercial', :text => 'See https://www.leanplum.com/tos' } + s.author = { 'Leanplum' => 'support@leanplum.com' } + s.social_media_url = 'https://twitter.com/leanplum' + s.requires_arc = true + s.source = { :git => 'https://github.com/Leanplum/Leanplum-tvOS-SDK-Internal.git', :tag => s.version.to_s } + s.tvos.deployment_target = '9.0' + s.frameworks = 'CFNetwork', 'Foundation', 'Security', 'SystemConfiguration', 'UIKit' + s.weak_frameworks = 'AdSupport', 'StoreKit' + s.library = 'sqlite3' + s.xcconfig = { 'OTHER_LDFLAGS' => '-ObjC', 'BITCODE_GENERATION_MODE' => 'bitcode' } + s.documentation_url = 'https://www.leanplum.com/docs#/docs' + s.source_files = 'Leanplum-SDK/Classes/**/*' + s.module_name = 'LeanplumTV' +end diff --git a/Leanplum-tvOS-SDK.podspec b/Leanplum-tvOS-SDK.podspec index d7f39080..133b4488 100644 --- a/Leanplum-tvOS-SDK.podspec +++ b/Leanplum-tvOS-SDK.podspec @@ -7,7 +7,7 @@ Pod::Spec.new do |s| s.license = { :type => 'Commercial', :text => 'See https://www.leanplum.com/tos' } s.author = { 'Leanplum' => 'support@leanplum.com' } s.social_media_url = 'https://twitter.com/leanplum' - s.platform = :tvos, '8.0' + s.tvos.deployment_target = '9.0' s.requires_arc = true s.source = { :git => 'https://github.com/Leanplum/Leanplum-iOS-SDK.git', :tag => s.version.to_s } s.frameworks = 'CFNetwork', 'Foundation', 'Security', 'SystemConfiguration', 'UIKit' diff --git a/build.sh b/build.sh index cb205a6e..a8d0f109 100755 --- a/build.sh +++ b/build.sh @@ -90,10 +90,16 @@ main() { CURRENTCONFIG_X86_DEVICE_DIR=${CURRENTCONFIG_X86_DEVICE_DIR:-$default} default="${BUILD_DIR}${X8664_DIR}/${CONFIGURATION}-iphonesimulator" CURRENTCONFIG_X8664_SIMULATOR_DIR=${CURRENTCONFIG_X8664_SIMULATOR_DIR:-$default} + default="${BUILD_DIR}${ARM64_DIR}/${CONFIGURATION}-appletvos" + CURRENTCONFIG_ARM64_TV_DEVICE_DIR=${CURRENTCONFIG_ARM64_TV_DEVICE_DIR:-$default} + default="${BUILD_DIR}${X8664_DIR}/${CONFIGURATION}-appletvsimulator" + CURRENTCONFIG_X8664_TV_SIMULATOR_DIR=${CURRENTCONFIG_X8664_TV_SIMULATOR_DIR:-$default} ACTION="clean build" DEVICE_SDK="iphoneos" + TVOS_SDK="appletvos" SIM_SDK="iphonesimulator" + TVOS_SIM_SDK="appletvsimulator" rm -rf "$RELEASE_DIR_BASE" mkdir -p "$RELEASE_DIR_BASE" @@ -105,6 +111,7 @@ main() { pod install cd "$SDK_DIR/Example/Pods" build_ios_dylib + build_tvos_dylib # Build Static Framework RELEASE_DIR="$RELEASE_DIR_BASE/static" @@ -129,29 +136,29 @@ main() { # None ####################################### build_ios() { - echo "Starting static build for Leanplum-SDK (iOS)" + echo "Starting build for Leanplum-SDK (iOS)" - run "Building Leanplum-SDK (device/armv7) target ..." \ + run "Building Leanplum-SDK-iOS static (device/armv7) target ..." \ xcodebuild -configuration "${CONFIGURATION}" -target "Leanplum-iOS-SDK-source" -sdk "${DEVICE_SDK}" \ "$ACTION" ARCHS='armv7' RUN_CLANG_STATIC_ANALYZER=NO BUILD_DIR="${BUILD_DIR}${ARMV7_DIR}" \ BUILD_ROOT="${BUILD_ROOT}" OTHER_CFLAGS="-fembed-bitcode" \ GCC_PREPROCESSOR_DEFINITIONS="PACKAGE_IDENTIFIER=${LEANPLUM_PACKAGE_IDENTIFIER}" - run "Building Leanplum-SDK (device/armv7s) target ..." \ + run "Building Leanplum-SDK-iOS static (device/armv7s) target ..." \ xcodebuild -configuration "${CONFIGURATION}" -target "Leanplum-iOS-SDK-source" -sdk "${DEVICE_SDK}" \ "$ACTION" ARCHS='armv7s' RUN_CLANG_STATIC_ANALYZER=NO BUILD_DIR="${BUILD_DIR}${ARMV7S_DIR}" \ BUILD_ROOT="${BUILD_ROOT}" OTHER_CFLAGS="-fembed-bitcode" \ GCC_PREPROCESSOR_DEFINITIONS="PACKAGE_IDENTIFIER=${LEANPLUM_PACKAGE_IDENTIFIER}" - run "Building Leanplum-SDK (device/arm64) target ..." \ + run "Building Leanplum-SDK-iOS static (device/arm64) target ..." \ xcodebuild -configuration "${CONFIGURATION}" -target "Leanplum-iOS-SDK-source" -sdk "${DEVICE_SDK}" \ "$ACTION" ARCHS='arm64' RUN_CLANG_STATIC_ANALYZER=NO BUILD_DIR="${BUILD_DIR}${ARM64_DIR}" \ BUILD_ROOT="${BUILD_ROOT}" OTHER_CFLAGS="-fembed-bitcode" \ GCC_PREPROCESSOR_DEFINITIONS="PACKAGE_IDENTIFIER=${LEANPLUM_PACKAGE_IDENTIFIER}" - run "Building Leanplum-SDK (simulator/i386) target ..." \ + run "Building Leanplum-SDK-iOS static (simulator/i386) target ..." \ xcodebuild -configuration "${CONFIGURATION}" -target "Leanplum-iOS-SDK-source" -sdk "${SIM_SDK}" \ "$ACTION" ARCHS='i386' VALID_ARCHS='i386' RUN_CLANG_STATIC_ANALYZER=NO \ BUILD_DIR="${BUILD_DIR}${X86_DIR}" BUILD_ROOT="${BUILD_ROOT}" OTHER_CFLAGS="-fembed-bitcode" \ GCC_PREPROCESSOR_DEFINITIONS="PACKAGE_IDENTIFIER=${LEANPLUM_PACKAGE_IDENTIFIER}" - run "Building Leanplum-SDK (simulator/x86_64) target ..." \ + run "Building Leanplum-SDK-iOS static (simulator/x86_64) target ..." \ xcodebuild -configuration "${CONFIGURATION}" -target "Leanplum-iOS-SDK-source" -sdk "${SIM_SDK}" \ "$ACTION" ARCHS='x86_64' VALID_ARCHS='x86_64' RUN_CLANG_STATIC_ANALYZER=NO \ BUILD_DIR="${BUILD_DIR}${X8664_DIR}" BUILD_ROOT="${BUILD_ROOT}" OTHER_CFLAGS="-fembed-bitcode" \ @@ -198,28 +205,29 @@ EOF # None ####################################### build_ios_dylib() { - echo "Starting dylib build for Leanplum-SDK (iOS)" - run "Building Leanplum-SDK (device/armv7) target ..." \ + echo "Starting build for Leanplum-SDK (iOS)" + + run "Building Leanplum-SDK-iOS dynamic (device/armv7) target ..." \ xcodebuild -configuration "${CONFIGURATION}" -target "Leanplum-iOS-SDK-source" -sdk "${DEVICE_SDK}" \ "$ACTION" ARCHS='armv7' RUN_CLANG_STATIC_ANALYZER=NO BUILD_DIR="${BUILD_DIR}${ARMV7_DIR}" \ BUILD_ROOT="${BUILD_ROOT}" OTHER_CFLAGS="-fembed-bitcode" \ GCC_PREPROCESSOR_DEFINITIONS="PACKAGE_IDENTIFIER=${LEANPLUM_PACKAGE_IDENTIFIER}" - run "Building Leanplum-SDK (device/armv7s) target ..." \ + run "Building Leanplum-SDK-iOS dynamic (device/armv7s) target ..." \ xcodebuild -configuration "${CONFIGURATION}" -target "Leanplum-iOS-SDK-source" -sdk "${DEVICE_SDK}" \ "$ACTION" ARCHS='armv7s' RUN_CLANG_STATIC_ANALYZER=NO BUILD_DIR="${BUILD_DIR}${ARMV7S_DIR}" \ BUILD_ROOT="${BUILD_ROOT}" OTHER_CFLAGS="-fembed-bitcode" \ GCC_PREPROCESSOR_DEFINITIONS="PACKAGE_IDENTIFIER=${LEANPLUM_PACKAGE_IDENTIFIER}" - run "Building Leanplum-SDK (device/arm64) target ..." \ + run "Building Leanplum-SDK-iOS dynamic (device/arm64) target ..." \ xcodebuild -configuration "${CONFIGURATION}" -target "Leanplum-iOS-SDK-source" -sdk "${DEVICE_SDK}" \ "$ACTION" ARCHS='arm64' RUN_CLANG_STATIC_ANALYZER=NO BUILD_DIR="${BUILD_DIR}${ARM64_DIR}" \ BUILD_ROOT="${BUILD_ROOT}" OTHER_CFLAGS="-fembed-bitcode" \ GCC_PREPROCESSOR_DEFINITIONS="PACKAGE_IDENTIFIER=${LEANPLUM_PACKAGE_IDENTIFIER}" - run "Building Leanplum-SDK (simulator/i386) target ..." \ + run "Building Leanplum-SDK-iOS dynamic (simulator/i386) target ..." \ xcodebuild -configuration "${CONFIGURATION}" -target "Leanplum-iOS-SDK-source" -sdk "${SIM_SDK}" \ "$ACTION" ARCHS='i386' VALID_ARCHS='i386' RUN_CLANG_STATIC_ANALYZER=NO \ BUILD_DIR="${BUILD_DIR}${X86_DIR}" BUILD_ROOT="${BUILD_ROOT}" OTHER_CFLAGS="-fembed-bitcode" \ GCC_PREPROCESSOR_DEFINITIONS="PACKAGE_IDENTIFIER=${LEANPLUM_PACKAGE_IDENTIFIER}" - run "Building Leanplum-SDK (simulator/x86_64) target ..." \ + run "Building Leanplum-SDK-iOS dynamic (simulator/x86_64) target ..." \ xcodebuild -configuration "${CONFIGURATION}" -target "Leanplum-iOS-SDK-source" -sdk "${SIM_SDK}" \ "$ACTION" ARCHS='x86_64' VALID_ARCHS='x86_64' RUN_CLANG_STATIC_ANALYZER=NO \ BUILD_DIR="${BUILD_DIR}${X8664_DIR}" BUILD_ROOT="${BUILD_ROOT}" OTHER_CFLAGS="-fembed-bitcode" \ @@ -260,4 +268,62 @@ build_ios_dylib() { printf "%s\n" "Successfully built Leanplum-SDK (iOS) Framework.\n" } +####################################### +# Builds the dynamic library tvOS target. +# Globals: +# None +# Arguments: +# None +# Returns: +# None +####################################### +build_tvos_dylib() { + echo "Starting build for Leanplum-SDK (tvOS)" + + mkdir -p "${RELEASE_DIR}/" + + run "Building Leanplum-SDK-tvOS dynamic (device/arm64) target ..." \ + xcodebuild -configuration "${CONFIGURATION}" -target "Leanplum-tvOS-SDK-source" -sdk "${TVOS_SDK}" \ + "$ACTION" ARCHS='arm64' RUN_CLANG_STATIC_ANALYZER=NO BUILD_DIR="${BUILD_DIR}${ARM64_DIR}" \ + BUILD_ROOT="${BUILD_ROOT}" OTHER_CFLAGS="-fembed-bitcode" \ + GCC_PREPROCESSOR_DEFINITIONS="PACKAGE_IDENTIFIER=${LEANPLUM_PACKAGE_IDENTIFIER}" + run "Building Leanplum-SDK-tvOS dynamic (simulator/x86_64) target ..." \ + xcodebuild -configuration "${CONFIGURATION}" -target "Leanplum-tvOS-SDK-source" -sdk "${TVOS_SIM_SDK}" \ + "$ACTION" ARCHS='x86_64' VALID_ARCHS='x86_64' RUN_CLANG_STATIC_ANALYZER=NO \ + BUILD_DIR="${BUILD_DIR}${X8664_DIR}" BUILD_ROOT="${BUILD_ROOT}" OTHER_CFLAGS="-fembed-bitcode" \ + GCC_PREPROCESSOR_DEFINITIONS="PACKAGE_IDENTIFIER=${LEANPLUM_PACKAGE_IDENTIFIER}" + + run "Combining builds to universal fat library ..." \ + lipo -create -output "${RELEASE_DIR}/LeanplumTV" \ + "${CURRENTCONFIG_ARM64_TV_DEVICE_DIR}/Leanplum-tvOS-SDK-source/LeanplumTV.framework/LeanplumTV" \ + "${CURRENTCONFIG_X8664_TV_SIMULATOR_DIR}/Leanplum-tvOS-SDK-source/LeanplumTV.framework/LeanplumTV" + + # Copy generated framework + cp -r "${BUILD_DIR}$ARM64_DIR/$CONFIGURATION-appletvos/Leanplum-tvOS-SDK-source/"\ +"LeanplumTV.framework/" "${RELEASE_DIR}/LeanplumTV.framework" + rm -f "${RELEASE_DIR}/LeanplumTV.framework/LeanplumTV" + mv "${RELEASE_DIR}/LeanplumTV" "${RELEASE_DIR}/LeanplumTV.framework/" + + # Delete unnecessary headers + mv "${RELEASE_DIR}/LeanplumTV.framework/Headers/Leanplum.h" \ + "${RELEASE_DIR}/LeanplumTV.framework/" + mv "${RELEASE_DIR}/LeanplumTV.framework/Headers/LPInbox.h" \ + "${RELEASE_DIR}/LeanplumTV.framework/" + rm -rf "${RELEASE_DIR}/LeanplumTV.framework/Headers" + mkdir "${RELEASE_DIR}/LeanplumTV.framework/Headers" + mv "${RELEASE_DIR}/LeanplumTV.framework/Leanplum.h" \ + "${RELEASE_DIR}/LeanplumTV.framework/Headers/" + mv "${RELEASE_DIR}/LeanplumTV.framework/LPInbox.h" \ + "${RELEASE_DIR}/LeanplumTV.framework/Headers/" + + rm -rf "${RELEASE_DIR}/LeanplumTV.framework/_CodeSignature" + + # Update modulemap with correct import, since umbrella header is not generated by cocoapods with + # a custom module_name set. + sed -i "" -e "s/Leanplum-tvOS-SDK-source-umbrella.h/Leanplum.h/g" \ + "${RELEASE_DIR}/LeanplumTV.framework/modules/module.modulemap" + + printf "%s\n" "Successfully built Leanplum-SDK (tvOS) Framework.\n" +} + main "$@"