diff --git a/.DS_Store b/.DS_Store index 4d52e2d4e689b3e884f5dad0922598acb0dff9e6..33a6d0e123957cfcc55309cce2ce732440b3c0b6 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/Demo/.DS_Store b/Demo/.DS_Store old mode 100755 new mode 100644 index 3bbec29fe5b46be40ba6c667d790f0219d5fc0c2..dbb80f8fe3f16b5cec89210e7d7393980106cccc Binary files a/Demo/.DS_Store and b/Demo/.DS_Store differ diff --git a/Demo/Demo.xcodeproj/project.pbxproj b/Demo/Demo.xcodeproj/project.pbxproj old mode 100755 new mode 100644 index 44f6afa2b80216f04490ad64b68b740b6955e938..535d96b24e46127a8e5c75315e158da1dc4b4178 --- a/Demo/Demo.xcodeproj/project.pbxproj +++ b/Demo/Demo.xcodeproj/project.pbxproj @@ -16,16 +16,24 @@ 2A0C4E3F18D6D18700200F18 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2A0C4E2118D6D18700200F18 /* UIKit.framework */; }; 2A0C4E4718D6D18700200F18 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 2A0C4E4518D6D18700200F18 /* InfoPlist.strings */; }; 2A0C4E4918D6D18700200F18 /* DemoTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 2A0C4E4818D6D18700200F18 /* DemoTests.m */; }; - AF0F01A51FF4A0430095BE0C /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = AF0F01A41FF4A0430095BE0C /* ViewController.m */; }; - AF16D1981F026C4000A2B28B /* ScrollViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = AF16D1971F026C4000A2B28B /* ScrollViewController.m */; }; + 772E49B322F189B00009DFD2 /* MMAViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 772E49B222F189B00009DFD2 /* MMAViewController.m */; }; + 772E49BD22F1959B0009DFD2 /* VideoViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 772E49B422F195950009DFD2 /* VideoViewController.xib */; }; + 772E49BE22F1959B0009DFD2 /* SecondViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 772E49B522F195960009DFD2 /* SecondViewController.m */; }; + 772E49BF22F1959B0009DFD2 /* VideoViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 772E49B722F195970009DFD2 /* VideoViewController.m */; }; + 772E49C022F1959B0009DFD2 /* SecondViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 772E49B822F195980009DFD2 /* SecondViewController.xib */; }; + 772E49C122F1959B0009DFD2 /* NormalViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 772E49B922F195990009DFD2 /* NormalViewController.m */; }; + 772E49C222F1959B0009DFD2 /* NormalViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 772E49BA22F195990009DFD2 /* NormalViewController.xib */; }; + 772E49C722F19F950009DFD2 /* videoAd.mp4 in Resources */ = {isa = PBXBuildFile; fileRef = 772E49C522F19F940009DFD2 /* videoAd.mp4 */; }; + 77303F6722F98A3A00A51176 /* Advertisement.mp4 in Resources */ = {isa = PBXBuildFile; fileRef = 77303F6622F98A3A00A51176 /* Advertisement.mp4 */; }; + 77303F6A22F98F2D00A51176 /* landingPageIcon.png in Resources */ = {isa = PBXBuildFile; fileRef = 77303F6922F98F2D00A51176 /* landingPageIcon.png */; }; + 7781CA6122C4BBD1002805DB /* sdkconfig.xml in Resources */ = {isa = PBXBuildFile; fileRef = 7781CA6022C4BBD1002805DB /* sdkconfig.xml */; }; + 77BDFC3F230D44BF00079FDF /* libMobileTrackingSimulator.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 2ABB195518DAFA0300C7CAA9 /* libMobileTrackingSimulator.a */; }; AF353EDF1CFC24FB00969035 /* AdSupport.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AF353EDE1CFC24FB00969035 /* AdSupport.framework */; }; AF4B464B218AB16400BE2F3F /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AF353EE01CFC251C00969035 /* SystemConfiguration.framework */; }; AF4B464C218AB18300BE2F3F /* CoreLocation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AF353ED91CFC24E400969035 /* CoreLocation.framework */; }; AF6EA2E51EF655AD000DF811 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = AF6EA2E41EF655AD000DF811 /* Images.xcassets */; }; - AF78E1521EFA247B0025B677 /* sdkconfig.xml in Resources */ = {isa = PBXBuildFile; fileRef = AF78E1511EFA247B0025B677 /* sdkconfig.xml */; }; AF7D89611EF655F50069A7DC /* Launch Screen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = AF7D89601EF655F50069A7DC /* Launch Screen.storyboard */; }; AFB3717E1F3854E10092930F /* admaster.js in Resources */ = {isa = PBXBuildFile; fileRef = AFB3717D1F3854E10092930F /* admaster.js */; }; - AFBC6A3A1EF9578D0030508A /* libMobileTrackingSimulator.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 2ABB195518DAFA0300C7CAA9 /* libMobileTrackingSimulator.a */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -57,7 +65,7 @@ remoteGlobalIDString = 2A81721B18DAEB3A00E0EFEC; remoteInfo = MobileTrackingSimulator; }; - AFBC6A381EF957860030508A /* PBXContainerItemProxy */ = { + 77BDFC40230D44CE00079FDF /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 2A0C4E5218D6D19700200F18 /* MobileTracking.xcodeproj */; proxyType = 1; @@ -84,16 +92,26 @@ 2A0C4E4618D6D18700200F18 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 2A0C4E4818D6D18700200F18 /* DemoTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DemoTests.m; sourceTree = ""; }; 2A0C4E5218D6D19700200F18 /* MobileTracking.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = MobileTracking.xcodeproj; path = ../MobileTracking/MobileTracking.xcodeproj; sourceTree = ""; }; - AF0F01A31FF4A0430095BE0C /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; - AF0F01A41FF4A0430095BE0C /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; - AF16D1961F026C4000A2B28B /* ScrollViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScrollViewController.h; sourceTree = ""; }; - AF16D1971F026C4000A2B28B /* ScrollViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ScrollViewController.m; sourceTree = ""; }; + 772E49B122F189B00009DFD2 /* MMAViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MMAViewController.h; sourceTree = ""; }; + 772E49B222F189B00009DFD2 /* MMAViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MMAViewController.m; sourceTree = ""; }; + 772E49B422F195950009DFD2 /* VideoViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = VideoViewController.xib; sourceTree = ""; }; + 772E49B522F195960009DFD2 /* SecondViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SecondViewController.m; sourceTree = ""; }; + 772E49B622F195970009DFD2 /* SecondViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SecondViewController.h; sourceTree = ""; }; + 772E49B722F195970009DFD2 /* VideoViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VideoViewController.m; sourceTree = ""; }; + 772E49B822F195980009DFD2 /* SecondViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = SecondViewController.xib; sourceTree = ""; }; + 772E49B922F195990009DFD2 /* NormalViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NormalViewController.m; sourceTree = ""; }; + 772E49BA22F195990009DFD2 /* NormalViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = NormalViewController.xib; sourceTree = ""; }; + 772E49BB22F1959A0009DFD2 /* VideoViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VideoViewController.h; sourceTree = ""; }; + 772E49BC22F1959B0009DFD2 /* NormalViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NormalViewController.h; sourceTree = ""; }; + 772E49C522F19F940009DFD2 /* videoAd.mp4 */ = {isa = PBXFileReference; lastKnownFileType = file; path = videoAd.mp4; sourceTree = ""; }; + 77303F6622F98A3A00A51176 /* Advertisement.mp4 */ = {isa = PBXFileReference; lastKnownFileType = file; path = Advertisement.mp4; sourceTree = ""; }; + 77303F6922F98F2D00A51176 /* landingPageIcon.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = landingPageIcon.png; sourceTree = ""; }; + 7781CA6022C4BBD1002805DB /* sdkconfig.xml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = sdkconfig.xml; sourceTree = ""; }; AF2DFF4021955F0300B10C3F /* libxml2.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libxml2.tbd; path = usr/lib/libxml2.tbd; sourceTree = SDKROOT; }; AF353ED91CFC24E400969035 /* CoreLocation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreLocation.framework; path = System/Library/Frameworks/CoreLocation.framework; sourceTree = SDKROOT; }; AF353EDE1CFC24FB00969035 /* AdSupport.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AdSupport.framework; path = System/Library/Frameworks/AdSupport.framework; sourceTree = SDKROOT; }; AF353EE01CFC251C00969035 /* SystemConfiguration.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SystemConfiguration.framework; path = System/Library/Frameworks/SystemConfiguration.framework; sourceTree = SDKROOT; }; AF6EA2E41EF655AD000DF811 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; - AF78E1511EFA247B0025B677 /* sdkconfig.xml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = sdkconfig.xml; sourceTree = ""; }; AF7D89601EF655F50069A7DC /* Launch Screen.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = "Launch Screen.storyboard"; sourceTree = ""; }; AFB3717D1F3854E10092930F /* admaster.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = admaster.js; sourceTree = ""; }; /* End PBXFileReference section */ @@ -103,9 +121,9 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 77BDFC3F230D44BF00079FDF /* libMobileTrackingSimulator.a in Frameworks */, AF4B464C218AB18300BE2F3F /* CoreLocation.framework in Frameworks */, AF4B464B218AB16400BE2F3F /* SystemConfiguration.framework in Frameworks */, - AFBC6A3A1EF9578D0030508A /* libMobileTrackingSimulator.a in Frameworks */, AF353EDF1CFC24FB00969035 /* AdSupport.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; @@ -161,15 +179,25 @@ 2A0C4E2318D6D18700200F18 /* Demo */ = { isa = PBXGroup; children = ( + 77303F6622F98A3A00A51176 /* Advertisement.mp4 */, + 772E49C522F19F940009DFD2 /* videoAd.mp4 */, + 77303F6922F98F2D00A51176 /* landingPageIcon.png */, 2A0C4E2C18D6D18700200F18 /* AppDelegate.h */, 2A0C4E2D18D6D18700200F18 /* AppDelegate.m */, - AF0F01A31FF4A0430095BE0C /* ViewController.h */, - AF0F01A41FF4A0430095BE0C /* ViewController.m */, - AF78E1511EFA247B0025B677 /* sdkconfig.xml */, + 772E49B122F189B00009DFD2 /* MMAViewController.h */, + 772E49B222F189B00009DFD2 /* MMAViewController.m */, + 772E49BC22F1959B0009DFD2 /* NormalViewController.h */, + 772E49B922F195990009DFD2 /* NormalViewController.m */, + 772E49BA22F195990009DFD2 /* NormalViewController.xib */, + 772E49B622F195970009DFD2 /* SecondViewController.h */, + 772E49B522F195960009DFD2 /* SecondViewController.m */, + 772E49B822F195980009DFD2 /* SecondViewController.xib */, + 772E49BB22F1959A0009DFD2 /* VideoViewController.h */, + 772E49B722F195970009DFD2 /* VideoViewController.m */, + 772E49B422F195950009DFD2 /* VideoViewController.xib */, AFB3717D1F3854E10092930F /* admaster.js */, 2A0C4E2F18D6D18700200F18 /* Main.storyboard */, - AF16D1961F026C4000A2B28B /* ScrollViewController.h */, - AF16D1971F026C4000A2B28B /* ScrollViewController.m */, + 7781CA6022C4BBD1002805DB /* sdkconfig.xml */, AF7D89601EF655F50069A7DC /* Launch Screen.storyboard */, AF6EA2E41EF655AD000DF811 /* Images.xcassets */, 2A0C4E2418D6D18700200F18 /* Supporting Files */, @@ -230,7 +258,7 @@ buildRules = ( ); dependencies = ( - AFBC6A391EF957860030508A /* PBXTargetDependency */, + 77BDFC41230D44CE00079FDF /* PBXTargetDependency */, ); name = Demo; productName = Demo; @@ -267,6 +295,11 @@ 2A0C4E1918D6D18700200F18 = { DevelopmentTeam = 44PQ7EUSW9; ProvisioningStyle = Manual; + SystemCapabilities = { + com.apple.AccessWiFi = { + enabled = 0; + }; + }; }; 2A0C4E3A18D6D18700200F18 = { DevelopmentTeam = 4E89P63KS8; @@ -279,6 +312,7 @@ developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( + English, en, Base, ); @@ -328,11 +362,17 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( + 7781CA6122C4BBD1002805DB /* sdkconfig.xml in Resources */, + 77303F6722F98A3A00A51176 /* Advertisement.mp4 in Resources */, + 772E49BD22F1959B0009DFD2 /* VideoViewController.xib in Resources */, AF6EA2E51EF655AD000DF811 /* Images.xcassets in Resources */, + 772E49C222F1959B0009DFD2 /* NormalViewController.xib in Resources */, + 77303F6A22F98F2D00A51176 /* landingPageIcon.png in Resources */, + 772E49C722F19F950009DFD2 /* videoAd.mp4 in Resources */, 2A0C4E2818D6D18700200F18 /* InfoPlist.strings in Resources */, - AF78E1521EFA247B0025B677 /* sdkconfig.xml in Resources */, AFB3717E1F3854E10092930F /* admaster.js in Resources */, AF7D89611EF655F50069A7DC /* Launch Screen.storyboard in Resources */, + 772E49C022F1959B0009DFD2 /* SecondViewController.xib in Resources */, 2A0C4E3118D6D18700200F18 /* Main.storyboard in Resources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -352,10 +392,12 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 772E49BE22F1959B0009DFD2 /* SecondViewController.m in Sources */, 2A0C4E2E18D6D18700200F18 /* AppDelegate.m in Sources */, 2A0C4E2A18D6D18700200F18 /* main.m in Sources */, - AF0F01A51FF4A0430095BE0C /* ViewController.m in Sources */, - AF16D1981F026C4000A2B28B /* ScrollViewController.m in Sources */, + 772E49BF22F1959B0009DFD2 /* VideoViewController.m in Sources */, + 772E49C122F1959B0009DFD2 /* NormalViewController.m in Sources */, + 772E49B322F189B00009DFD2 /* MMAViewController.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -375,10 +417,10 @@ target = 2A0C4E1918D6D18700200F18 /* Demo */; targetProxy = 2A0C4E4018D6D18700200F18 /* PBXContainerItemProxy */; }; - AFBC6A391EF957860030508A /* PBXTargetDependency */ = { + 77BDFC41230D44CE00079FDF /* PBXTargetDependency */ = { isa = PBXTargetDependency; name = MobileTrackingSimulator; - targetProxy = AFBC6A381EF957860030508A /* PBXContainerItemProxy */; + targetProxy = 77BDFC40230D44CE00079FDF /* PBXContainerItemProxy */; }; /* End PBXTargetDependency section */ @@ -504,10 +546,11 @@ buildSettings = { ARCHS = "$(ARCHS_STANDARD)"; CLANG_ENABLE_OBJC_ARC = YES; - CODE_SIGN_IDENTITY = "iPhone Developer"; + CODE_SIGN_IDENTITY = "iPhone Developer: Jian Wu (G946Z272GF)"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer: Jian Wu (G946Z272GF)"; CODE_SIGN_STYLE = Manual; DEVELOPMENT_TEAM = 44PQ7EUSW9; + ENABLE_BITCODE = YES; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "Demo/Demo-Prefix.pch"; HEADER_SEARCH_PATHS = ( @@ -528,7 +571,7 @@ PRODUCT_BUNDLE_IDENTIFIER = com.test.abcde; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE = "97e98d37-8685-4f3a-96ce-cd9d04f6286a"; - PROVISIONING_PROFILE_SPECIFIER = sur_developer; + PROVISIONING_PROFILE_SPECIFIER = Develop; TARGETED_DEVICE_FAMILY = "1,2"; VALID_ARCHS = "armv7 arm64"; WRAPPER_EXTENSION = app; @@ -540,10 +583,11 @@ buildSettings = { ARCHS = "$(ARCHS_STANDARD)"; CLANG_ENABLE_OBJC_ARC = YES; - CODE_SIGN_IDENTITY = "iPhone Developer"; + CODE_SIGN_IDENTITY = "iPhone Developer: Jian Wu (G946Z272GF)"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer: Jian Wu (G946Z272GF)"; CODE_SIGN_STYLE = Manual; DEVELOPMENT_TEAM = 44PQ7EUSW9; + ENABLE_BITCODE = YES; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "Demo/Demo-Prefix.pch"; HEADER_SEARCH_PATHS = ( @@ -564,7 +608,7 @@ PRODUCT_BUNDLE_IDENTIFIER = com.test.abcde; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE = "97e98d37-8685-4f3a-96ce-cd9d04f6286a"; - PROVISIONING_PROFILE_SPECIFIER = sur_developer; + PROVISIONING_PROFILE_SPECIFIER = Develop; TARGETED_DEVICE_FAMILY = "1,2"; VALID_ARCHS = "armv7 arm64"; WRAPPER_EXTENSION = app; diff --git a/Demo/Demo.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/Demo/Demo.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings new file mode 100644 index 0000000000000000000000000000000000000000..0c67376ebacb410fd873cac1d8d8dd431b262c02 --- /dev/null +++ b/Demo/Demo.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings @@ -0,0 +1,5 @@ + + + + + diff --git a/Demo/Demo.xcodeproj/project.xcworkspace/xcuserdata/huangli.xcuserdatad/UserInterfaceState.xcuserstate b/Demo/Demo.xcodeproj/project.xcworkspace/xcuserdata/huangli.xcuserdatad/UserInterfaceState.xcuserstate index d0935aec5abc3cb297579c175d0687f923d51eb3..a5b41de5b77fa50b226675c27e4b80783bb235f2 100644 Binary files a/Demo/Demo.xcodeproj/project.xcworkspace/xcuserdata/huangli.xcuserdatad/UserInterfaceState.xcuserstate and b/Demo/Demo.xcodeproj/project.xcworkspace/xcuserdata/huangli.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/Demo/Demo.xcodeproj/project.xcworkspace/xcuserdata/huangli.xcuserdatad/WorkspaceSettings.xcsettings b/Demo/Demo.xcodeproj/project.xcworkspace/xcuserdata/huangli.xcuserdatad/WorkspaceSettings.xcsettings new file mode 100644 index 0000000000000000000000000000000000000000..f25782dd5da23d4fbb9b56120619695572ca3e63 --- /dev/null +++ b/Demo/Demo.xcodeproj/project.xcworkspace/xcuserdata/huangli.xcuserdatad/WorkspaceSettings.xcsettings @@ -0,0 +1,18 @@ + + + + + BuildLocationStyle + UseAppPreferences + CustomBuildLocationType + RelativeToDerivedData + DerivedDataLocationStyle + Default + EnabledFullIndexStoreVisibility + + IssueFilterStyle + ShowActiveSchemeOnly + LiveSourceIssuesEnabled + + + diff --git a/Demo/Demo.xcodeproj/xcuserdata/huangli.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/Demo/Demo.xcodeproj/xcuserdata/huangli.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist index 08359070da07be661f971e57333b2f32b47b716e..998388e576c11a371c73bbe3133bf4ea873bd63f 100644 --- a/Demo/Demo.xcodeproj/xcuserdata/huangli.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +++ b/Demo/Demo.xcodeproj/xcuserdata/huangli.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist @@ -1,20 +1,22 @@ @@ -22,15 +24,16 @@ @@ -38,15 +41,169 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -54,96 +211,705 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -153,13 +919,13 @@ shouldBeEnabled = "Yes" ignoreCount = "0" continueAfterRunningActions = "No" - filePath = "../MobileTracking/Viewability/ViewabilityService.m" - timestampString = "577966959.731649" + filePath = "../MobileTracking/Viewability/VAMonitor.m" + timestampString = "586784135.7150249" startingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807" - startingLineNumber = "117" - endingLineNumber = "117" - landmarkName = "-addVAMonitor:" + startingLineNumber = "100" + endingLineNumber = "100" + landmarkName = "-verifyProgress" landmarkType = "7"> @@ -169,13 +935,13 @@ shouldBeEnabled = "Yes" ignoreCount = "0" continueAfterRunningActions = "No" - filePath = "../MobileTracking/Viewability/ViewabilityService.m" - timestampString = "577966959.731884" + filePath = "../MobileTracking/JSViewAbility/VAViewCapture.m" + timestampString = "586783779.385841" startingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807" - startingLineNumber = "119" - endingLineNumber = "119" - landmarkName = "-addVAMonitor:" + startingLineNumber = "61" + endingLineNumber = "61" + landmarkName = "-captureStatus" landmarkType = "7"> @@ -185,13 +951,13 @@ shouldBeEnabled = "Yes" ignoreCount = "0" continueAfterRunningActions = "No" - filePath = "../MobileTracking/Viewability/ViewabilityService.m" - timestampString = "577967026.9131171" + filePath = "../MobileTracking/MobileTracking/MobileTracking.m" + timestampString = "588848560.377527" startingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807" - startingLineNumber = "113" - endingLineNumber = "113" - landmarkName = "-addVAMonitor:" + startingLineNumber = "1077" + endingLineNumber = "1077" + landmarkName = "-generateTrackingURL:" landmarkType = "7"> diff --git a/Demo/Demo.xcodeproj/xcuserdata/huangli.xcuserdatad/xcschemes/Demo.xcscheme b/Demo/Demo.xcodeproj/xcuserdata/huangli.xcuserdatad/xcschemes/Demo.xcscheme index 846967b4f14b73e637d6cedcd31ec05859b3c282..3a5ef39b982e6cd5ae7f17382186a33ecf53de10 100644 --- a/Demo/Demo.xcodeproj/xcuserdata/huangli.xcuserdatad/xcschemes/Demo.xcscheme +++ b/Demo/Demo.xcodeproj/xcuserdata/huangli.xcuserdatad/xcschemes/Demo.xcscheme @@ -71,6 +71,13 @@ ReferencedContainer = "container:Demo.xcodeproj"> + + + + diff --git a/Demo/Demo/.DS_Store b/Demo/Demo/.DS_Store index 19b35306b1d6e8dcefda045fc50820b7f038fd88..0c8ee468a99536d7c7c67e32900858b8970baadb 100644 Binary files a/Demo/Demo/.DS_Store and b/Demo/Demo/.DS_Store differ diff --git a/Demo/Demo/Advertisement.mp4 b/Demo/Demo/Advertisement.mp4 new file mode 100644 index 0000000000000000000000000000000000000000..c767f4a1033867ab1af37dfbe01b13f98c6c9394 Binary files /dev/null and b/Demo/Demo/Advertisement.mp4 differ diff --git a/Demo/Demo/AppDelegate.m b/Demo/Demo/AppDelegate.m index 77a3bd5c29f1b4f95d55ff433914c24824d90b93..2e85059332e541eac362d1cc08bb51bb4c69f9e5 100755 --- a/Demo/Demo/AppDelegate.m +++ b/Demo/Demo/AppDelegate.m @@ -8,15 +8,52 @@ #import "AppDelegate.h" #import "MobileTracking.h" +//#import "ViewController.h" +//#import "TabCoverViewController.h" +//#import "PageViewController.h" + @implementation AppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { - NSLog(@"%@",NSHomeDirectory()); - // Override point for customization after application launch. + [[MobileTracking sharedInstance] enableLog:YES]; -// [[MobileTracking sharedInstance] view:@"http://vxyz.admaster.com.cn/v/a17298,b81949763,c3194,i0,m201"]; + +// ViewController *vc1 = [[ViewController alloc] init]; +// UINavigationController *navCtrl1 = [[UINavigationController alloc] initWithRootViewController:vc1]; +// vc1.view.backgroundColor = [UIColor whiteColor]; +// vc1.title = @"首页"; +// vc1.tabBarItem.image = [UIImage imageNamed:@"xihuan.png"]; +// +// +// TabCoverViewController *vc2 = [[TabCoverViewController alloc] init]; +// UINavigationController *navCtrl2 = [[UINavigationController alloc] initWithRootViewController:vc2]; +// vc2.view.backgroundColor = [UIColor whiteColor]; +// vc2.title = @"Tab"; +// vc2.tabBarItem.image = [UIImage imageNamed:@"liwu.png"]; +// +// PageViewController *vc3 = [[PageViewController alloc] init]; +// UINavigationController *navCtrl3 = [[UINavigationController alloc] initWithRootViewController:vc3]; +// vc3.view.backgroundColor = [UIColor whiteColor]; +// vc3.title = @"Page"; +// vc3.tabBarItem.image = [UIImage imageNamed:@"wode.png"]; +// +// UITabBarController *tabBarCtrl = [[UITabBarController alloc] init]; +// tabBarCtrl.view.backgroundColor = [UIColor whiteColor]; +// tabBarCtrl.viewControllers = @[navCtrl1, navCtrl2, navCtrl3]; +// +// // 设置窗口的跟视图控制器为分栏控制器 +// self.window.rootViewController = tabBarCtrl; +// +// UITabBar *tabBar = tabBarCtrl.tabBar; +// tabBar.barStyle = UIBarStyleDefault; +// tabBar.translucent = NO; +// tabBar.barTintColor = [UIColor whiteColor]; +// tabBar.tintColor = [UIColor blackColor]; +// +// // tabBar.selectionIndicatorImage = [UIImage imageNamed:@"left-circle.png"]; +// [self.window makeKeyAndVisible]; return YES; } @@ -29,7 +66,7 @@ - (void)applicationDidEnterBackground:(UIApplication *)application { [[MobileTracking sharedInstance] didEnterBackground]; - // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. + // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. } @@ -48,6 +85,7 @@ { [[MobileTracking sharedInstance] willTerminate]; // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. + } @end diff --git a/Demo/Demo/Base.lproj/Main.storyboard b/Demo/Demo/Base.lproj/Main.storyboard index d9cfc7aea8db1384d89bcf4ff5987a45aadc0385..4a9d0b3029604b7dd8500409bcc483afb3713f68 100755 --- a/Demo/Demo/Base.lproj/Main.storyboard +++ b/Demo/Demo/Base.lproj/Main.storyboard @@ -1,12 +1,11 @@ - + - - + @@ -55,7 +54,7 @@ - + @@ -71,7 +70,7 @@ - + @@ -86,7 +85,7 @@ + + + + + + + + + + + + + + diff --git a/Demo/Demo/ScrollViewController.h b/Demo/Demo/ScrollViewController.h deleted file mode 100644 index 84e314950dc5c5295dd23c32f96a8df7a8efa13f..0000000000000000000000000000000000000000 --- a/Demo/Demo/ScrollViewController.h +++ /dev/null @@ -1,13 +0,0 @@ -// -// ScrollViewController.h -// Demo -// -// Created by master on 2017/6/27. -// Copyright © 2017年 Admaster. All rights reserved. -// - -#import - -@interface ScrollViewController : UIViewController - -@end diff --git a/Demo/Demo/ScrollViewController.m b/Demo/Demo/ScrollViewController.m deleted file mode 100644 index d3847e27ea305ebf49f0e4ebc61ca2143d81aedd..0000000000000000000000000000000000000000 --- a/Demo/Demo/ScrollViewController.m +++ /dev/null @@ -1,91 +0,0 @@ -// -// ScrollViewController.m -// Demo -// -// Created by master on 2017/6/27. -// Copyright © 2017年 Admaster. All rights reserved. -// - -#import "ScrollViewController.h" -#import "MobileTracking.h" -@interface ScrollViewController () -@property (weak, nonatomic) IBOutlet UIView *adView; - -@end - -@implementation ScrollViewController - -- (void)viewDidLoad { - [super viewDidLoad]; -//测试u字段点击拼接到最后 2g 有无情况下 -// NSString *url = @"http://vxyz.admaster.com.cn/pppp,2g1111,2j1111,2t1111,2k1111,2l1111,2m1111,2n1111,2o1111,2r1111,2s1111,2f1111,2a1111,1g1111,2d1111,2j1111,2h1111,2v60,2u1.8,2w15,2x0001,va1,b123456,uhttp://redirecturl.com"; - /* 去噪测试 - 以下参数不覆盖原值: AdviewabilityEnable AdviewabilityConfigArea AdviewabilityConfigThreshold AdviewabilityVideoDuration AdviewabilityVideoProgressPoint AdviewabilityRecord - */ -// NSString *url = @"http://v.admaster.com.cn/i/a90981,b1899467,c2,i0,m202,8a2,8b2,h,2j,2u2,2v50,2w15,2x1111,2d1234,va1"; - - /* 去噪测试 - 以下参数不覆盖原值: AdviewabilityEnable AdviewabilityConfigArea AdviewabilityConfigThreshold AdviewabilityVideoDuration AdviewabilityVideoProgressPoint AdviewabilityRecord - */ -// NSString *url = @"http://v.admaster.com.cn/i/a90981,b1899467,c2,i0,m202,8a2,8b2,h,2p,2jtt,2w15,2x1101,2d1234,va1,2g0101,uhttp://www.baidu.com"; -//// NSString *url2 = @"http://v.miaozhen.com/i/a90981,p1899467,c2,i0,m202,8a2,8b2,h,2p,2jtt,2w15,2x1101,2d1234,va1,2g0101"; -// NSString *url2 = @"http://v.admaster.com.cn/i/a90981,b1899467,c2,i0,m202,8a2,8b2,h,2p,2jtt,2w15,2x1101,2d1234,va1,2g0101"; -// NSString *url = @"http://test.m.cn.miaozhen.com/x/k=test1234&p=test5678&va=1&vb=15&vj=1111&vi=10&vh=80&o=www.baidu.com"; -// NSString *url = @"http://v.admaster.com.cn/i/a90981,b1899467,c2,i0,m202,8a2,8b2,h,2p,2jtt,2w15,2x1101,2d1234,va1,2g0101,uhttp://www.baidu.com"; - -// NSLog(@"普通曝光链接"); -// [[MobileTracking sharedInstance] view:url]; - -// static BOOL vb = YES; -// if(vb = !vb) { -// printf("\n-----------------------viewability曝光链接\n"); -// [[MobileTracking sharedInstance] view:url]; - NSString *url = @"http://v.admaster.com.cn/i/a90981,b1899467,c2,i0,m202,8a2,8b2,h,2p,2jtt,2w15,2x1101,2d1234,va1,2g0101,uhttp://www.baidu.com"; - - //开始监测 - [[MobileTracking sharedInstance] viewVideo:url ad:_adView videoPlayType:2]; -//http://v.admaster.com.cn/i/a90981,b1899467,c2,i0,m202,8a2,8b2,h,2p,2w15,2x1101,va1,2u2,2v50,2j%5B%7B2m%3A1%2C2k%3A720.0x384.0%2C2s%3A1%2C2n%3A0%2C2d%3A234.0x543.0%2C2l%3A1%2C2t%3A1515489681571%2C2o%3A720.0x384.0%7D%2C%7B2m%3A1%2C2k%3A720.0x384.0%2C2s%3A1%2C2n%3A0%2C2d%3A234.0x543.0%2C2l%3A1%2C2t%3A1515489683670%2C2o%3A720.0x384.0%7D%5D,2f1,1g2,2h1,2gb74e7f1b98c6c3bd7cc63c8accf1fd4a - //5秒后停止监测 -// dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2.0*NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ -// NSLog(@"url stop concurrent:"); -// for(int i =0; i< 10;i++) { -// dispatch_async(dispatch_get_global_queue(0, 0), ^{ -// [[MobileTracking sharedInstance] stop:url]; -// }); -// -// } -// }); -// [[MobileTracking sharedInstance] view:url2 ad:_adView]; - - - -// } else { -// printf("\n-----------------------viewability视频曝光链接\n"); -// [[MobileTracking sharedInstance] viewVideo:url ad:_adView videoPlayType:11]; -// } - -// NSLog(@"视频曝光链接"); -// [[MobileTracking sharedInstance] viewVideo:url ad:_adView]; -// NSLog(@"点击链接"); -// [[MobileTracking sharedInstance] click:url]; - - // Do any additional setup after loading the view. - // -} - -- (void)didReceiveMemoryWarning { - [super didReceiveMemoryWarning]; - // Dispose of any resources that can be recreated. -} - -/* -#pragma mark - Navigation - -// In a storyboard-based application, you will often want to do a little preparation before navigation -- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { - // Get the new view controller using [segue destinationViewController]. - // Pass the selected object to the new view controller. -} -*/ - -@end diff --git a/Demo/Demo/SecondViewController.h b/Demo/Demo/SecondViewController.h new file mode 100644 index 0000000000000000000000000000000000000000..7956d09583696b29f3f8e59a2d6f21dbfd3325ce --- /dev/null +++ b/Demo/Demo/SecondViewController.h @@ -0,0 +1,17 @@ +// +// SecondViewController.h +// Demo +// +// Created by huangli on 2018/12/7. +// Copyright © 2018年 Admaster. All rights reserved. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface SecondViewController : UIViewController + +@end + +NS_ASSUME_NONNULL_END diff --git a/Demo/Demo/ViewController.m b/Demo/Demo/SecondViewController.m similarity index 40% rename from Demo/Demo/ViewController.m rename to Demo/Demo/SecondViewController.m index e0c5878698c68245dd68f633a098d6900e9428a7..8cc3610109dfb1a2ff88499149b22c0e544d7511 100644 --- a/Demo/Demo/ViewController.m +++ b/Demo/Demo/SecondViewController.m @@ -1,32 +1,22 @@ // -// ViewController.m +// SecondViewController.m // Demo // -// Created by master on 2017/12/28. -// Copyright © 2017年 Admaster. All rights reserved. +// Created by huangli on 2018/12/7. +// Copyright © 2018年 Admaster. All rights reserved. // -#import "ViewController.h" -#import "MobileTracking.h" +#import "SecondViewController.h" -@interface ViewController () +@interface SecondViewController () @end -@implementation ViewController +@implementation SecondViewController - (void)viewDidLoad { [super viewDidLoad]; - // Do any additional setup after loading the view. -} -- (IBAction)click:(id)sender { - NSString *url = @"http://v.admaster.com.cn/i/a90981,b1899467,c2,i0,m202,8a2,8b2,h,2p,2jtt,2w15,2x1101,2d1234,va1,2g0101"; -// [[MobileTracking sharedInstance] view:url]; -} - --(void)didReceiveMemoryWarning { - [super didReceiveMemoryWarning]; - // Dispose of any resources that can be recreated. + // Do any additional setup after loading the view from its nib. } /* diff --git a/Demo/Demo/SecondViewController.xib b/Demo/Demo/SecondViewController.xib new file mode 100644 index 0000000000000000000000000000000000000000..2ce9e40300ad75a24b494d4cc746417ac9e0a9c6 --- /dev/null +++ b/Demo/Demo/SecondViewController.xib @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Demo/Demo/VideoViewController.h b/Demo/Demo/VideoViewController.h new file mode 100644 index 0000000000000000000000000000000000000000..87fb0f068376d27bb94b6a56c07eafb61a4f6177 --- /dev/null +++ b/Demo/Demo/VideoViewController.h @@ -0,0 +1,19 @@ +// +// VideoViewController.h +// Demo +// +// Created by huangli on 2018/12/7. +// Copyright © 2018年 Admaster. All rights reserved. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface VideoViewController : UIViewController + +- (instancetype)initVideoPlayType:(NSInteger)type title:(NSString *)title viewUrl:(NSString *)viewUrl clickUrl:(NSString *)clickUrl; + +@end + +NS_ASSUME_NONNULL_END diff --git a/Demo/Demo/VideoViewController.m b/Demo/Demo/VideoViewController.m new file mode 100644 index 0000000000000000000000000000000000000000..97b14fffeef40b3e5c17473263966de8d8ec28e6 --- /dev/null +++ b/Demo/Demo/VideoViewController.m @@ -0,0 +1,143 @@ +// +// VideoViewController.m +// Demo +// +// Created by huangli on 2018/12/7. +// Copyright © 2018年 Admaster. All rights reserved. +// + +#import "VideoViewController.h" +#import "SecondViewController.h" + +#import +#import "MobileTracking.h" + +@interface VideoViewController () +@property (weak, nonatomic) IBOutlet UIScrollView *bottomScrollView; + +@property (nonatomic, strong) MPMoviePlayerController *mPMoviePlayerController;; +@property (nonatomic, strong)UIView *tapview; +@property (nonatomic, strong) UILabel *remindLabel; +@property (nonatomic, assign)NSInteger type; +@property (nonatomic, strong)NSString *navtitle; +@property (nonatomic, strong)NSString *viewUrl; +@property (nonatomic, strong)NSString *clickUrl; + +@end + + + +@implementation VideoViewController + +- (instancetype)initVideoPlayType:(NSInteger)type title:(NSString *)title viewUrl:(NSString *)viewUrl clickUrl:(NSString *)clickUrl +{ + self = [super init]; + if (self) { + _navtitle = title; + _viewUrl = viewUrl; + _clickUrl = clickUrl; + _type = type; + } + return self; +} +- (void)viewDidLoad { + [super viewDidLoad]; + // Do any additional setup after loading the view from its nib. + self.title = _navtitle; + + _bottomScrollView.delegate = self; + + [self initViews]; + +} +- (void)initViews { + +// 视频 + NSURL *url = [[NSBundle mainBundle] URLForResource:@"Advertisement.mp4" withExtension:nil]; + _mPMoviePlayerController = [[MPMoviePlayerController alloc]initWithContentURL:url]; + _mPMoviePlayerController.view.frame = CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, 320); + [_bottomScrollView addSubview:_mPMoviePlayerController.view]; + if (_type == 0 || _type == 1) { + [_mPMoviePlayerController play]; +// 广告开始播放的情况下调用;网络的广告资源需要等资源加载成功开始播放的情况下调用 + // 可视化视频曝光 + [[MobileTracking sharedInstance] viewVideo:_viewUrl ad:_mPMoviePlayerController.view videoPlayType:_type]; + + + } + + [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(finishedPlay) name:MPMoviePlayerPlaybackDidFinishNotification object:nil]; + +// 点击广告,触发事件,进入下一个页面 + _tapview = [[UIView alloc]initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, 320)]; + [_mPMoviePlayerController.view addSubview:_tapview]; + UITapGestureRecognizer *tableViewGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapView:)]; + tableViewGesture.numberOfTapsRequired = 1; + tableViewGesture.cancelsTouchesInView = NO; + [_tapview addGestureRecognizer:tableViewGesture]; + +// 播放的内容提醒:广告&正片 + _remindLabel = [[UILabel alloc]initWithFrame:CGRectMake(0, 350, [UIScreen mainScreen].bounds.size.width, 50)]; + if (_type == 0 || _type == 1) { + _remindLabel.text = @"status:前贴片广告播放中..."; + } else { + _remindLabel.text = @"点击视频窗口开始播放广告"; + } + [_bottomScrollView addSubview:_remindLabel]; +} + +- (void)viewWillAppear:(BOOL)animated { + + [super viewWillAppear:animated]; + + if (_mPMoviePlayerController.playbackState == MPMoviePlaybackStatePaused) { + [_mPMoviePlayerController play]; + } + +} + +//停止监测 +- (void)finishedPlay { + [[MobileTracking sharedInstance]stop:_viewUrl]; + if (_tapview) { + [_tapview removeFromSuperview]; + } + _remindLabel.text = @"status:视频播放中..."; + NSURL *url = [[NSBundle mainBundle] URLForResource:@"videoAd.mp4" withExtension:nil]; + _mPMoviePlayerController.contentURL = url; + [_mPMoviePlayerController play]; + +} + +//点击url +- (void)tapView:(UITapGestureRecognizer *)tap { + + if (_mPMoviePlayerController.playbackState == MPMoviePlaybackStateStopped) { + [_mPMoviePlayerController play]; + [[MobileTracking sharedInstance] viewVideo:_viewUrl ad:_mPMoviePlayerController.view videoPlayType:_type]; + + _remindLabel.text = @"status:前贴片广告播放中..."; + } else { + // 可视化视频点击 + [[MobileTracking sharedInstance]click:_clickUrl]; + + [_mPMoviePlayerController pause]; + SecondViewController *secondVC = [[SecondViewController alloc]init]; + [self.navigationController pushViewController:secondVC animated:YES]; + + } + +} + + +/* +#pragma mark - Navigation + +// In a storyboard-based application, you will often want to do a little preparation before navigation +- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { + // Get the new view controller using [segue destinationViewController]. + // Pass the selected object to the new view controller. +} +*/ + +@end diff --git a/Demo/Demo/VideoViewController.xib b/Demo/Demo/VideoViewController.xib new file mode 100644 index 0000000000000000000000000000000000000000..2eec6231850cc7b0a93429963846ecfee39333da --- /dev/null +++ b/Demo/Demo/VideoViewController.xib @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Demo/Demo/ViewController.h b/Demo/Demo/ViewController.h deleted file mode 100644 index 5418107b1a52ee5030582ad1b063eae0814a0c67..0000000000000000000000000000000000000000 --- a/Demo/Demo/ViewController.h +++ /dev/null @@ -1,13 +0,0 @@ -// -// ViewController.h -// Demo -// -// Created by master on 2017/12/28. -// Copyright © 2017年 Admaster. All rights reserved. -// - -#import - -@interface ViewController : UIViewController - -@end diff --git a/Demo/Demo/landingPageIcon.png b/Demo/Demo/landingPageIcon.png new file mode 100644 index 0000000000000000000000000000000000000000..e6ab9ef636945a2bdf3dac536c124b1c478f493c Binary files /dev/null and b/Demo/Demo/landingPageIcon.png differ diff --git a/Demo/Demo/sdkconfig.xml b/Demo/Demo/sdkconfig.xml index 0f0931760fb80a5bde8bd42f8e6e95ded163a518..d46bf37c6d1eb27affbe55ef93b174bd26903780 100644 --- a/Demo/Demo/sdkconfig.xml +++ b/Demo/Demo/sdkconfig.xml @@ -2,17 +2,17 @@ - - + + - + 0 60 60 - + @@ -28,23 +28,23 @@ 20 - + admaster - + - + admaster.com.cn - + @@ -52,8 +52,7 @@ 0b - - + true @@ -61,7 +60,7 @@ 259200 0 - + @@ -73,18 +72,18 @@ md5 - + - - - - - - - - + + + https://p.attri.mobi/a + + 24 + + true + - + @@ -176,7 +175,7 @@ true true - + @@ -228,7 +227,7 @@ true - + @@ -244,8 +243,8 @@ true - - + + @@ -255,10 +254,10 @@ false - + - + ImpressionID @@ -266,7 +265,7 @@ true true - + @@ -353,7 +352,7 @@ true - + @@ -398,7 +397,7 @@ true - + - + - + , @@ -421,7 +420,7 @@ true - + miaozhen @@ -442,78 +441,107 @@ 604800 1 + md5 raw md5 md5 - - - - - - - + + + + + /apl/ + + 24 + false + + OS mo true true + TS mt true true + MAC m6a true true + IDFA m5 true true + IMEI m2 true true + RAWIMEI m3 true true + ANDROIDID m1a true true + + + + OAID + m11 + true + true + + + + + ADID + m10 + true + true + + WIFI mw true true + AKEY mp true true + ANAME mn @@ -521,6 +549,7 @@ true + SCWH mh @@ -541,36 +570,42 @@ true true + OPENUDID m0 true true + TERM md true true + OSVS me true true + LBS mm true true + SDKVS mv true true + REDIRECTURL o @@ -580,6 +615,7 @@ + start mb=start @@ -592,6 +628,7 @@ true + Adplacement @@ -601,123 +638,161 @@ + ImpressionID vf true true + + + ImpressionType + br + true + true + + AdviewabilityRecord va true true + AdviewabilityEvents vd true true + AdviewabilityTime 1 true true + AdviewabilityFrame 2 true true + AdviewabilityPoint 3 true true + AdviewabilityAlpha 4 true true + AdviewabilityShown 5 true true + AdviewabilityCoverRate 6 true true + AdviewabilityShowFrame 7 true true + AdviewabilityForground 8 true true + AdviewabilityResult vx true true + AdviewabilityConfigArea vh true true + AdviewabilityConfigThreshold vi true true + AdviewabilityVideoDuration vb true true + AdviewabilityVideoProgress vc true true + AdviewabilityVideoPlayType vg true true + AdviewabilityVideoProgressPoint vj true true + + + + AdviewabilityStrongInteract + vk + true + true + + & + + https://g.cn.miaozhen.com/x/k=adid + = + true - + girdsum @@ -755,63 +830,63 @@ true true - + TS ts true true - + MAC m true true - + IDFA if true true - + IMEI im true true - + ANDROIDID aid true true - + WIFI wifi true true - + AKEY ak true true - + ANAME an true true - + SCWH @@ -819,56 +894,56 @@ true true - + OPENUDID oid true true - + ODIN odin true true - + TERM term true true - + OSVS osvs true true - + LBS lbs true true - + MUID mid true true - + MUDS muds true true - + REDIRECTURL u @@ -896,7 +971,7 @@ true - + @@ -906,7 +981,7 @@ false - + @@ -1001,7 +1076,7 @@ true - + @@ -1053,8 +1128,8 @@ true - - + + adbug @@ -1089,28 +1164,28 @@ true true - + TS t true true - + MAC n true true - + IDFA z true true - + IDFAMD5 0j @@ -1123,21 +1198,21 @@ true true - + WIFI w true true - + AKEY x true true - + ANAME y @@ -1151,7 +1226,7 @@ true true - + OPENUDID o @@ -1164,14 +1239,14 @@ true true - + OSVS q true true - + LBS l @@ -1212,9 +1287,9 @@ false false - + - + ImpressionID @@ -1222,7 +1297,7 @@ true true - + AdviewabilityEvents 2j @@ -1295,7 +1370,7 @@ true true - + @@ -1304,8 +1379,8 @@ true - - + + rtbasia @@ -1333,12 +1408,12 @@ raw @@ -1486,6 +1561,13 @@ true true + + + ImpressionType + rbtr + true + true + AdviewabilityRecord vrc @@ -1596,6 +1678,7 @@ true - + + diff --git a/Demo/Demo/videoAd.mp4 b/Demo/Demo/videoAd.mp4 new file mode 100644 index 0000000000000000000000000000000000000000..a3ba1932c9eed86d32ee9da5c25098d40d41073b Binary files /dev/null and b/Demo/Demo/videoAd.mp4 differ diff --git a/MobileTracking/.DS_Store b/MobileTracking/.DS_Store old mode 100755 new mode 100644 index 107296d1883c9b01aa82f1c2d9c625bbd7f2c2f4..e1e1cc6b29b660de4a6e1d8a5ebc66beebc1396f Binary files a/MobileTracking/.DS_Store and b/MobileTracking/.DS_Store differ diff --git a/MobileTracking/JSViewAbility/VACompanyRun.h b/MobileTracking/JSViewAbility/VACompanyRun.h index 56877c6feda4ddaa86790c47c2d4a0a638197bfe..5d7e9c9652b464062c878471433ae6916a1c3e32 100644 --- a/MobileTracking/JSViewAbility/VACompanyRun.h +++ b/MobileTracking/JSViewAbility/VACompanyRun.h @@ -21,4 +21,5 @@ - (BOOL)canRun; + @end diff --git a/MobileTracking/JSViewAbility/VAViewCapture.m b/MobileTracking/JSViewAbility/VAViewCapture.m index f130d81fb6520881395b1a0f4e5686a09154b710..411fa7d2bcd32b41e7346caa99187bcee8a652d1 100644 --- a/MobileTracking/JSViewAbility/VAViewCapture.m +++ b/MobileTracking/JSViewAbility/VAViewCapture.m @@ -10,10 +10,11 @@ #import "VAViewCapture.h" #import "NSDate+VASDK.h" -#import "UIView+Monitor.h" +#import "UIView+MMA_Monitor.h" #import "VAMaros.h" #import "VAJSMaros.h" #import "MMA_Helper.h" +#import "MMA_AdViewMonitor.h" @interface VAViewCapture () @property (nonatomic, weak) UIView *monitorView; @@ -49,12 +50,15 @@ } CGRect frame = _monitorView.frame; - CGRect windowFrame = _monitorView.frameOnKeyWindow; - CGRect showFrame = _monitorView.showOnKeyWindow; + CGRect windowFrame = _monitorView.mma_frameOnKeyWindow; + CGRect showFrame = _monitorView.mma_showOnKeyWindow; CGFloat alpha = _monitorView.alpha; BOOL hidden = _monitorView.hidden; - CGFloat coverRate = 1 - (showFrame.size.width * showFrame.size.height) / (frame.size.width * frame.size.height); +// CGFloat coverRate = 1 - (showFrame.size.width * showFrame.size.height) / (frame.size.width * frame.size.height); + MMA_AdViewMonitor *monitor = [[MMA_AdViewMonitor alloc] init]; + MMA_AdViewResult *result = [monitor monitorWithAdView:_monitorView]; + CGFloat coverRate = result.cover_rate; // NSLog(@"capture time %@",captureDate.mtimestamp); return @{ diff --git a/MobileTracking/MobileTracking.xcodeproj/project.pbxproj b/MobileTracking/MobileTracking.xcodeproj/project.pbxproj index 427b92860649099942ffe77eb82b611a2810499d..4e2f7fe3003119ce1d13ee17518090b1e716b323 100755 --- a/MobileTracking/MobileTracking.xcodeproj/project.pbxproj +++ b/MobileTracking/MobileTracking.xcodeproj/project.pbxproj @@ -22,7 +22,7 @@ /* Begin PBXBuildFile section */ 2A632A1C18CEB10B00BE2533 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2A632A1B18CEB10B00BE2533 /* Foundation.framework */; }; - 2A632A2118CEB10B00BE2533 /* MobileTracking.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 2A632A2018CEB10B00BE2533 /* MobileTracking.h */; }; + 2A632A2118CEB10B00BE2533 /* MobileTracking.h in Copy Files (2 items) */ = {isa = PBXBuildFile; fileRef = 2A632A2018CEB10B00BE2533 /* MobileTracking.h */; }; 2A632A2318CEB10B00BE2533 /* MobileTracking.m in Sources */ = {isa = PBXBuildFile; fileRef = 2A632A2218CEB10B00BE2533 /* MobileTracking.m */; }; 2A632A2A18CEB10B00BE2533 /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2A632A2918CEB10B00BE2533 /* XCTest.framework */; }; 2A632A2B18CEB10B00BE2533 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2A632A1B18CEB10B00BE2533 /* Foundation.framework */; }; @@ -64,12 +64,18 @@ 2ABFE2A718D06E79007BD457 /* MMA_Task.m in Sources */ = {isa = PBXBuildFile; fileRef = 2ABFE2A618D06E79007BD457 /* MMA_Task.m */; }; 2ABFE2B118D07126007BD457 /* MMA_TaskQueue.m in Sources */ = {isa = PBXBuildFile; fileRef = 2ABFE2B018D07126007BD457 /* MMA_TaskQueue.m */; }; 2ABFE2EF18D1B1A2007BD457 /* MMA_Helper.m in Sources */ = {isa = PBXBuildFile; fileRef = 2ABFE2EE18D1B1A2007BD457 /* MMA_Helper.m */; }; - AF1AAE921EF61EF300E9C276 /* AdHeper.m in Sources */ = {isa = PBXBuildFile; fileRef = AF1AAE791EF61EF300E9C276 /* AdHeper.m */; }; - AF1AAE931EF61EF300E9C276 /* AdHeper.m in Sources */ = {isa = PBXBuildFile; fileRef = AF1AAE791EF61EF300E9C276 /* AdHeper.m */; }; + 7791985F229FB9C10090A788 /* MMA_AdViewMonitor.m in Sources */ = {isa = PBXBuildFile; fileRef = 7791985A229FB9BF0090A788 /* MMA_AdViewMonitor.m */; }; + 77919860229FB9C10090A788 /* MMA_AdViewResult.m in Sources */ = {isa = PBXBuildFile; fileRef = 7791985B229FB9C00090A788 /* MMA_AdViewResult.m */; }; + 77919861229FB9C10090A788 /* MMA_AdCalSize.m in Sources */ = {isa = PBXBuildFile; fileRef = 7791985C229FB9C00090A788 /* MMA_AdCalSize.m */; }; + 77919862229FB9C10090A788 /* MMA_AdHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = 7791985D229FB9C00090A788 /* MMA_AdHelper.m */; }; + 77919863229FBDDD0090A788 /* MMA_AdCalSize.m in Sources */ = {isa = PBXBuildFile; fileRef = 7791985C229FB9C00090A788 /* MMA_AdCalSize.m */; }; + 77919864229FBDE00090A788 /* MMA_AdHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = 7791985D229FB9C00090A788 /* MMA_AdHelper.m */; }; + 77919865229FBDE50090A788 /* MMA_AdViewResult.m in Sources */ = {isa = PBXBuildFile; fileRef = 7791985B229FB9C00090A788 /* MMA_AdViewResult.m */; }; + 77919866229FBDE80090A788 /* MMA_AdViewMonitor.m in Sources */ = {isa = PBXBuildFile; fileRef = 7791985A229FB9BF0090A788 /* MMA_AdViewMonitor.m */; }; AF1AAE941EF61EF300E9C276 /* NSDate+VASDK.m in Sources */ = {isa = PBXBuildFile; fileRef = AF1AAE7B1EF61EF300E9C276 /* NSDate+VASDK.m */; }; AF1AAE951EF61EF300E9C276 /* NSDate+VASDK.m in Sources */ = {isa = PBXBuildFile; fileRef = AF1AAE7B1EF61EF300E9C276 /* NSDate+VASDK.m */; }; - AF1AAE961EF61EF300E9C276 /* UIView+Monitor.m in Sources */ = {isa = PBXBuildFile; fileRef = AF1AAE7D1EF61EF300E9C276 /* UIView+Monitor.m */; }; - AF1AAE971EF61EF300E9C276 /* UIView+Monitor.m in Sources */ = {isa = PBXBuildFile; fileRef = AF1AAE7D1EF61EF300E9C276 /* UIView+Monitor.m */; }; + AF1AAE961EF61EF300E9C276 /* UIView+MMA_Monitor.m in Sources */ = {isa = PBXBuildFile; fileRef = AF1AAE7D1EF61EF300E9C276 /* UIView+MMA_Monitor.m */; }; + AF1AAE971EF61EF300E9C276 /* UIView+MMA_Monitor.m in Sources */ = {isa = PBXBuildFile; fileRef = AF1AAE7D1EF61EF300E9C276 /* UIView+MMA_Monitor.m */; }; AF1AAE981EF61EF300E9C276 /* VAMaros.m in Sources */ = {isa = PBXBuildFile; fileRef = AF1AAE7F1EF61EF300E9C276 /* VAMaros.m */; }; AF1AAE991EF61EF300E9C276 /* VAMaros.m in Sources */ = {isa = PBXBuildFile; fileRef = AF1AAE7F1EF61EF300E9C276 /* VAMaros.m */; }; AF1AAE9A1EF61EF300E9C276 /* VAMonitor.m in Sources */ = {isa = PBXBuildFile; fileRef = AF1AAE811EF61EF300E9C276 /* VAMonitor.m */; }; @@ -123,14 +129,15 @@ /* End PBXContainerItemProxy section */ /* Begin PBXCopyFilesBuildPhase section */ - 2A632A1618CEB10B00BE2533 /* CopyFiles */ = { + 2A632A1618CEB10B00BE2533 /* Copy Files (2 items) */ = { isa = PBXCopyFilesBuildPhase; buildActionMask = 2147483647; dstPath = "include/$(PRODUCT_NAME)"; dstSubfolderSpec = 16; files = ( - 2A632A2118CEB10B00BE2533 /* MobileTracking.h in CopyFiles */, + 2A632A2118CEB10B00BE2533 /* MobileTracking.h in Copy Files (2 items) */, ); + name = "Copy Files (2 items)"; runOnlyForDeploymentPostprocessing = 0; }; 2A81721618DAEB3A00E0EFEC /* Copy Files */ = { @@ -190,13 +197,19 @@ 2ABFE2B018D07126007BD457 /* MMA_TaskQueue.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MMA_TaskQueue.m; sourceTree = ""; }; 2ABFE2ED18D1B1A2007BD457 /* MMA_Helper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MMA_Helper.h; sourceTree = ""; }; 2ABFE2EE18D1B1A2007BD457 /* MMA_Helper.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MMA_Helper.m; sourceTree = ""; }; + 77919857229FB9BF0090A788 /* MMA_AdHelper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MMA_AdHelper.h; sourceTree = ""; }; + 77919858229FB9BF0090A788 /* MMA_AdViewResult.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MMA_AdViewResult.h; sourceTree = ""; }; + 77919859229FB9BF0090A788 /* MMA_AdViewMonitor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MMA_AdViewMonitor.h; sourceTree = ""; }; + 7791985A229FB9BF0090A788 /* MMA_AdViewMonitor.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MMA_AdViewMonitor.m; sourceTree = ""; }; + 7791985B229FB9C00090A788 /* MMA_AdViewResult.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MMA_AdViewResult.m; sourceTree = ""; }; + 7791985C229FB9C00090A788 /* MMA_AdCalSize.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MMA_AdCalSize.m; sourceTree = ""; }; + 7791985D229FB9C00090A788 /* MMA_AdHelper.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MMA_AdHelper.m; sourceTree = ""; }; + 7791985E229FB9C00090A788 /* MMA_AdCalSize.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MMA_AdCalSize.h; sourceTree = ""; }; AF0F01A01FF49BCC0095BE0C /* MMASign.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MMASign.h; sourceTree = ""; }; - AF1AAE781EF61EF300E9C276 /* AdHeper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AdHeper.h; sourceTree = ""; }; - AF1AAE791EF61EF300E9C276 /* AdHeper.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AdHeper.m; sourceTree = ""; }; AF1AAE7A1EF61EF300E9C276 /* NSDate+VASDK.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSDate+VASDK.h"; sourceTree = ""; }; AF1AAE7B1EF61EF300E9C276 /* NSDate+VASDK.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSDate+VASDK.m"; sourceTree = ""; }; - AF1AAE7C1EF61EF300E9C276 /* UIView+Monitor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIView+Monitor.h"; sourceTree = ""; }; - AF1AAE7D1EF61EF300E9C276 /* UIView+Monitor.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIView+Monitor.m"; sourceTree = ""; }; + AF1AAE7C1EF61EF300E9C276 /* UIView+MMA_Monitor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIView+MMA_Monitor.h"; sourceTree = ""; }; + AF1AAE7D1EF61EF300E9C276 /* UIView+MMA_Monitor.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIView+MMA_Monitor.m"; sourceTree = ""; }; AF1AAE7E1EF61EF300E9C276 /* VAMaros.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VAMaros.h; sourceTree = ""; }; AF1AAE7F1EF61EF300E9C276 /* VAMaros.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VAMaros.m; sourceTree = ""; }; AF1AAE801EF61EF300E9C276 /* VAMonitor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VAMonitor.h; sourceTree = ""; }; @@ -281,7 +294,6 @@ AFB371581F3854770092930F /* JSViewAbility */, AF1AAE771EF61EF300E9C276 /* Viewability */, 2A632A1D18CEB10B00BE2533 /* MobileTracking */, - 2A632A3118CEB10B00BE2533 /* MobileTrackingTests */, 2A632A1A18CEB10B00BE2533 /* Frameworks */, 2A632A1918CEB10B00BE2533 /* Products */, ); @@ -356,6 +368,7 @@ 2ABFE1F118CED085007BD457 /* EncryptModule */ = { isa = PBXGroup; children = ( + 2A632A3118CEB10B00BE2533 /* MobileTrackingTests */, AFB87D322004BA9E00A02E0C /* libMMASign.a */, AF0F01A01FF49BCC0095BE0C /* MMASign.h */, ); @@ -492,14 +505,20 @@ AF1AAE851EF61EF300E9C276 /* VAMonitorFrame.m */, AF1AAE8E1EF61EF300E9C276 /* VAViewTools.h */, AF1AAE8F1EF61EF300E9C276 /* VAViewTools.m */, - AF1AAE781EF61EF300E9C276 /* AdHeper.h */, - AF1AAE791EF61EF300E9C276 /* AdHeper.m */, AF1AAE7A1EF61EF300E9C276 /* NSDate+VASDK.h */, AF1AAE7B1EF61EF300E9C276 /* NSDate+VASDK.m */, - AF1AAE7C1EF61EF300E9C276 /* UIView+Monitor.h */, - AF1AAE7D1EF61EF300E9C276 /* UIView+Monitor.m */, + AF1AAE7C1EF61EF300E9C276 /* UIView+MMA_Monitor.h */, + AF1AAE7D1EF61EF300E9C276 /* UIView+MMA_Monitor.m */, + 7791985E229FB9C00090A788 /* MMA_AdCalSize.h */, + 7791985C229FB9C00090A788 /* MMA_AdCalSize.m */, + 77919857229FB9BF0090A788 /* MMA_AdHelper.h */, + 7791985D229FB9C00090A788 /* MMA_AdHelper.m */, AF1AAE7E1EF61EF300E9C276 /* VAMaros.h */, AF1AAE7F1EF61EF300E9C276 /* VAMaros.m */, + 77919859229FB9BF0090A788 /* MMA_AdViewMonitor.h */, + 7791985A229FB9BF0090A788 /* MMA_AdViewMonitor.m */, + 77919858229FB9BF0090A788 /* MMA_AdViewResult.h */, + 7791985B229FB9C00090A788 /* MMA_AdViewResult.m */, ); path = Viewability; sourceTree = ""; @@ -538,7 +557,7 @@ buildPhases = ( 2A632A1418CEB10B00BE2533 /* Sources */, 2A632A1518CEB10B00BE2533 /* Frameworks */, - 2A632A1618CEB10B00BE2533 /* CopyFiles */, + 2A632A1618CEB10B00BE2533 /* Copy Files (2 items) */, ); buildRules = ( ); @@ -598,6 +617,7 @@ developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( + English, en, ); mainGroup = 2A632A0F18CEB10B00BE2533; @@ -637,7 +657,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "rm -rf ${BUILT_PRODUCTS_DIR}/libMobileTracking.a\n\nlipo -create \"${BUILT_PRODUCTS_DIR}/../Release-iphonesimulator/libMobileTrackingSimulator.a\" \\\n\"${BUILT_PRODUCTS_DIR}/libMobileTrackingDevice.a\" -output \\\n\"${SRCROOT}/../OutputRelease/libMobileTracking.a\"\n\nrm -f \"${SRCROOT}/../OutputRelease/*\"\n\ncp \"${BUILT_PRODUCTS_DIR}/include/MobileTrackingDevice/MobileTracking.h\" \"${SRCROOT}/../OutputRelease/\""; + shellScript = "rm -rf ${BUILT_PRODUCTS_DIR}/libMobileTracking.a\n\nlipo -create \"${BUILT_PRODUCTS_DIR}/../Release-iphonesimulator/libMobileTrackingSimulator.a\" \\\n\"${BUILT_PRODUCTS_DIR}/libMobileTrackingDevice.a\" -output \\\n\"${SRCROOT}/../OutputRelease/libMobileTracking.a\"\n\nrm -f \"${SRCROOT}/../OutputRelease/*\"\n\ncp \"${BUILT_PRODUCTS_DIR}/include/MobileTrackingDevice/MobileTracking.h\" \"${SRCROOT}/../OutputRelease/\"\n"; }; /* End PBXShellScriptBuildPhase section */ @@ -654,28 +674,31 @@ 2A79BC1F18D2DC2900FC62C1 /* MMA_TrackingInfoService.m in Sources */, 2ABFE23B18CF0427007BD457 /* MMA_GDataXMLNode.m in Sources */, AF1AAE9E1EF61EF300E9C276 /* VAMonitorFrame.m in Sources */, + 77919862229FB9C10090A788 /* MMA_AdHelper.m in Sources */, AF1AAE981EF61EF300E9C276 /* VAMaros.m in Sources */, AF1AAEA81EF61EF300E9C276 /* VAViewTools.m in Sources */, AF89EC731EFA0CB400A2AF21 /* Viewability_iOS.md in Sources */, AF1AAE941EF61EF300E9C276 /* NSDate+VASDK.m in Sources */, + 77919860229FB9C10090A788 /* MMA_AdViewResult.m in Sources */, AF1AAE9A1EF61EF300E9C276 /* VAMonitor.m in Sources */, 2ABFE28F18CF25A1007BD457 /* MMA_XMLReader.m in Sources */, AFB3716F1F3854770092930F /* VADeviceMessage.m in Sources */, 2ABFE2EF18D1B1A2007BD457 /* MMA_Helper.m in Sources */, AFB371751F3854770092930F /* VAJSMaros.m in Sources */, 2ABFE2A718D06E79007BD457 /* MMA_Task.m in Sources */, + 77919861229FB9C10090A788 /* MMA_AdCalSize.m in Sources */, AF1AAEAA1EF61EF300E9C276 /* ViewabilityService.m in Sources */, 2ABFE2A418D0581A007BD457 /* MMA_Log.m in Sources */, 2A8171BE18DA91C700E0EFEC /* MMA_SSNetworkInfo.m in Sources */, 2ABFE22418CED086007BD457 /* MMA_Reachability.m in Sources */, 2ABFE22318CED086007BD457 /* MMA_OpenUDID.m in Sources */, - AF1AAE961EF61EF300E9C276 /* UIView+Monitor.m in Sources */, + AF1AAE961EF61EF300E9C276 /* UIView+MMA_Monitor.m in Sources */, 2ABFE28C18CF1EA5007BD457 /* MMA_SDKConfig.m in Sources */, 2ABFE2B118D07126007BD457 /* MMA_TaskQueue.m in Sources */, AFB371731F3854770092930F /* VAJavascriptParse.m in Sources */, AFB371711F3854770092930F /* VAJavascriptBridge.m in Sources */, 2ABFE2A118D02ED2007BD457 /* MMA_GTMNSString+URLArguments.m in Sources */, - AF1AAE921EF61EF300E9C276 /* AdHeper.m in Sources */, + 7791985F229FB9C10090A788 /* MMA_AdViewMonitor.m in Sources */, AF1AAE9C1EF61EF300E9C276 /* VAMonitorConfig.m in Sources */, AFB3717B1F3854770092930F /* ViewabilityJSService.m in Sources */, AF1AAEA61EF61EF300E9C276 /* VAViewMonitor.m in Sources */, @@ -701,17 +724,21 @@ AFB3716E1F3854770092930F /* VACompanyRun.m in Sources */, AF1AAEA11EF61EF300E9C276 /* VAMonitorTimeline.m in Sources */, AFB3717A1F3854770092930F /* VAViewCapture.m in Sources */, + 77919863229FBDDD0090A788 /* MMA_AdCalSize.m in Sources */, AFB371781F3854770092930F /* VAJSViewabilityData.m in Sources */, 2A81720218DAEB3A00E0EFEC /* MMA_TrackingInfoService.m in Sources */, 2A81720318DAEB3A00E0EFEC /* MMA_GDataXMLNode.m in Sources */, + 77919866229FBDE80090A788 /* MMA_AdViewMonitor.m in Sources */, AF1AAE9F1EF61EF300E9C276 /* VAMonitorFrame.m in Sources */, AF1AAE991EF61EF300E9C276 /* VAMaros.m in Sources */, AF1AAEA91EF61EF300E9C276 /* VAViewTools.m in Sources */, AF89EC741EFA0CB400A2AF21 /* Viewability_iOS.md in Sources */, + 77919865229FBDE50090A788 /* MMA_AdViewResult.m in Sources */, AF1AAE951EF61EF300E9C276 /* NSDate+VASDK.m in Sources */, AF1AAE9B1EF61EF300E9C276 /* VAMonitor.m in Sources */, 2A81720418DAEB3A00E0EFEC /* MMA_XMLReader.m in Sources */, AFB371701F3854770092930F /* VADeviceMessage.m in Sources */, + 77919864229FBDE00090A788 /* MMA_AdHelper.m in Sources */, 2A81720518DAEB3A00E0EFEC /* MMA_Helper.m in Sources */, AFB371761F3854770092930F /* VAJSMaros.m in Sources */, 2A81720618DAEB3A00E0EFEC /* MMA_Task.m in Sources */, @@ -721,13 +748,12 @@ 2A81720918DAEB3A00E0EFEC /* MMA_Reachability.m in Sources */, AF59E977205116C400994BCF /* MMA_LocationService.m in Sources */, 2A81720A18DAEB3A00E0EFEC /* MMA_OpenUDID.m in Sources */, - AF1AAE971EF61EF300E9C276 /* UIView+Monitor.m in Sources */, + AF1AAE971EF61EF300E9C276 /* UIView+MMA_Monitor.m in Sources */, 2A81720B18DAEB3A00E0EFEC /* MMA_SDKConfig.m in Sources */, 2A81720C18DAEB3A00E0EFEC /* MMA_TaskQueue.m in Sources */, AFB371741F3854770092930F /* VAJavascriptParse.m in Sources */, AFB371721F3854770092930F /* VAJavascriptBridge.m in Sources */, 2A81720D18DAEB3A00E0EFEC /* MMA_GTMNSString+URLArguments.m in Sources */, - AF1AAE931EF61EF300E9C276 /* AdHeper.m in Sources */, AF1AAE9D1EF61EF300E9C276 /* VAMonitorConfig.m in Sources */, AFB3717C1F3854770092930F /* ViewabilityJSService.m in Sources */, AF1AAEA71EF61EF300E9C276 /* VAViewMonitor.m in Sources */, @@ -779,6 +805,7 @@ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; COPY_PHASE_STRIP = NO; + ENABLE_BITCODE = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_DYNAMIC_NO_PIC = NO; GCC_OPTIMIZATION_LEVEL = 0; @@ -827,6 +854,7 @@ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; COPY_PHASE_STRIP = YES; + ENABLE_BITCODE = YES; ENABLE_NS_ASSERTIONS = NO; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; @@ -857,6 +885,7 @@ armv7s, ); DSTROOT = /tmp/MobileTracking.dst; + ENABLE_BITCODE = YES; GCC_GENERATE_DEBUGGING_SYMBOLS = NO; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "MobileTracking/MobileTracking-Prefix.pch"; @@ -882,6 +911,7 @@ armv7s, ); DSTROOT = /tmp/MobileTracking.dst; + ENABLE_BITCODE = YES; GCC_GENERATE_DEBUGGING_SYMBOLS = NO; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "MobileTracking/MobileTracking-Prefix.pch"; @@ -951,6 +981,7 @@ armv7s, ); DSTROOT = /tmp/MobileTracking.dst; + ENABLE_BITCODE = YES; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "MobileTracking/MobileTracking-Prefix.pch"; LIBRARY_SEARCH_PATHS = ( @@ -975,6 +1006,7 @@ armv7s, ); DSTROOT = /tmp/MobileTracking.dst; + ENABLE_BITCODE = YES; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "MobileTracking/MobileTracking-Prefix.pch"; LIBRARY_SEARCH_PATHS = ( @@ -998,6 +1030,7 @@ "$(ARCHS_STANDARD)", "armv7s,arm64", ); + ENABLE_BITCODE = YES; ONLY_ACTIVE_ARCH = NO; OTHER_CFLAGS = "-fembed-bitcode"; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -1012,6 +1045,7 @@ "$(ARCHS_STANDARD)", "armv7s,arm64", ); + ENABLE_BITCODE = YES; ONLY_ACTIVE_ARCH = NO; OTHER_CFLAGS = "-fembed-bitcode"; PRODUCT_NAME = "$(TARGET_NAME)"; diff --git a/MobileTracking/MobileTracking.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/MobileTracking/MobileTracking.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000000000000000000000000000000000000..18d981003d68d0546c4804ac2ff47dd97c6e7921 --- /dev/null +++ b/MobileTracking/MobileTracking.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/MobileTracking/MobileTracking/.DS_Store b/MobileTracking/MobileTracking/.DS_Store index 91589cf9c65bf51268c161fdcdb608e740658fd5..fecc0aab2fc0d1e4d7e346507f1e67b2bbbcee86 100644 Binary files a/MobileTracking/MobileTracking/.DS_Store and b/MobileTracking/MobileTracking/.DS_Store differ diff --git a/MobileTracking/MobileTrackingTests/MobileTrackingTests-Info.plist b/MobileTracking/MobileTracking/EncryptModule/MobileTrackingTests/MobileTrackingTests-Info.plist similarity index 100% rename from MobileTracking/MobileTrackingTests/MobileTrackingTests-Info.plist rename to MobileTracking/MobileTracking/EncryptModule/MobileTrackingTests/MobileTrackingTests-Info.plist diff --git a/MobileTracking/MobileTrackingTests/MobileTrackingTests.m b/MobileTracking/MobileTracking/EncryptModule/MobileTrackingTests/MobileTrackingTests.m similarity index 100% rename from MobileTracking/MobileTrackingTests/MobileTrackingTests.m rename to MobileTracking/MobileTracking/EncryptModule/MobileTrackingTests/MobileTrackingTests.m diff --git a/MobileTracking/MobileTrackingTests/en.lproj/InfoPlist.strings b/MobileTracking/MobileTracking/EncryptModule/MobileTrackingTests/en.lproj/InfoPlist.strings similarity index 100% rename from MobileTracking/MobileTrackingTests/en.lproj/InfoPlist.strings rename to MobileTracking/MobileTracking/EncryptModule/MobileTrackingTests/en.lproj/InfoPlist.strings diff --git a/MobileTracking/MobileTracking/MMA_Macro.h b/MobileTracking/MobileTracking/MMA_Macro.h index e9be624ec427d0551866a3047a82e54204b682f0..8a93ca99498d759131e50c8cb620141e3470bf17 100755 --- a/MobileTracking/MobileTracking/MMA_Macro.h +++ b/MobileTracking/MobileTracking/MMA_Macro.h @@ -9,7 +9,7 @@ #ifndef MobileTracking_Macro_h #define MobileTracking_Macro_h -#define MMA_SDK_VERSION @"V2.0.3" +#define MMA_SDK_VERSION @"V2.1.0" #define NOTIFICATION_VB @"viewability_notification" #define NOTIFICATION_EXPOSE @"expose_notification" @@ -76,6 +76,8 @@ #define AD_VB_TIME @"AdviewabilityTime" #define AD_VB_EVENTS @"AdviewabilityEvents" #define IMPRESSIONID @"ImpressionID" +#define IMPRESSIONTYPE @"ImpressionType" //普通曝光的类型 +#define AD_VB_INTERACT @"AdviewabilityStrongInteract" //#define AD_VB_ENABLE @"AdviewabilityEnable" //是否开启 ViewAbility 监测 @@ -117,7 +119,8 @@ AD_VB_TIME, \ AD_VB_EVENTS, \ IMPRESSIONID, \ AD_VB_VIDEOPLAYTYPE, \ -AD_VB_VIDEOPROGRESS \ +AD_VB_VIDEOPROGRESS, \ +AD_VB_INTERACT \ ] //AD_VB_AREA, \ //AD_VB_THRESHOLD, \ diff --git a/MobileTracking/MobileTracking/MobileTracking.h b/MobileTracking/MobileTracking/MobileTracking.h index 53006d5c90b1e8b67aac810f46ad957863551bc5..753766f47edc7000f2e2282e8cee9452ee43fa95 100755 --- a/MobileTracking/MobileTracking/MobileTracking.h +++ b/MobileTracking/MobileTracking/MobileTracking.h @@ -6,7 +6,7 @@ // Copyright (c) 2014年 Admaster. All rights reserved. // -//#define MMA_SDK_VERSION @"V2.0.3" +//#define MMA_SDK_VERSION @"V2.1.0" #import @@ -23,8 +23,12 @@ // 点击 - (void)click:(NSString *)url; -// 普通曝光 -- (void)view:(NSString *)url; +/* 普通曝光 + url:监测的链接 + adView:监测的广告视图对象 + impressionType:曝光类型。Tracked Ads:0;曝光:1 + */ +- (void)view:(NSString *)url ad:(UIView *)adView impressionType:(NSInteger)type; // 可视化监测曝光 - (void)view:(NSString *)url ad:(UIView *)adView; diff --git a/MobileTracking/MobileTracking/MobileTracking.m b/MobileTracking/MobileTracking/MobileTracking.m index bfce6089f66f5595c786af48c21a0caaf4c1ddae..35b8506f213448d30146b463f3590f8fdbf37065 100755 --- a/MobileTracking/MobileTracking/MobileTracking.m +++ b/MobileTracking/MobileTracking/MobileTracking.m @@ -46,7 +46,7 @@ @end -@interface VBOpenResult : NSObject +@interface MMA_VBOpenResult : NSObject @property (nonatomic) BOOL canOpen; @property (nonatomic,copy) NSString *url; //@property (nonatomic,copy) NSString *viewabilityURL; @@ -55,7 +55,7 @@ @end -@implementation VBOpenResult +@implementation MMA_VBOpenResult - (instancetype)init { self = [super init]; @@ -115,7 +115,6 @@ } /* Old (NSUserDefaults) ----> New(File) */ - NSData *sdkData = [NSData dataWithContentsOfFile:SDK_CONFIG_DATA_PATH]; if (sdkData) { _sdkConfig = [MMA_XMLReader sdkConfigWithData:sdkData]; @@ -199,8 +198,8 @@ continue; } NSURL *URL = [NSURL URLWithString:task.url]; - NSURLCacheStoragePolicy policy = NSURLRequestReloadIgnoringCacheData; - NSURLRequest *request = [NSURLRequest requestWithURL:URL cachePolicy:policy timeoutInterval:self.sdkConfig.offlineCache.timeout]; +// NSURLCacheStoragePolicy policy = NSURLRequestReloadIgnoringCacheData; + NSURLRequest *request = [NSURLRequest requestWithURL:URL cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:self.sdkConfig.offlineCache.timeout]; RQOperation *operation = [RQOperation operationWithRequest:request]; operation.completionHandler = ^(__unused NSURLResponse *response, NSData *data, NSError *error) @@ -232,8 +231,7 @@ MMA_Task *task = [self.sendQueue pop]; [MMA_Log log:@"##send_queue_url:%@" ,task.url]; NSURL *URL = [NSURL URLWithString:task.url]; - NSURLCacheStoragePolicy policy = NSURLRequestReloadIgnoringLocalAndRemoteCacheData; - NSURLRequest *request = [NSURLRequest requestWithURL:URL cachePolicy:policy timeoutInterval:self.sdkConfig.offlineCache.timeout]; + NSURLRequest *request = [NSURLRequest requestWithURL:URL cachePolicy:NSURLRequestReloadIgnoringLocalAndRemoteCacheData timeoutInterval:self.sdkConfig.offlineCache.timeout]; RQOperation *operation = [RQOperation operationWithRequest:request]; operation.completionHandler = ^(__unused NSURLResponse *response, NSData *data, NSError *error) @@ -389,11 +387,11 @@ // 去掉字段2g 如果有2j 去掉AdMeasurability Adviewability AdviewabilityEvents ImpressionID四个字段生成链接 -- (VBOpenResult *)vbFilterURL:(NSString *)url isForViewability:(BOOL)viewability isVideo:(BOOL)isVideo { +- (MMA_VBOpenResult *)vbFilterURL:(NSString *)url isForViewability:(BOOL)viewability isVideo:(BOOL)isVideo { @try { MMA_Company *company = [self confirmCompany:url]; - VBOpenResult *res = [[VBOpenResult alloc] init]; + MMA_VBOpenResult *res = [[MMA_VBOpenResult alloc] init]; res.config = self.viewabilityConfig; // 初始化默认配置为当前的配置 res.url = url; res.canOpen = NO; @@ -427,7 +425,7 @@ NSString *noRedirectURL = [NSString stringWithString:trackURL]; NSMutableString *filterURL = [[NSMutableString alloc] initWithString:noRedirectURL]; - NSArray *exposeKeys = @[IMPRESSIONID]; + NSArray *exposeKeys = @[IMPRESSIONID, IMPRESSIONTYPE]; // NSArray *viewabilityKeys = @[AD_MEASURABILITY, // AD_VB, @@ -570,7 +568,7 @@ - (void)click:(NSString *)url { - VBOpenResult *result = [self vbFilterURL:url isForViewability:NO isVideo:NO]; + MMA_VBOpenResult *result = [self vbFilterURL:url isForViewability:NO isVideo:NO]; url = [NSString stringWithString:result.url]; MMA_Company *company = [self confirmCompany:url]; if(!company) { @@ -578,6 +576,15 @@ return; } NSString *adID = [self getAdIDForURL:url]; + if (adID && adID.length) { + NSString *domain = company.domain[0]; + if(!domain || !domain.length) { + domain = @""; + } + + NSString *monitorKey = [NSString stringWithFormat:@"%@-%@",domain,adID]; + [_viewabilityService setVAMonitorVisible:monitorKey]; + } NSString *impressKey = [NSString stringWithFormat:@"%@-%@",company.domain[0],adID]; NSString *impressID = _impressionDictionary[impressKey]; @@ -590,12 +597,12 @@ } // 普通曝光请求: 普通曝光默认不开启viewability. 需要redirectURL -- (void)view:(NSString *)url +- (void)view:(NSString *)url ad:(UIView *)adView impressionType:(NSInteger)type { @try { BOOL viewability = NO; - VBOpenResult *result = [self vbFilterURL:url isForViewability:viewability isVideo:NO]; - [self view:url ad:nil isVideo:NO videoPlayType:0 handleResult:result]; + MMA_VBOpenResult *result = [self vbFilterURL:url isForViewability:viewability isVideo:NO]; + [self view:url ad:adView isVideo:NO videoPlayType:0 handleResult:result impressionType:type]; } @catch (NSException *exception) { [MMA_Log log:@"##exception:%@" ,exception]; @@ -605,17 +612,15 @@ // 视频Viewaility曝光请求: 视频曝光判断是否含有相关AdViewabilityEvents字段决定是否开启viewability 不需要redirectURL - (void)viewVideo:(NSString *)url ad:(UIView *)adView videoPlayType:(NSInteger)type{ BOOL viewability = YES; - VBOpenResult *result = [self vbFilterURL:url isForViewability:viewability isVideo:YES]; - - [self view:url ad:adView isVideo:YES videoPlayType:type handleResult:result]; + MMA_VBOpenResult *result = [self vbFilterURL:url isForViewability:viewability isVideo:YES]; + [self view:url ad:adView isVideo:YES videoPlayType:type handleResult:result impressionType:1]; } // 广告Viewability曝光请求: 同视频Viewability曝光逻辑 不需要redirectURL - (void)view:(NSString *)url ad:(UIView *)adView { BOOL viewability = YES; - VBOpenResult *result = [self vbFilterURL:url isForViewability:viewability isVideo:NO]; - - [self view:url ad:adView isVideo:NO videoPlayType:0 handleResult:result]; + MMA_VBOpenResult *result = [self vbFilterURL:url isForViewability:viewability isVideo:NO]; + [self view:url ad:adView isVideo:NO videoPlayType:0 handleResult:result impressionType:1]; } // 停止可见监测 @@ -643,7 +648,7 @@ // viewability曝光不需要redirectURL已在前面剔除,普通曝光需要redirectURL -- (void)view:(NSString *)url ad:(UIView *)adView isVideo:(BOOL)isVideo videoPlayType:(NSInteger)type handleResult:(VBOpenResult *)result { +- (void)view:(NSString *)url ad:(UIView *)adView isVideo:(BOOL)isVideo videoPlayType:(NSInteger)type handleResult:(MMA_VBOpenResult *)result impressionType:(NSInteger)impressionType{ @try { /** * 获取是否含有使用viewability字段 @@ -685,12 +690,23 @@ NSString * compString = [NSString stringWithFormat:@"%@%@%@%@",[self.trackingInfoService idfa],[self.trackingInfoService idfv],adID,timestamp]; NSString *impressID = [MMA_Helper md5HexDigest:compString]; _impressionDictionary[impressKey] = impressID; - /** * 发送正常的url 监测使用去噪impressionID曝光url,拼接AD_VB (2f),AD_VB_RESULT(vx) */ - [self filterURL:[self handleImpressURL:result.url impression:impressID redirectURL:result.redirectURL additionKey:useViewabilityService]]; - [[NSNotificationCenter defaultCenter] postNotificationName:NOTIFICATION_EXPOSE object:nil]; + +// impressionType=0视为Tracked ads;impressionType=1视为曝光 + if (impressionType == 0) { + [self handleImpressionType:@"0" URL:result.url impression:impressID redirectURL:result.redirectURL additionKey:useViewabilityService]; + } else if (impressionType == 1){ + if(!adView || ![adView isKindOfClass:[UIView class]]) { +// view=nil或者view非法的情况下,未达到CBR条件,如果是可见监测停止监测 + [self handleImpressionType:@"0" URL:result.url impression:impressID redirectURL:result.redirectURL additionKey:useViewabilityService]; + return; + } else { +// 达到CBR条件,如果是可见监测继续监测 + [self handleImpressionType:@"1" URL:result.url impression:impressID redirectURL:result.redirectURL additionKey:useViewabilityService]; + } + } /** * Viewability功能模块 @@ -707,28 +723,28 @@ // 如果view非法或为空 不可测量参数置为0 if(!adView || ![adView isKindOfClass:[UIView class]]) { - - NSDictionary *dictionary = @{ - AD_VB_EVENTS : @"[]", - AD_VB : @"0", - AD_VB_RESULT : @"2", - IMPRESSIONID : impressID, - AD_MEASURABILITY : @"0" - }; - NSMutableDictionary *accessDictionary = [NSMutableDictionary dictionary]; - [dictionary enumerateKeysAndObjectsUsingBlock:^(NSString * key, id obj, BOOL * _Nonnull stop) { - NSString *accessKey = keyvalueAccess[key]; - if(accessKey && accessKey.length) { - accessDictionary[accessKey] = obj; - } - }]; - NSString *url = [self monitorHandleWithURL:result.url data:accessDictionary redirectURL:@""]; - [self filterURL:url]; - } else { - VAMonitor *monitor = [VAMonitor monitorWithView:adView isVideo:isVideo url:result.url redirectURL:@"" impressionID:impressID adID:adID keyValueAccess:[keyvalueAccess copy] config:result.config domain:domain]; - monitor.delegate = self; - [_viewabilityService addVAMonitor:monitor]; + return; +// NSDictionary *dictionary = @{ +// AD_VB_EVENTS : @"[]", +// AD_VB : @"0", +// AD_VB_RESULT : @"2", +// IMPRESSIONID : impressID, +// AD_MEASURABILITY : @"0" +// }; +// NSMutableDictionary *accessDictionary = [NSMutableDictionary dictionary]; +// [dictionary enumerateKeysAndObjectsUsingBlock:^(NSString * key, id obj, BOOL * _Nonnull stop) { +// NSString *accessKey = keyvalueAccess[key]; +// if(accessKey && accessKey.length) { +// accessDictionary[accessKey] = obj; +// } +// }]; +// NSString *url = [self monitorHandleWithURL:result.url data:accessDictionary redirectURL:@""]; +// [self filterURL:url]; } + VAMonitor *monitor = [VAMonitor monitorWithView:adView isVideo:isVideo url:result.url redirectURL:@"" impressionID:impressID adID:adID keyValueAccess:[keyvalueAccess copy] config:result.config domain:domain]; + monitor.delegate = self; + [_viewabilityService addVAMonitor:monitor]; + } @@ -740,6 +756,16 @@ } } +- (void)handleImpressionType:(NSString *)impressionType URL:(NSString *)url impression:(NSString *)impressionID redirectURL:(NSString *)redirectURL additionKey:(BOOL)additionKey { + MMA_Company *company = [self confirmCompany:url]; + NSMutableString *trackURL = [NSMutableString stringWithString:url]; + MMA_Argument *impressionTypeArgument = [company.config.viewabilityarguments valueForKey:IMPRESSIONTYPE]; + if(impressionTypeArgument.value) { + [trackURL appendFormat:@"%@%@%@%@",company.separator,impressionTypeArgument.value,company.equalizer,impressionType]; + } + [self filterURL:[self handleImpressURL:trackURL impression:impressionID redirectURL:redirectURL additionKey:additionKey]]; + [[NSNotificationCenter defaultCenter] postNotificationName:NOTIFICATION_EXPOSE object:nil]; +} // 普通曝光 - (void)jsView:(NSString *)url ad:(UIView *)adView{ diff --git a/MobileTracking/MobileTracking/Service/MMA_LocationService.m b/MobileTracking/MobileTracking/Service/MMA_LocationService.m index 0a0b8c3de191267706bb7a8d9e24d4bf04f4d0ce..dfcf5bdaaba61a2ea2d9f04e8e682aa3c0778791 100644 --- a/MobileTracking/MobileTracking/Service/MMA_LocationService.m +++ b/MobileTracking/MobileTracking/Service/MMA_LocationService.m @@ -39,9 +39,10 @@ - (CLLocationManager *)locationManager { if (!_locationManager) { _locationManager = [[CLLocationManager alloc] init]; - if ([self.locationManager respondsToSelector:@selector(requestWhenInUseAuthorization)]) { - [_locationManager requestWhenInUseAuthorization]; - } +// 不主动弹出弹窗,需要在允许的时候获取 +// if ([self.locationManager respondsToSelector:@selector(requestWhenInUseAuthorization)]) { +// [_locationManager requestWhenInUseAuthorization]; +// } [_locationManager setDelegate:self]; [_locationManager setDesiredAccuracy:kCLLocationAccuracyBest]; [_locationManager setDistanceFilter:kCLDistanceFilterNone]; @@ -52,9 +53,10 @@ LOGGG(@"开始定位"); //判断用户定位服务是否开启 if ([CLLocationManager locationServicesEnabled] && [CLLocationManager authorizationStatus] != kCLAuthorizationStatusDenied) { - if([self.locationManager respondsToSelector:@selector(requestWhenInUseAuthorization)]) { - [self.locationManager requestWhenInUseAuthorization]; - } +// 不主动弹出弹窗,需要在允许的时候获取 +// if([self.locationManager respondsToSelector:@selector(requestWhenInUseAuthorization)]) { +// [self.locationManager requestWhenInUseAuthorization]; +// } [self.locationManager startUpdatingLocation]; if(!self.isStart) { dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(20 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ diff --git a/MobileTracking/MobileTracking/Vendor/RequestQueue/MMA_RequestQueue.m b/MobileTracking/MobileTracking/Vendor/RequestQueue/MMA_RequestQueue.m index 2ef3a15d00bfa9284028fbcf24fa15b4158fbef9..537f06c1130e6bd4f9e02d4730e688924c76fe49 100755 --- a/MobileTracking/MobileTracking/Vendor/RequestQueue/MMA_RequestQueue.m +++ b/MobileTracking/MobileTracking/Vendor/RequestQueue/MMA_RequestQueue.m @@ -31,7 +31,7 @@ // #import "MMA_RequestQueue.h" - +#import #import #if !__has_feature(objc_arc) @@ -42,7 +42,7 @@ NSString *const MMAHTTPResponseErrorDomain = @"MMAHTTPResponseErrorDomain"; -@interface RQOperation () +@interface RQOperation () { BOOL _executing; BOOL _finished; @@ -51,13 +51,16 @@ NSString *const MMAHTTPResponseErrorDomain = @"MMAHTTPResponseErrorDomain"; BOOL _isRedirect; } @property (nonatomic, strong) NSURLConnection *connection; + +@property (nonatomic, strong) NSURLSession *connectionSession; +@property (nonatomic, strong) NSURLSessionDataTask *sessionDataTask; + @property (nonatomic, strong) NSURLResponse *responseReceived; @property (nonatomic, strong) NSMutableData *accumulatedData; @property (nonatomic, getter = isExecuting) BOOL executing; @property (nonatomic, getter = isFinished) BOOL finished; @property (nonatomic, getter = isCancelled) BOOL cancelled; - @end @@ -74,7 +77,15 @@ NSString *const MMAHTTPResponseErrorDomain = @"MMAHTTPResponseErrorDomain"; { _request = request; _autoRetryDelay = 5.0; - _connection = [[NSURLConnection alloc] initWithRequest:request delegate:self startImmediately:NO]; + + if ([[[UIDevice currentDevice] systemVersion] floatValue] < 7.0) { + _connection = [[NSURLConnection alloc] initWithRequest:request delegate:self startImmediately:NO]; + } else { +// 新增NSURLSession请求。2019年05月 + _connectionSession = [NSURLSession sessionWithConfiguration:[NSURLSessionConfiguration defaultSessionConfiguration] delegate:self delegateQueue:nil]; + _sessionDataTask = [_connectionSession dataTaskWithRequest:request]; + } + } return self; } @@ -92,8 +103,14 @@ NSString *const MMAHTTPResponseErrorDomain = @"MMAHTTPResponseErrorDomain"; { [self willChangeValueForKey:@"isExecuting"]; _executing = YES; - [_connection scheduleInRunLoop:[NSRunLoop mainRunLoop] forMode:NSRunLoopCommonModes]; - [_connection start]; + + if ([[[UIDevice currentDevice] systemVersion] floatValue] < 7.0) { + [_connection scheduleInRunLoop:[NSRunLoop mainRunLoop] forMode:NSRunLoopCommonModes]; + [_connection start]; + }else { + [_sessionDataTask resume]; + } + [self didChangeValueForKey:@"isExecuting"]; } } @@ -107,12 +124,22 @@ NSString *const MMAHTTPResponseErrorDomain = @"MMAHTTPResponseErrorDomain"; { [self willChangeValueForKey:@"isCancelled"]; _cancelled = YES; - [_connection cancel]; + + [self didChangeValueForKey:@"isCancelled"]; //call callback NSError *error = [NSError errorWithDomain:NSURLErrorDomain code:NSURLErrorCancelled userInfo:nil]; - [self connection:_connection didFailWithError:error]; + + if ([[[UIDevice currentDevice] systemVersion] floatValue] < 7.0) { + [_connection cancel]; + [self connection:_connection didFailWithError:error]; + }else { + [_sessionDataTask cancel]; + [self URLSession:_connectionSession task:_sessionDataTask didCompleteWithError:error]; + + } + } } } @@ -154,8 +181,68 @@ NSString *const MMAHTTPResponseErrorDomain = @"MMAHTTPResponseErrorDomain"; return _autoRetryErrorCodes; } -#pragma mark NSURLConnectionDelegate +#pragma mark NSURLSessionDelegate +- (void) URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task didCompleteWithError:(NSError *)error { + + if (error) { + if (_autoRetry && [self.autoRetryErrorCodes containsObject:@(error.code)]) + { + _connection = [[NSURLConnection alloc] initWithRequest:_request delegate:self startImmediately:NO]; + [_connection performSelector:@selector(start) withObject:nil afterDelay:_autoRetryDelay]; + } + else + { + [self finish]; + if (_completionHandler) _completionHandler(_responseReceived, _accumulatedData, error); + } + } else { + [self finish]; + + NSError *error = nil; + if ([_responseReceived respondsToSelector:@selector(statusCode)]) + { + + //treat status codes >= 400 as an error + NSInteger statusCode = [(NSHTTPURLResponse *)_responseReceived statusCode]; + if (statusCode / 100 >= 4&& !_isRedirect) + { + NSString *message = [NSString stringWithFormat:NSLocalizedString(@"The server returned a %i error", @"MMA_RequestQueue HTTPResponse error message format"), statusCode]; + NSDictionary *infoDict = @{NSLocalizedDescriptionKey: message}; + error = [NSError errorWithDomain:MMAHTTPResponseErrorDomain + code:statusCode + userInfo:infoDict]; + } + } + + if (_completionHandler) _completionHandler(_responseReceived, _accumulatedData, error); + } + +} +- (void) URLSession:(NSURLSession *)session dataTask:(nonnull NSURLSessionDataTask *)dataTask didReceiveData:(nonnull NSData *)data { + + if (_accumulatedData == nil) + { + _accumulatedData = [[NSMutableData alloc] initWithCapacity:MAX(0, (int)_responseReceived.expectedContentLength)]; + } + [_accumulatedData appendData:data]; + +} +- (void) URLSession:(NSURLSession *)session dataTask:(NSURLSessionDataTask *)dataTask didReceiveResponse:(NSURLResponse *)response completionHandler:(void (^)(NSURLSessionResponseDisposition))completionHandler { + _responseReceived = response; + + completionHandler(NSURLSessionResponseAllow); + +} + +- (void) URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task willPerformHTTPRedirection:(NSHTTPURLResponse *)response newRequest:(NSURLRequest *)request completionHandler:(void (^)(NSURLRequest * _Nullable))completionHandler { + NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse*)response; + if (httpResponse.statusCode==301||httpResponse.statusCode==302) { + _isRedirect = YES; + } + completionHandler(request); +} +#pragma mark - NSURLConnectionDelegate - (void)connection:(__unused NSURLConnection *)connection didFailWithError:(NSError *)error { if (_autoRetry && [self.autoRetryErrorCodes containsObject:@(error.code)]) @@ -184,19 +271,10 @@ NSString *const MMAHTTPResponseErrorDomain = @"MMAHTTPResponseErrorDomain"; - (void)connection:(__unused NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response { + _responseReceived = response; } -- (void)connection:(__unused NSURLConnection *)connection didSendBodyData:(__unused NSInteger)bytesWritten totalBytesWritten:(NSInteger)totalBytesWritten totalBytesExpectedToWrite:(NSInteger)totalBytesExpectedToWrite -{ - if (_uploadProgressHandler) - { - float progress = (float)totalBytesWritten / (float)totalBytesExpectedToWrite; - _uploadProgressHandler(progress, totalBytesWritten, totalBytesExpectedToWrite); - } -} - - /*****************只判断2次跳转是否成功*************/ - (NSURLRequest *)connection:(NSURLConnection *)connection willSendRequest:(NSURLRequest *)request redirectResponse:(NSURLResponse *)response{ @@ -214,7 +292,7 @@ NSString *const MMAHTTPResponseErrorDomain = @"MMAHTTPResponseErrorDomain"; { if (_accumulatedData == nil) { - _accumulatedData = [[NSMutableData alloc] initWithCapacity:MAX(0, _responseReceived.expectedContentLength)]; + _accumulatedData = [[NSMutableData alloc] initWithCapacity:MAX(0,(int) _responseReceived.expectedContentLength)]; } [_accumulatedData appendData:data]; if (_downloadProgressHandler) diff --git a/MobileTracking/MobileTracking/Viewability_iOS.md b/MobileTracking/MobileTracking/Viewability_iOS.md index e4f83c5b2d4bf85318f098a8d0dde03ed2ea08cc..0500d1b35b85c46cbe770b536de1e7d96ea81818 100644 --- a/MobileTracking/MobileTracking/Viewability_iOS.md +++ b/MobileTracking/MobileTracking/Viewability_iOS.md @@ -1,21 +1,28 @@ -##Admaster iOS SDK 部署指南 -###步骤1:添加 Admaster iOS SDK 到工程中 +## MMA iOS SDK 部署指南 + +### 步骤1:添加 MMA iOS SDK 到工程中 1. 将SDK发布文件中,release目录下的**MobileTracking.h** 、**libMobileTracking.a**、**sdkconfig.xml** 三个文件拷贝到项目工程中,将 **sdkconfig.xml** 上传到 web 服务器,使其可以通过 web 方式访问,假设其地址为 **http://xxxxxx.com/sdkconfig.xml**(其后会用到)。 2. 在项目工程 App 的 Target Build Settings 中的 **Other Linker Flags** 选项里添加 **-lxml2** **-all_load** 或 **-lxml2** **-force_load** 静态库的绝对路径 -3. 如果不想开启定位服务,需要在sdkconfig内将所有Company标签内的设置为false,使用定位服务请添加隐私权限访问描述,例如 +3. 添加SDK需要的Framework +在需要添加SDK的项目的 Xcode 开发环境中选择 TARGETS-->Build Phases-->Link Binary With Libraries--> + 添加以下framework框架: + ``` -// 在使用期间访问位置 -NSLocationWhenInUseUsageDescription -是否允许App通过您的地理位置信息获取您周边的相关数据 + CoreLocation.framework + libxml2.2.tbd + AdSupport.framework + CoreTelephony.framework + SystemConfiguration.framework ``` -###步骤2:配置文件sdkconfig.xml的使用方法 -在使用的文件中引用 **#import "MobileTracking.h"**. -使用说明: -####1、初始化方法 +### 步骤2:配置文件sdkconfig.xml的使用方法 +在使用的文件中引用 +**#import "MobileTracking.h"**. +使用说明: + +#### 1、初始化方法 在进行监测之前,必须进行初始化,通过以上的代码进行初始化操作 ``` @@ -23,7 +30,7 @@ ``` -####2、配置远程配置文件地址方法 +#### 2、配置远程配置文件地址方法 SDK 会自动下载远程的配置文件,使用最新的配置文件进行参数的组装。 @@ -31,41 +38,71 @@ SDK 会自动下载远程的配置文件,使用最新的配置文件进行参 [[MobileTracking sharedInstance] configFromUrl:@“http://xxxxxx.com/sdkconfig.xml”]; ``` -####3、曝光的监测 +#### 3、曝光的监测 通过调用以下的代码进行曝光的监测, - * 第一个参数为第三方公司的监测地址 - * 第二个参数为当前广告视图对象(**可视化广告监测为必传字段,普通广告监测默认缺省。**) + * view:参数为第三方公司的监测地址 + * ad:参数为当前广告视图对象(**可视化广告监测为必传字段,普通广告监测默认缺省。**) + * videoPlayType:参数为当前视频广告的播放类型(**视频可视化广告监测为可选字段,1-自动播放,2-手动播放,0-无法识别。**) + * impressionType:参数为曝光的类型。(**普通广告监测的类型为必选字段,0-Tracked ads,1-曝光**) -普通广告监测 +3.1 曝光监测 ``` -[[MobileTracking sharedInstance] view:@"http://vxyz.admaster.com.cn/v/a17298,b81949763,c3194,i0,m201”]; +// impressionType=1 表示这是曝光监测。此时如果传0,表示这是Tracked ads监测 +[[MobileTracking sharedInstance] view:@"http://example.com/xxxxxx” ad:adView impressionType:1]; ``` -可视化广告监测 + +  备注:SDK曝光监测接口现已升级为曝光/Track Ads接口, 支持曝光或Tracked Ads监测。 +    1、曝光的定义:只有广告物料已经加载在客户端并至少已经开始渲染(Begin to render,简称BtR)时,才应称之为“曝光”事件。“渲染”指的是绘制物料的过程,或者指将物料添加到文档对象模型的过程。 +    2、Tracked Ads的定义:当监测代码已经下载到客户端时(即便广告不一定渲染),称该事件为“Tracked Ads”事件。 +    开发者应根据广告实际展示情况,选择调用曝光或Tracked Ads监测,详细调用过程如上面的示例。如果进行曝光调用,则SDK会查验传入的广告View对象是否已开始渲染,如果是,则SDK会向监测方发出曝光上报;如果不是,则SDK会向监测方发出Tracked Ads上报。如果进行Tracked Ads调用,则SDK会直接向监测方发出Tracked Ads上报。 + + +3.2 可见性广告监测 ``` -[[MobileTracking sharedInstance] view:@"http://vxyz.admaster.com.cn/v/a17298,b81949763,c3194,i0,m201” adView:adview]; +[[MobileTracking sharedInstance] view:@"http://example.com/xxxxxx” ad:adview]; + +``` +  备注:对广告进行可见性监测时,广告必须是满足开始渲染(Begin to render,简称BtR)条件的合法曝光,否则SDK不会执行可见监测。在调用可见曝光监测接口时,SDK会查验传入的广告View对象是否已开始渲染,如果是,则SDK会向监测方发出曝光上报,并继续进行可见监测,直到满足可见/不可见条件,再结束可见监测流程;如果不是,则SDK会向监测方发出Tracked Ads上报,并结束可见监测流程。 + +3.3 视频可见性广告监测 ``` +[[MobileTracking sharedInstance] viewVideo:@"http://example.com/xxxxxx” ad:adview videoPlayType:type]; -视频可视化广告监测 +``` +3.4 可见性广告JS监测 + +``` +[[MobileTracking sharedInstance] jsView:@"http://example.com/xxxxxx” ad:adview]; + +``` + +3.5 视频可见性广告JS监测 + +``` +[[MobileTracking sharedInstance] jsViewVideo:@"http://example.com/xxxxxx” ad:adview]; + +``` +3.6 可见性广告监测停止,广告播放结束时调用 ``` -[[MobileTracking sharedInstance] viewVideo:@"http://vxyz.admaster.com.cn/v/a17298,b81949763,c3194,i0,m201” adView:adview]; +[[MobileTracking sharedInstance] stop:@"http://example.com/xxxxxx”]; ``` -####4、点击监测 +#### 4、点击监测 通过调用以下的代码进行点击的监测,参数为第三方公司的监测地址 ``` -[[MobileTracking sharedInstance] click:@"http://vxyz.admaster.com.cn/v/a17298,b81949763,c3194,i0,m201"]; +[[MobileTracking sharedInstance] click:@"http://example.com/xxxxxx"]; ``` -####5、进入后台时调用 +#### 5、进入后台时调用 主要用于保存当前监测数据,不被丢失。建议放在AppDelegate的applicationDidEnterBackground方法中 ``` @@ -73,7 +110,7 @@ SDK 会自动下载远程的配置文件,使用最新的配置文件进行参 ``` -####6、回到前台时调用 +#### 6、回到前台时调用 重新读取缓存数据,主要用于保证当前监测数据,及时上报,建议放在AppDelegate的applicationWillEnterForeground方法中 ``` @@ -81,27 +118,26 @@ SDK 会自动下载远程的配置文件,使用最新的配置文件进行参 ``` -####7、应用结束时调用 +#### 7、应用结束时调用 主要用于保存当前监测数据,不被丢失。 ``` [[MobileTracking sharedInstance] willTerminate]; ``` -####7、开启调试日志 +#### 7、开启调试日志 建议在测试时候打开 ``` [[MobileTracking sharedInstance] enableLog:YES]; ``` -###步骤3:验证和调试 +### 步骤3:验证和调试 SDK 的测试有两个方面: 1. 参数是否齐全,URL 拼接方式是否正确 2. 请求次数和第三方监测平台是否能对应上 -针对第一点,使用 Admaster SDK 测试平台进行测试和验证,登入 http://developer.admaster.com.cn/, 根据页面上的提示进行调用, 页面会实时显示出服务器接收到的信息,如果和本地的设备相关信息一致,则表示测试通过。 +请联系第三方监测平台完成测试 -针对第二点,建议使用第三方监测系统的正式环境进行测试,主要对比媒体自身广告系统监测数据和第三方监测数据数量上的差异。 diff --git a/MobileTracking/Viewability/AdHeper.h b/MobileTracking/Viewability/AdHeper.h deleted file mode 100644 index d6693c67df9eb6d28283c2ce8d4224d0ec217e9a..0000000000000000000000000000000000000000 --- a/MobileTracking/Viewability/AdHeper.h +++ /dev/null @@ -1,14 +0,0 @@ -// -// AdHeper.h -// AdMaster_Ad_Cheat -// -// Created by master on 10/12/16. -// Copyright © 2016 AdMaster. All rights reserved. -// - -#import - -@interface AdHeper : NSObject -+ (NSString *)formatRect:(CGRect) rect; - -@end diff --git a/MobileTracking/Viewability/MMA_AdCalSize.h b/MobileTracking/Viewability/MMA_AdCalSize.h new file mode 100644 index 0000000000000000000000000000000000000000..ad8b7ef53c618fc153c44e742a94aca0920dff6d --- /dev/null +++ b/MobileTracking/Viewability/MMA_AdCalSize.h @@ -0,0 +1,17 @@ +// +// AdCalSize.h +// AdCoverDemo +// +// Created by admin on 2019/5/20. +// Copyright © 2019 admaster. All rights reserved. +// + +#import +#import + +@interface MMA_AdCalSize : NSObject + +- (CGFloat)calSize:(NSArray *)rects; + +@end + diff --git a/MobileTracking/Viewability/MMA_AdCalSize.m b/MobileTracking/Viewability/MMA_AdCalSize.m new file mode 100644 index 0000000000000000000000000000000000000000..ab48b5b06f67ad16eab0ef121ba9d32aa97e48c8 --- /dev/null +++ b/MobileTracking/Viewability/MMA_AdCalSize.m @@ -0,0 +1,193 @@ +// +// AdCalSize.m +// AdCoverDemo +// +// Created by admin on 2019/5/20. +// Copyright © 2019 admaster. All rights reserved. +// + +#import "MMA_AdCalSize.h" + +@interface MMA_AdNode : NSObject +@property (nonatomic) float aLeft; +@property (nonatomic) float aRight; +@property (nonatomic) NSInteger coveredNum; +@property (nonatomic) float len; +@property (nonatomic) float left; +@property (nonatomic) float right; +@end +@implementation MMA_AdNode + +@end + +@interface MMA_AdLine : NSObject + +@property (nonatomic) float left; +@property (nonatomic) float right; +@property (nonatomic) float y; +@property (nonatomic) BOOL isTop; + +- (instancetype)initWithRect:(CGRect)rect top:(BOOL)isTop; + +@end + +@implementation MMA_AdLine + +- (instancetype)initWithRect:(CGRect)rect top:(BOOL)isTop; +{ + self = [super init]; + if (self) { + self.left = rect.origin.x; + self.isTop = isTop; + self.right = rect.origin.x + rect.size.width; + self.y = isTop ? rect.origin.y : rect.origin.y + rect.size.height; + } + return self; +} +- (id)copyWithZone:(NSZone *)zone { + MMA_AdLine *line = [[[self class] allocWithZone:zone] init]; + line.left = _left; + line.right = _right; + line.isTop = _isTop; + line.y = _y; + return line; +} + +@end + +@interface MMA_AdCalSize () + +@property (nonatomic, strong) NSMutableArray *lines; +@property (nonatomic, strong) NSMutableSet *xValues; +@property (nonatomic, strong) NSMutableDictionary *nodeList; + +@property (nonatomic, strong) NSArray *sortedLines; +@property (nonatomic, strong) NSArray *sortedXValues; + +@end + +@implementation MMA_AdCalSize + +- (instancetype)init +{ + self = [super init]; + if (self) { + + self.lines = [NSMutableArray arrayWithCapacity:100]; + self.xValues = [NSMutableSet setWithCapacity:100]; + self.nodeList = [NSMutableDictionary dictionaryWithCapacity:100]; + + } + return self; +} + +- (CGFloat)calSize:(NSArray *)rects { + + for (NSString *sRect in rects) { + CGRect rect = CGRectFromString(sRect); + MMA_AdLine *line1 = [[MMA_AdLine alloc] initWithRect:rect top:YES]; + MMA_AdLine *line2 = [[MMA_AdLine alloc] initWithRect:rect top:NO]; + [self.lines addObjectsFromArray:@[line1, line2]]; + [self.xValues addObjectsFromArray:@[@(line1.left),@(line1.right)]]; + } + + _sortedLines = [self.lines sortedArrayUsingComparator:^NSComparisonResult(MMA_AdLine *obj1, MMA_AdLine *obj2) { + return obj1.y > obj2.y; + }]; + + _sortedXValues = [[self.xValues allObjects] sortedArrayUsingComparator:^NSComparisonResult(NSNumber *obj1, NSNumber *obj2) { + return obj1.floatValue > obj2.floatValue; + }]; + [self buildTree:1 areaX:1 areaY:_sortedXValues.count]; + CGFloat res = 0; + for (int i = 0; i < _sortedLines.count - 1; i++) { + [self updateTree:1 line:self.sortedLines[i]]; + MMA_AdLine *line = self.sortedLines[i+1]; + MMA_AdLine *last_line = self.sortedLines[i]; + MMA_AdNode *adNode = [self.nodeList objectForKey:@(1)]; + res += adNode.len*(line.y - last_line.y); + } + return res; +} + +- (void)buildTree:(NSInteger)index areaX:(NSInteger)aX areaY:(NSInteger)aY { + + MMA_AdNode *adNode = [[MMA_AdNode alloc] init]; + adNode.aLeft = aX; + adNode.aRight = aY; + adNode.coveredNum = 0; + adNode.left = [self.sortedXValues[aX-1] floatValue]; + adNode.right = [self.sortedXValues[aY-1] floatValue]; + adNode.len = 0; + [self.nodeList setObject:adNode forKey:@(index)]; + + if (aX + 1 == aY) { + return; + } + + NSInteger middle = (aX + aY) >> 1; + + [self buildTree:index<<1 areaX:aX areaY:middle]; + [self buildTree:index<<1|1 areaX:middle areaY:aY]; + +} + +- (void)updateTree:(NSInteger)index line:(MMA_AdLine *)line { + + if (index < 0) { + return; + } + MMA_AdNode *adNode = [self.nodeList objectForKey:@(index)]; + MMA_AdNode *leftNode = [self.nodeList objectForKey:@(index<<1)]; + MMA_AdNode *rightNode = [self.nodeList objectForKey:@(index<<1|1)]; +// if (adNode == nil) { +// return; +// } +// if (leftNode == nil) { +// return; +// } +// if (rightNode == nil) { +// return; +// } + if (line.left == adNode.left && line.right == adNode.right) { + adNode.coveredNum += line.isTop ? 1 : -1; +// 计算当前所有的区间的覆盖面积 + if (adNode.coveredNum > 0) { + adNode.len = adNode.right - adNode.left; + } else if (adNode.aLeft + 1 == adNode.aRight) { + adNode.len = 0; + } else { + adNode.len = leftNode.len + rightNode.len; + } + [self.nodeList setObject:adNode forKey:@(index)]; + return; + } + + if (line.right <= leftNode.right) { + [self updateTree:index<<1 line:line]; + } else if (line.left >= rightNode.left) { + [self updateTree:index<<1|1 line:line]; + } else { + MMA_AdLine *tmpline = [line copy]; + tmpline.right = leftNode.right; + [self updateTree:index<<1 line:tmpline]; + tmpline = line; + tmpline.left = rightNode.left; + [self updateTree:index<<1|1 line:tmpline]; + } + // 计算当前所有区间覆盖的面积 以及映射到父节点 + if (adNode.coveredNum > 0) { + adNode.len = adNode.right - adNode.left; + [self.nodeList setObject:adNode forKey:@(index)]; + return; + } else if (adNode.left+1 == adNode.aRight) { + adNode.len = 0; + } else { + adNode.len = leftNode.len + rightNode.len; + } +// if (adNode != nil) { + [self.nodeList setObject:adNode forKey:@(index)]; +// } +} + +@end diff --git a/MobileTracking/Viewability/MMA_AdHelper.h b/MobileTracking/Viewability/MMA_AdHelper.h new file mode 100644 index 0000000000000000000000000000000000000000..240dc64edca845c36094ccbfecfae29a0a02147e --- /dev/null +++ b/MobileTracking/Viewability/MMA_AdHelper.h @@ -0,0 +1,17 @@ +// +// AdHelper.h +// AdCoverDemo +// +// Created by 黄力 on 2019/5/13. +// Copyright © 2019 admaster. All rights reserved. +// + +#import +#import + +@interface MMA_AdHelper : NSObject + ++ (NSString *)formatRect:(CGRect) rect; + +@end + diff --git a/MobileTracking/Viewability/AdHeper.m b/MobileTracking/Viewability/MMA_AdHelper.m similarity index 47% rename from MobileTracking/Viewability/AdHeper.m rename to MobileTracking/Viewability/MMA_AdHelper.m index dac6a68b3d4ac57914f3cc20583e4d766075a5c5..6a788a4eb02308c39ba946a376eb4ef992575eed 100644 --- a/MobileTracking/Viewability/AdHeper.m +++ b/MobileTracking/Viewability/MMA_AdHelper.m @@ -1,15 +1,14 @@ // -// AdHeper.m -// AdMaster_Ad_Cheat +// AdHelper.m +// AdCoverDemo // -// Created by master on 10/12/16. -// Copyright © 2016 AdMaster. All rights reserved. +// Created by 黄力 on 2019/5/13. +// Copyright © 2019 admaster. All rights reserved. // -#import "AdHeper.h" -#import -@implementation AdHeper +#import "MMA_AdHelper.h" +@implementation MMA_AdHelper + (NSString *)formatRect:(CGRect) rect { return [NSString stringWithFormat:@"%.1fX%.1fX%.1fX%.1f",rect.origin.x,rect.origin.y,rect.size.width,rect.size.height]; diff --git a/MobileTracking/Viewability/MMA_AdViewMonitor.h b/MobileTracking/Viewability/MMA_AdViewMonitor.h new file mode 100644 index 0000000000000000000000000000000000000000..2cdd58cdaf2277bbc7e255acc15582940bbc2c3c --- /dev/null +++ b/MobileTracking/Viewability/MMA_AdViewMonitor.h @@ -0,0 +1,17 @@ +// +// AdViewMonitor.h +// AdCoverDemo +// +// Created by 黄力 on 2019/5/13. +// Copyright © 2019 admaster. All rights reserved. +// + +#import +#import "MMA_AdViewResult.h" +#import + +@interface MMA_AdViewMonitor : NSObject + +- (MMA_AdViewResult *)monitorWithAdView:(UIView *)view; + +@end diff --git a/MobileTracking/Viewability/MMA_AdViewMonitor.m b/MobileTracking/Viewability/MMA_AdViewMonitor.m new file mode 100644 index 0000000000000000000000000000000000000000..3ba0a991c416186b04682771b1ffc6f453943eaa --- /dev/null +++ b/MobileTracking/Viewability/MMA_AdViewMonitor.m @@ -0,0 +1,88 @@ +// +// AdViewMonitor.m +// AdCoverDemo +// +// Created by 黄力 on 2019/5/13. +// Copyright © 2019 admaster. All rights reserved. +// + +#import "MMA_AdViewMonitor.h" +#import "UIView+MMA_Monitor.h" + +@interface MMA_AdViewMonitor() + +@property (nonatomic, weak) UIView *monitorView; +@property (nonatomic, strong) MMA_AdViewResult *result; + +@end + +@implementation MMA_AdViewMonitor + +- (MMA_AdViewResult *)monitorWithAdView:(UIView *)view { + + _monitorView = view; + + _result = [[MMA_AdViewResult alloc] initWithView:view]; + + if (self.result.isShowing) { + [self monitorView:view]; + } + [self.result calculte]; + return self.result; +} + +- (void)monitorView:(UIView *)view { + + [self travereRelateViews:_monitorView]; + +} + +/** + * 节点遍历 保存相交面积(相对Window) + * 以及所有视图层之上的所有节点(部分跳过遍历) + */ +- (void)travereRelateViews:(UIView *)view { + + @try { + + if (view == nil) { + return ; + } + + UIView *superView = view.superview; + + if (view == _monitorView.window) { + return ; + } +// 无superview 添加最后的window + if (superView == nil) { + superView = _monitorView.window; + + } +// 遍历父view的所有view + NSInteger index = [superView.subviews indexOfObject:view]; + UIView *nextView = nil; + if (index + 1 < superView.subviews.count) { + nextView = superView.subviews[index + 1]; + /* 去最低子节点 */ + /* 存在子节点并且当前父节点的clipsToBounds为NO,YES 所有子view被框在父view内不用遍历 */ + if ([nextView mma_isShowing] && nextView.subviews.count != 0 && nextView.clipsToBounds == NO) { + nextView = nextView.subviews[0]; + } + } else { + /* 无相邻节点 遍历父节点 */ + nextView = superView; + } + + [self.result enqueueView:nextView]; + [self travereRelateViews:nextView]; + + } @catch (NSException *exception) { + + } @finally { + + } + +} + +@end diff --git a/MobileTracking/Viewability/MMA_AdViewResult.h b/MobileTracking/Viewability/MMA_AdViewResult.h new file mode 100644 index 0000000000000000000000000000000000000000..392aa940e8513339d47e90005e06af6e8a65a5bc --- /dev/null +++ b/MobileTracking/Viewability/MMA_AdViewResult.h @@ -0,0 +1,30 @@ +// +// AdViewResult.h +// AdCoverDemo +// +// Created by 黄力 on 2019/5/13. +// Copyright © 2019 admaster. All rights reserved. +// + +#import +#import + + + +@interface MMA_AdViewResult : NSObject + +@property (nonatomic, assign) BOOL isShowing; //视 图是否在屏幕内可见 +@property (nonatomic, strong) NSString *ad_frame; //adview基于屏幕的frame xXyXwidthXheigh +@property (nonatomic, assign) CGFloat ad_alpha; // 透明度 +@property (nonatomic, assign) BOOL ad_hide; // Hide +@property (nonatomic, assign) BOOL ad_showing; // 0 为没有问题正常显示 1 为尺寸缺失或者没有在Window 上或者出屏幕 +@property (nonatomic, assign) CGFloat cover_rate; // 被覆盖率 0-1 cover_frame/ad_frame +@property (nonatomic, strong) NSArray *cover_frame;// Conver rect list + + +- (instancetype)initWithView:(UIView *)view; +- (void)enqueueView:(UIView *)view; +- (void)calculte; +- (NSString *)addescription; +@end + diff --git a/MobileTracking/Viewability/MMA_AdViewResult.m b/MobileTracking/Viewability/MMA_AdViewResult.m new file mode 100644 index 0000000000000000000000000000000000000000..4965a8af4d7b80ae4e64d4abac09a5e4b314f075 --- /dev/null +++ b/MobileTracking/Viewability/MMA_AdViewResult.m @@ -0,0 +1,177 @@ +// +// AdViewResult.m +// AdCoverDemo +// +// Created by 黄力 on 2019/5/13. +// Copyright © 2019 admaster. All rights reserved. +// + +#import "MMA_AdViewResult.h" +#import "UIView+MMA_Monitor.h" +#import "MMA_AdHelper.h" +#import "MMA_AdCalSize.h" + +@interface MMA_AdViewResult () + +@property (nonatomic, weak) UIView *adView; + +@property (nonatomic, strong)NSMutableSet *viewList; +@property (nonatomic, strong)NSMutableSet *viewCoverList_Format; +@property (nonatomic, strong) NSMutableSet *viewCoverList; + +@property (nonatomic) CGRect showOnWindow; //在父视图中的可见frame +@property (nonatomic) CGRect originFrame; //初始frame on superview +@property (nonatomic) CGFloat coveredSize; //覆盖 + +@end + +@implementation MMA_AdViewResult + +#pragma mark - init +- (instancetype)initWithView:(UIView *)view +{ + self = [super init]; + if (self) { + if (view == nil) { + return nil; + } + self.adView = view; + self.coveredSize = 0; + [self.viewList addObject:[view mma_properties]]; + +// view有没有正常显示 + if (!view.mma_isShowing || !view.mma_isSuperviewsShowing || view.mma_width == 0 || view.mma_height == 0 || !CGRectIntersectsRect([view mma_showOnKeyWindow], [UIApplication sharedApplication].keyWindow.frame)) { + self.isShowing = NO; + } else { + self.isShowing = YES; + } + +// 使用CGFloat小数点,小数点14位可能出现偏差,所以修改为float + self.ad_showing = !self.isShowing || view.mma_sHeight != view.mma_height || view.mma_sWidth != view.mma_width; + + self.showOnWindow = view.mma_showOnKeyWindow; + self.originFrame = view.frame; + + } + return self; +} + +#pragma mark - method +- (void)enqueueView:(UIView *)view { + + @try { + + if (!_adView) { + return ; + } + /* 如果这个视图没有显示就不添加进list */ + if (!view.mma_isShowing) { + return ; + } + [self.viewList addObject:view.mma_properties]; + + CGRect coverRect = [self.adView mma_intersectionWithView:view]; + if (!CGRectEqualToRect(coverRect, CGRectZero)) { + if (![self.adView mma_isSuper:view]) { +// 限制最大view数量阈值 + if (self.viewCoverList.count < 60) { + [self.viewCoverList addObject:NSStringFromCGRect(coverRect)]; + } +// 限制最大格式化的view数量阈值 + if (self.viewCoverList_Format.count < 60) { + [self.viewCoverList_Format addObject:[MMA_AdHelper formatRect:coverRect]]; + } + } + } + + } @catch (NSException *exception) { + + } @finally { + + } + +} + +- (void)calculte { + + if (!self.viewCoverList.count) { + self.coveredSize = 0; + return ; + } + NSSortDescriptor *sd = [[NSSortDescriptor alloc] initWithKey:@"" ascending:YES]; + NSArray *viewCoverList = [_viewCoverList sortedArrayUsingDescriptors:@[sd]]; + MMA_AdCalSize *sizeCal = [[MMA_AdCalSize alloc] init]; + CGFloat res = [sizeCal calSize:viewCoverList]; + self.coveredSize = res; + +} + +#pragma mark - set +- (NSMutableSet *)viewList { + if(!_viewList) { + _viewList = [NSMutableSet setWithCapacity:0]; + } + return _viewList; +} + +- (NSMutableSet *)viewCoverList { + if (!_viewCoverList) { + _viewCoverList = [NSMutableSet setWithCapacity:0]; + } + return _viewCoverList; +} +- (NSMutableSet *)viewCoverList_Format { + if(!_viewCoverList_Format) { + _viewCoverList_Format = [NSMutableSet setWithCapacity:0]; + } + return _viewCoverList_Format; +} + +#pragma mark - output +- (BOOL)isShowing { + return _isShowing; +} + +- (NSString *)ad_frame { + return [MMA_AdHelper formatRect:self.showOnWindow]; +} + +- (CGFloat)ad_alpha { + return self.adView.alpha; +} + +- (BOOL)ad_hide { + return self.adView.hidden; +} + +- (BOOL)ad_showing { + return _ad_showing; +} + +- (CGFloat)cover_rate { + + /* 总区域 */ + CGFloat areaSize = self.originFrame.size.width * self.originFrame.size.height; + /* 可视区域 */ + CGFloat showSize = self.showOnWindow.size.width * self.showOnWindow.size.height; + + if (areaSize == 0) { + return 1; + } else { + return (areaSize - showSize + self.coveredSize) / areaSize; + + } + + +} +- (NSArray *)cover_frame { + NSSortDescriptor *sd = [[NSSortDescriptor alloc] initWithKey:@"" ascending:YES]; + return [self.viewCoverList_Format sortedArrayUsingDescriptors:@[sd]]; + +} + +- (NSString *)addescription { + return [NSString stringWithFormat:@"\n原始frame: %@\nalpha: %f\nis_hidden: %d\nad_showing: %d\n被覆盖率: %f\n",self.ad_frame,self.ad_alpha,self.ad_hide,self.ad_showing,self.cover_rate]; +} + +@end diff --git a/MobileTracking/Viewability/UIView+MMA_Monitor.h b/MobileTracking/Viewability/UIView+MMA_Monitor.h new file mode 100644 index 0000000000000000000000000000000000000000..33696af59c564a397ad25b890d55b280bc9866fe --- /dev/null +++ b/MobileTracking/Viewability/UIView+MMA_Monitor.h @@ -0,0 +1,44 @@ +// +// UIView+Monitor.h +// AdMaster_Ad_Cheat +// +// Created by master on 10/11/16. +// Copyright © 2016 AdMaster. All rights reserved. +// + +#import + +@interface UIView (MMA_Monitor) + +/** isshowing */ +- (BOOL)mma_isShowing; + +/** traverse all superview issshowing */ +- (BOOL)mma_isSuperviewsShowing; + +/** return intersection rect with view */ +- (CGRect)mma_intersectionWithView:(UIView *)view; + +/** show frame on keywindow */ +- (CGRect)mma_showOnKeyWindow; + +- (CGRect)mma_frameOnKeyWindow; + +/** return is super -> */ +- (BOOL)mma_isSuper:(UIView *)view; + +/** height */ +- (float)mma_height; + +/** width */ +- (float)mma_width; + +/** height on window */ +- (float)mma_sHeight; + +/** width on window */ +- (float)mma_sWidth; + +- (NSDictionary *)mma_properties; + +@end diff --git a/MobileTracking/Viewability/UIView+MMA_Monitor.m b/MobileTracking/Viewability/UIView+MMA_Monitor.m new file mode 100644 index 0000000000000000000000000000000000000000..1870c2e54bde5e79b87a0a9161243952595ea7f8 --- /dev/null +++ b/MobileTracking/Viewability/UIView+MMA_Monitor.m @@ -0,0 +1,191 @@ + + + +// +// UIView+Monitor.m +// AdMaster_Ad_Cheat +// +// Created by master on 10/11/16. +// Copyright © 2016 AdMaster. All rights reserved. +// + +#import "UIView+MMA_Monitor.h" +@implementation UIView (MMA_Monitor) + +//Window投射尺寸 自身尺寸 alpha hidden window +- (BOOL)mma_isShowing { + + BOOL alphaCheck = !(self.alpha == 0); + BOOL hiddenCheck = !self.hidden; + + BOOL sizeCheck = self.mma_width != 0 && self.mma_height != 0; + BOOL sSizeCheck = self.mma_sWidth != 0 && self.mma_sHeight != 0; + + BOOL windowCheck = [self isKindOfClass:[UIWindow class]] ? YES : (self.window != nil); + + return alphaCheck && hiddenCheck && sizeCheck && sSizeCheck && windowCheck; + +} + +- (BOOL)mma_hiddenCheck { + BOOL alphaCheck = !(self.alpha == 0); + BOOL hiddenCheck = !self.hidden; + return alphaCheck && hiddenCheck; +} + +/** traverse all superview issshowing */ +- (BOOL)mma_isSuperviewsShowing { + + UIView *superview = self.superview; + if (!superview) { + return NO; + } + BOOL superviewsCheck = YES; + while (superview) { + superviewsCheck = superviewsCheck && superview.mma_hiddenCheck; + superview = superview.superview; + } + return superviewsCheck && self.window.mma_isShowing; + +} + +//相交rect +- (CGRect)mma_intersectionWithView:(UIView *)view { + + CGRect mainRect = [self mma_showOnKeyWindow]; + CGRect coverRect = [view mma_showOnKeyWindow]; + if (CGRectIntersectsRect(mainRect, coverRect)) { + return CGRectIntersection(mainRect, coverRect); + } + return CGRectZero; +} + +/** show frame on keywindow */ +- (CGRect)mma_showOnKeyWindow { + + UIWindow *window = [UIApplication sharedApplication].keyWindow; + UIView *superview = self.superview; + while (superview) { + if (superview.clipsToBounds) { + break; + } + superview = superview.superview; + } + + // super遍历结束,如果没有需要了遍历window + if (superview == nil) { + if (self.window.clipsToBounds == YES) { + superview = self.window; + } + } + + CGRect realRect = CGRectZero; + if (superview == nil) { + realRect = self.bounds; // 因为可能不存在父视图坐标系转换的时候设定从自己的view坐标系转换.需要使用bound + return [self convertRect:realRect toView:window]; + } else { + CGRect selfOnWindow = [self convertRect:self.bounds toView:window]; + CGRect superOnWindow = [superview convertRect:superview.bounds toView:window]; + CGRect intersection = CGRectIntersection(selfOnWindow, superOnWindow); + return intersection; + + } +} + +- (CGRect)mma_frameOnKeyWindow { + UIWindow *window = [UIApplication sharedApplication].keyWindow; + return [self convertRect:self.bounds toView:window]; +} + +/** return is super -> */ +- (BOOL)mma_isSuper:(UIView *)view { + NSArray *superviews = nil; + if (!superviews) { + superviews = [self mma_superviews]; + } + if ([superviews indexOfObject:view] == NSNotFound) { + return NO; + } + return YES; +} + +- (NSArray *)mma_superviews { + NSMutableArray *supers = [NSMutableArray array]; + [supers addObject:self.window]; + UIView *superview = self.superview; + while (superview) { + [supers addObject:superview]; + superview = superview.superview; + } + return [supers copy]; +} + +/** height */ +- (float)mma_height { + return self.frame.size.height; +} + +/** width */ +- (float)mma_width { + return self.frame.size.width; +} + +/** height on window */ +- (float)mma_sHeight { + return [self mma_showOnKeyWindow].size.height; +} + +/** width on window */ +- (float)mma_sWidth { + return [self mma_showOnKeyWindow].size.width; +} + +- (NSDictionary *)mma_properties { + + return @{ + @"class":NSStringFromClass([self class]), + @"frameOnWindow":NSStringFromCGRect([self mma_showOnKeyWindow]), + @"frame":NSStringFromCGRect([self frame]), + @"backgroundColor":[self mma_bgcolorString], + @"clipsToBounds":@(self.clipsToBounds) + }; + +} + +- (NSString *)mma_bgcolorString { + return [self mma_stringFromColor:self.backgroundColor]; +} + +//颜色转string +- (NSString *)mma_stringFromColor:(UIColor *)value { + + if (value && [value isKindOfClass:[UIColor class]]) { + UIColor *colorValue = (UIColor *)value; + + CGColorSpaceModel colorSpaceModel = CGColorSpaceGetModel(CGColorGetColorSpace(colorValue.CGColor)); + if (colorSpaceModel == kCGColorSpaceModelMonochrome || colorSpaceModel == kCGColorSpaceModelRGB) { + size_t numberOfComponents = CGColorGetNumberOfComponents(colorValue.CGColor); + const CGFloat *components = CGColorGetComponents(colorValue.CGColor); + + if (colorSpaceModel == kCGColorSpaceModelMonochrome && numberOfComponents >= 1) { + CGFloat w = (255 * components[0]); + CGFloat a = (numberOfComponents > 1 ? components[1] : 1.0f); + + return [NSString stringWithFormat:@"rgba(%.0f, %.0f, %.0f, %.2f)", w, w, w, a]; + } + else if (colorSpaceModel == kCGColorSpaceModelRGB && numberOfComponents >= 3) + { + CGFloat r = (255 * components[0]); + CGFloat g = (255 * components[1]); + CGFloat b = (255 * components[2]); + CGFloat a = (numberOfComponents > 3 ? components[3] : 1.0f); + + return [NSString stringWithFormat:@"rgba(%.0f, %.0f, %.0f, %.2f)", r, g, b, a]; + } + } + } + return @""; + +} + +@end diff --git a/MobileTracking/Viewability/UIView+Monitor.h b/MobileTracking/Viewability/UIView+Monitor.h deleted file mode 100644 index eb2497cc8bce07c97c676ae15e913494d0ed6044..0000000000000000000000000000000000000000 --- a/MobileTracking/Viewability/UIView+Monitor.h +++ /dev/null @@ -1,20 +0,0 @@ -// -// UIView+Monitor.h -// AdMaster_Ad_Cheat -// -// Created by master on 10/11/16. -// Copyright © 2016 AdMaster. All rights reserved. -// - -#import -#import "AdHeper.h" - -@interface UIView (Monitor) - -/** show frame on keywindow 在window上的可视区域*/ -- (CGRect)showOnKeyWindow; - -- (CGRect)frameOnKeyWindow; - - -@end diff --git a/MobileTracking/Viewability/UIView+Monitor.m b/MobileTracking/Viewability/UIView+Monitor.m deleted file mode 100644 index f0a933890305d5876c8d4cc21be295a659ed415f..0000000000000000000000000000000000000000 --- a/MobileTracking/Viewability/UIView+Monitor.m +++ /dev/null @@ -1,54 +0,0 @@ - - - -// -// UIView+Monitor.m -// AdMaster_Ad_Cheat -// -// Created by master on 10/11/16. -// Copyright © 2016 AdMaster. All rights reserved. -// - -#import "UIView+Monitor.h" -@implementation UIView (Monitor) - -//- (CGRect)extracted:(const CGRect *)realRect superview:(UIView *)superview { -// return [self intersectionRectOnWindow:*realRect with:superview]; -//} - -- (CGRect)showOnKeyWindow { - // 可视尺寸 - CGRect realRect = self.frameOnKeyWindow; - UIWindow *window = [UIApplication sharedApplication].keyWindow; - UIView *superview = self.superview; - while (superview) { - if(superview.clipsToBounds) { - realRect = [self intersectionRectOnWindow:realRect with:superview]; - } - superview = superview.superview; - } - - realRect = [window intersectionRectOnWindow:realRect with:window]; - - return realRect; -} - -// view 基于window和window 的rect 相交得到的尺寸 -- (CGRect)intersectionRectOnWindow:(CGRect)aRect with:(UIView *)bView { - - CGRect bRect = [bView frameOnKeyWindow]; - - CGRect intersection = CGRectIntersection(aRect, bRect); - return intersection; -} - -- (CGRect)frameOnKeyWindow { - UIWindow *window = [UIApplication sharedApplication].keyWindow; - return [self convertRect:self.bounds toView:window]; -} - - - - - -@end diff --git a/MobileTracking/Viewability/VAMonitor.h b/MobileTracking/Viewability/VAMonitor.h index c504046536ca0407bb2273766f560c5f8735bca5..b8c1f13e4a4a31482134fd693382826049773f0d 100644 --- a/MobileTracking/Viewability/VAMonitor.h +++ b/MobileTracking/Viewability/VAMonitor.h @@ -7,7 +7,7 @@ // #import -#import "UIView+Monitor.h" +#import "UIView+MMA_Monitor.h" #import "VAMonitorFrame.h" #import "VAMonitorTimeline.h" #import "VAMonitorConfig.h" @@ -56,6 +56,9 @@ typedef NS_ENUM(NSUInteger, VAProgressStatus) { @property (nonatomic, strong,readonly) VAMonitorConfig *config; @property (nonatomic, readonly) BOOL isValid; + +@property (nonatomic, readonly) BOOL clickToValid;//强交互致使得广告监测结果有效可见 + @property (nonatomic, readonly) BOOL isVideo; @@ -73,6 +76,8 @@ typedef NS_ENUM(NSUInteger, VAProgressStatus) { - (void)stopAndUpload; +- (void)setValidExpose; + - (NSString *)keyQuery:(NSString *)key; - (BOOL)canRecord:(NSString *)key; @end diff --git a/MobileTracking/Viewability/VAMonitor.m b/MobileTracking/Viewability/VAMonitor.m index acbe5f1109019d979768dda82a8c5dd5f397e35b..8f9e71cf35dab603129fe52ad28a04b2c043c9e5 100644 --- a/MobileTracking/Viewability/VAMonitor.m +++ b/MobileTracking/Viewability/VAMonitor.m @@ -43,6 +43,7 @@ _adID = adID; _timeline = [[VAMonitorTimeline alloc] initWithMonitor:self]; _isValid = NO; + _clickToValid = NO; _keyValueAccess = keyValueAccess; _config = config; _domain = domain; @@ -196,6 +197,10 @@ AD_VB_RESULT : [NSString stringWithFormat:@"%d",_isValid ? 1:4], AD_MEASURABILITY : @"1" // 是否可测量 }]; + + if (_clickToValid) { + parmaters[AD_VB_INTERACT] = @"1"; + } // 是否需要传入记录的数据 if(self.config.needRecordData) { parmaters[AD_VB_EVENTS] = [self.timeline generateUploadEvents]; @@ -222,6 +227,11 @@ return @""; } +- (void)setValidExpose { + _clickToValid = YES; + _isValid = YES; +} + - (void)dealloc { NSLog(@"ID:%@ deallocd",self.impressionID); } diff --git a/MobileTracking/Viewability/VAMonitorFrame.h b/MobileTracking/Viewability/VAMonitorFrame.h index c94897924b0519a87737d08d58fdb570ff401b13..5604e5469181630fe5b2dd09b927894bb2808abe 100644 --- a/MobileTracking/Viewability/VAMonitorFrame.h +++ b/MobileTracking/Viewability/VAMonitorFrame.h @@ -20,6 +20,8 @@ @property (nonatomic,readonly) BOOL hidden; +@property (nonatomic,readonly) BOOL ad_showing; + @property (nonatomic,readonly) BOOL isForground; // 是否前台运行 0/后 1/前 @property (nonatomic,readonly) NSDate *captureDate; // 监测日期 diff --git a/MobileTracking/Viewability/VAMonitorFrame.m b/MobileTracking/Viewability/VAMonitorFrame.m index d6da10fd7e1d0d654addee38727cd4b4e7b46ba9..537a94b074424a9ee259d0e803509e1d78582ea8 100644 --- a/MobileTracking/Viewability/VAMonitorFrame.m +++ b/MobileTracking/Viewability/VAMonitorFrame.m @@ -7,10 +7,16 @@ // #import "VAMonitorFrame.h" -#import "UIView+Monitor.h" +#import "UIView+MMA_Monitor.h" #import "NSDate+VASDK.h" +#import "MMA_AdViewMonitor.h" + +@interface VAMonitorFrame () +@property (nonatomic, strong) MMA_AdViewResult *viewabilityResult; +@end + @implementation VAMonitorFrame @@ -19,26 +25,34 @@ return nil; } if (self = [super init]) { + + MMA_AdViewMonitor *monitor = [[MMA_AdViewMonitor alloc] init]; + _viewabilityResult = [monitor monitorWithAdView:view]; + _frame = view.frame; - _windowFrame = view.frameOnKeyWindow; - _showFrame = view.showOnKeyWindow; + _windowFrame = view.mma_frameOnKeyWindow; + _showFrame = view.mma_showOnKeyWindow; _alpha = view.alpha; _hidden = view.hidden; + _ad_showing = _viewabilityResult.ad_showing; _isForground = ([UIApplication sharedApplication].applicationState==UIApplicationStateActive); _captureDate = [NSDate date]; - if(_frame.size.width * _frame.size.height == 0) { - _coverRate = 1; - } else { - _coverRate = 1 - (_showFrame.size.width * _showFrame.size.height) / (_frame.size.width * _frame.size.height); - } + + _coverRate = _viewabilityResult.cover_rate; +// if(_frame.size.width * _frame.size.height == 0) { +// _coverRate = 1; +// } else { +// +// _coverRate = 1 - (_showFrame.size.width * _showFrame.size.height) / (_frame.size.width * _frame.size.height); +// } } return self; } - (BOOL)isVisible { - return _showFrame.size.width > 0 && _showFrame.size.height > 0 && _hidden == NO && _alpha > 0.001 && _isForground;; + return _showFrame.size.width > 0 && _showFrame.size.height > 0 && _hidden == NO && _alpha > 0.001 && _isForground && !_viewabilityResult.ad_showing; } - (BOOL)isEqualFrame:(VAMonitorFrame *)frame { @@ -48,7 +62,7 @@ fabs(_alpha - frame.alpha) < 0.001 && _hidden == frame.hidden && _isForground == frame.isForground && - _coverRate == frame.coverRate) { + _coverRate == frame.coverRate && _ad_showing == frame.ad_showing) { return YES; } return NO; diff --git a/MobileTracking/Viewability/ViewabilityService.h b/MobileTracking/Viewability/ViewabilityService.h index 196f126b10269c14f5f5070d61f9f1f250d7ff36..34bdc41c881212fd8f73986d8784278242b78636 100644 --- a/MobileTracking/Viewability/ViewabilityService.h +++ b/MobileTracking/Viewability/ViewabilityService.h @@ -16,4 +16,6 @@ - (void)addVAMonitor:(VAMonitor *)monitor; - (void)processCacheMonitorsWithDelegate:(id )delegate; - (void)stopVAMonitor:(NSString *)monitorKey; +- (void)setVAMonitorVisible:(NSString *)monitorKey; + @end diff --git a/MobileTracking/Viewability/ViewabilityService.m b/MobileTracking/Viewability/ViewabilityService.m index 9ddc0fe9df9f66b8f4dabf3f3350770a69f4464a..f66051c5fcd3456b6078b3cc673d0f2cf40344d5 100644 --- a/MobileTracking/Viewability/ViewabilityService.m +++ b/MobileTracking/Viewability/ViewabilityService.m @@ -136,6 +136,21 @@ static const char *view_capture_queue = "adview.capture.queue"; }); } +- (void)setVAMonitorVisible:(NSString *)monitorKey { + dispatch_async(_monitorQueue, ^{ + VAMonitor *exitMonitor = _monitors[monitorKey]; + if (exitMonitor) { + NSLog(@"Key:%@ 广告存在停止监测",monitorKey); + [exitMonitor setValidExpose]; + exitMonitor.status = VAMonitorStatusWaitingUpload; + exitMonitor.progressStatus = VAProgressStatusEnd; + dispatch_async(_captureQueue, ^{ + [exitMonitor stopAndUpload]; + }); + } + }); +} + - (void)saveMonitors { @try { dispatch_barrier_sync(_captureQueue, ^{ diff --git a/MobileTracking/build.sh b/MobileTracking/build.sh index be1acb3555fb5cc1ffc2e30f55f1d7ea751fe706..55009cff5ea30947396281fbe2316ff7664dcfa0 100755 --- a/MobileTracking/build.sh +++ b/MobileTracking/build.sh @@ -11,19 +11,19 @@ iphonesimulator_path=${UNIVERSAL_OUTPUTFOLDER}/${CONFIGURATION}-iphonesimulator ${$targetName:?"mush set targetName"} xcodebuild -target $targetName clean # clean project -xcodebuild -target $targetName -sdk iphoneos12.0 # build iphoneos +xcodebuild -target $targetName -sdk iphoneos12.2 # build iphoneos #build iphonesimulator -xcodebuild -target $targetName -configuration ${CONFIGURATION} -sdk iphonesimulator12.0 -arch x86_64 -arch i386 +xcodebuild -target $targetName -configuration ${CONFIGURATION} -sdk iphonesimulator12.2 -arch x86_64 -arch i386 if [ ! -d "$universal_path" ]; then #判断文件是否存在 不存在创建 中括号两边要空格 - mkdir "$universal_path" +mkdir "$universal_path" fi -echo +echo # 合并版本库 -lipo -create -output "${universal_path}/${PROJECT_NAME}" "${iphoneos_path}/${PROJECT_NAME}" "${iphonesimulator_path}/${PROJECT_NAME}" +lipo -create -output "${universal_path}/${PROJECT_NAME}" "${iphoneos_path}/${PROJECT_NAME}" "${iphonesimulator_path}/${PROJECT_NAME}" cp -R "${iphoneos_path}/include" "$universal_path/" # open $universal_path -echo 'build complete' \ No newline at end of file +echo 'build complete' diff --git a/OutputRelease/MobileTracking.h b/OutputRelease/MobileTracking.h old mode 100755 new mode 100644 index 384b68d9d1fc054ca530deaaaba1a0c7a0733efc..753766f47edc7000f2e2282e8cee9452ee43fa95 --- a/OutputRelease/MobileTracking.h +++ b/OutputRelease/MobileTracking.h @@ -6,7 +6,7 @@ // Copyright (c) 2014年 Admaster. All rights reserved. // -//#define MMA_SDK_VERSION @"V2.0.2" +//#define MMA_SDK_VERSION @"V2.1.0" #import @@ -23,8 +23,12 @@ // 点击 - (void)click:(NSString *)url; -// 普通曝光 -- (void)view:(NSString *)url; +/* 普通曝光 + url:监测的链接 + adView:监测的广告视图对象 + impressionType:曝光类型。Tracked Ads:0;曝光:1 + */ +- (void)view:(NSString *)url ad:(UIView *)adView impressionType:(NSInteger)type; // 可视化监测曝光 - (void)view:(NSString *)url ad:(UIView *)adView; diff --git a/OutputRelease/libMobileTracking.a b/OutputRelease/libMobileTracking.a index 6c8da27cd2fc758f81d1eeb9dc4402f5045146dd..3673dfb0f194a9e7944b6e75acd507d468a4160f 100644 Binary files a/OutputRelease/libMobileTracking.a and b/OutputRelease/libMobileTracking.a differ diff --git a/OutputRelease/sdkconfig.xml b/OutputRelease/sdkconfig.xml index 0f0931760fb80a5bde8bd42f8e6e95ded163a518..d46bf37c6d1eb27affbe55ef93b174bd26903780 100644 --- a/OutputRelease/sdkconfig.xml +++ b/OutputRelease/sdkconfig.xml @@ -2,17 +2,17 @@ - - + + - + 0 60 60 - + @@ -28,23 +28,23 @@ 20 - + admaster - + - + admaster.com.cn - + @@ -52,8 +52,7 @@ 0b - - + true @@ -61,7 +60,7 @@ 259200 0 - + @@ -73,18 +72,18 @@ md5 - + - - - - - - - - + + + https://p.attri.mobi/a + + 24 + + true + - + @@ -176,7 +175,7 @@ true true - + @@ -228,7 +227,7 @@ true - + @@ -244,8 +243,8 @@ true - - + + @@ -255,10 +254,10 @@ false - + - + ImpressionID @@ -266,7 +265,7 @@ true true - + @@ -353,7 +352,7 @@ true - + @@ -398,7 +397,7 @@ true - + - + - + , @@ -421,7 +420,7 @@ true - + miaozhen @@ -442,78 +441,107 @@ 604800 1 + md5 raw md5 md5 - - - - - - - + + + + + /apl/ + + 24 + false + + OS mo true true + TS mt true true + MAC m6a true true + IDFA m5 true true + IMEI m2 true true + RAWIMEI m3 true true + ANDROIDID m1a true true + + + + OAID + m11 + true + true + + + + + ADID + m10 + true + true + + WIFI mw true true + AKEY mp true true + ANAME mn @@ -521,6 +549,7 @@ true + SCWH mh @@ -541,36 +570,42 @@ true true + OPENUDID m0 true true + TERM md true true + OSVS me true true + LBS mm true true + SDKVS mv true true + REDIRECTURL o @@ -580,6 +615,7 @@ + start mb=start @@ -592,6 +628,7 @@ true + Adplacement @@ -601,123 +638,161 @@ + ImpressionID vf true true + + + ImpressionType + br + true + true + + AdviewabilityRecord va true true + AdviewabilityEvents vd true true + AdviewabilityTime 1 true true + AdviewabilityFrame 2 true true + AdviewabilityPoint 3 true true + AdviewabilityAlpha 4 true true + AdviewabilityShown 5 true true + AdviewabilityCoverRate 6 true true + AdviewabilityShowFrame 7 true true + AdviewabilityForground 8 true true + AdviewabilityResult vx true true + AdviewabilityConfigArea vh true true + AdviewabilityConfigThreshold vi true true + AdviewabilityVideoDuration vb true true + AdviewabilityVideoProgress vc true true + AdviewabilityVideoPlayType vg true true + AdviewabilityVideoProgressPoint vj true true + + + + AdviewabilityStrongInteract + vk + true + true + + & + + https://g.cn.miaozhen.com/x/k=adid + = + true - + girdsum @@ -755,63 +830,63 @@ true true - + TS ts true true - + MAC m true true - + IDFA if true true - + IMEI im true true - + ANDROIDID aid true true - + WIFI wifi true true - + AKEY ak true true - + ANAME an true true - + SCWH @@ -819,56 +894,56 @@ true true - + OPENUDID oid true true - + ODIN odin true true - + TERM term true true - + OSVS osvs true true - + LBS lbs true true - + MUID mid true true - + MUDS muds true true - + REDIRECTURL u @@ -896,7 +971,7 @@ true - + @@ -906,7 +981,7 @@ false - + @@ -1001,7 +1076,7 @@ true - + @@ -1053,8 +1128,8 @@ true - - + + adbug @@ -1089,28 +1164,28 @@ true true - + TS t true true - + MAC n true true - + IDFA z true true - + IDFAMD5 0j @@ -1123,21 +1198,21 @@ true true - + WIFI w true true - + AKEY x true true - + ANAME y @@ -1151,7 +1226,7 @@ true true - + OPENUDID o @@ -1164,14 +1239,14 @@ true true - + OSVS q true true - + LBS l @@ -1212,9 +1287,9 @@ false false - + - + ImpressionID @@ -1222,7 +1297,7 @@ true true - + AdviewabilityEvents 2j @@ -1295,7 +1370,7 @@ true true - + @@ -1304,8 +1379,8 @@ true - - + + rtbasia @@ -1333,12 +1408,12 @@ raw @@ -1486,6 +1561,13 @@ true true + + + ImpressionType + rbtr + true + true + AdviewabilityRecord vrc @@ -1596,6 +1678,7 @@ true - + + diff --git a/README.md b/README.md index 216daf2d417d19b8fec9ca19e0c2f81c53f9a67e..0500d1b35b85c46cbe770b536de1e7d96ea81818 100755 --- a/README.md +++ b/README.md @@ -6,23 +6,23 @@ 2. 在项目工程 App 的 Target Build Settings 中的 **Other Linker Flags** 选项里添加 **-lxml2** **-all_load** 或 **-lxml2** **-force_load** 静态库的绝对路径 3. 添加SDK需要的Framework 在需要添加SDK的项目的 Xcode 开发环境中选择 TARGETS-->Build Phases-->Link Binary With Libraries--> + 添加以下framework框架: + ``` CoreLocation.framework libxml2.2.tbd - AdSupport.framework - CoreTelephony.framework - SystemConfiguration.framework - + AdSupport.framework + CoreTelephony.framework + SystemConfiguration.framework ``` ### 步骤2:配置文件sdkconfig.xml的使用方法 -在使用的文件中引用 **#import "MobileTracking.h"**. +在使用的文件中引用 +**#import "MobileTracking.h"**. 使用说明: #### 1、初始化方法 - 在进行监测之前,必须进行初始化,通过以上的代码进行初始化操作 ``` @@ -42,47 +42,53 @@ SDK 会自动下载远程的配置文件,使用最新的配置文件进行参 通过调用以下的代码进行曝光的监测, - * 第一个参数为第三方公司的监测地址 - * 第二个参数为当前广告视图对象(**可视化广告监测为必传字段,普通广告监测默认缺省。**) - * 第三个参数为当前视频广告的播放类型(**视频可视化广告监测为可选字段,1-自动播放,2-手动播放,0-无法识别。**) + * view:参数为第三方公司的监测地址 + * ad:参数为当前广告视图对象(**可视化广告监测为必传字段,普通广告监测默认缺省。**) + * videoPlayType:参数为当前视频广告的播放类型(**视频可视化广告监测为可选字段,1-自动播放,2-手动播放,0-无法识别。**) + * impressionType:参数为曝光的类型。(**普通广告监测的类型为必选字段,0-Tracked ads,1-曝光**) -普通广告监测 +3.1 曝光监测 ``` -[[MobileTracking sharedInstance] view:@"http://example.com/xxxxxx”]; +// impressionType=1 表示这是曝光监测。此时如果传0,表示这是Tracked ads监测 +[[MobileTracking sharedInstance] view:@"http://example.com/xxxxxx” ad:adView impressionType:1]; ``` -可见性广告监测 -``` -[[MobileTracking sharedInstance] view:@"http://example.com/xxxxxx” ad:adview]; +  备注:SDK曝光监测接口现已升级为曝光/Track Ads接口, 支持曝光或Tracked Ads监测。 +    1、曝光的定义:只有广告物料已经加载在客户端并至少已经开始渲染(Begin to render,简称BtR)时,才应称之为“曝光”事件。“渲染”指的是绘制物料的过程,或者指将物料添加到文档对象模型的过程。 +    2、Tracked Ads的定义:当监测代码已经下载到客户端时(即便广告不一定渲染),称该事件为“Tracked Ads”事件。 +    开发者应根据广告实际展示情况,选择调用曝光或Tracked Ads监测,详细调用过程如上面的示例。如果进行曝光调用,则SDK会查验传入的广告View对象是否已开始渲染,如果是,则SDK会向监测方发出曝光上报;如果不是,则SDK会向监测方发出Tracked Ads上报。如果进行Tracked Ads调用,则SDK会直接向监测方发出Tracked Ads上报。 -``` -视频可见性广告监测 +3.2 可见性广告监测 ``` -[[MobileTracking sharedInstance] viewVideo:@"http://example.com/xxxxxx” ad:adview]; +[[MobileTracking sharedInstance] view:@"http://example.com/xxxxxx” ad:adview]; ``` +  备注:对广告进行可见性监测时,广告必须是满足开始渲染(Begin to render,简称BtR)条件的合法曝光,否则SDK不会执行可见监测。在调用可见曝光监测接口时,SDK会查验传入的广告View对象是否已开始渲染,如果是,则SDK会向监测方发出曝光上报,并继续进行可见监测,直到满足可见/不可见条件,再结束可见监测流程;如果不是,则SDK会向监测方发出Tracked Ads上报,并结束可见监测流程。 + +3.3 视频可见性广告监测 + ``` [[MobileTracking sharedInstance] viewVideo:@"http://example.com/xxxxxx” ad:adview videoPlayType:type]; ``` -可见性广告JS监测 +3.4 可见性广告JS监测 ``` [[MobileTracking sharedInstance] jsView:@"http://example.com/xxxxxx” ad:adview]; ``` -视频可见性广告JS监测 +3.5 视频可见性广告JS监测 ``` [[MobileTracking sharedInstance] jsViewVideo:@"http://example.com/xxxxxx” ad:adview]; ``` -可见性广告监测停止,广告播放结束时调用 +3.6 可见性广告监测停止,广告播放结束时调用 ``` [[MobileTracking sharedInstance] stop:@"http://example.com/xxxxxx”]; diff --git "a/\347\211\271\345\210\253\347\211\210/Bitcode/iphoneos/libMobileTracking.a" "b/\347\211\271\345\210\253\347\211\210/Bitcode/iphoneos/libMobileTracking.a" new file mode 100644 index 0000000000000000000000000000000000000000..3673dfb0f194a9e7944b6e75acd507d468a4160f Binary files /dev/null and "b/\347\211\271\345\210\253\347\211\210/Bitcode/iphoneos/libMobileTracking.a" differ diff --git "a/\347\211\271\345\210\253\347\211\210/Bitcode/iphonesimulator/libMobileTracking.a" "b/\347\211\271\345\210\253\347\211\210/Bitcode/iphonesimulator/libMobileTracking.a" new file mode 100644 index 0000000000000000000000000000000000000000..15eb37b8e2aeb4a0f17ba60ee00377a93639c7af Binary files /dev/null and "b/\347\211\271\345\210\253\347\211\210/Bitcode/iphonesimulator/libMobileTracking.a" differ diff --git "a/\347\211\271\345\210\253\347\211\210/Bitcode/universal/libMobileTracking.a" "b/\347\211\271\345\210\253\347\211\210/Bitcode/universal/libMobileTracking.a" new file mode 100644 index 0000000000000000000000000000000000000000..3673dfb0f194a9e7944b6e75acd507d468a4160f Binary files /dev/null and "b/\347\211\271\345\210\253\347\211\210/Bitcode/universal/libMobileTracking.a" differ diff --git "a/\347\211\271\345\210\253\347\211\210/noBitcode/iphoneos/libMobileTracking.a" "b/\347\211\271\345\210\253\347\211\210/noBitcode/iphoneos/libMobileTracking.a" new file mode 100644 index 0000000000000000000000000000000000000000..f9ebd4fed98a52a08ee27e42ba1e33309a6568e5 Binary files /dev/null and "b/\347\211\271\345\210\253\347\211\210/noBitcode/iphoneos/libMobileTracking.a" differ diff --git "a/\347\211\271\345\210\253\347\211\210/noBitcode/iphonesimulator/libMobileTracking.a" "b/\347\211\271\345\210\253\347\211\210/noBitcode/iphonesimulator/libMobileTracking.a" new file mode 100644 index 0000000000000000000000000000000000000000..33c803c6adf58e0ccbbb96ac3aeea87024f84b9c Binary files /dev/null and "b/\347\211\271\345\210\253\347\211\210/noBitcode/iphonesimulator/libMobileTracking.a" differ diff --git "a/\347\211\271\345\210\253\347\211\210/noBitcode/universal/libMobileTracking.a" "b/\347\211\271\345\210\253\347\211\210/noBitcode/universal/libMobileTracking.a" new file mode 100644 index 0000000000000000000000000000000000000000..ed10c3a54410fe19d6d787dfae76e7382880c315 Binary files /dev/null and "b/\347\211\271\345\210\253\347\211\210/noBitcode/universal/libMobileTracking.a" differ