diff --git a/.swiftlint.yml b/.swiftlint.yml new file mode 100644 index 0000000..918c5e6 --- /dev/null +++ b/.swiftlint.yml @@ -0,0 +1,57 @@ + +included: +- Trackable +- TrackableExample +- TrackableTests + +whitelist_rules: +- trailing_newline +- vertical_whitespace +- type_name +- type_body_length +- trailing_semicolon +- statement_position +- redundant_nil_coalesing +- overridden_super_call +- operator_whitespace +- opening_brace +- nesting +- mark +- legacy_constant +- legacy_constructor +- legacy_cggeometry_functions +- function_body_length +- force_try +- explicit_init +- empty_count +- control_statement +- conditional_returns_on_newline +- comma +- colon +- closure_spacing +- custom_rules +- xcode_default_file_header +- prohibited_super_call +- redundant_nil_coalescing +- redundant_string_enum_value +- return_arrow_whitespace +- syntactic_sugar +- todo +- trailing_comma +- unused_closure_parameter +- unused_enumerated +- valid_docs +- valid_ibinspectable +- void_return +- weak_delegate +- closing_brace +- closure_parameter_position +- dynamic_inline +- empty_parameters +- empty_parentheses_with_trailing_closure +- file_length +- function_parameter_count +- implicit_getter +- leading_whitespace +- legacy_nsgeometry_functions +- nimble_operator diff --git a/.travis.yml b/.travis.yml index a077a15..2dc7fdb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,10 +1,10 @@ language: objective-c -osx_image: xcode7.1 +osx_image: xcode8.2 before_install: - gem install xcpretty --no-rdoc --no-ri --no-document --quiet -script: +script: - set -o pipefail && xcodebuild -scheme Trackable -workspace Trackable.xcworkspace -enableCodeCoverage YES -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 6S,OS=9.1' build test | xcpretty after_success: diff --git a/Podfile b/Podfile index 7512f5e..3a3ef2b 100644 --- a/Podfile +++ b/Podfile @@ -1,9 +1,9 @@ -platform :ios, '8.0' +platform :ios, '9.0' use_frameworks! target 'TrackableTests' do - pod 'Quick', '~> 0.8.0' - pod 'Nimble', '3.0.0' + pod 'Quick' + pod 'Nimble' end target 'TrackableExample' do diff --git a/Podfile.lock b/Podfile.lock index 147d1e5..3810c9b 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -1,18 +1,20 @@ PODS: - - Mixpanel (2.9.1): - - Mixpanel/Mixpanel (= 2.9.1) - - Mixpanel/Mixpanel (2.9.1) - - Nimble (3.0.0) - - Quick (0.8.0) + - Mixpanel (3.0.8): + - Mixpanel/Mixpanel (= 3.0.8) + - Mixpanel/Mixpanel (3.0.8) + - Nimble (5.1.1) + - Quick (1.0.0) DEPENDENCIES: - Mixpanel - - Nimble (= 3.0.0) - - Quick (~> 0.8.0) + - Nimble + - Quick SPEC CHECKSUMS: - Mixpanel: 5ca24b2a05f4c77fe9bcfe7671d681d0f3f8d76f - Nimble: 4c353d43735b38b545cbb4cb91504588eb5de926 - Quick: 563d0f6ec5f72e394645adb377708639b7dd38ab + Mixpanel: 550a23d5dd95f8e9cda21e697661ffddbc8da46b + Nimble: 415e3aa3267e7bc2c96b05fa814ddea7bb686a29 + Quick: 8024e4a47e6cc03a9d5245ef0948264fc6d27cff -COCOAPODS: 0.39.0 +PODFILE CHECKSUM: 031fe2fe8b28f8440262c2a0de4ecf774036cd62 + +COCOAPODS: 1.2.0.beta.3 diff --git a/Pods/Headers/Private/Mixpanel/MPABTestDesignerChangeRequestMessage.h b/Pods/Headers/Private/Mixpanel/MPABTestDesignerChangeRequestMessage.h deleted file mode 120000 index 742d7ab..0000000 --- a/Pods/Headers/Private/Mixpanel/MPABTestDesignerChangeRequestMessage.h +++ /dev/null @@ -1 +0,0 @@ -../../../Mixpanel/Mixpanel/MPABTestDesignerChangeRequestMessage.h \ No newline at end of file diff --git a/Pods/Headers/Private/Mixpanel/MPABTestDesignerChangeResponseMessage.h b/Pods/Headers/Private/Mixpanel/MPABTestDesignerChangeResponseMessage.h deleted file mode 120000 index ad4107e..0000000 --- a/Pods/Headers/Private/Mixpanel/MPABTestDesignerChangeResponseMessage.h +++ /dev/null @@ -1 +0,0 @@ -../../../Mixpanel/Mixpanel/MPABTestDesignerChangeResponseMessage.h \ No newline at end of file diff --git a/Pods/Headers/Private/Mixpanel/MPABTestDesignerClearRequestMessage.h b/Pods/Headers/Private/Mixpanel/MPABTestDesignerClearRequestMessage.h deleted file mode 120000 index 82be650..0000000 --- a/Pods/Headers/Private/Mixpanel/MPABTestDesignerClearRequestMessage.h +++ /dev/null @@ -1 +0,0 @@ -../../../Mixpanel/Mixpanel/MPABTestDesignerClearRequestMessage.h \ No newline at end of file diff --git a/Pods/Headers/Private/Mixpanel/MPABTestDesignerClearResponseMessage.h b/Pods/Headers/Private/Mixpanel/MPABTestDesignerClearResponseMessage.h deleted file mode 120000 index e1dbeba..0000000 --- a/Pods/Headers/Private/Mixpanel/MPABTestDesignerClearResponseMessage.h +++ /dev/null @@ -1 +0,0 @@ -../../../Mixpanel/Mixpanel/MPABTestDesignerClearResponseMessage.h \ No newline at end of file diff --git a/Pods/Headers/Private/Mixpanel/MPABTestDesignerConnection.h b/Pods/Headers/Private/Mixpanel/MPABTestDesignerConnection.h deleted file mode 120000 index 24265d9..0000000 --- a/Pods/Headers/Private/Mixpanel/MPABTestDesignerConnection.h +++ /dev/null @@ -1 +0,0 @@ -../../../Mixpanel/Mixpanel/MPABTestDesignerConnection.h \ No newline at end of file diff --git a/Pods/Headers/Private/Mixpanel/MPABTestDesignerDeviceInfoRequestMessage.h b/Pods/Headers/Private/Mixpanel/MPABTestDesignerDeviceInfoRequestMessage.h deleted file mode 120000 index f8f487d..0000000 --- a/Pods/Headers/Private/Mixpanel/MPABTestDesignerDeviceInfoRequestMessage.h +++ /dev/null @@ -1 +0,0 @@ -../../../Mixpanel/Mixpanel/MPABTestDesignerDeviceInfoRequestMessage.h \ No newline at end of file diff --git a/Pods/Headers/Private/Mixpanel/MPABTestDesignerDeviceInfoResponseMessage.h b/Pods/Headers/Private/Mixpanel/MPABTestDesignerDeviceInfoResponseMessage.h deleted file mode 120000 index ec1c62a..0000000 --- a/Pods/Headers/Private/Mixpanel/MPABTestDesignerDeviceInfoResponseMessage.h +++ /dev/null @@ -1 +0,0 @@ -../../../Mixpanel/Mixpanel/MPABTestDesignerDeviceInfoResponseMessage.h \ No newline at end of file diff --git a/Pods/Headers/Private/Mixpanel/MPABTestDesignerDisconnectMessage.h b/Pods/Headers/Private/Mixpanel/MPABTestDesignerDisconnectMessage.h deleted file mode 120000 index 7c20a85..0000000 --- a/Pods/Headers/Private/Mixpanel/MPABTestDesignerDisconnectMessage.h +++ /dev/null @@ -1 +0,0 @@ -../../../Mixpanel/Mixpanel/MPABTestDesignerDisconnectMessage.h \ No newline at end of file diff --git a/Pods/Headers/Private/Mixpanel/MPABTestDesignerMessage.h b/Pods/Headers/Private/Mixpanel/MPABTestDesignerMessage.h deleted file mode 120000 index 0f62cb1..0000000 --- a/Pods/Headers/Private/Mixpanel/MPABTestDesignerMessage.h +++ /dev/null @@ -1 +0,0 @@ -../../../Mixpanel/Mixpanel/MPABTestDesignerMessage.h \ No newline at end of file diff --git a/Pods/Headers/Private/Mixpanel/MPABTestDesignerSnapshotRequestMessage.h b/Pods/Headers/Private/Mixpanel/MPABTestDesignerSnapshotRequestMessage.h deleted file mode 120000 index a0c663d..0000000 --- a/Pods/Headers/Private/Mixpanel/MPABTestDesignerSnapshotRequestMessage.h +++ /dev/null @@ -1 +0,0 @@ -../../../Mixpanel/Mixpanel/MPABTestDesignerSnapshotRequestMessage.h \ No newline at end of file diff --git a/Pods/Headers/Private/Mixpanel/MPABTestDesignerSnapshotResponseMessage.h b/Pods/Headers/Private/Mixpanel/MPABTestDesignerSnapshotResponseMessage.h deleted file mode 120000 index 0a007da..0000000 --- a/Pods/Headers/Private/Mixpanel/MPABTestDesignerSnapshotResponseMessage.h +++ /dev/null @@ -1 +0,0 @@ -../../../Mixpanel/Mixpanel/MPABTestDesignerSnapshotResponseMessage.h \ No newline at end of file diff --git a/Pods/Headers/Private/Mixpanel/MPABTestDesignerTweakRequestMessage.h b/Pods/Headers/Private/Mixpanel/MPABTestDesignerTweakRequestMessage.h deleted file mode 120000 index b3d47a8..0000000 --- a/Pods/Headers/Private/Mixpanel/MPABTestDesignerTweakRequestMessage.h +++ /dev/null @@ -1 +0,0 @@ -../../../Mixpanel/Mixpanel/MPABTestDesignerTweakRequestMessage.h \ No newline at end of file diff --git a/Pods/Headers/Private/Mixpanel/MPABTestDesignerTweakResponseMessage.h b/Pods/Headers/Private/Mixpanel/MPABTestDesignerTweakResponseMessage.h deleted file mode 120000 index f6b028b..0000000 --- a/Pods/Headers/Private/Mixpanel/MPABTestDesignerTweakResponseMessage.h +++ /dev/null @@ -1 +0,0 @@ -../../../Mixpanel/Mixpanel/MPABTestDesignerTweakResponseMessage.h \ No newline at end of file diff --git a/Pods/Headers/Private/Mixpanel/MPAbstractABTestDesignerMessage.h b/Pods/Headers/Private/Mixpanel/MPAbstractABTestDesignerMessage.h deleted file mode 120000 index b04e699..0000000 --- a/Pods/Headers/Private/Mixpanel/MPAbstractABTestDesignerMessage.h +++ /dev/null @@ -1 +0,0 @@ -../../../Mixpanel/Mixpanel/MPAbstractABTestDesignerMessage.h \ No newline at end of file diff --git a/Pods/Headers/Private/Mixpanel/MPApplicationStateSerializer.h b/Pods/Headers/Private/Mixpanel/MPApplicationStateSerializer.h deleted file mode 120000 index 74780b9..0000000 --- a/Pods/Headers/Private/Mixpanel/MPApplicationStateSerializer.h +++ /dev/null @@ -1 +0,0 @@ -../../../Mixpanel/Mixpanel/MPApplicationStateSerializer.h \ No newline at end of file diff --git a/Pods/Headers/Private/Mixpanel/MPClassDescription.h b/Pods/Headers/Private/Mixpanel/MPClassDescription.h deleted file mode 120000 index 0f4ff03..0000000 --- a/Pods/Headers/Private/Mixpanel/MPClassDescription.h +++ /dev/null @@ -1 +0,0 @@ -../../../Mixpanel/Mixpanel/MPClassDescription.h \ No newline at end of file diff --git a/Pods/Headers/Private/Mixpanel/MPDesignerEventBindingMessage.h b/Pods/Headers/Private/Mixpanel/MPDesignerEventBindingMessage.h deleted file mode 120000 index cdd6c18..0000000 --- a/Pods/Headers/Private/Mixpanel/MPDesignerEventBindingMessage.h +++ /dev/null @@ -1 +0,0 @@ -../../../Mixpanel/Mixpanel/MPDesignerEventBindingMessage.h \ No newline at end of file diff --git a/Pods/Headers/Private/Mixpanel/MPDesignerSessionCollection.h b/Pods/Headers/Private/Mixpanel/MPDesignerSessionCollection.h deleted file mode 120000 index bad4949..0000000 --- a/Pods/Headers/Private/Mixpanel/MPDesignerSessionCollection.h +++ /dev/null @@ -1 +0,0 @@ -../../../Mixpanel/Mixpanel/MPDesignerSessionCollection.h \ No newline at end of file diff --git a/Pods/Headers/Private/Mixpanel/MPEnumDescription.h b/Pods/Headers/Private/Mixpanel/MPEnumDescription.h deleted file mode 120000 index 2e78ea8..0000000 --- a/Pods/Headers/Private/Mixpanel/MPEnumDescription.h +++ /dev/null @@ -1 +0,0 @@ -../../../Mixpanel/Mixpanel/MPEnumDescription.h \ No newline at end of file diff --git a/Pods/Headers/Private/Mixpanel/MPEventBinding.h b/Pods/Headers/Private/Mixpanel/MPEventBinding.h deleted file mode 120000 index f092b4a..0000000 --- a/Pods/Headers/Private/Mixpanel/MPEventBinding.h +++ /dev/null @@ -1 +0,0 @@ -../../../Mixpanel/Mixpanel/MPEventBinding.h \ No newline at end of file diff --git a/Pods/Headers/Private/Mixpanel/MPLogger.h b/Pods/Headers/Private/Mixpanel/MPLogger.h deleted file mode 120000 index 6f738dd..0000000 --- a/Pods/Headers/Private/Mixpanel/MPLogger.h +++ /dev/null @@ -1 +0,0 @@ -../../../Mixpanel/Mixpanel/MPLogger.h \ No newline at end of file diff --git a/Pods/Headers/Private/Mixpanel/MPNotification.h b/Pods/Headers/Private/Mixpanel/MPNotification.h deleted file mode 120000 index e4beab8..0000000 --- a/Pods/Headers/Private/Mixpanel/MPNotification.h +++ /dev/null @@ -1 +0,0 @@ -../../../Mixpanel/Mixpanel/MPNotification.h \ No newline at end of file diff --git a/Pods/Headers/Private/Mixpanel/MPNotificationViewController.h b/Pods/Headers/Private/Mixpanel/MPNotificationViewController.h deleted file mode 120000 index 0207aff..0000000 --- a/Pods/Headers/Private/Mixpanel/MPNotificationViewController.h +++ /dev/null @@ -1 +0,0 @@ -../../../Mixpanel/Mixpanel/MPNotificationViewController.h \ No newline at end of file diff --git a/Pods/Headers/Private/Mixpanel/MPObjectIdentifierProvider.h b/Pods/Headers/Private/Mixpanel/MPObjectIdentifierProvider.h deleted file mode 120000 index 2c9adc4..0000000 --- a/Pods/Headers/Private/Mixpanel/MPObjectIdentifierProvider.h +++ /dev/null @@ -1 +0,0 @@ -../../../Mixpanel/Mixpanel/MPObjectIdentifierProvider.h \ No newline at end of file diff --git a/Pods/Headers/Private/Mixpanel/MPObjectIdentityProvider.h b/Pods/Headers/Private/Mixpanel/MPObjectIdentityProvider.h deleted file mode 120000 index 112f2e8..0000000 --- a/Pods/Headers/Private/Mixpanel/MPObjectIdentityProvider.h +++ /dev/null @@ -1 +0,0 @@ -../../../Mixpanel/Mixpanel/MPObjectIdentityProvider.h \ No newline at end of file diff --git a/Pods/Headers/Private/Mixpanel/MPObjectSelector.h b/Pods/Headers/Private/Mixpanel/MPObjectSelector.h deleted file mode 120000 index 34d9f66..0000000 --- a/Pods/Headers/Private/Mixpanel/MPObjectSelector.h +++ /dev/null @@ -1 +0,0 @@ -../../../Mixpanel/Mixpanel/MPObjectSelector.h \ No newline at end of file diff --git a/Pods/Headers/Private/Mixpanel/MPObjectSerializer.h b/Pods/Headers/Private/Mixpanel/MPObjectSerializer.h deleted file mode 120000 index 6122f97..0000000 --- a/Pods/Headers/Private/Mixpanel/MPObjectSerializer.h +++ /dev/null @@ -1 +0,0 @@ -../../../Mixpanel/Mixpanel/MPObjectSerializer.h \ No newline at end of file diff --git a/Pods/Headers/Private/Mixpanel/MPObjectSerializerConfig.h b/Pods/Headers/Private/Mixpanel/MPObjectSerializerConfig.h deleted file mode 120000 index 40fa3dd..0000000 --- a/Pods/Headers/Private/Mixpanel/MPObjectSerializerConfig.h +++ /dev/null @@ -1 +0,0 @@ -../../../Mixpanel/Mixpanel/MPObjectSerializerConfig.h \ No newline at end of file diff --git a/Pods/Headers/Private/Mixpanel/MPObjectSerializerContext.h b/Pods/Headers/Private/Mixpanel/MPObjectSerializerContext.h deleted file mode 120000 index 8306145..0000000 --- a/Pods/Headers/Private/Mixpanel/MPObjectSerializerContext.h +++ /dev/null @@ -1 +0,0 @@ -../../../Mixpanel/Mixpanel/MPObjectSerializerContext.h \ No newline at end of file diff --git a/Pods/Headers/Private/Mixpanel/MPPropertyDescription.h b/Pods/Headers/Private/Mixpanel/MPPropertyDescription.h deleted file mode 120000 index 09a69e9..0000000 --- a/Pods/Headers/Private/Mixpanel/MPPropertyDescription.h +++ /dev/null @@ -1 +0,0 @@ -../../../Mixpanel/Mixpanel/MPPropertyDescription.h \ No newline at end of file diff --git a/Pods/Headers/Private/Mixpanel/MPSequenceGenerator.h b/Pods/Headers/Private/Mixpanel/MPSequenceGenerator.h deleted file mode 120000 index 1302843..0000000 --- a/Pods/Headers/Private/Mixpanel/MPSequenceGenerator.h +++ /dev/null @@ -1 +0,0 @@ -../../../Mixpanel/Mixpanel/MPSequenceGenerator.h \ No newline at end of file diff --git a/Pods/Headers/Private/Mixpanel/MPSurvey.h b/Pods/Headers/Private/Mixpanel/MPSurvey.h deleted file mode 120000 index 92d0680..0000000 --- a/Pods/Headers/Private/Mixpanel/MPSurvey.h +++ /dev/null @@ -1 +0,0 @@ -../../../Mixpanel/Mixpanel/MPSurvey.h \ No newline at end of file diff --git a/Pods/Headers/Private/Mixpanel/MPSurveyNavigationController.h b/Pods/Headers/Private/Mixpanel/MPSurveyNavigationController.h deleted file mode 120000 index 7bccdf9..0000000 --- a/Pods/Headers/Private/Mixpanel/MPSurveyNavigationController.h +++ /dev/null @@ -1 +0,0 @@ -../../../Mixpanel/Mixpanel/MPSurveyNavigationController.h \ No newline at end of file diff --git a/Pods/Headers/Private/Mixpanel/MPSurveyQuestion.h b/Pods/Headers/Private/Mixpanel/MPSurveyQuestion.h deleted file mode 120000 index dd49cb5..0000000 --- a/Pods/Headers/Private/Mixpanel/MPSurveyQuestion.h +++ /dev/null @@ -1 +0,0 @@ -../../../Mixpanel/Mixpanel/MPSurveyQuestion.h \ No newline at end of file diff --git a/Pods/Headers/Private/Mixpanel/MPSurveyQuestionViewController.h b/Pods/Headers/Private/Mixpanel/MPSurveyQuestionViewController.h deleted file mode 120000 index 6fc6943..0000000 --- a/Pods/Headers/Private/Mixpanel/MPSurveyQuestionViewController.h +++ /dev/null @@ -1 +0,0 @@ -../../../Mixpanel/Mixpanel/MPSurveyQuestionViewController.h \ No newline at end of file diff --git a/Pods/Headers/Private/Mixpanel/MPSwizzler.h b/Pods/Headers/Private/Mixpanel/MPSwizzler.h deleted file mode 120000 index abed467..0000000 --- a/Pods/Headers/Private/Mixpanel/MPSwizzler.h +++ /dev/null @@ -1 +0,0 @@ -../../../Mixpanel/Mixpanel/MPSwizzler.h \ No newline at end of file diff --git a/Pods/Headers/Private/Mixpanel/MPTweak.h b/Pods/Headers/Private/Mixpanel/MPTweak.h deleted file mode 120000 index a8101c0..0000000 --- a/Pods/Headers/Private/Mixpanel/MPTweak.h +++ /dev/null @@ -1 +0,0 @@ -../../../Mixpanel/Mixpanel/MPTweak.h \ No newline at end of file diff --git a/Pods/Headers/Private/Mixpanel/MPTweakInline.h b/Pods/Headers/Private/Mixpanel/MPTweakInline.h deleted file mode 120000 index 2d8b4bb..0000000 --- a/Pods/Headers/Private/Mixpanel/MPTweakInline.h +++ /dev/null @@ -1 +0,0 @@ -../../../Mixpanel/Mixpanel/MPTweakInline.h \ No newline at end of file diff --git a/Pods/Headers/Private/Mixpanel/MPTweakInlineInternal.h b/Pods/Headers/Private/Mixpanel/MPTweakInlineInternal.h deleted file mode 120000 index 1d13b79..0000000 --- a/Pods/Headers/Private/Mixpanel/MPTweakInlineInternal.h +++ /dev/null @@ -1 +0,0 @@ -../../../Mixpanel/Mixpanel/MPTweakInlineInternal.h \ No newline at end of file diff --git a/Pods/Headers/Private/Mixpanel/MPTweakStore.h b/Pods/Headers/Private/Mixpanel/MPTweakStore.h deleted file mode 120000 index 1ab0ec5..0000000 --- a/Pods/Headers/Private/Mixpanel/MPTweakStore.h +++ /dev/null @@ -1 +0,0 @@ -../../../Mixpanel/Mixpanel/MPTweakStore.h \ No newline at end of file diff --git a/Pods/Headers/Private/Mixpanel/MPTypeDescription.h b/Pods/Headers/Private/Mixpanel/MPTypeDescription.h deleted file mode 120000 index ac5c3bd..0000000 --- a/Pods/Headers/Private/Mixpanel/MPTypeDescription.h +++ /dev/null @@ -1 +0,0 @@ -../../../Mixpanel/Mixpanel/MPTypeDescription.h \ No newline at end of file diff --git a/Pods/Headers/Private/Mixpanel/MPUIControlBinding.h b/Pods/Headers/Private/Mixpanel/MPUIControlBinding.h deleted file mode 120000 index e30360d..0000000 --- a/Pods/Headers/Private/Mixpanel/MPUIControlBinding.h +++ /dev/null @@ -1 +0,0 @@ -../../../Mixpanel/Mixpanel/MPUIControlBinding.h \ No newline at end of file diff --git a/Pods/Headers/Private/Mixpanel/MPUITableViewBinding.h b/Pods/Headers/Private/Mixpanel/MPUITableViewBinding.h deleted file mode 120000 index 8c9dbc9..0000000 --- a/Pods/Headers/Private/Mixpanel/MPUITableViewBinding.h +++ /dev/null @@ -1 +0,0 @@ -../../../Mixpanel/Mixpanel/MPUITableViewBinding.h \ No newline at end of file diff --git a/Pods/Headers/Private/Mixpanel/MPValueTransformers.h b/Pods/Headers/Private/Mixpanel/MPValueTransformers.h deleted file mode 120000 index ead98e3..0000000 --- a/Pods/Headers/Private/Mixpanel/MPValueTransformers.h +++ /dev/null @@ -1 +0,0 @@ -../../../Mixpanel/Mixpanel/MPValueTransformers.h \ No newline at end of file diff --git a/Pods/Headers/Private/Mixpanel/MPVariant.h b/Pods/Headers/Private/Mixpanel/MPVariant.h deleted file mode 120000 index 76f6ffd..0000000 --- a/Pods/Headers/Private/Mixpanel/MPVariant.h +++ /dev/null @@ -1 +0,0 @@ -../../../Mixpanel/Mixpanel/MPVariant.h \ No newline at end of file diff --git a/Pods/Headers/Private/Mixpanel/MPWebSocket.h b/Pods/Headers/Private/Mixpanel/MPWebSocket.h deleted file mode 120000 index 54b318a..0000000 --- a/Pods/Headers/Private/Mixpanel/MPWebSocket.h +++ /dev/null @@ -1 +0,0 @@ -../../../Mixpanel/Mixpanel/MPWebSocket.h \ No newline at end of file diff --git a/Pods/Headers/Private/Mixpanel/Mixpanel.h b/Pods/Headers/Private/Mixpanel/Mixpanel.h deleted file mode 120000 index 1f79002..0000000 --- a/Pods/Headers/Private/Mixpanel/Mixpanel.h +++ /dev/null @@ -1 +0,0 @@ -../../../Mixpanel/Mixpanel/Mixpanel.h \ No newline at end of file diff --git a/Pods/Headers/Private/Mixpanel/NSData+MPBase64.h b/Pods/Headers/Private/Mixpanel/NSData+MPBase64.h deleted file mode 120000 index 0264b3b..0000000 --- a/Pods/Headers/Private/Mixpanel/NSData+MPBase64.h +++ /dev/null @@ -1 +0,0 @@ -../../../Mixpanel/Mixpanel/NSData+MPBase64.h \ No newline at end of file diff --git a/Pods/Headers/Private/Mixpanel/NSInvocation+MPHelpers.h b/Pods/Headers/Private/Mixpanel/NSInvocation+MPHelpers.h deleted file mode 120000 index 0f46ae5..0000000 --- a/Pods/Headers/Private/Mixpanel/NSInvocation+MPHelpers.h +++ /dev/null @@ -1 +0,0 @@ -../../../Mixpanel/Mixpanel/NSInvocation+MPHelpers.h \ No newline at end of file diff --git a/Pods/Headers/Private/Mixpanel/UIColor+MPColor.h b/Pods/Headers/Private/Mixpanel/UIColor+MPColor.h deleted file mode 120000 index a5d755c..0000000 --- a/Pods/Headers/Private/Mixpanel/UIColor+MPColor.h +++ /dev/null @@ -1 +0,0 @@ -../../../Mixpanel/Mixpanel/UIColor+MPColor.h \ No newline at end of file diff --git a/Pods/Headers/Private/Mixpanel/UIImage+MPAverageColor.h b/Pods/Headers/Private/Mixpanel/UIImage+MPAverageColor.h deleted file mode 120000 index b5badcd..0000000 --- a/Pods/Headers/Private/Mixpanel/UIImage+MPAverageColor.h +++ /dev/null @@ -1 +0,0 @@ -../../../Mixpanel/Mixpanel/UIImage+MPAverageColor.h \ No newline at end of file diff --git a/Pods/Headers/Private/Mixpanel/UIImage+MPImageEffects.h b/Pods/Headers/Private/Mixpanel/UIImage+MPImageEffects.h deleted file mode 120000 index e5b7950..0000000 --- a/Pods/Headers/Private/Mixpanel/UIImage+MPImageEffects.h +++ /dev/null @@ -1 +0,0 @@ -../../../Mixpanel/Mixpanel/UIImage+MPImageEffects.h \ No newline at end of file diff --git a/Pods/Headers/Private/Mixpanel/UIView+MPHelpers.h b/Pods/Headers/Private/Mixpanel/UIView+MPHelpers.h deleted file mode 120000 index 18ac380..0000000 --- a/Pods/Headers/Private/Mixpanel/UIView+MPHelpers.h +++ /dev/null @@ -1 +0,0 @@ -../../../Mixpanel/Mixpanel/UIView+MPHelpers.h \ No newline at end of file diff --git a/Pods/Headers/Private/Mixpanel/_MPTweakBindObserver.h b/Pods/Headers/Private/Mixpanel/_MPTweakBindObserver.h deleted file mode 120000 index 90812e6..0000000 --- a/Pods/Headers/Private/Mixpanel/_MPTweakBindObserver.h +++ /dev/null @@ -1 +0,0 @@ -../../../Mixpanel/Mixpanel/_MPTweakBindObserver.h \ No newline at end of file diff --git a/Pods/Headers/Private/Nimble/DSL.h b/Pods/Headers/Private/Nimble/DSL.h deleted file mode 120000 index 0308fcd..0000000 --- a/Pods/Headers/Private/Nimble/DSL.h +++ /dev/null @@ -1 +0,0 @@ -../../../Nimble/Nimble/objc/DSL.h \ No newline at end of file diff --git a/Pods/Headers/Private/Nimble/NMBExceptionCapture.h b/Pods/Headers/Private/Nimble/NMBExceptionCapture.h deleted file mode 120000 index c86b6a1..0000000 --- a/Pods/Headers/Private/Nimble/NMBExceptionCapture.h +++ /dev/null @@ -1 +0,0 @@ -../../../Nimble/Nimble/objc/NMBExceptionCapture.h \ No newline at end of file diff --git a/Pods/Headers/Private/Nimble/Nimble.h b/Pods/Headers/Private/Nimble/Nimble.h deleted file mode 120000 index 06ace47..0000000 --- a/Pods/Headers/Private/Nimble/Nimble.h +++ /dev/null @@ -1 +0,0 @@ -../../../Nimble/Nimble/Nimble.h \ No newline at end of file diff --git a/Pods/Headers/Private/Quick/NSString+QCKSelectorName.h b/Pods/Headers/Private/Quick/NSString+QCKSelectorName.h deleted file mode 120000 index 0c5df21..0000000 --- a/Pods/Headers/Private/Quick/NSString+QCKSelectorName.h +++ /dev/null @@ -1 +0,0 @@ -../../../Quick/Quick/NSString+QCKSelectorName.h \ No newline at end of file diff --git a/Pods/Headers/Private/Quick/QCKDSL.h b/Pods/Headers/Private/Quick/QCKDSL.h deleted file mode 120000 index 08e04e9..0000000 --- a/Pods/Headers/Private/Quick/QCKDSL.h +++ /dev/null @@ -1 +0,0 @@ -../../../Quick/Quick/DSL/QCKDSL.h \ No newline at end of file diff --git a/Pods/Headers/Private/Quick/Quick.h b/Pods/Headers/Private/Quick/Quick.h deleted file mode 120000 index 16c22c2..0000000 --- a/Pods/Headers/Private/Quick/Quick.h +++ /dev/null @@ -1 +0,0 @@ -../../../Quick/Quick/Quick.h \ No newline at end of file diff --git a/Pods/Headers/Private/Quick/QuickConfiguration.h b/Pods/Headers/Private/Quick/QuickConfiguration.h deleted file mode 120000 index 2ae958e..0000000 --- a/Pods/Headers/Private/Quick/QuickConfiguration.h +++ /dev/null @@ -1 +0,0 @@ -../../../Quick/Quick/Configuration/QuickConfiguration.h \ No newline at end of file diff --git a/Pods/Headers/Private/Quick/QuickSpec.h b/Pods/Headers/Private/Quick/QuickSpec.h deleted file mode 120000 index 50bd82e..0000000 --- a/Pods/Headers/Private/Quick/QuickSpec.h +++ /dev/null @@ -1 +0,0 @@ -../../../Quick/Quick/QuickSpec.h \ No newline at end of file diff --git a/Pods/Headers/Private/Quick/World+DSL.h b/Pods/Headers/Private/Quick/World+DSL.h deleted file mode 120000 index 0e0c397..0000000 --- a/Pods/Headers/Private/Quick/World+DSL.h +++ /dev/null @@ -1 +0,0 @@ -../../../Quick/Quick/DSL/World+DSL.h \ No newline at end of file diff --git a/Pods/Headers/Private/Quick/World.h b/Pods/Headers/Private/Quick/World.h deleted file mode 120000 index 03dc4ee..0000000 --- a/Pods/Headers/Private/Quick/World.h +++ /dev/null @@ -1 +0,0 @@ -../../../Quick/Quick/World.h \ No newline at end of file diff --git a/Pods/Manifest.lock b/Pods/Manifest.lock index 147d1e5..3810c9b 100644 --- a/Pods/Manifest.lock +++ b/Pods/Manifest.lock @@ -1,18 +1,20 @@ PODS: - - Mixpanel (2.9.1): - - Mixpanel/Mixpanel (= 2.9.1) - - Mixpanel/Mixpanel (2.9.1) - - Nimble (3.0.0) - - Quick (0.8.0) + - Mixpanel (3.0.8): + - Mixpanel/Mixpanel (= 3.0.8) + - Mixpanel/Mixpanel (3.0.8) + - Nimble (5.1.1) + - Quick (1.0.0) DEPENDENCIES: - Mixpanel - - Nimble (= 3.0.0) - - Quick (~> 0.8.0) + - Nimble + - Quick SPEC CHECKSUMS: - Mixpanel: 5ca24b2a05f4c77fe9bcfe7671d681d0f3f8d76f - Nimble: 4c353d43735b38b545cbb4cb91504588eb5de926 - Quick: 563d0f6ec5f72e394645adb377708639b7dd38ab + Mixpanel: 550a23d5dd95f8e9cda21e697661ffddbc8da46b + Nimble: 415e3aa3267e7bc2c96b05fa814ddea7bb686a29 + Quick: 8024e4a47e6cc03a9d5245ef0948264fc6d27cff -COCOAPODS: 0.39.0 +PODFILE CHECKSUM: 031fe2fe8b28f8440262c2a0de4ecf774036cd62 + +COCOAPODS: 1.2.0.beta.3 diff --git a/Pods/Mixpanel/LICENSE b/Pods/Mixpanel/LICENSE index 2654c80..b2aa8c2 100644 --- a/Pods/Mixpanel/LICENSE +++ b/Pods/Mixpanel/LICENSE @@ -257,22 +257,3 @@ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -================================================================================ - -libMPCategoryHelpers.a (c) Mixpanel, Inc. 2014. - -Mixpanel grants you a limited, non-exclusive, non-transferable, -non-sublicenseable, revocable license to use the Software solely for your -internal use. You may not commercialize this Software for the benefit of any -third party. You may not decompile, disassemble, reverse engineer or otherwise -attempt to obtain or perceive the source code from which any software component -of the Software are compiled or interpreted, and you acknowledge that nothing -herein will be construed to grant you any right to obtain or use such code nor -create any derivative product from any of the foregoing, except with the prior -written consent of Mixpanel. Any dispute arising hereunder shall be submitted -to confidential binding arbitration in the County and City of San Francisco, -California for the maximum judgment enforceable, except that to the extent you -have in any manner violated or threatened to violate Mixplanel’s intellectual -property rights, Mixpanel may seek injunctive or other appropriate relief in -any state or federal court in the State of California. diff --git a/Pods/Mixpanel/Mixpanel/AutomaticEventsConstants.h b/Pods/Mixpanel/Mixpanel/AutomaticEventsConstants.h new file mode 100644 index 0000000..d442b16 --- /dev/null +++ b/Pods/Mixpanel/Mixpanel/AutomaticEventsConstants.h @@ -0,0 +1,17 @@ +// +// AutomaticEventsConstants.h +// Mixpanel +// +// Created by Sam Green on 3/22/16. +// Copyright © 2016 Mixpanel. All rights reserved. +// + +#import + +typedef NS_ENUM(NSUInteger, AutomaticEventMode) { + AutomaticEventModeNone, + AutomaticEventModeCount, +}; + +#pragma mark - Strings +static NSString *const kAutomaticEventName = @"$ios_event"; diff --git a/Pods/Mixpanel/Mixpanel/Media.xcassets/MPArrowLeft.imageset/MPArrowLeft.png b/Pods/Mixpanel/Mixpanel/Images/MPArrowLeft.png similarity index 100% rename from Pods/Mixpanel/Mixpanel/Media.xcassets/MPArrowLeft.imageset/MPArrowLeft.png rename to Pods/Mixpanel/Mixpanel/Images/MPArrowLeft.png diff --git a/Pods/Mixpanel/Mixpanel/Media.xcassets/MPArrowLeft.imageset/MPArrowLeft@2x.png b/Pods/Mixpanel/Mixpanel/Images/MPArrowLeft@2x.png similarity index 100% rename from Pods/Mixpanel/Mixpanel/Media.xcassets/MPArrowLeft.imageset/MPArrowLeft@2x.png rename to Pods/Mixpanel/Mixpanel/Images/MPArrowLeft@2x.png diff --git a/Pods/Mixpanel/Mixpanel/Media.xcassets/MPArrowRight.imageset/MPArrowRight.png b/Pods/Mixpanel/Mixpanel/Images/MPArrowRight.png similarity index 100% rename from Pods/Mixpanel/Mixpanel/Media.xcassets/MPArrowRight.imageset/MPArrowRight.png rename to Pods/Mixpanel/Mixpanel/Images/MPArrowRight.png diff --git a/Pods/Mixpanel/Mixpanel/Media.xcassets/MPArrowRight.imageset/MPArrowRight@2x.png b/Pods/Mixpanel/Mixpanel/Images/MPArrowRight@2x.png similarity index 100% rename from Pods/Mixpanel/Mixpanel/Media.xcassets/MPArrowRight.imageset/MPArrowRight@2x.png rename to Pods/Mixpanel/Mixpanel/Images/MPArrowRight@2x.png diff --git a/Pods/Mixpanel/Mixpanel/Media.xcassets/MPCheckmark.imageset/MPCheckmark.png b/Pods/Mixpanel/Mixpanel/Images/MPCheckmark.png similarity index 100% rename from Pods/Mixpanel/Mixpanel/Media.xcassets/MPCheckmark.imageset/MPCheckmark.png rename to Pods/Mixpanel/Mixpanel/Images/MPCheckmark.png diff --git a/Pods/Mixpanel/Mixpanel/Media.xcassets/MPCheckmark.imageset/MPCheckmark@2x.png b/Pods/Mixpanel/Mixpanel/Images/MPCheckmark@2x.png similarity index 100% rename from Pods/Mixpanel/Mixpanel/Media.xcassets/MPCheckmark.imageset/MPCheckmark@2x.png rename to Pods/Mixpanel/Mixpanel/Images/MPCheckmark@2x.png diff --git a/Pods/Mixpanel/Mixpanel/Images/MPCloseButton.png b/Pods/Mixpanel/Mixpanel/Images/MPCloseButton.png new file mode 100644 index 0000000..e4ab761 Binary files /dev/null and b/Pods/Mixpanel/Mixpanel/Images/MPCloseButton.png differ diff --git a/Pods/Mixpanel/Mixpanel/Images/MPCloseButton@2x.png b/Pods/Mixpanel/Mixpanel/Images/MPCloseButton@2x.png new file mode 100644 index 0000000..e710710 Binary files /dev/null and b/Pods/Mixpanel/Mixpanel/Images/MPCloseButton@2x.png differ diff --git a/Pods/Mixpanel/Mixpanel/Images/MPCloseButton@3x.png b/Pods/Mixpanel/Mixpanel/Images/MPCloseButton@3x.png new file mode 100644 index 0000000..6945afd Binary files /dev/null and b/Pods/Mixpanel/Mixpanel/Images/MPCloseButton@3x.png differ diff --git a/Pods/Mixpanel/Mixpanel/Media.xcassets/MPDismissKeyboard.imageset/MPDismissKeyboard.png b/Pods/Mixpanel/Mixpanel/Images/MPDismissKeyboard.png similarity index 100% rename from Pods/Mixpanel/Mixpanel/Media.xcassets/MPDismissKeyboard.imageset/MPDismissKeyboard.png rename to Pods/Mixpanel/Mixpanel/Images/MPDismissKeyboard.png diff --git a/Pods/Mixpanel/Mixpanel/Media.xcassets/MPDismissKeyboard.imageset/MPDismissKeyboard@2x.png b/Pods/Mixpanel/Mixpanel/Images/MPDismissKeyboard@2x.png similarity index 100% rename from Pods/Mixpanel/Mixpanel/Media.xcassets/MPDismissKeyboard.imageset/MPDismissKeyboard@2x.png rename to Pods/Mixpanel/Mixpanel/Images/MPDismissKeyboard@2x.png diff --git a/Pods/Mixpanel/Mixpanel/Media.xcassets/MPLogo.imageset/MPLogo.png b/Pods/Mixpanel/Mixpanel/Images/MPLogo.png similarity index 100% rename from Pods/Mixpanel/Mixpanel/Media.xcassets/MPLogo.imageset/MPLogo.png rename to Pods/Mixpanel/Mixpanel/Images/MPLogo.png diff --git a/Pods/Mixpanel/Mixpanel/Media.xcassets/MPLogo.imageset/MPLogo@2x.png b/Pods/Mixpanel/Mixpanel/Images/MPLogo@2x.png similarity index 100% rename from Pods/Mixpanel/Mixpanel/Media.xcassets/MPLogo.imageset/MPLogo@2x.png rename to Pods/Mixpanel/Mixpanel/Images/MPLogo@2x.png diff --git a/Pods/Mixpanel/Mixpanel/MPABTestDesignerChangeRequestMessage.m b/Pods/Mixpanel/Mixpanel/MPABTestDesignerChangeRequestMessage.m index 3b3cdc1..70310f5 100644 --- a/Pods/Mixpanel/Mixpanel/MPABTestDesignerChangeRequestMessage.m +++ b/Pods/Mixpanel/Mixpanel/MPABTestDesignerChangeRequestMessage.m @@ -13,7 +13,7 @@ @implementation MPABTestDesignerChangeRequestMessage + (instancetype)message { - return [[self alloc] initWithType:MPABTestDesignerChangeRequestMessageType]; + return [(MPABTestDesignerChangeRequestMessage *)[self alloc] initWithType:MPABTestDesignerChangeRequestMessageType]; } - (NSOperation *)responseCommandWithConnection:(MPABTestDesignerConnection *)connection @@ -28,9 +28,10 @@ - (NSOperation *)responseCommandWithConnection:(MPABTestDesignerConnection *)con [connection setSessionObject:variant forKey:kSessionVariantKey]; } - if ([[self payload][@"actions"] isKindOfClass:[NSArray class]]) { + id actions = [self payload][@"actions"]; + if ([actions isKindOfClass:[NSArray class]]) { dispatch_sync(dispatch_get_main_queue(), ^{ - [variant addActionsFromJSONObject:[self payload][@"actions"] andExecute:YES]; + [variant addActionsFromJSONObject:actions andExecute:YES]; }); } diff --git a/Pods/Mixpanel/Mixpanel/MPABTestDesignerChangeResponseMessage.m b/Pods/Mixpanel/Mixpanel/MPABTestDesignerChangeResponseMessage.m index 1824721..78410da 100644 --- a/Pods/Mixpanel/Mixpanel/MPABTestDesignerChangeResponseMessage.m +++ b/Pods/Mixpanel/Mixpanel/MPABTestDesignerChangeResponseMessage.m @@ -7,7 +7,7 @@ @implementation MPABTestDesignerChangeResponseMessage + (instancetype)message { - return [[self alloc] initWithType:@"change_response"]; + return [(MPABTestDesignerChangeResponseMessage *)[self alloc] initWithType:@"change_response"]; } - (void)setStatus:(NSString *)status diff --git a/Pods/Mixpanel/Mixpanel/MPABTestDesignerClearRequestMessage.m b/Pods/Mixpanel/Mixpanel/MPABTestDesignerClearRequestMessage.m index 184014a..07bdd5f 100644 --- a/Pods/Mixpanel/Mixpanel/MPABTestDesignerClearRequestMessage.m +++ b/Pods/Mixpanel/Mixpanel/MPABTestDesignerClearRequestMessage.m @@ -17,7 +17,7 @@ @implementation MPABTestDesignerClearRequestMessage + (instancetype)message { - return [[self alloc] initWithType:MPABTestDesignerClearRequestMessageType]; + return [(MPABTestDesignerClearRequestMessage *)[self alloc] initWithType:MPABTestDesignerClearRequestMessageType]; } - (NSOperation *)responseCommandWithConnection:(MPABTestDesignerConnection *)connection @@ -28,7 +28,7 @@ - (NSOperation *)responseCommandWithConnection:(MPABTestDesignerConnection *)con MPVariant *variant = [conn sessionObjectForKey:kSessionVariantKey]; if (variant) { - NSArray *actions = (self.payload)[@"actions"]; + NSArray *actions = [self payload][@"actions"]; dispatch_sync(dispatch_get_main_queue(), ^{ for (NSString *name in actions) { [variant removeActionWithName:name]; diff --git a/Pods/Mixpanel/Mixpanel/MPABTestDesignerClearResponseMessage.m b/Pods/Mixpanel/Mixpanel/MPABTestDesignerClearResponseMessage.m index fed88e3..31feba6 100644 --- a/Pods/Mixpanel/Mixpanel/MPABTestDesignerClearResponseMessage.m +++ b/Pods/Mixpanel/Mixpanel/MPABTestDesignerClearResponseMessage.m @@ -12,7 +12,7 @@ @implementation MPABTestDesignerClearResponseMessage + (instancetype)message { - return [[self alloc] initWithType:@"clear_response"]; + return [(MPABTestDesignerClearResponseMessage *)[self alloc] initWithType:@"clear_response"]; } - (void)setStatus:(NSString *)status diff --git a/Pods/Mixpanel/Mixpanel/MPABTestDesignerConnection.m b/Pods/Mixpanel/Mixpanel/MPABTestDesignerConnection.m index 6a4f980..f242bca 100644 --- a/Pods/Mixpanel/Mixpanel/MPABTestDesignerConnection.m +++ b/Pods/Mixpanel/Mixpanel/MPABTestDesignerConnection.m @@ -17,13 +17,14 @@ #import "MPSwizzler.h" NSString * const kSessionVariantKey = @"session_variant"; +static NSString * const kStartLoadingAnimationKey = @"MPConnectivityBarLoadingAnimation"; +static NSString * const kFinishLoadingAnimationKey = @"MPConnectivityBarFinishLoadingAnimation"; @interface MPABTestDesignerConnection () - +@property (strong, nonatomic) UIWindow *connectivityIndicatorWindow; @end @implementation MPABTestDesignerConnection - { /* The difference between _open and _connected is that open is set when the socket is open, and _connected is set when @@ -41,6 +42,7 @@ @implementation MPABTestDesignerConnection MPWebSocket *_webSocket; NSOperationQueue *_commandQueue; UIView *_recordingView; + CALayer *_indeterminateLayer; void (^_connectCallback)(); void (^_disconnectCallback)(); } @@ -62,7 +64,7 @@ - (instancetype)initWithURL:(NSURL *)url keepTrying:(BOOL)keepTrying connectCall _open = NO; _connected = NO; _sessionEnded = NO; - _session = [[NSMutableDictionary alloc] init]; + _session = [NSMutableDictionary dictionary]; _url = url; _connectCallback = connectCallback; _disconnectCallback = disconnectCallback; @@ -92,7 +94,7 @@ - (void)open:(BOOL)initiate maxInterval:(int)maxInterval maxRetries:(int)maxRetr static int retries = 0; BOOL inRetryLoop = retries > 0; - MessagingDebug(@"In open. initiate = %d, retries = %d, maxRetries = %d, maxInterval = %d, connected = %d", initiate, retries, maxRetries, maxInterval, _connected); + MPLogDebug(@"In open. initiate = %d, retries = %d, maxRetries = %d, maxInterval = %d, connected = %d", initiate, retries, maxRetries, maxInterval, _connected); if (self.sessionEnded || _connected || (inRetryLoop && retries >= maxRetries) ) { // break out of retry loop if any of the success conditions are met. @@ -101,7 +103,7 @@ - (void)open:(BOOL)initiate maxInterval:(int)maxInterval maxRetries:(int)maxRetr // If we are initiating a new connection, or we are already in a // retry loop (but not both). Then open a socket. if (!_open) { - MessagingDebug(@"Attempting to open WebSocket to: %@, try %d/%d ", _url, retries, maxRetries); + MPLogDebug(@"Attempting to open WebSocket to: %@, try %d/%d ", _url, retries, maxRetries); _open = YES; _webSocket = [[MPWebSocket alloc] initWithURL:_url]; _webSocket.delegate = self; @@ -121,8 +123,7 @@ - (void)open:(BOOL)initiate maxInterval:(int)maxInterval maxRetries:(int)maxRetr - (void)close { [_webSocket close]; - for (NSString *key in [_session keyEnumerator]) { - id value = [_session valueForKey:key]; + for (id value in _session.allValues) { if ([value conformsToProtocol:@protocol(MPDesignerSessionCollection)]) { [value cleanup]; } @@ -160,17 +161,17 @@ - (id)sessionObjectForKey:(NSString *)key - (void)sendMessage:(id)message { if (_connected) { - MessagingDebug(@"Sending message: %@", [message debugDescription]); + MPLogDebug(@"Sending message: %@", [message debugDescription]); NSString *jsonString = [[NSString alloc] initWithData:[message JSONData] encoding:NSUTF8StringEncoding]; [_webSocket send:jsonString]; } else { - MessagingDebug(@"Not sending message as we are not connected: %@", [message debugDescription]); + MPLogDebug(@"Not sending message as we are not connected: %@", [message debugDescription]); } } - (id )designerMessageForMessage:(id)message { - MessagingDebug(@"raw message: %@", message); + MPLogInfo(@"raw message: %@", message); NSParameterAssert([message isKindOfClass:[NSString class]] || [message isKindOfClass:[NSData class]]); @@ -179,7 +180,7 @@ - (void)sendMessage:(id)message NSData *jsonData = [message isKindOfClass:[NSString class]] ? [(NSString *)message dataUsingEncoding:NSUTF8StringEncoding] : message; NSError *error = nil; - id jsonObject = [NSJSONSerialization JSONObjectWithData:jsonData options:0 error:&error]; + id jsonObject = [NSJSONSerialization JSONObjectWithData:jsonData options:(NSJSONReadingOptions)0 error:&error]; if ([jsonObject isKindOfClass:[NSDictionary class]]) { NSDictionary *messageDictionary = (NSDictionary *)jsonObject; NSString *type = messageDictionary[@"type"]; @@ -187,7 +188,7 @@ - (void)sendMessage:(id)message designerMessage = [_typeToMessageClassMap[type] messageWithType:type payload:payload]; } else { - MessagingDebug(@"Badly formed socket message expected JSON dictionary: %@", error); + MPLogWarning(@"Badly formed socket message expected JSON dictionary: %@", error); } return designerMessage; @@ -199,14 +200,13 @@ - (void)webSocket:(MPWebSocket *)webSocket didReceiveMessage:(id)message { if (!_connected) { _connected = YES; - [self showConnectedView]; + [self showConnectedViewWithLoading:NO]; if (_connectCallback) { _connectCallback(); } } id designerMessage = [self designerMessageForMessage:message]; - MessagingDebug(@"WebSocket received message: %@", [designerMessage debugDescription]); - + MPLogInfo(@"WebSocket received message: %@", [designerMessage debugDescription]); NSOperation *commandOperation = [designerMessage responseCommandWithConnection:self]; if (commandOperation) { @@ -216,13 +216,14 @@ - (void)webSocket:(MPWebSocket *)webSocket didReceiveMessage:(id)message - (void)webSocketDidOpen:(MPWebSocket *)webSocket { - MessagingDebug(@"WebSocket %@ did open.", webSocket); + MPLogInfo(@"WebSocket %@ did open.", webSocket); _commandQueue.suspended = NO; + [self showConnectedViewWithLoading:YES]; } - (void)webSocket:(MPWebSocket *)webSocket didFailWithError:(NSError *)error { - MessagingDebug(@"WebSocket did fail with error: %@", error); + MPLogError(@"WebSocket did fail with error: %@", error); _commandQueue.suspended = YES; [_commandQueue cancelAllOperations]; [self hideConnectedView]; @@ -238,7 +239,7 @@ - (void)webSocket:(MPWebSocket *)webSocket didFailWithError:(NSError *)error - (void)webSocket:(MPWebSocket *)webSocket didCloseWithCode:(NSInteger)code reason:(NSString *)reason wasClean:(BOOL)wasClean { - MessagingDebug(@"WebSocket did close with code '%d' reason '%@'.", (int)code, reason); + MPLogDebug(@"WebSocket did close with code '%d' reason '%@'.", (int)code, reason); _commandQueue.suspended = YES; [_commandQueue cancelAllOperations]; @@ -253,23 +254,61 @@ - (void)webSocket:(MPWebSocket *)webSocket didCloseWithCode:(NSInteger)code reas } } -- (void)showConnectedView -{ - if(!_recordingView) { +- (void)showConnectedViewWithLoading:(BOOL)isLoading { + if (!self.connectivityIndicatorWindow) { UIWindow *mainWindow = [[UIApplication sharedApplication] delegate].window; - _recordingView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, mainWindow.frame.size.width, 1.0)]; - _recordingView.backgroundColor = [UIColor colorWithRed:4/255.0f green:180/255.0f blue:4/255.0f alpha:1.0]; - [mainWindow addSubview:_recordingView]; - [mainWindow bringSubviewToFront:_recordingView]; + self.connectivityIndicatorWindow = [[UIWindow alloc] initWithFrame:CGRectMake(0, 0, mainWindow.frame.size.width, 4.f)]; + self.connectivityIndicatorWindow.backgroundColor = [UIColor clearColor]; + self.connectivityIndicatorWindow.windowLevel = UIWindowLevelAlert; + self.connectivityIndicatorWindow.alpha = 0; + self.connectivityIndicatorWindow.hidden = NO; + + _recordingView = [[UIView alloc] initWithFrame:self.connectivityIndicatorWindow.frame]; + _recordingView.backgroundColor = [UIColor clearColor]; + _indeterminateLayer = [CALayer layer]; + _indeterminateLayer.backgroundColor = [UIColor colorWithRed:1/255.0 green:179/255.0 blue:109/255.0 alpha:1.0].CGColor; + _indeterminateLayer.frame = CGRectMake(0, 0, 0, 4.0f); + [_recordingView.layer addSublayer:_indeterminateLayer]; + [self.connectivityIndicatorWindow addSubview:_recordingView]; + [self.connectivityIndicatorWindow bringSubviewToFront:_recordingView]; + + [UIView animateWithDuration:0.3 animations:^{ + self.connectivityIndicatorWindow.alpha = 1; + }]; } + [self animateConnecting:isLoading]; } -- (void)hideConnectedView -{ - if (_recordingView) { +- (void)animateConnecting:(BOOL)isLoading { + if (isLoading) { + CABasicAnimation* myAnimation = [CABasicAnimation animationWithKeyPath:@"bounds.size.width"]; + myAnimation.duration = 10.f; + myAnimation.fromValue = @0; + myAnimation.toValue = @(_connectivityIndicatorWindow.bounds.size.width * 1.9f); + myAnimation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut]; + myAnimation.fillMode = kCAFillModeForwards; + myAnimation.removedOnCompletion = NO; + [_indeterminateLayer addAnimation:myAnimation forKey:kStartLoadingAnimationKey]; + } else { + [_indeterminateLayer removeAnimationForKey:kStartLoadingAnimationKey]; + CABasicAnimation* myAnimation = [CABasicAnimation animationWithKeyPath:@"bounds.size.width"]; + myAnimation.duration = 0.4f; + myAnimation.fromValue = @([[_indeterminateLayer.presentationLayer valueForKeyPath: @"bounds.size.width"] floatValue]); + myAnimation.toValue = @(_connectivityIndicatorWindow.bounds.size.width * 2.f); + myAnimation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut]; + myAnimation.fillMode = kCAFillModeForwards; + myAnimation.removedOnCompletion = NO; + [_indeterminateLayer addAnimation:myAnimation forKey:kFinishLoadingAnimationKey]; + } +} + +- (void)hideConnectedView { + if (self.connectivityIndicatorWindow) { + [_indeterminateLayer removeFromSuperlayer]; [_recordingView removeFromSuperview]; + self.connectivityIndicatorWindow.hidden = YES; } - _recordingView = nil; + self.connectivityIndicatorWindow = nil; } @end diff --git a/Pods/Mixpanel/Mixpanel/MPABTestDesignerDeviceInfoRequestMessage.m b/Pods/Mixpanel/Mixpanel/MPABTestDesignerDeviceInfoRequestMessage.m index 8bd815a..cc6acdb 100644 --- a/Pods/Mixpanel/Mixpanel/MPABTestDesignerDeviceInfoRequestMessage.m +++ b/Pods/Mixpanel/Mixpanel/MPABTestDesignerDeviceInfoRequestMessage.m @@ -14,7 +14,7 @@ @implementation MPABTestDesignerDeviceInfoRequestMessage + (instancetype)message { - return [[self alloc] initWithType:MPABTestDesignerDeviceInfoRequestMessageType]; + return [(MPABTestDesignerDeviceInfoRequestMessage *)[self alloc] initWithType:MPABTestDesignerDeviceInfoRequestMessageType]; } - (NSOperation *)responseCommandWithConnection:(MPABTestDesignerConnection *)connection @@ -48,7 +48,7 @@ - (NSOperation *)responseCommandWithConnection:(MPABTestDesignerConnection *)con - (NSArray *)availableFontFamilies { - NSMutableDictionary *fontFamilies = [[NSMutableDictionary alloc] init]; + NSMutableDictionary *fontFamilies = [NSMutableDictionary dictionary]; // Get all the font families and font names. for (NSString *familyName in [UIFont familyNames]) { @@ -75,14 +75,14 @@ - (NSArray *)availableFontFamilies } } - return [fontFamilies allValues]; + return fontFamilies.allValues; } - (NSMutableDictionary *)fontDictionaryForFontFamilyName:(NSString *)familyName fontNames:(NSArray *)fontNames { return [@{ - @"family" : familyName, - @"font_names" : [fontNames mutableCopy] + @"family": familyName, + @"font_names": [fontNames mutableCopy] } mutableCopy]; } diff --git a/Pods/Mixpanel/Mixpanel/MPABTestDesignerDeviceInfoResponseMessage.m b/Pods/Mixpanel/Mixpanel/MPABTestDesignerDeviceInfoResponseMessage.m index 0d56451..d776e91 100644 --- a/Pods/Mixpanel/Mixpanel/MPABTestDesignerDeviceInfoResponseMessage.m +++ b/Pods/Mixpanel/Mixpanel/MPABTestDesignerDeviceInfoResponseMessage.m @@ -8,7 +8,7 @@ @implementation MPABTestDesignerDeviceInfoResponseMessage + (instancetype)message { // TODO: provide a payload - return [[self alloc] initWithType:@"device_info_response"]; + return [(MPABTestDesignerDeviceInfoResponseMessage *)[self alloc] initWithType:@"device_info_response"]; } - (NSString *)systemName @@ -63,7 +63,7 @@ - (void)setDeviceName:(NSString *)deviceName - (NSString *)libVersion { - return [self payloadObjectForKey:@"device_name"]; + return [self payloadObjectForKey:@"lib_version"]; } - (void)setLibVersion:(NSString *)libVersion diff --git a/Pods/Mixpanel/Mixpanel/MPABTestDesignerDisconnectMessage.m b/Pods/Mixpanel/Mixpanel/MPABTestDesignerDisconnectMessage.m index 04f5a50..022cd8d 100644 --- a/Pods/Mixpanel/Mixpanel/MPABTestDesignerDisconnectMessage.m +++ b/Pods/Mixpanel/Mixpanel/MPABTestDesignerDisconnectMessage.m @@ -16,7 +16,7 @@ @implementation MPABTestDesignerDisconnectMessage + (instancetype)message { - return [[self alloc] initWithType:MPABTestDesignerDisconnectMessageType]; + return [(MPABTestDesignerDisconnectMessage *)[self alloc] initWithType:MPABTestDesignerDisconnectMessageType]; } - (NSOperation *)responseCommandWithConnection:(MPABTestDesignerConnection *)connection @@ -26,7 +26,7 @@ - (NSOperation *)responseCommandWithConnection:(MPABTestDesignerConnection *)con MPABTestDesignerConnection *conn = weak_connection; MPVariant *variant = [connection sessionObjectForKey:kSessionVariantKey]; - if(variant) { + if (variant) { dispatch_sync(dispatch_get_main_queue(), ^{ [variant stop]; }); diff --git a/Pods/Mixpanel/Mixpanel/MPABTestDesignerSnapshotRequestMessage.m b/Pods/Mixpanel/Mixpanel/MPABTestDesignerSnapshotRequestMessage.m index 6d002a4..81f3b24 100644 --- a/Pods/Mixpanel/Mixpanel/MPABTestDesignerSnapshotRequestMessage.m +++ b/Pods/Mixpanel/Mixpanel/MPABTestDesignerSnapshotRequestMessage.m @@ -17,19 +17,12 @@ @implementation MPABTestDesignerSnapshotRequestMessage + (instancetype)message { - return [[self alloc] initWithType:MPABTestDesignerSnapshotRequestMessageType]; + return [(MPABTestDesignerSnapshotRequestMessage *)[self alloc] initWithType:MPABTestDesignerSnapshotRequestMessageType]; } - (MPObjectSerializerConfig *)configuration { - NSDictionary *config = -#if 1 - [self payloadObjectForKey:@"config"]; -#else - [NSJSONSerialization JSONObjectWithData:[NSData dataWithContentsOfURL:[[NSBundle mainBundle] URLForResource:@"snapshot_config" withExtension:@"json"]] - options:0 error:nil]; -#endif - + NSDictionary *config = [self payloadObjectForKey:@"config"]; return config ? [[MPObjectSerializerConfig alloc] initWithDictionary:config] : nil; } @@ -45,7 +38,7 @@ - (NSOperation *)responseCommandWithConnection:(MPABTestDesignerConnection *)con // Update the class descriptions in the connection session if provided as part of the message. if (serializerConfig) { [connection setSessionObject:serializerConfig forKey:kSnapshotSerializerConfigKey]; - } else if ([connection sessionObjectForKey:kSnapshotSerializerConfigKey]){ + } else if ([connection sessionObjectForKey:kSnapshotSerializerConfigKey]) { // Get the class descriptions from the connection session store. serializerConfig = [connection sessionObjectForKey:kSnapshotSerializerConfigKey]; } else { @@ -73,7 +66,7 @@ - (NSOperation *)responseCommandWithConnection:(MPABTestDesignerConnection *)con }); snapshotMessage.screenshot = screenshot; - if (imageHash && [imageHash isEqualToString:snapshotMessage.imageHash]) { + if ([imageHash isEqualToString:snapshotMessage.imageHash]) { serializedObjects = [connection sessionObjectForKey:@"snapshot_hierarchy"]; } else { dispatch_sync(dispatch_get_main_queue(), ^{ diff --git a/Pods/Mixpanel/Mixpanel/MPABTestDesignerSnapshotResponseMessage.m b/Pods/Mixpanel/Mixpanel/MPABTestDesignerSnapshotResponseMessage.m index b6dda3a..bb7b88b 100644 --- a/Pods/Mixpanel/Mixpanel/MPABTestDesignerSnapshotResponseMessage.m +++ b/Pods/Mixpanel/Mixpanel/MPABTestDesignerSnapshotResponseMessage.m @@ -3,13 +3,12 @@ #import #import "MPABTestDesignerSnapshotResponseMessage.h" -#import "NSData+MPBase64.h" @implementation MPABTestDesignerSnapshotResponseMessage + (instancetype)message { - return [[self alloc] initWithType:@"snapshot_response"]; + return [(MPABTestDesignerSnapshotResponseMessage *)[self alloc] initWithType:@"snapshot_response"]; } - (void)setScreenshot:(UIImage *)screenshot @@ -19,7 +18,7 @@ - (void)setScreenshot:(UIImage *)screenshot if (screenshot) { NSData *jpegSnapshotImageData = UIImageJPEGRepresentation(screenshot, 0.5); if (jpegSnapshotImageData) { - payloadObject = [jpegSnapshotImageData mp_base64EncodedString]; + payloadObject = [jpegSnapshotImageData base64EncodedStringWithOptions:NSDataBase64Encoding64CharacterLineLength]; imageHash = [self getImageHash:jpegSnapshotImageData]; } } @@ -32,8 +31,8 @@ - (void)setScreenshot:(UIImage *)screenshot - (UIImage *)screenshot { NSString *base64Image = [self payloadObjectForKey:@"screenshot"]; - NSData *imageData = [NSData mp_dataFromBase64String:base64Image]; - + NSData *imageData = [[NSData alloc] initWithBase64EncodedString:base64Image + options:NSDataBase64DecodingIgnoreUnknownCharacters]; return imageData ? [UIImage imageWithData:imageData] : nil; } diff --git a/Pods/Mixpanel/Mixpanel/MPABTestDesignerTweakRequestMessage.m b/Pods/Mixpanel/Mixpanel/MPABTestDesignerTweakRequestMessage.m index 009deda..b0ec3a2 100644 --- a/Pods/Mixpanel/Mixpanel/MPABTestDesignerTweakRequestMessage.m +++ b/Pods/Mixpanel/Mixpanel/MPABTestDesignerTweakRequestMessage.m @@ -18,7 +18,7 @@ @implementation MPABTestDesignerTweakRequestMessage + (instancetype)message { - return [[self alloc] initWithType:MPABTestDesignerTweakRequestMessageType]; + return [(MPABTestDesignerTweakRequestMessage *)[self alloc] initWithType:MPABTestDesignerTweakRequestMessageType]; } - (NSOperation *)responseCommandWithConnection:(MPABTestDesignerConnection *)connection @@ -33,9 +33,10 @@ - (NSOperation *)responseCommandWithConnection:(MPABTestDesignerConnection *)con [conn setSessionObject:variant forKey:kSessionVariantKey]; } - if ([[self payload][@"tweaks"] isKindOfClass:[NSArray class]]) { + id tweaks = [self payload][@"tweaks"]; + if ([tweaks isKindOfClass:[NSArray class]]) { dispatch_sync(dispatch_get_main_queue(), ^{ - [variant addTweaksFromJSONObject:[self payload][@"tweaks"] andExecute:YES]; + [variant addTweaksFromJSONObject:tweaks andExecute:YES]; }); } diff --git a/Pods/Mixpanel/Mixpanel/MPABTestDesignerTweakResponseMessage.m b/Pods/Mixpanel/Mixpanel/MPABTestDesignerTweakResponseMessage.m index a580010..8ce4db5 100644 --- a/Pods/Mixpanel/Mixpanel/MPABTestDesignerTweakResponseMessage.m +++ b/Pods/Mixpanel/Mixpanel/MPABTestDesignerTweakResponseMessage.m @@ -12,7 +12,7 @@ @implementation MPABTestDesignerTweakResponseMessage + (instancetype)message { - return [[self alloc] initWithType:@"tweak_response"]; + return [(MPABTestDesignerTweakResponseMessage *)[self alloc] initWithType:@"tweak_response"]; } - (void)setStatus:(NSString *)status diff --git a/Pods/Mixpanel/Mixpanel/MPAbstractABTestDesignerMessage.m b/Pods/Mixpanel/Mixpanel/MPAbstractABTestDesignerMessage.m index 6c2e500..bec4473 100644 --- a/Pods/Mixpanel/Mixpanel/MPAbstractABTestDesignerMessage.m +++ b/Pods/Mixpanel/Mixpanel/MPAbstractABTestDesignerMessage.m @@ -18,7 +18,7 @@ @implementation MPAbstractABTestDesignerMessage + (instancetype)messageWithType:(NSString *)type payload:(NSDictionary *)payload { - return [[self alloc] initWithType:type payload:payload]; + return [(MPAbstractABTestDesignerMessage *)[self alloc] initWithType:type payload:payload]; } - (instancetype)initWithType:(NSString *)type @@ -55,12 +55,12 @@ - (NSDictionary *)payload - (NSData *)JSONData { - NSDictionary *jsonObject = @{ @"type" : _type, @"payload" : [_payload copy] }; + NSDictionary *jsonObject = @{ @"type": _type, @"payload": [_payload copy] }; NSError *error = nil; - NSData *jsonData = [NSJSONSerialization dataWithJSONObject:jsonObject options:0 error:&error]; - if (jsonData == nil && error) { - MixpanelError(@"Failed to serialize test designer message: %@", error); + NSData *jsonData = [NSJSONSerialization dataWithJSONObject:jsonObject options:(NSJSONWritingOptions)0 error:&error]; + if (error) { + MPLogError(@"Failed to serialize test designer message: %@", error); } return jsonData; diff --git a/Pods/Mixpanel/Mixpanel/MPApplicationStateSerializer.m b/Pods/Mixpanel/Mixpanel/MPApplicationStateSerializer.m index 00bbc6f..f2fee83 100644 --- a/Pods/Mixpanel/Mixpanel/MPApplicationStateSerializer.m +++ b/Pods/Mixpanel/Mixpanel/MPApplicationStateSerializer.m @@ -37,17 +37,9 @@ - (UIImage *)screenshotImageForWindowAtIndex:(NSUInteger)index UIWindow *window = [self windowAtIndex:index]; if (window && !CGRectEqualToRect(window.frame, CGRectZero)) { UIGraphicsBeginImageContextWithOptions(window.bounds.size, YES, window.screen.scale); -#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 70000 - if ([window respondsToSelector:@selector(drawViewHierarchyInRect:afterScreenUpdates:)]) { - if ([window drawViewHierarchyInRect:window.bounds afterScreenUpdates:NO] == NO) { - MixpanelError(@"Unable to get complete screenshot for window at index: %d.", (int)index); - } - } else { - [window.layer renderInContext:UIGraphicsGetCurrentContext()]; + if ([window drawViewHierarchyInRect:window.bounds afterScreenUpdates:NO] == NO) { + MPLogError(@"Unable to get complete screenshot for window at index: %d.", (int)index); } -#else - [window.layer renderInContext:UIGraphicsGetCurrentContext()]; -#endif image = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); } @@ -57,7 +49,7 @@ - (UIImage *)screenshotImageForWindowAtIndex:(NSUInteger)index - (UIWindow *)windowAtIndex:(NSUInteger)index { - NSParameterAssert(index < [_application.windows count]); + NSParameterAssert(index < _application.windows.count); return _application.windows[index]; } diff --git a/Pods/Mixpanel/Mixpanel/MPBOOLToNSNumberValueTransformer.m b/Pods/Mixpanel/Mixpanel/MPBOOLToNSNumberValueTransformer.m index 1ce5355..3c8a61b 100644 --- a/Pods/Mixpanel/Mixpanel/MPBOOLToNSNumberValueTransformer.m +++ b/Pods/Mixpanel/Mixpanel/MPBOOLToNSNumberValueTransformer.m @@ -18,7 +18,7 @@ + (BOOL)allowsReverseTransformation - (id)transformedValue:(id)value { if ([value respondsToSelector:@selector(boolValue)]) { - return [value boolValue] ? @YES : @NO; + return @([value boolValue]); } return nil; diff --git a/Pods/Mixpanel/Mixpanel/MPCATransform3DToNSDictionaryValueTransformer.m b/Pods/Mixpanel/Mixpanel/MPCATransform3DToNSDictionaryValueTransformer.m index bc8fddd..a524422 100644 --- a/Pods/Mixpanel/Mixpanel/MPCATransform3DToNSDictionaryValueTransformer.m +++ b/Pods/Mixpanel/Mixpanel/MPCATransform3DToNSDictionaryValueTransformer.m @@ -6,25 +6,25 @@ static NSDictionary *MPCATransform3DCreateDictionaryRepresentation(CATransform3D transform) { return @{ - @"m11" : @(transform.m11), - @"m12" : @(transform.m12), - @"m13" : @(transform.m13), - @"m14" : @(transform.m14), - - @"m21" : @(transform.m21), - @"m22" : @(transform.m22), - @"m23" : @(transform.m23), - @"m24" : @(transform.m24), - - @"m31" : @(transform.m31), - @"m32" : @(transform.m32), - @"m33" : @(transform.m33), - @"m34" : @(transform.m34), - - @"m41" : @(transform.m41), - @"m42" : @(transform.m42), - @"m43" : @(transform.m43), - @"m44" : @(transform.m44), + @"m11": @(transform.m11), + @"m12": @(transform.m12), + @"m13": @(transform.m13), + @"m14": @(transform.m14), + + @"m21": @(transform.m21), + @"m22": @(transform.m22), + @"m23": @(transform.m23), + @"m24": @(transform.m24), + + @"m31": @(transform.m31), + @"m32": @(transform.m32), + @"m33": @(transform.m33), + @"m34": @(transform.m34), + + @"m41": @(transform.m41), + @"m42": @(transform.m42), + @"m43": @(transform.m43), + @"m44": @(transform.m44), }; } diff --git a/Pods/Mixpanel/Mixpanel/MPCGAffineTransformToNSDictionaryValueTransformer.m b/Pods/Mixpanel/Mixpanel/MPCGAffineTransformToNSDictionaryValueTransformer.m index a761a03..7c2c1a2 100644 --- a/Pods/Mixpanel/Mixpanel/MPCGAffineTransformToNSDictionaryValueTransformer.m +++ b/Pods/Mixpanel/Mixpanel/MPCGAffineTransformToNSDictionaryValueTransformer.m @@ -6,12 +6,12 @@ static NSDictionary *MPCGAffineTransformCreateDictionaryRepresentation(CGAffineTransform transform) { return @{ - @"a" : @(transform.a), - @"b" : @(transform.b), - @"c" : @(transform.c), - @"d" : @(transform.d), - @"tx" : @(transform.tx), - @"ty" : @(transform.ty) + @"a": @(transform.a), + @"b": @(transform.b), + @"c": @(transform.c), + @"d": @(transform.d), + @"tx": @(transform.tx), + @"ty": @(transform.ty) }; } diff --git a/Pods/Mixpanel/Mixpanel/MPClassDescription.h b/Pods/Mixpanel/Mixpanel/MPClassDescription.h index 68f8493..1dd40da 100644 --- a/Pods/Mixpanel/Mixpanel/MPClassDescription.h +++ b/Pods/Mixpanel/Mixpanel/MPClassDescription.h @@ -12,7 +12,7 @@ - (instancetype)initWithSuperclassDescription:(MPClassDescription *)superclassDescription dictionary:(NSDictionary *)dictionary; -- (BOOL)isDescriptionForKindOfClass:(Class)class; +- (BOOL)isDescriptionForKindOfClass:(Class)aClass; @end diff --git a/Pods/Mixpanel/Mixpanel/MPClassDescription.m b/Pods/Mixpanel/Mixpanel/MPClassDescription.m index cb3f730..638dfa5 100644 --- a/Pods/Mixpanel/Mixpanel/MPClassDescription.m +++ b/Pods/Mixpanel/Mixpanel/MPClassDescription.m @@ -48,7 +48,7 @@ - (instancetype)initWithSuperclassDescription:(MPClassDescription *)superclassDe - (NSArray *)propertyDescriptions { - NSMutableDictionary *allPropertyDescriptions = [[NSMutableDictionary alloc] init]; + NSMutableDictionary *allPropertyDescriptions = [NSMutableDictionary dictionary]; MPClassDescription *description = self; while (description) @@ -61,12 +61,12 @@ - (NSArray *)propertyDescriptions description = description.superclassDescription; } - return [allPropertyDescriptions allValues]; + return allPropertyDescriptions.allValues; } -- (BOOL)isDescriptionForKindOfClass:(Class)class +- (BOOL)isDescriptionForKindOfClass:(Class)aClass { - return [self.name isEqualToString:NSStringFromClass(class)] && [self.superclassDescription isDescriptionForKindOfClass:[class superclass]]; + return [self.name isEqualToString:NSStringFromClass(aClass)] && [self.superclassDescription isDescriptionForKindOfClass:[aClass superclass]]; } - (NSString *)debugDescription diff --git a/Pods/Mixpanel/Mixpanel/MPDesignerEventBindingRequestMesssage.m b/Pods/Mixpanel/Mixpanel/MPDesignerEventBindingRequestMesssage.m index 3fc1f3c..f4c1631 100644 --- a/Pods/Mixpanel/Mixpanel/MPDesignerEventBindingRequestMesssage.m +++ b/Pods/Mixpanel/Mixpanel/MPDesignerEventBindingRequestMesssage.m @@ -29,13 +29,13 @@ - (void)updateBindings:(NSArray *)bindingPayload NSMutableArray *newBindings = [NSMutableArray array]; for (NSDictionary *bindingInfo in bindingPayload) { MPEventBinding *binding = [MPEventBinding bindingWithJSONObject:bindingInfo]; - [newBindings addObject:binding]; + if (binding) { + [newBindings addObject:binding]; + } } - if (self.bindings) { - for (MPEventBinding *oldBinding in self.bindings) { - [oldBinding stop]; - } + for (MPEventBinding *oldBinding in self.bindings) { + [oldBinding stop]; } self.bindings = newBindings; for (MPEventBinding *newBinding in self.bindings) { @@ -45,10 +45,8 @@ - (void)updateBindings:(NSArray *)bindingPayload - (void)cleanup { - if (self.bindings) { - for (MPEventBinding *oldBinding in self.bindings) { - [oldBinding stop]; - } + for (MPEventBinding *oldBinding in self.bindings) { + [oldBinding stop]; } self.bindings = nil; } @@ -59,7 +57,7 @@ @implementation MPDesignerEventBindingRequestMessage + (instancetype)message { - return [[self alloc] initWithType:@"event_binding_request"]; + return [(MPDesignerEventBindingRequestMessage *)[self alloc] initWithType:@"event_binding_request"]; } - (NSOperation *)responseCommandWithConnection:(MPABTestDesignerConnection *)connection @@ -69,8 +67,8 @@ - (NSOperation *)responseCommandWithConnection:(MPABTestDesignerConnection *)con MPABTestDesignerConnection *conn = weak_connection; dispatch_sync(dispatch_get_main_queue(), ^{ - NSLog(@"Loading event bindings:\n%@",[self payload][@"events"]); NSArray *payload = [self payload][@"events"]; + NSLog(@"Loading event bindings:\n%@", payload); MPEventBindingCollection *bindingCollection = [conn sessionObjectForKey:@"event_bindings"]; if (!bindingCollection) { bindingCollection = [[MPEventBindingCollection alloc] init]; diff --git a/Pods/Mixpanel/Mixpanel/MPDesignerEventBindingResponseMesssage.m b/Pods/Mixpanel/Mixpanel/MPDesignerEventBindingResponseMesssage.m index f020521..0087b01 100644 --- a/Pods/Mixpanel/Mixpanel/MPDesignerEventBindingResponseMesssage.m +++ b/Pods/Mixpanel/Mixpanel/MPDesignerEventBindingResponseMesssage.m @@ -12,7 +12,7 @@ @implementation MPDesignerEventBindingResponseMessage + (instancetype)message { - return [[self alloc] initWithType:@"event_binding_response"]; + return [(MPDesignerEventBindingResponseMessage *)[self alloc] initWithType:@"event_binding_response"]; } - (void)setStatus:(NSString *)status diff --git a/Pods/Mixpanel/Mixpanel/MPDesignerTrackMessage.m b/Pods/Mixpanel/Mixpanel/MPDesignerTrackMessage.m index 88cec82..b698f22 100644 --- a/Pods/Mixpanel/Mixpanel/MPDesignerTrackMessage.m +++ b/Pods/Mixpanel/Mixpanel/MPDesignerTrackMessage.m @@ -16,12 +16,12 @@ @implementation MPDesignerTrackMessage + (instancetype)message { - return [[self alloc] initWithType:@"track_message"]; + return [(MPDesignerTrackMessage *)[self alloc] initWithType:@"track_message"]; } + (instancetype)messageWithPayload:(NSDictionary *)payload { - return[[self alloc] initWithType:@"track_message" andPayload:payload]; + return [(MPDesignerTrackMessage *)[self alloc] initWithType:@"track_message" andPayload:payload]; } - (instancetype)initWithType:(NSString *)type @@ -39,10 +39,10 @@ - (instancetype)initWithType:(NSString *)type andPayload:(NSDictionary *)payload - (NSData *)JSONData { - NSDictionary *jsonObject = @{ @"type" : self.type, @"payload" : [_payload copy] }; + NSDictionary *jsonObject = @{ @"type": self.type, @"payload": [_payload copy] }; NSError *error = nil; - NSData *jsonData = [NSJSONSerialization dataWithJSONObject:jsonObject options:0 error:&error]; + NSData *jsonData = [NSJSONSerialization dataWithJSONObject:jsonObject options:(NSJSONWritingOptions)0 error:&error]; if (error) { NSLog(@"Failed to serialize test designer message: %@", error); } diff --git a/Pods/Mixpanel/Mixpanel/MPEnumDescription.m b/Pods/Mixpanel/Mixpanel/MPEnumDescription.m index a4f6458..cd1bde0 100644 --- a/Pods/Mixpanel/Mixpanel/MPEnumDescription.m +++ b/Pods/Mixpanel/Mixpanel/MPEnumDescription.m @@ -19,7 +19,7 @@ - (instancetype)initWithDictionary:(NSDictionary *)dictionary if (self) { _flagSet = [dictionary[@"flag_set"] boolValue]; _baseType = [dictionary[@"base_type"] copy]; - _values = [[NSMutableDictionary alloc] init]; + _values = [NSMutableDictionary dictionary]; for (NSDictionary *value in dictionary[@"values"]) { _values[value[@"value"]] = value[@"display_name"]; @@ -31,7 +31,7 @@ - (instancetype)initWithDictionary:(NSDictionary *)dictionary - (NSArray *)allValues { - return [_values allKeys]; + return _values.allKeys; } @end diff --git a/Pods/Mixpanel/Mixpanel/MPEventBinding.h b/Pods/Mixpanel/Mixpanel/MPEventBinding.h index e299d5b..bc34ba2 100644 --- a/Pods/Mixpanel/Mixpanel/MPEventBinding.h +++ b/Pods/Mixpanel/Mixpanel/MPEventBinding.h @@ -12,9 +12,9 @@ @interface MPEventBinding : NSObject @property (nonatomic) NSUInteger ID; -@property (nonatomic) NSString *name; -@property (nonatomic) MPObjectSelector *path; -@property (nonatomic) NSString *eventName; +@property (nonatomic, copy) NSString *name; +@property (nonatomic, strong) MPObjectSelector *path; +@property (nonatomic, copy) NSString *eventName; @property (nonatomic, assign) Class swizzleClass; @@ -32,8 +32,6 @@ + (id)bindingWithJSONObject:(id)object; -+ (id)bindngWithJSONObject:(id)object __deprecated; - - (instancetype)init __unavailable; - (instancetype)initWithEventName:(NSString *)eventName onPath:(NSString *)path; diff --git a/Pods/Mixpanel/Mixpanel/MPEventBinding.m b/Pods/Mixpanel/Mixpanel/MPEventBinding.m index 26e88d9..2554548 100644 --- a/Pods/Mixpanel/Mixpanel/MPEventBinding.m +++ b/Pods/Mixpanel/Mixpanel/MPEventBinding.m @@ -33,15 +33,15 @@ + (MPEventBinding *)bindngWithJSONObject:(NSDictionary *)object + (Class)subclassFromString:(NSString *)bindingType { NSDictionary *classTypeMap = @{ - [MPUIControlBinding typeName] : [MPUIControlBinding class], - [MPUITableViewBinding typeName] : [MPUITableViewBinding class] + [MPUIControlBinding typeName]: [MPUIControlBinding class], + [MPUITableViewBinding typeName]: [MPUITableViewBinding class] }; return[classTypeMap valueForKey:bindingType] ?: [MPUIControlBinding class]; } + (void)track:(NSString *)event properties:(NSDictionary *)properties { - NSMutableDictionary *bindingProperties = [[NSMutableDictionary alloc] initWithObjectsAndKeys: @YES, @"$from_binding", nil]; + NSMutableDictionary *bindingProperties = [NSMutableDictionary dictionaryWithObjectsAndKeys: @YES, @"$from_binding", nil]; [bindingProperties addEntriesFromDictionary:properties]; [[Mixpanel sharedInstance] track:event properties:bindingProperties]; } @@ -108,4 +108,18 @@ - (void)encodeWithCoder:(NSCoder *)aCoder [aCoder encodeObject:NSStringFromClass(_swizzleClass) forKey:@"swizzleClass"]; } +- (BOOL)isEqual:(id)other { + if (other == self) { + return YES; + } else if (![other isKindOfClass:[MPEventBinding class]]) { + return NO; + } else { + return [self.eventName isEqual:((MPEventBinding *)other).eventName] && [self.path isEqual:((MPEventBinding *)other).path]; + } +} + +- (NSUInteger)hash { + return [self.eventName hash] ^ [self.path hash]; +} + @end diff --git a/Pods/Mixpanel/Mixpanel/MPFoundation.h b/Pods/Mixpanel/Mixpanel/MPFoundation.h new file mode 100644 index 0000000..4ff5778 --- /dev/null +++ b/Pods/Mixpanel/Mixpanel/MPFoundation.h @@ -0,0 +1,10 @@ +#import + +#if TARGET_OS_IPHONE +#ifndef NSFoundationVersionNumber_iOS_9_0 +// support for Xcode 7.* +#define NSFoundationVersionNumber_iOS_8_x_Max 1199 +#define NSFoundationVersionNumber_iOS_9_0 1240.1 +#define NSFoundationVersionNumber_iOS_9_x_Max 1299 +#endif +#endif diff --git a/Pods/Mixpanel/Mixpanel/MPLogger.h b/Pods/Mixpanel/Mixpanel/MPLogger.h index fa08912..718210c 100644 --- a/Pods/Mixpanel/Mixpanel/MPLogger.h +++ b/Pods/Mixpanel/Mixpanel/MPLogger.h @@ -6,35 +6,32 @@ // Copyright (c) 2014 Mixpanel. All rights reserved. // -#import +#import +#import -#ifndef MPLogger_h -#define MPLogger_h +static bool gLoggingEnabled = NO; -static inline void MPLog(NSString *format, ...) { - __block va_list arg_list; - va_start (arg_list, format); - NSString *formattedString = [[NSString alloc] initWithFormat:format arguments:arg_list]; - va_end(arg_list); - NSLog(@"[Mixpanel] %@", formattedString); +#define __MP_MAKE_LOG_FUNCTION(LEVEL, NAME) \ +static inline void NAME(NSString *format, ...) { \ + if (!gLoggingEnabled) return; \ + va_list arg_list; \ + va_start(arg_list, format); \ + NSString *formattedString = [[NSString alloc] initWithFormat:format arguments:arg_list]; \ + asl_add_log_file(NULL, STDERR_FILENO); \ + asl_log(NULL, NULL, (LEVEL), "%s", [formattedString UTF8String]); \ + va_end(arg_list); \ } -#ifdef MIXPANEL_ERROR -#define MixpanelError(...) MPLog(__VA_ARGS__) -#else -#define MixpanelError(...) -#endif - -#ifdef MIXPANEL_DEBUG -#define MixpanelDebug(...) MPLog(__VA_ARGS__) -#else -#define MixpanelDebug(...) -#endif - -#ifdef MIXPANEL_MESSAGING_DEBUG -#define MessagingDebug(...) MPLog(__VA_ARGS__) -#else -#define MessagingDebug(...) -#endif - -#endif +// Something has failed. +__MP_MAKE_LOG_FUNCTION(ASL_LEVEL_ERR, MPLogError) + +// Something is amiss and might fail if not corrected. +__MP_MAKE_LOG_FUNCTION(ASL_LEVEL_WARNING, MPLogWarning) + +// The lowest priority that you would normally log, and purely informational in nature. +__MP_MAKE_LOG_FUNCTION(ASL_LEVEL_INFO, MPLogInfo) + +// The lowest priority, and normally not logged except for code based messages. +__MP_MAKE_LOG_FUNCTION(ASL_LEVEL_DEBUG, MPLogDebug) + +#undef __MP_MAKE_LOG_FUNCTION diff --git a/Pods/Mixpanel/Mixpanel/MPNSAttributedStringToNSDictionaryValueTransformer.m b/Pods/Mixpanel/Mixpanel/MPNSAttributedStringToNSDictionaryValueTransformer.m index 941e15d..4fa9c23 100644 --- a/Pods/Mixpanel/Mixpanel/MPNSAttributedStringToNSDictionaryValueTransformer.m +++ b/Pods/Mixpanel/Mixpanel/MPNSAttributedStringToNSDictionaryValueTransformer.m @@ -19,25 +19,33 @@ + (BOOL)allowsReverseTransformation - (id)transformedValue:(id)value { if ([value isKindOfClass:[NSAttributedString class]]) { - NSAttributedString *attributedString = value; + NSMutableAttributedString *attributedString = [value mutableCopy]; + [attributedString beginEditing]; + __block BOOL safe = NO; + [attributedString enumerateAttribute:NSParagraphStyleAttributeName inRange:NSMakeRange(0, attributedString.length) options:0 usingBlock:^(id value, NSRange range, BOOL *stop) { + if (value) { + NSParagraphStyle *paragraphStyle = value; + if([paragraphStyle respondsToSelector:@selector(headIndent)]) { + safe = YES; + } + } + }]; + if (!safe) { + [attributedString removeAttribute:NSParagraphStyleAttributeName range:NSMakeRange(0, attributedString.length)]; + } + [attributedString endEditing]; NSError *error = nil; - NSData *data = nil; - -#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 70000 - if ([attributedString respondsToSelector:@selector(dataFromRange:documentAttributes:error:)]) { - data = [attributedString dataFromRange:NSMakeRange(0, [attributedString length]) - documentAttributes:@{ NSDocumentTypeDocumentAttribute : NSHTMLTextDocumentType} - error:&error]; - } -#endif + NSData *data = [attributedString dataFromRange:NSMakeRange(0, attributedString.length) + documentAttributes:@{ NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType} + error:&error]; if (data) { return @{ - @"mime_type" : @"text/html", - @"data" : [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding] + @"mime_type": @"text/html", + @"data": [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding] }; } else { - MixpanelError(@"Failed to convert NSAttributedString to HTML: %@", error); + MPLogError(@"Failed to convert NSAttributedString to HTML: %@", error); } } @@ -53,16 +61,13 @@ - (id)reverseTransformedValue:(id)value if ([mimeType isEqualToString:@"text/html"] && dataString) { NSError *error = nil; - NSAttributedString *attributedString; -#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 70000 NSData *data = [dataString dataUsingEncoding:NSUTF8StringEncoding]; - attributedString = [[NSAttributedString alloc] initWithData:data - options:@{ NSDocumentTypeDocumentAttribute : NSHTMLTextDocumentType} - documentAttributes:NULL - error:&error]; -#endif + NSAttributedString *attributedString = [[NSAttributedString alloc] initWithData:data + options:@{ NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType} + documentAttributes:NULL + error:&error]; if (attributedString == nil) { - MixpanelError(@"Failed to convert HTML to NSAttributed string: %@", error); + MPLogError(@"Failed to convert HTML to NSAttributed string: %@", error); } return attributedString; diff --git a/Pods/Mixpanel/Mixpanel/MPNSNumberToCGFloatValueTransformer.m b/Pods/Mixpanel/Mixpanel/MPNSNumberToCGFloatValueTransformer.m index 58a9375..ca4f8b9 100644 --- a/Pods/Mixpanel/Mixpanel/MPNSNumberToCGFloatValueTransformer.m +++ b/Pods/Mixpanel/Mixpanel/MPNSNumberToCGFloatValueTransformer.m @@ -21,11 +21,11 @@ - (id)transformedValue:(id)value NSNumber *number = (NSNumber *) value; // if the number is not a cgfloat, cast it to a cgfloat - if (strcmp([number objCType], (char *) @encode(CGFloat)) != 0) { - if (strcmp((char *) @encode(CGFloat), (char *) @encode(double)) == 0) { - value = @([number doubleValue]); + if (strcmp(number.objCType, @encode(CGFloat)) != 0) { + if (strcmp(@encode(CGFloat), @encode(double)) == 0) { + value = @(number.doubleValue); } else { - value = @([number floatValue]); + value = @(number.floatValue); } } diff --git a/Pods/Mixpanel/Mixpanel/MPNetwork.h b/Pods/Mixpanel/Mixpanel/MPNetwork.h new file mode 100644 index 0000000..e14179e --- /dev/null +++ b/Pods/Mixpanel/Mixpanel/MPNetwork.h @@ -0,0 +1,35 @@ +// +// MPNetwork.h +// Mixpanel +// +// Created by Sam Green on 6/12/16. +// Copyright © 2016 Mixpanel. All rights reserved. +// + +#import + +typedef NS_ENUM(NSUInteger, MPNetworkEndpoint) { + MPNetworkEndpointTrack, + MPNetworkEndpointEngage, + MPNetworkEndpointDecide +}; + +@interface MPNetwork : NSObject + +@property (nonatomic) BOOL shouldManageNetworkActivityIndicator; +@property (nonatomic) BOOL useIPAddressForGeoLocation; + +- (instancetype)initWithServerURL:(NSURL *)serverURL; + +- (void)flushEventQueue:(NSArray *)events; +- (void)flushPeopleQueue:(NSArray *)people; + +- (void)updateNetworkActivityIndicator:(BOOL)enabled; + +- (NSURLRequest *)buildGetRequestForEndpoint:(MPNetworkEndpoint)endpoint + withQueryItems:(NSArray *)queryItems; + +- (NSURLRequest *)buildPostRequestForEndpoint:(MPNetworkEndpoint)endpoint + andBody:(NSString *)body; + +@end diff --git a/Pods/Mixpanel/Mixpanel/MPNetwork.m b/Pods/Mixpanel/Mixpanel/MPNetwork.m new file mode 100644 index 0000000..ea5984b --- /dev/null +++ b/Pods/Mixpanel/Mixpanel/MPNetwork.m @@ -0,0 +1,304 @@ +// +// MPNetwork.m +// Mixpanel +// +// Created by Sam Green on 6/12/16. +// Copyright © 2016 Mixpanel. All rights reserved. +// + +#import "MPNetwork.h" +#import "MPNetworkPrivate.h" +#import "MPLogger.h" +#import "Mixpanel.h" +#import + +#define MIXPANEL_NO_NETWORK_ACTIVITY_INDICATOR (defined(MIXPANEL_APP_EXTENSION) || defined(MIXPANEL_TVOS_EXTENSION) || defined(MIXPANEL_WATCH_EXTENSION)) + +static const NSUInteger kBatchSize = 50; + +@implementation MPNetwork + ++ (NSURLSession *)sharedURLSession { + static NSURLSession *sharedSession = nil; + @synchronized(self) { + if (sharedSession == nil) { + NSURLSessionConfiguration *sessionConfig = [NSURLSessionConfiguration defaultSessionConfiguration]; + sessionConfig.timeoutIntervalForRequest = 7.0; + sharedSession = [NSURLSession sessionWithConfiguration:sessionConfig]; + } + } + return sharedSession; +} + +- (instancetype)initWithServerURL:(NSURL *)serverURL { + self = [super init]; + if (self) { + self.serverURL = serverURL; + self.shouldManageNetworkActivityIndicator = YES; + self.useIPAddressForGeoLocation = YES; + } + return self; +} + +#pragma mark - Flush +- (void)flushEventQueue:(NSMutableArray *)events { + [self flushQueue:events endpoint:MPNetworkEndpointTrack]; +} + +- (void)flushPeopleQueue:(NSMutableArray *)people { + [self flushQueue:people endpoint:MPNetworkEndpointEngage]; +} + +- (void)flushQueue:(NSMutableArray *)queue endpoint:(MPNetworkEndpoint)endpoint { + if ([[NSDate date] timeIntervalSince1970] < self.requestsDisabledUntilTime) { + MPLogDebug(@"Attempted to flush to %lu, when we still have a timeout. Ignoring flush.", endpoint); + return; + } + + while (queue.count > 0) { + NSUInteger batchSize = MIN(queue.count, kBatchSize); + NSArray *batch = [queue subarrayWithRange:NSMakeRange(0, batchSize)]; + + NSString *requestData = [MPNetwork encodeArrayForAPI:batch]; + NSString *postBody = [NSString stringWithFormat:@"ip=%d&data=%@", self.useIPAddressForGeoLocation, requestData]; + MPLogDebug(@"%@ flushing %lu of %lu to %lu: %@", self, (unsigned long)batch.count, (unsigned long)queue.count, endpoint, queue); + NSURLRequest *request = [self buildPostRequestForEndpoint:endpoint andBody:postBody]; + + [self updateNetworkActivityIndicator:YES]; + + __block BOOL didFail = NO; + dispatch_semaphore_t semaphore = dispatch_semaphore_create(0); + [[[MPNetwork sharedURLSession] dataTaskWithRequest:request completionHandler:^(NSData *responseData, + NSURLResponse *urlResponse, + NSError *error) { + [self updateNetworkActivityIndicator:NO]; + + BOOL success = [self handleNetworkResponse:(NSHTTPURLResponse *)urlResponse withError:error]; + if (error || !success) { + MPLogError(@"%@ network failure: %@", self, error); + didFail = YES; + } else { + NSString *response = [[NSString alloc] initWithData:responseData + encoding:NSUTF8StringEncoding]; + if ([response intValue] == 0) { + MPLogInfo(@"%@ %lu api rejected some items", self, endpoint); + } + } + + dispatch_semaphore_signal(semaphore); + }] resume]; + + dispatch_semaphore_wait(semaphore, DISPATCH_TIME_FOREVER); + + if (didFail) { + break; + } + + [queue removeObjectsInArray:batch]; + } +} + +- (BOOL)handleNetworkResponse:(NSHTTPURLResponse *)response withError:(NSError *)error { + MPLogDebug(@"HTTP Response: %@", response.allHeaderFields); + MPLogDebug(@"HTTP Error: %@", error.localizedDescription); + + BOOL failed = [MPNetwork parseHTTPFailure:response withError:error]; + if (failed) { + MPLogDebug(@"Consecutive network failures: %lu", self.consecutiveFailures); + self.consecutiveFailures++; + } else { + MPLogDebug(@"Consecutive network failures reset to 0"); + self.consecutiveFailures = 0; + } + + // Did the server response with an HTTP `Retry-After` header? + NSTimeInterval retryTime = [MPNetwork parseRetryAfterTime:response]; + if (self.consecutiveFailures >= 2) { + + // Take the larger of exponential back off and server provided `Retry-After` + retryTime = MAX(retryTime, [MPNetwork calculateBackOffTimeFromFailures:self.consecutiveFailures]); + } + + NSDate *retryDate = [NSDate dateWithTimeIntervalSinceNow:retryTime]; + self.requestsDisabledUntilTime = [retryDate timeIntervalSince1970]; + + MPLogDebug(@"Retry backoff time: %.2f - %@", retryTime, retryDate); + + return !failed; +} + +#pragma mark - Helpers ++ (NSArray *)buildDecideQueryForProperties:(NSDictionary *)properties + withDistinctID:(NSString *)distinctID + andToken:(NSString *)token { + NSURLQueryItem *itemVersion = [NSURLQueryItem queryItemWithName:@"version" value:@"1"]; + NSURLQueryItem *itemLib = [NSURLQueryItem queryItemWithName:@"lib" value:@"iphone"]; + NSURLQueryItem *itemToken = [NSURLQueryItem queryItemWithName:@"token" value:token]; + NSURLQueryItem *itemDistinctID = [NSURLQueryItem queryItemWithName:@"distinct_id" value:distinctID]; + + // Convert properties dictionary to a string + NSData *propertiesData = [NSJSONSerialization dataWithJSONObject:properties + options:0 + error:NULL]; + NSString *propertiesString = [[NSString alloc] initWithData:propertiesData + encoding:NSUTF8StringEncoding]; + NSURLQueryItem *itemProperties = [NSURLQueryItem queryItemWithName:@"properties" value:propertiesString]; + + return @[ itemVersion, itemLib, itemToken, itemDistinctID, itemProperties ]; +} + ++ (NSString *)pathForEndpoint:(MPNetworkEndpoint)endpoint { + static NSDictionary *endPointToPath = nil; + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + endPointToPath = @{ @(MPNetworkEndpointTrack): @"/track/", + @(MPNetworkEndpointEngage): @"/engage/", + @(MPNetworkEndpointDecide): @"/decide" }; + }); + NSNumber *key = @(endpoint); + return endPointToPath[key]; +} + +- (NSURLRequest *)buildGetRequestForEndpoint:(MPNetworkEndpoint)endpoint + withQueryItems:(NSArray *)queryItems { + return [self buildRequestForEndpoint:[MPNetwork pathForEndpoint:endpoint] + byHTTPMethod:@"GET" + withQueryItems:queryItems + andBody:nil]; +} + +- (NSURLRequest *)buildPostRequestForEndpoint:(MPNetworkEndpoint)endpoint + andBody:(NSString *)body { + return [self buildRequestForEndpoint:[MPNetwork pathForEndpoint:endpoint] + byHTTPMethod:@"POST" + withQueryItems:nil + andBody:body]; +} + +- (NSURLRequest *)buildRequestForEndpoint:(NSString *)endpoint + byHTTPMethod:(NSString *)method + withQueryItems:(NSArray *)queryItems + andBody:(NSString *)body { + // Build URL from path and query items + NSURL *urlWithEndpoint = [self.serverURL URLByAppendingPathComponent:endpoint]; + NSURLComponents *components = [NSURLComponents componentsWithURL:urlWithEndpoint + resolvingAgainstBaseURL:YES]; + components.queryItems = queryItems; + + // NSURLComponents/NSURLQueryItem doesn't encode + as %2B, and then the + is interpreted as a space on servers + components.percentEncodedQuery = [components.percentEncodedQuery stringByReplacingOccurrencesOfString:@"+" withString:@"%2B"]; + + // Build request from URL + NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:components.URL]; + [request setValue:@"gzip" forHTTPHeaderField:@"Accept-Encoding"]; + [request setHTTPMethod:method]; + [request setHTTPBody:[body dataUsingEncoding:NSUTF8StringEncoding]]; + + MPLogDebug(@"%@ http request: %@?%@", self, request, body); + + return [request copy]; +} + ++ (NSString *)encodeArrayForAPI:(NSArray *)array { + NSData *data = [MPNetwork encodeArrayAsJSONData:array]; + return [MPNetwork encodeJSONDataAsBase64:data]; +} + ++ (NSData *)encodeArrayAsJSONData:(NSArray *)array { + NSError *error = NULL; + NSData *data = nil; + @try { + data = [NSJSONSerialization dataWithJSONObject:[self convertFoundationTypesToJSON:array] + options:(NSJSONWritingOptions)0 + error:&error]; + } + @catch (NSException *exception) { + MPLogError(@"exception encoding api data: %@", exception); + } + + if (error) { + MPLogError(@"error encoding api data: %@", error); + } + + return data; +} + ++ (NSString *)encodeJSONDataAsBase64:(NSData *)data { + return [data base64EncodedStringWithOptions:NSDataBase64Encoding64CharacterLineLength]; +} + ++ (id)convertFoundationTypesToJSON:(id)obj { + // valid json types + if ([obj isKindOfClass:NSString.class] || [obj isKindOfClass:NSNumber.class] || [obj isKindOfClass:NSNull.class]) { + return obj; + } + + if ([obj isKindOfClass:NSDate.class]) { + return [[self dateFormatter] stringFromDate:obj]; + } else if ([obj isKindOfClass:NSURL.class]) { + return [obj absoluteString]; + } + + // recurse on containers + if ([obj isKindOfClass:NSArray.class]) { + NSMutableArray *a = [NSMutableArray array]; + for (id i in obj) { + [a addObject:[self convertFoundationTypesToJSON:i]]; + } + return [NSArray arrayWithArray:a]; + } + + if ([obj isKindOfClass:NSDictionary.class]) { + NSMutableDictionary *d = [NSMutableDictionary dictionary]; + for (id key in obj) { + NSString *stringKey = key; + if (![key isKindOfClass:[NSString class]]) { + stringKey = [key description]; + MPLogWarning(@"%@ property keys should be strings. got: %@. coercing to: %@", self, [key class], stringKey); + } + id v = [self convertFoundationTypesToJSON:obj[key]]; + d[stringKey] = v; + } + return [NSDictionary dictionaryWithDictionary:d]; + } + + // default to sending the object's description + NSString *s = [obj description]; + MPLogWarning(@"%@ property values should be valid json types. got: %@. coercing to: %@", self, [obj class], s); + return s; +} + ++ (NSDateFormatter *)dateFormatter { + static NSDateFormatter *formatter = nil; + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + formatter = [[NSDateFormatter alloc] init]; + formatter.dateFormat = @"yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"; + formatter.timeZone = [NSTimeZone timeZoneWithAbbreviation:@"UTC"]; + formatter.locale = [[NSLocale alloc] initWithLocaleIdentifier:@"en_US_POSIX"]; + }); + return formatter; +} + ++ (NSTimeInterval)calculateBackOffTimeFromFailures:(NSUInteger)failureCount { + NSTimeInterval time = pow(2.0, failureCount - 1) * 60 + arc4random_uniform(30); + return MIN(MAX(60, time), 600); +} + ++ (NSTimeInterval)parseRetryAfterTime:(NSHTTPURLResponse *)response { + return [response.allHeaderFields[@"Retry-After"] doubleValue]; +} + ++ (BOOL)parseHTTPFailure:(NSHTTPURLResponse *)response withError:(NSError *)error { + return (error != nil || (500 <= response.statusCode && response.statusCode <= 599)); +} + +- (void)updateNetworkActivityIndicator:(BOOL)enabled { +#if !MIXPANEL_NO_NETWORK_ACTIVITY_INDICATOR + if (self.shouldManageNetworkActivityIndicator) { + [UIApplication sharedApplication].networkActivityIndicatorVisible = enabled; + } +#endif +} + +@end diff --git a/Pods/Mixpanel/Mixpanel/MPNetworkPrivate.h b/Pods/Mixpanel/Mixpanel/MPNetworkPrivate.h new file mode 100644 index 0000000..3d05fce --- /dev/null +++ b/Pods/Mixpanel/Mixpanel/MPNetworkPrivate.h @@ -0,0 +1,39 @@ +// +// MPNetworkPrivate.h +// Mixpanel +// +// Created by Sam Green on 6/17/16. +// Copyright © 2016 Mixpanel. All rights reserved. +// + +#import "MPNetwork.h" + +@interface MPNetwork () + +@property (nonatomic, strong) NSURL *serverURL; + +@property (nonatomic) NSTimeInterval requestsDisabledUntilTime; +@property (nonatomic) NSUInteger consecutiveFailures; + +- (BOOL)handleNetworkResponse:(NSHTTPURLResponse *)response withError:(NSError *)error; + ++ (NSTimeInterval)calculateBackOffTimeFromFailures:(NSUInteger)failureCount; ++ (NSTimeInterval)parseRetryAfterTime:(NSHTTPURLResponse *)response; ++ (BOOL)parseHTTPFailure:(NSHTTPURLResponse *)response withError:(NSError *)error; + ++ (NSString *)encodeArrayForAPI:(NSArray *)array; ++ (NSData *)encodeArrayAsJSONData:(NSArray *)array; ++ (NSString *)encodeJSONDataAsBase64:(NSData *)data; + ++ (NSArray *)buildDecideQueryForProperties:(NSDictionary *)properties + withDistinctID:(NSString *)distinctID + andToken:(NSString *)token; + +- (NSURLRequest *)buildRequestForEndpoint:(NSString *)endpoint + byHTTPMethod:(NSString *)method + withQueryItems:(NSArray *)queryItems + andBody:(NSString *)body; + ++ (NSURLSession *)sharedURLSession; + +@end diff --git a/Pods/Mixpanel/Mixpanel/MPNotification.h b/Pods/Mixpanel/Mixpanel/MPNotification.h index ffbab4c..9d1b766 100644 --- a/Pods/Mixpanel/Mixpanel/MPNotification.h +++ b/Pods/Mixpanel/Mixpanel/MPNotification.h @@ -1,13 +1,14 @@ #import -@interface MPNotification : NSObject - extern NSString *const MPNotificationTypeMini; extern NSString *const MPNotificationTypeTakeover; +@interface MPNotification : NSObject + @property (nonatomic, readonly) NSUInteger ID; @property (nonatomic, readonly) NSUInteger messageID; @property (nonatomic, strong) NSString *type; +@property (nonatomic, strong) NSString *style; @property (nonatomic, strong) NSURL *imageURL; @property (nonatomic, strong) NSData *image; @property (nonatomic, strong) NSString *title; @@ -16,7 +17,6 @@ extern NSString *const MPNotificationTypeTakeover; @property (nonatomic, strong) NSURL *callToActionURL; + (MPNotification *)notificationWithJSONObject:(NSDictionary *)object; - - (instancetype)init __unavailable; @end diff --git a/Pods/Mixpanel/Mixpanel/MPNotification.m b/Pods/Mixpanel/Mixpanel/MPNotification.m index 011a772..ebbddef 100644 --- a/Pods/Mixpanel/Mixpanel/MPNotification.m +++ b/Pods/Mixpanel/Mixpanel/MPNotification.m @@ -1,61 +1,57 @@ -#if ! __has_feature(objc_arc) -#error This file must be compiled with ARC. Either turn on ARC for the project or use -fobjc-arc flag on this file. -#endif - #import "MPLogger.h" #import "MPNotification.h" -@interface MPNotification () - -- (instancetype)initWithID:(NSUInteger)ID messageID:(NSUInteger)messageID type:(NSString *)type title:(NSString *)title body:(NSString *)body callToAction:(NSString *)callToAction callToActionURL:(NSURL *)callToActionURL imageURL:(NSURL *)imageURL; - -@end - -@implementation MPNotification - NSString *const MPNotificationTypeMini = @"mini"; NSString *const MPNotificationTypeTakeover = @"takeover"; +@implementation MPNotification + + (MPNotification *)notificationWithJSONObject:(NSDictionary *)object { if (object == nil) { - MixpanelError(@"notif json object should not be nil"); + MPLogError(@"notif json object should not be nil"); return nil; } NSNumber *ID = object[@"id"]; - if (!([ID isKindOfClass:[NSNumber class]] && [ID integerValue] > 0)) { - MixpanelError(@"invalid notif id: %@", ID); + if (!([ID isKindOfClass:[NSNumber class]] && ID.integerValue > 0)) { + MPLogError(@"invalid notif id: %@", ID); return nil; } NSNumber *messageID = object[@"message_id"]; - if (!([messageID isKindOfClass:[NSNumber class]] && [messageID integerValue] > 0)) { - MixpanelError(@"invalid notif message id: %@", messageID); + if (!([messageID isKindOfClass:[NSNumber class]] && messageID.integerValue > 0)) { + MPLogError(@"invalid notif message id: %@", messageID); return nil; } NSString *type = object[@"type"]; if (![type isKindOfClass:[NSString class]]) { - MixpanelError(@"invalid notif type: %@", type); + MPLogError(@"invalid notif type: %@", type); + return nil; + } + + NSString *style = object[@"style"]; + if (![style isKindOfClass:[NSString class]]) { + MPLogError(@"invalid notif style: %@", style); return nil; } NSString *title = object[@"title"]; if (![title isKindOfClass:[NSString class]]) { - MixpanelError(@"invalid notif title: %@", title); + MPLogError(@"invalid notif title: %@", title); return nil; } NSString *body = object[@"body"]; if (![body isKindOfClass:[NSString class]]) { - MixpanelError(@"invalid notif body: %@", body); + MPLogError(@"invalid notif body: %@", body); return nil; } NSString *callToAction = object[@"cta"]; if (![callToAction isKindOfClass:[NSString class]]) { - MixpanelError(@"invalid notif cta: %@", callToAction); + MPLogError(@"invalid notif cta: %@", callToAction); return nil; } @@ -63,13 +59,13 @@ + (MPNotification *)notificationWithJSONObject:(NSDictionary *)object NSObject *URLString = object[@"cta_url"]; if (URLString != nil && ![URLString isKindOfClass:[NSNull class]]) { if (![URLString isKindOfClass:[NSString class]] || [(NSString *)URLString length] == 0) { - MixpanelError(@"invalid notif URL: %@", URLString); + MPLogError(@"invalid notif URL: %@", URLString); return nil; } callToActionURL = [NSURL URLWithString:(NSString *)URLString]; if (callToActionURL == nil) { - MixpanelError(@"invalid notif URL: %@", URLString); + MPLogError(@"invalid notif URL: %@", URLString); return nil; } } @@ -78,14 +74,14 @@ + (MPNotification *)notificationWithJSONObject:(NSDictionary *)object NSString *imageURLString = object[@"image_url"]; if (imageURLString != nil && ![imageURLString isKindOfClass:[NSNull class]]) { if (![imageURLString isKindOfClass:[NSString class]]) { - MixpanelError(@"invalid notif image URL: %@", imageURLString); + MPLogError(@"invalid notif image URL: %@", imageURLString); return nil; } - NSString *escapedUrl = [imageURLString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; - imageURL = [NSURL URLWithString:escapedUrl]; + NSString *escapedURLString = [imageURLString stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]]; + imageURL = [NSURL URLWithString:escapedURLString]; if (imageURL == nil) { - MixpanelError(@"invalid notif image URL: %@", imageURLString); + MPLogError(@"invalid notif image URL: %@", escapedURLString); return nil; } @@ -95,65 +91,66 @@ + (MPNotification *)notificationWithJSONObject:(NSDictionary *)object NSString *extension = [imagePath pathExtension]; imagePath = [[imageName stringByAppendingString:@"@2x"] stringByAppendingPathExtension:extension]; } - - imagePath = [imagePath stringByAddingPercentEscapesUsingEncoding:NSStringEncodingConversionExternalRepresentation]; - imageURL = [[NSURL alloc] initWithScheme:imageURL.scheme host:imageURL.host path:imagePath]; - - if (imageURL == nil) { - MixpanelError(@"invalid notif image URL: %@", imageURLString); + + NSURLComponents *imageURLComponents = [[NSURLComponents alloc] init]; + imageURLComponents.scheme = imageURL.scheme; + imageURLComponents.host = imageURL.host; + imageURLComponents.path = imagePath; + + if (imageURLComponents.URL == nil) { + MPLogError(@"invalid notif image URL: %@", imageURLString); return nil; } + imageURL = imageURLComponents.URL; } - NSArray *supportedOrientations = [[NSBundle mainBundle] infoDictionary][@"UISupportedInterfaceOrientations"]; - if (![supportedOrientations containsObject:@"UIInterfaceOrientationPortrait"] && [type isEqualToString:@"takeover"]) { - MixpanelError(@"takeover notifications are not supported in landscape-only apps."); - return nil; - } - - return [[MPNotification alloc] initWithID:[ID unsignedIntegerValue] - messageID:[messageID unsignedIntegerValue] - type:type - title:title - body:body - callToAction:callToAction - callToActionURL:callToActionURL - imageURL:imageURL]; + return [[MPNotification alloc] initWithID:ID.unsignedIntegerValue + messageID:messageID.unsignedIntegerValue + type:type + style:style + title:title + body:body + callToAction:callToAction + callToActionURL:callToActionURL + imageURL:imageURL]; } -- (instancetype)initWithID:(NSUInteger)ID messageID:(NSUInteger)messageID type:(NSString *)type title:(NSString *)title body:(NSString *)body callToAction:(NSString *)callToAction callToActionURL:(NSURL *)callToActionURL imageURL:(NSURL *)imageURL +- (instancetype)initWithID:(NSUInteger)ID + messageID:(NSUInteger)messageID + type:(NSString *)type + style:(NSString *)style + title:(NSString *)title + body:(NSString *)body + callToAction:(NSString *)callToAction + callToActionURL:(NSURL *)callToActionURL + imageURL:(NSURL *)imageURL { if (self = [super init]) { - BOOL valid = YES; - - if (!(title && title.length > 0)) { - valid = NO; - MixpanelError(@"Notification title nil or empty: %@", title); + if (title.length == 0) { + MPLogError(@"Notification title nil or empty: %@", title); + return nil; } - if (!(body && body.length > 0)) { - valid = NO; - MixpanelError(@"Notification body nil or empty: %@", body); + if (body.length == 0) { + MPLogError(@"Notification body nil or empty: %@", body); + return nil; } if (!([type isEqualToString:MPNotificationTypeTakeover] || [type isEqualToString:MPNotificationTypeMini])) { - valid = NO; - MixpanelError(@"Invalid notification type: %@, must be %@ or %@", type, MPNotificationTypeMini, MPNotificationTypeTakeover); + MPLogError(@"Invalid notification type: %@, must be %@ or %@", type, MPNotificationTypeMini, MPNotificationTypeTakeover); + return nil; } - if (valid) { - _ID = ID; - _messageID = messageID; - self.type = type; - self.title = title; - self.body = body; - self.imageURL = imageURL; - self.callToAction = callToAction; - self.callToActionURL = callToActionURL; - self.image = nil; - } else { - self = nil; - } + _ID = ID; + _messageID = messageID; + _type = type; + _style = style; + _title = title; + _body = body; + _imageURL = imageURL; + _callToAction = callToAction; + _callToActionURL = callToActionURL; + _image = nil; } return self; @@ -165,7 +162,7 @@ - (NSData *)image NSError *error = nil; NSData *imageData = [NSData dataWithContentsOfURL:_imageURL options:NSDataReadingMappedIfSafe error:&error]; if (error || !imageData) { - MixpanelError(@"image failed to load from URL: %@", _imageURL); + MPLogError(@"image failed to load from URL: %@", _imageURL); return nil; } _image = imageData; diff --git a/Pods/Mixpanel/Mixpanel/MPNotification.storyboard b/Pods/Mixpanel/Mixpanel/MPNotification.storyboard deleted file mode 100644 index 1313bc1..0000000 --- a/Pods/Mixpanel/Mixpanel/MPNotification.storyboard +++ /dev/null @@ -1,153 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Pods/Mixpanel/Mixpanel/MPNotificationViewController.h b/Pods/Mixpanel/Mixpanel/MPNotificationViewController.h index fdd5f0a..88defff 100644 --- a/Pods/Mixpanel/Mixpanel/MPNotificationViewController.h +++ b/Pods/Mixpanel/Mixpanel/MPNotificationViewController.h @@ -1,7 +1,3 @@ -#if ! __has_feature(objc_arc) -#error This file must be compiled with ARC. Either turn on ARC for the project or use -fobjc-arc flag on this file. -#endif - #import "MPNotification.h" @protocol MPNotificationViewControllerDelegate; diff --git a/Pods/Mixpanel/Mixpanel/MPNotificationViewController.m b/Pods/Mixpanel/Mixpanel/MPNotificationViewController.m index 1c282be..5aa0cfd 100644 --- a/Pods/Mixpanel/Mixpanel/MPNotificationViewController.m +++ b/Pods/Mixpanel/Mixpanel/MPNotificationViewController.m @@ -1,7 +1,3 @@ -#if ! __has_feature(objc_arc) -#error This file must be compiled with ARC. Either turn on ARC for the project or use -fobjc-arc flag on this file. -#endif - #import #import #import "UIView+MPHelpers.h" @@ -11,6 +7,7 @@ #import "UIColor+MPColor.h" #import "UIImage+MPAverageColor.h" #import "UIImage+MPImageEffects.h" +#import "MPFoundation.h" #define MPNotifHeight 65.0f @@ -45,6 +42,8 @@ @interface MPBgRadialGradientView : UIView @interface MPActionButton : UIButton +@property (nonatomic, assign) BOOL isLight; + @end @interface MPNotificationViewController () @@ -68,14 +67,10 @@ @interface MPTakeoverNotificationViewController () { @property (nonatomic, strong) IBOutlet UIImageView *imageView; @property (nonatomic, strong) IBOutlet UILabel *titleView; @property (nonatomic, strong) IBOutlet UILabel *bodyView; -@property (nonatomic, strong) IBOutlet UIButton *okayButton; +@property (nonatomic, strong) IBOutlet MPActionButton *okayButton; @property (nonatomic, strong) IBOutlet UIButton *closeButton; -@property (nonatomic, strong) IBOutlet MPAlphaMaskView *imageAlphaMaskView; @property (nonatomic, strong) IBOutlet UIImageView *backgroundImageView; -@property (nonatomic, strong) IBOutlet NSLayoutConstraint *imageWidth; -@property (nonatomic, strong) IBOutlet NSLayoutConstraint *imageHeight; -@property (nonatomic, strong) IBOutlet UIView *imageDragView; -@property (nonatomic, strong) IBOutlet UIView *bgMask; +@property (nonatomic, strong) IBOutlet UIView *viewMask; @end @@ -88,40 +83,41 @@ @implementation MPTakeoverNotificationViewController - (void)viewDidLoad { [super viewDidLoad]; - self.backgroundImageView.image = self.backgroundImage; if (self.notification) { if (self.notification.image) { UIImage *image = [UIImage imageWithData:self.notification.image scale:2.0f]; if (image) { - self.imageWidth.constant = image.size.width; - self.imageHeight.constant = image.size.height; self.imageView.image = image; } else { - MixpanelError(@"image failed to load from data: %@", self.notification.image); + MPLogError(@"image failed to load from data: %@", self.notification.image); } } self.titleView.text = self.notification.title; self.bodyView.text = self.notification.body; - if (self.notification.callToAction && [self.notification.callToAction length] > 0) { + if (self.notification.callToAction.length > 0) { [self.okayButton setTitle:self.notification.callToAction forState:UIControlStateNormal]; - [self.okayButton sizeToFit]; + } + + if ([self.notification.style isEqualToString:@"light"]) { + self.viewMask.backgroundColor = [UIColor whiteColor]; + self.titleView.textColor = [UIColor colorWithRed:92/255.0 green:101/255.0 blue:120/255.0 alpha:1]; + self.bodyView.textColor = [UIColor colorWithRed:123/255.0 green:146/255.0 blue:163/255.0 alpha:1]; + self.okayButton.isLight = YES; + [self.okayButton setTitleColor:[UIColor colorWithRed:123/255.0 green:146/255.0 blue:163/255.0 alpha:1] forState:UIControlStateNormal]; + self.okayButton.layer.borderColor = [UIColor colorWithRed:218/255.0 green:223/255.0 blue:232/255.0 alpha:1].CGColor; + UIImage *origImage = [self.closeButton imageForState:UIControlStateNormal]; + UIImage *tintedImage = [origImage imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate]; + [self.closeButton setImage:tintedImage forState:UIControlStateNormal]; + self.closeButton.tintColor = [UIColor colorWithRed:217/255.0 green:217/255.0 blue:217/255.0 alpha:1]; } } - - self.imageView.contentMode = UIViewContentModeScaleAspectFill; - self.imageView.layer.shadowOffset = CGSizeMake(0.0f, 0.0f); - self.imageView.layer.shadowOpacity = 1.0f; - self.imageView.layer.shadowRadius = 5.0f; - self.imageView.layer.shadowColor = [UIColor blackColor].CGColor; - - [self.okayButton addTarget:self action:@selector(pressedOkay) forControlEvents:UIControlEventTouchUpInside]; - [self.closeButton addTarget:self action:@selector(pressedClose) forControlEvents:UIControlEventTouchUpInside]; - - UIPanGestureRecognizer *gesture = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(didPan:)]; - [self.imageDragView addGestureRecognizer:gesture]; + + self.backgroundImageView.image = self.backgroundImage; + self.viewMask.clipsToBounds = YES; + self.viewMask.layer.cornerRadius = 6.f; } - (void)hideWithAnimation:(BOOL)animated completion:(void (^)(void))completion @@ -131,93 +127,46 @@ - (void)hideWithAnimation:(BOOL)animated completion:(void (^)(void))completion - (void)viewDidLayoutSubviews { - [self.okayButton sizeToFit]; - [self.imageAlphaMaskView sizeToFit]; + [super viewDidLayoutSubviews]; + + self.okayButton.center = CGPointMake(CGRectGetMidX(self.okayButton.superview.bounds), self.okayButton.center.y); +} + +- (BOOL)shouldAutorotate +{ + return NO; } -#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 70000 - (UIStatusBarStyle)preferredStatusBarStyle { return UIStatusBarStyleLightContent; } -#endif - (UIStatusBarAnimation)preferredStatusBarUpdateAnimation { return UIStatusBarAnimationFade; } -#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 90000 - (UIInterfaceOrientationMask)supportedInterfaceOrientations -#else -- (NSUInteger)supportedInterfaceOrientations -#endif { - return UIInterfaceOrientationMaskPortrait; + return UIInterfaceOrientationMaskAll; } -- (void)beginAppearanceTransition:(BOOL)isAppearing animated:(BOOL)animated +- (IBAction)pressedOkay { - [super beginAppearanceTransition:isAppearing animated:animated]; - - if (isAppearing) { - self.bgMask.alpha = 0.0f; - self.imageView.alpha = 0.0f; - self.titleView.alpha = 0.0f; - self.bodyView.alpha = 0.0f; - self.okayButton.alpha = 0.0f; - self.closeButton.alpha = 0.0f; + if ([self.delegate respondsToSelector:@selector(notificationController:wasDismissedWithStatus:)]) { + [self.delegate notificationController:self wasDismissedWithStatus:YES]; } } -- (void)endAppearanceTransition -{ - [super endAppearanceTransition]; - - NSTimeInterval duration = 0.20f; - - CGAffineTransform transform = CGAffineTransformMakeTranslation(0.0f, 10.0f); - transform = CGAffineTransformScale(transform, 0.9f, 0.9f); - self.imageView.transform = transform; - self.titleView.transform = transform; - self.bodyView.transform = transform; - self.okayButton.transform = transform; - - [UIView animateWithDuration:duration delay:0.0f options:UIViewAnimationOptionCurveEaseOut animations:^{ - self.titleView.transform = CGAffineTransformIdentity; - self.titleView.alpha = 1.0f; - self.bodyView.transform = CGAffineTransformIdentity; - self.bodyView.alpha = 1.0f; - self.okayButton.transform = CGAffineTransformIdentity; - self.okayButton.alpha = 1.0f; - self.imageView.transform = CGAffineTransformIdentity; - self.imageView.alpha = 1.0f; - self.bgMask.alpha = 1.0f; - } completion:nil]; - - [UIView animateWithDuration:duration delay:0.15f options:UIViewAnimationOptionCurveEaseOut animations:^{ - self.closeButton.transform = CGAffineTransformIdentity; - self.closeButton.alpha = 1.0f; - } completion:nil]; -} - -- (void)pressedOkay +- (IBAction)pressedClose { - id strongDelegate = self.delegate; - if (strongDelegate) { - [strongDelegate notificationController:self wasDismissedWithStatus:YES]; + if ([self.delegate respondsToSelector:@selector(notificationController:wasDismissedWithStatus:)]) { + [self.delegate notificationController:self wasDismissedWithStatus:NO]; } } -- (void)pressedClose -{ - id strongDelegate = self.delegate; - if (strongDelegate) { - [strongDelegate notificationController:self wasDismissedWithStatus:NO]; - } -} - -- (void)didPan:(UIPanGestureRecognizer *)gesture +- (IBAction)didPan:(UIPanGestureRecognizer *)gesture { if (gesture.numberOfTouches == 1) { if (gesture.state == UIGestureRecognizerStateBegan) { @@ -225,7 +174,7 @@ - (void)didPan:(UIPanGestureRecognizer *)gesture _touching = YES; } else if (gesture.state == UIGestureRecognizerStateChanged) { CGPoint translation = [gesture translationInView:self.view]; - self.imageView.layer.position = CGPointMake(0.3f * (translation.x) + _viewStart.x, 0.3f * (translation.y) + _viewStart.y); + self.imageView.layer.position = CGPointMake(0.3f * translation.x + _viewStart.x, 0.3f * translation.y + _viewStart.y); } } @@ -257,6 +206,8 @@ @interface MPMiniNotificationViewController () { @implementation MPMiniNotificationViewController +static const NSUInteger MPMiniNotificationSpacingFromBottom = 10; + - (void)viewDidLoad { [super viewDidLoad]; @@ -275,15 +226,7 @@ - (void)viewDidLoad self.bodyLabel.lineBreakMode = NSLineBreakByWordWrapping; self.bodyLabel.numberOfLines = 0; - if (!self.backgroundColor) { - self.backgroundColor = [UIColor mp_applicationPrimaryColor]; - if (!self.backgroundColor) { - self.backgroundColor = [UIColor mp_darkEffectColor]; - } - } - - UIColor *backgroundColorWithAlphaComponent = [self.backgroundColor colorWithAlphaComponent:0.95f]; - self.view.backgroundColor = backgroundColorWithAlphaComponent; + [self initializeMiniNotification]; if (self.notification != nil) { if (self.notification.image != nil) { @@ -299,15 +242,21 @@ - (void)viewDidLoad } else { self.bodyLabel.hidden = YES; } + + if ([self.notification.style isEqualToString:@"light"]) { + self.view.backgroundColor = [UIColor whiteColor]; + self.bodyLabel.textColor = [UIColor colorWithRed:123/255.0 green:146/255.0 blue:163/255.0 alpha:1]; + UIImage *origImage = self.imageView.image; + UIImage *tintedImage = [origImage imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate]; + self.imageView.image = tintedImage; + self.imageView.tintColor = [UIColor colorWithRed:123/255.0 green:146/255.0 blue:163/255.0 alpha:1]; + self.view.layer.borderColor = [UIColor colorWithRed:218/255.0 green:223/255.0 blue:232/255.0 alpha:1].CGColor; + self.view.layer.borderWidth = 1; + } } - self.circleLayer = [CircleLayer layer]; - self.circleLayer.contentsScale = [UIScreen mainScreen].scale; - [self.circleLayer setNeedsDisplay]; - [self.view addSubview:self.imageView]; [self.view addSubview:self.bodyLabel]; - [self.view.layer addSublayer:self.circleLayer]; self.view.frame = CGRectMake(0.0f, 0.0f, 0.0f, 30.0f); @@ -319,25 +268,23 @@ - (void)viewDidLoad [self.view addGestureRecognizer:pan]; } +- (void)initializeMiniNotification { + self.backgroundColor = [UIColor colorWithWhite:0 alpha:0.901f]; + self.view.backgroundColor = self.backgroundColor; +} + - (void)viewWillLayoutSubviews { UIView *parentView = self.view.superview; - CGRect parentFrame; -#if __IPHONE_OS_VERSION_MIN_REQUIRED >= 80000 - parentFrame = parentView.frame; -#elif __IPHONE_OS_VERSION_MAX_ALLOWED >= 80000 - if ([self respondsToSelector:@selector(viewWillTransitionToSize:withTransitionCoordinator:)]) { - parentFrame = parentView.frame; + CGRect parentFrame = parentView.frame; + + if (UIInterfaceOrientationIsPortrait([UIApplication sharedApplication].statusBarOrientation) && UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) { + self.view.frame = CGRectMake(15, parentFrame.size.height - MPNotifHeight - MPMiniNotificationSpacingFromBottom, parentFrame.size.width - 30, MPNotifHeight); } else { - double angle = [self angleForInterfaceOrientation:[self interfaceOrientation]]; - parentFrame = CGRectApplyAffineTransform(parentView.frame, CGAffineTransformMakeRotation((float)angle)); + self.view.frame = CGRectMake(parentFrame.size.width/4, parentFrame.size.height - MPNotifHeight - MPMiniNotificationSpacingFromBottom, parentFrame.size.width/2, MPNotifHeight); } -#else - double angle = [self angleForInterfaceOrientation:[self interfaceOrientation]]; - parentFrame = CGRectApplyAffineTransform(parentView.frame, CGAffineTransformMakeRotation((float)angle)); -#endif - - self.view.frame = CGRectMake(0.0f, parentFrame.size.height - MPNotifHeight, parentFrame.size.width, MPNotifHeight * 3.0f); + self.view.clipsToBounds = YES; + self.view.layer.cornerRadius = 6.f; // Position images self.imageView.layer.position = CGPointMake(MPNotifHeight / 2.0f, MPNotifHeight / 2.0f); @@ -348,29 +295,10 @@ - (void)viewWillLayoutSubviews // Position body label CGSize constraintSize = CGSizeMake(self.view.frame.size.width - MPNotifHeight - 12.5f, CGFLOAT_MAX); - CGSize sizeToFit; - // Use boundingRectWithSize for iOS 7 and above, sizeWithFont otherwise. -#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 70000 - if ([[[UIDevice currentDevice] systemVersion] compare:@"7.0" options:NSNumericSearch] != NSOrderedAscending) { - sizeToFit = [self.bodyLabel.text boundingRectWithSize:constraintSize - options:NSStringDrawingUsesLineFragmentOrigin - attributes:@{NSFontAttributeName: self.bodyLabel.font} - context:nil].size; - } else { -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated" - - sizeToFit = [self.bodyLabel.text sizeWithFont:self.bodyLabel.font - constrainedToSize:constraintSize - lineBreakMode:self.bodyLabel.lineBreakMode]; - -#pragma clang diagnostic pop - } -#else - sizeToFit = [self.bodyLabel.text sizeWithFont:self.bodyLabel.font - constrainedToSize:constraintSize - lineBreakMode:self.bodyLabel.lineBreakMode]; -#endif + CGSize sizeToFit = [self.bodyLabel.text boundingRectWithSize:constraintSize + options:NSStringDrawingUsesLineFragmentOrigin + attributes:@{NSFontAttributeName: self.bodyLabel.font} + context:nil].size; self.bodyLabel.frame = CGRectMake(MPNotifHeight, (CGFloat)ceil((MPNotifHeight - sizeToFit.height) / 2.0f) - 2.0f, (CGFloat)ceil(sizeToFit.width), (CGFloat)ceil(sizeToFit.height)); } @@ -378,12 +306,9 @@ - (void)viewWillLayoutSubviews - (UIView *)getTopView { UIView *topView = nil; - UIWindow *window = [[UIApplication sharedApplication] keyWindow]; - if(window) { - for (UIView *subview in window.subviews) { - if (!subview.hidden && subview.alpha > 0 && subview.frame.size.width > 0 && subview.frame.size.height > 0) { - topView = subview; - } + for (UIView *subview in [UIApplication sharedApplication].keyWindow.subviews) { + if (!subview.hidden && subview.alpha > 0 && subview.frame.size.width > 0 && subview.frame.size.height > 0) { + topView = subview; } } return topView; @@ -409,23 +334,7 @@ - (void)showWithAnimation UIView *topView = [self getTopView]; if (topView) { - - CGRect topFrame; - -#if __IPHONE_OS_VERSION_MIN_REQUIRED >= 80000 - topFrame = topView.frame; -#elif __IPHONE_OS_VERSION_MAX_ALLOWED >= 80000 - if ([self respondsToSelector:@selector(viewWillTransitionToSize:withTransitionCoordinator:)]) { - topFrame = topView.frame; - } else { - double angle = [self angleForInterfaceOrientation:[self interfaceOrientation]]; - topFrame = CGRectApplyAffineTransform(topView.frame, CGAffineTransformMakeRotation((float)angle)); - } -#else - double angle = [self angleForInterfaceOrientation:[self interfaceOrientation]]; - topFrame = CGRectApplyAffineTransform(topView.frame, CGAffineTransformMakeRotation((float)angle)); -#endif - + CGRect topFrame = topView.frame; [topView addSubview:self.view]; _canPan = NO; @@ -470,48 +379,26 @@ - (void)hideWithAnimation:(BOOL)animated completion:(void (^)(void))completion if (!_isBeingDismissed) { _isBeingDismissed = YES; - - CGFloat duration; - - if (animated) { - duration = 0.5f; - } else { - duration = 0.0f; - } - - UIView *parentView = self.view.superview; - CGRect parentFrame; - -#if __IPHONE_OS_VERSION_MIN_REQUIRED >= 80000 - parentFrame = parentView.frame; -#elif __IPHONE_OS_VERSION_MAX_ALLOWED >= 80000 - if ([self respondsToSelector:@selector(viewWillTransitionToSize:withTransitionCoordinator:)]) { - parentFrame = parentView.frame; - } else { - double angle = [self angleForInterfaceOrientation:[self interfaceOrientation]]; - parentFrame = CGRectApplyAffineTransform(parentView.frame, CGAffineTransformMakeRotation((float)angle)); - } -#else - double angle = [self angleForInterfaceOrientation:[self interfaceOrientation]]; - parentFrame = CGRectApplyAffineTransform(parentView.frame, CGAffineTransformMakeRotation((float)angle)); -#endif - - [UIView animateWithDuration:duration animations:^{ - self.view.frame = CGRectMake(0.0f, parentFrame.size.height, parentFrame.size.width, MPNotifHeight * 3.0f); - } completion:^(BOOL finished) { - [self.view removeFromSuperview]; - if (completion) { - completion(); - } - }]; + + CGFloat duration = animated ? 0.5f : 0.f; + CGRect parentFrame = self.view.superview.frame; + + [UIView animateWithDuration:duration + animations:^{ + self.view.frame = CGRectMake(self.view.frame.origin.x, parentFrame.size.height, self.view.frame.size.width, self.view.frame.size.height); + } completion:^(BOOL finished) { + [self.view removeFromSuperview]; + if (completion) { + completion(); + } + }]; } } - (void)didTap:(UITapGestureRecognizer *)gesture { - id strongDelegate = self.delegate; - if (!_isBeingDismissed && gesture.state == UIGestureRecognizerStateEnded && strongDelegate != nil) { - [strongDelegate notificationController:self wasDismissedWithStatus:YES]; + if (!_isBeingDismissed && gesture.state == UIGestureRecognizerStateEnded) { + [self.delegate notificationController:self wasDismissedWithStatus:YES]; } } @@ -550,11 +437,12 @@ @implementation MPAlphaMaskView - (instancetype)initWithCoder:(NSCoder *)aDecoder { - if(self = [super initWithCoder:aDecoder]) { + if (self = [super initWithCoder:aDecoder]) { _maskLayer = [GradientMaskLayer layer]; [self.layer setMask:_maskLayer]; self.opaque = NO; _maskLayer.opaque = NO; + _maskLayer.needsDisplayOnBoundsChange = YES; [_maskLayer setNeedsDisplay]; } return self; @@ -573,8 +461,7 @@ @implementation MPActionButton - (instancetype)initWithCoder:(NSCoder *)aDecoder { if (self = [super initWithCoder:aDecoder]) { - self.layer.backgroundColor = [UIColor colorWithRed:43.0f/255.0f green:43.0f/255.0f blue:52.0f/255.0f alpha:1.0f].CGColor; - self.layer.cornerRadius = 17.0f; + self.layer.cornerRadius = 5.0f; self.layer.borderColor = [UIColor whiteColor].CGColor; self.layer.borderWidth = 2.0f; } @@ -585,10 +472,13 @@ - (instancetype)initWithCoder:(NSCoder *)aDecoder - (void)setHighlighted:(BOOL)highlighted { if (highlighted) { - self.layer.borderColor = [UIColor colorWithRed:26.0f/255.0f green:26.0f/255.0f blue:35.0f/255.0f alpha:1.0f].CGColor; self.layer.borderColor = [UIColor grayColor].CGColor; } else { - self.layer.borderColor = [UIColor whiteColor].CGColor; + if (self.isLight) { + self.layer.borderColor = [UIColor colorWithRed:123/255.0 green:146/255.0 blue:163/255.0 alpha:1].CGColor; + } else { + self.layer.borderColor = [UIColor whiteColor].CGColor; + } } [super setHighlighted:highlighted]; @@ -600,7 +490,7 @@ @implementation MPBgRadialGradientView - (void)drawRect:(CGRect)rect { - CGPoint center = CGPointMake(160.0f, 200.0f); + CGPoint center = CGPointMake(CGRectGetMidX(rect), CGRectGetMidY(rect)); CGSize circleSize = CGSizeMake(center.y * 2.0f, center.y * 2.0f); CGRect circleFrame = CGRectMake(center.x - center.y, 0.0f, circleSize.width, circleSize.height); @@ -668,18 +558,17 @@ @implementation GradientMaskLayer - (void)drawInContext:(CGContextRef)ctx { - CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceGray(); - CGFloat components[] = { + + CGFloat components[] = { //[Grayscale, Alpha] for each component 1.0f, 1.0f, 1.0f, 1.0f, - 1.0f, 0.9f, + 1.0f, 0.0f, 1.0f, 0.0f}; - CGFloat locations[] = {0.0f, 0.7f, 0.8f, 1.0f}; - - CGGradientRef gradient = CGGradientCreateWithColorComponents(colorSpace, components, locations, 7); - CGContextDrawLinearGradient(ctx, gradient, CGPointMake(0.0f, 0.0f), CGPointMake(5.0f, self.bounds.size.height), 0); + CGFloat locations[] = {0.0f, 0.4f, 0.9f, 1.0f}; + CGGradientRef gradient = CGGradientCreateWithColorComponents(colorSpace, components, locations, 4); + CGContextDrawLinearGradient(ctx, gradient, CGPointMake(0.0f, 0.0f), CGPointMake(5.0f, self.bounds.size.height), (CGGradientDrawingOptions)0); NSUInteger bits = (NSUInteger)fabs(self.bounds.size.width) * (NSUInteger)fabs(self.bounds.size.height); diff --git a/Pods/Mixpanel/Mixpanel/MPNotification~ipad.storyboard b/Pods/Mixpanel/Mixpanel/MPNotification~ipad.storyboard new file mode 100644 index 0000000..1b52be0 --- /dev/null +++ b/Pods/Mixpanel/Mixpanel/MPNotification~ipad.storyboard @@ -0,0 +1,204 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Pods/Mixpanel/Mixpanel/MPNotification~iphonelandscape.storyboard b/Pods/Mixpanel/Mixpanel/MPNotification~iphonelandscape.storyboard new file mode 100644 index 0000000..1fe3e0a --- /dev/null +++ b/Pods/Mixpanel/Mixpanel/MPNotification~iphonelandscape.storyboard @@ -0,0 +1,193 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Pods/Mixpanel/Mixpanel/MPNotification~iphoneportrait.storyboard b/Pods/Mixpanel/Mixpanel/MPNotification~iphoneportrait.storyboard new file mode 100644 index 0000000..4d15d75 --- /dev/null +++ b/Pods/Mixpanel/Mixpanel/MPNotification~iphoneportrait.storyboard @@ -0,0 +1,175 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Pods/Mixpanel/Mixpanel/MPObjectSelector.h b/Pods/Mixpanel/Mixpanel/MPObjectSelector.h index 75a156b..bd97707 100644 --- a/Pods/Mixpanel/Mixpanel/MPObjectSelector.h +++ b/Pods/Mixpanel/Mixpanel/MPObjectSelector.h @@ -22,6 +22,7 @@ - (BOOL)fuzzyIsLeafSelected:(id)leaf fromRoot:(id)root; - (Class)selectedClass; +- (BOOL)pathContainsObjectOfClass:(Class)klass; - (NSString *)description; @end diff --git a/Pods/Mixpanel/Mixpanel/MPObjectSelector.m b/Pods/Mixpanel/Mixpanel/MPObjectSelector.m index 9a99aa4..522d04d 100644 --- a/Pods/Mixpanel/Mixpanel/MPObjectSelector.m +++ b/Pods/Mixpanel/Mixpanel/MPObjectSelector.m @@ -9,7 +9,6 @@ #import #import #import "MPObjectSelector.h" -#import "NSData+MPBase64.h" @interface MPObjectFilter : NSObject @@ -63,7 +62,7 @@ - (instancetype)initWithString:(NSString *)string NSMutableArray *filters = [NSMutableArray array]; MPObjectFilter *filter; - while((filter = [self nextFilter])) { + while ((filter = [self nextFilter])) { [filters addObject:filter]; } self.filters = [filters copy]; @@ -92,13 +91,14 @@ - (NSArray *)selectFromRoot:(id)root evaluatingFinalPredicate:(BOOL)finalPredica if (root) { views = @[root]; - for (NSUInteger i = 0, n = [_filters count]; i < n; i++) { - MPObjectFilter *filter = _filters[i]; + NSUInteger i = 0, n = _filters.count; + for (MPObjectFilter *filter in _filters) { filter.nameOnly = (i == n-1 && !finalPredicate); views = [filter apply:views]; - if ([views count] == 0) { + if (views.count == 0) { break; } + i++; } } return views; @@ -124,8 +124,8 @@ - (BOOL)isLeafSelected:(id)leaf fromRoot:(id)root evaluatingFinalPredicate:(BOOL { BOOL isSelected = YES; NSArray *views = @[leaf]; - NSUInteger n = [_filters count], i = n; - while(i--) { + NSUInteger n = _filters.count, i = n; + while (i--) { MPObjectFilter *filter = _filters[i]; filter.nameOnly = (i == n-1 && !finalPredicate); if (![filter appliesToAny:views]) { @@ -133,7 +133,7 @@ - (BOOL)isLeafSelected:(id)leaf fromRoot:(id)root evaluatingFinalPredicate:(BOOL break; } views = [filter applyReverse:views]; - if ([views count] == 0) { + if (views.count == 0) { break; } } @@ -191,24 +191,48 @@ - (MPObjectFilter *)nextFilter - (Class)selectedClass { - if ([_filters count] > 0) { - return NSClassFromString(((MPObjectFilter *)_filters[[_filters count] - 1]).name); + MPObjectFilter *filter = _filters.lastObject; + if (filter) { + return NSClassFromString(filter.name); } return nil; } +- (BOOL)pathContainsObjectOfClass:(Class)klass { + for (MPObjectFilter *filter in _filters) { + if ([NSClassFromString(filter.name) isSubclassOfClass:klass]) { + return YES; + } + } + return NO; +} + - (NSString *)description { return self.string; } +- (BOOL)isEqual:(id)other { + if (other == self) { + return YES; + } else if (![other isKindOfClass:[MPObjectSelector class]]) { + return NO; + } else { + return [self.string isEqual:((MPObjectSelector *)other).string]; + } +} + +- (NSUInteger)hash { + return [self.string hash]; +} + @end @implementation MPObjectFilter - (instancetype)init { - if((self = [super init])) { + if ((self = [super init])) { self.unique = NO; self.nameOnly = NO; } @@ -228,10 +252,10 @@ - (NSArray *)apply:(NSArray *)views // Select all children for (NSObject *view in views) { NSArray *children = [self getChildrenOfObject:view ofType:class]; - if (_index && [_index unsignedIntegerValue] < [children count]) { + if (_index && _index.unsignedIntegerValue < children.count) { // Indexing can only be used for subviews of UIView if ([view isKindOfClass:[UIView class]]) { - children = @[children[[_index unsignedIntegerValue]]]; + children = @[children[_index.unsignedIntegerValue]]; } else { children = @[]; } @@ -242,7 +266,7 @@ - (NSArray *)apply:(NSArray *)views if (!self.nameOnly) { // If unique is set and there are more than one, return nothing - if(self.unique && [result count] != 1) { + if (self.unique && result.count != 1) { return @[]; } // Filter any resulting views by predicate @@ -277,7 +301,7 @@ - (BOOL)appliesTo:(NSObject *)view return (([self.name isEqualToString:@"*"] || [view isKindOfClass:NSClassFromString(self.name)]) && (self.nameOnly || ( (!self.predicate || [_predicate evaluateWithObject:view]) - && (!self.index || [self isView:view siblingNumber:[_index integerValue]]) + && (!self.index || [self isView:view siblingNumber:_index.integerValue]) && (!(self.unique) || [self isView:view oneOfNSiblings:1]))) ); } @@ -316,8 +340,8 @@ - (BOOL)isView:(NSObject *)view siblingNumber:(NSInteger)index of:(NSInteger)num for (NSObject *parent in parents) { if ([parent isKindOfClass:[UIView class]]) { NSArray *siblings = [self getChildrenOfObject:parent ofType:NSClassFromString(_name)]; - if ((index < 0 || ((NSUInteger)index < [siblings count] && siblings[(NSUInteger)index] == view)) - && (numSiblings < 0 || [siblings count] == (NSUInteger)numSiblings)) { + if ((index < 0 || ((NSUInteger)index < siblings.count && siblings[(NSUInteger)index] == view)) + && (numSiblings < 0 || siblings.count == (NSUInteger)numSiblings)) { return YES; } } @@ -329,23 +353,28 @@ - (NSArray *)getParentsOfObject:(NSObject *)obj { NSMutableArray *result = [NSMutableArray array]; if ([obj isKindOfClass:[UIView class]]) { - if ([(UIView *)obj superview]) { - [result addObject:[(UIView *)obj superview]]; + UIView *superview = [(UIView *)obj superview]; + if (superview) { + [result addObject:superview]; } + UIResponder *nextResponder = [(UIView *)obj nextResponder]; // For UIView, nextResponder should be its controller or its superview. - if ([(UIView *)obj nextResponder] && [(UIView *)obj nextResponder] != [(UIView *)obj superview]) { - [result addObject:[(UIView *)obj nextResponder]]; + if (nextResponder && nextResponder != superview) { + [result addObject:nextResponder]; } } else if ([obj isKindOfClass:[UIViewController class]]) { - if ([(UIViewController *)obj parentViewController]) { - [result addObject:[(UIViewController *)obj parentViewController]]; + UIViewController *parentViewController = [(UIViewController *)obj parentViewController]; + if (parentViewController) { + [result addObject:parentViewController]; } - if ([(UIViewController *)obj presentingViewController]) { - [result addObject:[(UIViewController *)obj presentingViewController]]; + UIViewController *presentingViewController = [(UIViewController *)obj presentingViewController]; + if (presentingViewController) { + [result addObject:presentingViewController]; } - if ([UIApplication sharedApplication].keyWindow.rootViewController == obj) { + UIWindow *keyWindow = [UIApplication sharedApplication].keyWindow; + if (keyWindow.rootViewController == obj) { //TODO is there a better way to get the actual window that has this VC - [result addObject:[UIApplication sharedApplication].keyWindow]; + [result addObject:keyWindow]; } } return [result copy]; @@ -356,13 +385,17 @@ - (NSArray *)getChildrenOfObject:(NSObject *)obj ofType:(Class)class NSMutableArray *children = [NSMutableArray array]; // A UIWindow is also a UIView, so we could in theory follow the subviews chain from UIWindow, but // for now we only follow rootViewController from UIView. - if ([obj isKindOfClass:[UIWindow class]] && [((UIWindow *)obj).rootViewController isKindOfClass:class]) { - [children addObject:((UIWindow *)obj).rootViewController]; + if ([obj isKindOfClass:[UIWindow class]]) { + UIViewController *rootViewController = ((UIWindow *)obj).rootViewController; + if ([rootViewController isKindOfClass:class]) { + [children addObject:rootViewController]; + } } else if ([obj isKindOfClass:[UIView class]]) { // NB. For UIViews, only add subviews, nothing else. // The ordering of this result is critical to being able to // apply the index filter. - for (NSObject *child in [(UIView *)obj subviews]) { + NSArray *subviews = [[(UIView *)obj subviews] copy]; + for (NSObject *child in subviews) { if (!class || [child isKindOfClass:class]) { [children addObject:child]; } @@ -374,8 +407,9 @@ - (NSArray *)getChildrenOfObject:(NSObject *)obj ofType:(Class)class [children addObject:child]; } } - if (viewController.presentedViewController && (!class || [viewController.presentedViewController isKindOfClass:class])) { - [children addObject:viewController.presentedViewController]; + UIViewController *presentedViewController = viewController.presentedViewController; + if (presentedViewController && (!class || [presentedViewController isKindOfClass:class])) { + [children addObject:presentedViewController]; } if (!class || (viewController.isViewLoaded && [viewController.view isKindOfClass:class])) { [children addObject:viewController.view]; diff --git a/Pods/Mixpanel/Mixpanel/MPObjectSerializer.h b/Pods/Mixpanel/Mixpanel/MPObjectSerializer.h index a0d607f..20682a4 100644 --- a/Pods/Mixpanel/Mixpanel/MPObjectSerializer.h +++ b/Pods/Mixpanel/Mixpanel/MPObjectSerializer.h @@ -11,7 +11,7 @@ @interface MPObjectSerializer : NSObject /*! - @param An array of MPClassDescription instances. + An array of MPClassDescription instances. */ - (instancetype)initWithConfiguration:(MPObjectSerializerConfig *)configuration objectIdentityProvider:(MPObjectIdentityProvider *)objectIdentityProvider; diff --git a/Pods/Mixpanel/Mixpanel/MPObjectSerializer.m b/Pods/Mixpanel/Mixpanel/MPObjectSerializer.m index 16eeb1e..e5f90e3 100644 --- a/Pods/Mixpanel/Mixpanel/MPObjectSerializer.m +++ b/Pods/Mixpanel/Mixpanel/MPObjectSerializer.m @@ -46,7 +46,7 @@ - (NSDictionary *)serializedObjectsWithRootObject:(id)rootObject } return @{ - @"objects" : [context allSerializedObjects], + @"objects": [context allSerializedObjects], @"rootObject": [_objectIdentityProvider identifierForObject:rootObject] }; } @@ -58,7 +58,7 @@ - (void)visitObject:(NSObject *)object withContext:(MPObjectSerializerContext *) [context addVisitedObject:object]; - NSMutableDictionary *propertyValues = [[NSMutableDictionary alloc] init]; + NSMutableDictionary *propertyValues = [NSMutableDictionary dictionary]; MPClassDescription *classDescription = [self classDescriptionForObject:object]; if (classDescription) { @@ -72,9 +72,9 @@ - (void)visitObject:(NSObject *)object withContext:(MPObjectSerializerContext *) NSMutableArray *delegateMethods = [NSMutableArray array]; id delegate; - SEL delegateSelector = NSSelectorFromString(@"delegate"); + SEL delegateSelector = @selector(delegate); - if (classDescription && [[classDescription delegateInfos] count] > 0 && [object respondsToSelector:delegateSelector]) { + if ([classDescription delegateInfos].count > 0 && [object respondsToSelector:delegateSelector]) { delegate = ((id (*)(id, SEL))[object methodForSelector:delegateSelector])(object, delegateSelector); for (MPDelegateInfo *delegateInfo in [classDescription delegateInfos]) { if ([delegate respondsToSelector:NSSelectorFromString(delegateInfo.selectorName)]) { @@ -98,7 +98,7 @@ - (void)visitObject:(NSObject *)object withContext:(MPObjectSerializerContext *) - (NSArray *)classHierarchyArrayForObject:(NSObject *)object { - NSMutableArray *classHierarchy = [[NSMutableArray alloc] init]; + NSMutableArray *classHierarchy = [NSMutableArray array]; Class aClass = [object class]; while (aClass) @@ -125,13 +125,13 @@ - (NSArray *)allValuesForType:(NSString *)typeName - (NSArray *)parameterVariationsForPropertySelector:(MPPropertySelectorDescription *)selectorDescription { - NSAssert([selectorDescription.parameters count] <= 1, @"Currently only support selectors that take 0 to 1 arguments."); + NSAssert(selectorDescription.parameters.count <= 1, @"Currently only support selectors that take 0 to 1 arguments."); - NSMutableArray *variations = [[NSMutableArray alloc] init]; + NSMutableArray *variations = [NSMutableArray array]; // TODO: write an algorithm that generates all the variations of parameter combinations. - if ([selectorDescription.parameters count] > 0) { - MPPropertySelectorParameterDescription *parameterDescription = (selectorDescription.parameters)[0]; + if (selectorDescription.parameters.count > 0) { + MPPropertySelectorParameterDescription *parameterDescription = selectorDescription.parameters[0]; for (id value in [self allValuesForType:parameterDescription.type]) { [variations addObject:@[ value ]]; } @@ -184,7 +184,7 @@ - (id)instanceVariableValueForObject:(id)object propertyDescription:(MPPropertyD - (NSInvocation *)invocationForObject:(id)object withSelectorDescription:(MPPropertySelectorDescription *)selectorDescription { - NSUInteger __unused parameterCount = [selectorDescription.parameters count]; + NSUInteger __unused parameterCount = selectorDescription.parameters.count; SEL aSelector = NSSelectorFromString(selectorDescription.selectorName); NSAssert(aSelector != nil, @"Expected non-nil selector!"); @@ -193,7 +193,7 @@ - (NSInvocation *)invocationForObject:(id)object withSelectorDescription:(MPProp NSInvocation *invocation = nil; if (methodSignature) { - NSAssert([methodSignature numberOfArguments] == (parameterCount + 2), @"Unexpected number of arguments!"); + NSAssert(methodSignature.numberOfArguments == (parameterCount + 2), @"Unexpected number of arguments!"); invocation = [NSInvocation invocationWithMethodSignature:methodSignature]; invocation.selector = aSelector; @@ -214,7 +214,7 @@ - (id)propertyValue:(id)propertyValue propertyDescription:(MPPropertyDescription } else if ([propertyValue isKindOfClass:[NSArray class]] || [propertyValue isKindOfClass:[NSSet class]]) { - NSMutableArray *arrayOfIdentifiers = [[NSMutableArray alloc] init]; + NSMutableArray *arrayOfIdentifiers = [NSMutableArray array]; for (id value in propertyValue) { if ([context isVisitedObject:value] == NO) { [context enqueueUnvisitedObject:value]; @@ -231,8 +231,7 @@ - (id)propertyValue:(id)propertyValue propertyDescription:(MPPropertyDescription - (id)propertyValueForObject:(NSObject *)object withPropertyDescription:(MPPropertyDescription *)propertyDescription context:(MPObjectSerializerContext *)context { - NSMutableArray *values = [[NSMutableArray alloc] init]; - + NSMutableArray *values = [NSMutableArray array]; MPPropertySelectorDescription *selectorDescription = propertyDescription.getSelectorDescription; @@ -245,7 +244,7 @@ - (id)propertyValueForObject:(NSObject *)object withPropertyDescription:(MPPrope context:context]; NSDictionary *valueDictionary = @{ - @"value" : (value ?: [NSNull null]) + @"value": (value ?: [NSNull null]) }; [values addObject:valueDictionary]; @@ -259,7 +258,7 @@ - (id)propertyValueForObject:(NSObject *)object withPropertyDescription:(MPPrope context:context]; NSDictionary *valueDictionary = @{ - @"value" : (value ?: [NSNull null]) + @"value": (value ?: [NSNull null]) }; [values addObject:valueDictionary]; @@ -280,7 +279,7 @@ - (id)propertyValueForObject:(NSObject *)object withPropertyDescription:(MPPrope context:context]; NSDictionary *valueDictionary = @{ - @"where": @{ @"parameters" : parameters }, + @"where": @{ @"parameters": parameters }, @"value": (value ?: [NSNull null]) }; diff --git a/Pods/Mixpanel/Mixpanel/MPObjectSerializerConfig.m b/Pods/Mixpanel/Mixpanel/MPObjectSerializerConfig.m index 65fbbf6..5361255 100644 --- a/Pods/Mixpanel/Mixpanel/MPObjectSerializerConfig.m +++ b/Pods/Mixpanel/Mixpanel/MPObjectSerializerConfig.m @@ -17,7 +17,7 @@ - (instancetype)initWithDictionary:(NSDictionary *)dictionary { self = [super init]; if (self) { - NSMutableDictionary *classDescriptions = [[NSMutableDictionary alloc] init]; + NSMutableDictionary *classDescriptions = [NSMutableDictionary dictionary]; for (NSDictionary *d in dictionary[@"classes"]) { NSString *superclassName = d[@"superclass"]; MPClassDescription *superclassDescription = superclassName ? classDescriptions[superclassName] : nil; @@ -27,7 +27,7 @@ - (instancetype)initWithDictionary:(NSDictionary *)dictionary classDescriptions[classDescription.name] = classDescription; } - NSMutableDictionary *enumDescriptions = [[NSMutableDictionary alloc] init]; + NSMutableDictionary *enumDescriptions = [NSMutableDictionary dictionary]; for (NSDictionary *d in dictionary[@"enums"]) { MPEnumDescription *enumDescription = [[MPEnumDescription alloc] initWithDictionary:d]; enumDescriptions[enumDescription.name] = enumDescription; @@ -42,7 +42,7 @@ - (instancetype)initWithDictionary:(NSDictionary *)dictionary - (NSArray *)classDescriptions { - return [_classes allValues]; + return _classes.allValues; } - (MPEnumDescription *)enumWithName:(NSString *)name diff --git a/Pods/Mixpanel/Mixpanel/MPObjectSerializerContext.m b/Pods/Mixpanel/Mixpanel/MPObjectSerializerContext.m index e5af370..359232e 100644 --- a/Pods/Mixpanel/Mixpanel/MPObjectSerializerContext.m +++ b/Pods/Mixpanel/Mixpanel/MPObjectSerializerContext.m @@ -17,7 +17,7 @@ - (instancetype)initWithRootObject:(id)object if (self) { _visitedObjects = [NSMutableSet set]; _unvisitedObjects = [NSMutableSet setWithObject:object]; - _serializedObjects = [[NSMutableDictionary alloc] init]; + _serializedObjects = [NSMutableDictionary dictionary]; } return self; @@ -25,7 +25,7 @@ - (instancetype)initWithRootObject:(id)object - (BOOL)hasUnvisitedObjects { - return [_unvisitedObjects count] > 0; + return _unvisitedObjects.count > 0; } - (void)enqueueUnvisitedObject:(NSObject *)object @@ -63,7 +63,7 @@ - (void)addSerializedObject:(NSDictionary *)serializedObject - (NSArray *)allSerializedObjects { - return [_serializedObjects allValues]; + return _serializedObjects.allValues; } @end diff --git a/Pods/Mixpanel/Mixpanel/MPPropertyDescription.m b/Pods/Mixpanel/Mixpanel/MPPropertyDescription.m index bba861f..c11cec6 100644 --- a/Pods/Mixpanel/Mixpanel/MPPropertyDescription.m +++ b/Pods/Mixpanel/Mixpanel/MPPropertyDescription.m @@ -31,7 +31,7 @@ - (instancetype)initWithDictionary:(NSDictionary *)dictionary self = [super init]; if (self) { _selectorName = [dictionary[@"selector"] copy]; - NSMutableArray *parameters = [[NSMutableArray alloc] initWithCapacity:[dictionary[@"parameters"] count]]; + NSMutableArray *parameters = [NSMutableArray arrayWithCapacity:[dictionary[@"parameters"] count]]; for (NSDictionary *parameter in dictionary[@"parameters"]) { [parameters addObject:[[MPPropertySelectorParameterDescription alloc] initWithDictionary:parameter]]; } @@ -89,10 +89,10 @@ - (instancetype)initWithDictionary:(NSDictionary *)dictionary if (get == nil) { NSParameterAssert(dictionary[@"type"] != nil); get = @{ - @"selector" : _name, - @"result" : @{ - @"type" : dictionary[@"type"], - @"name" : @"value" + @"selector": _name, + @"result": @{ + @"type": dictionary[@"type"], + @"name": @"value" }, @"parameters": @[] }; @@ -102,11 +102,11 @@ - (instancetype)initWithDictionary:(NSDictionary *)dictionary if (set == nil && _readonly == NO) { NSParameterAssert(dictionary[@"type"] != nil); set = @{ - @"selector" : [NSString stringWithFormat:@"set%@:", [_name capitalizedString]], - @"parameters" : @[ + @"selector": [NSString stringWithFormat:@"set%@:", _name.capitalizedString], + @"parameters": @[ @{ - @"name" : @"value", - @"type" : dictionary[@"type"] + @"name": @"value", + @"type": dictionary[@"type"] } ] }; @@ -121,8 +121,8 @@ - (instancetype)initWithDictionary:(NSDictionary *)dictionary BOOL useKVC = (dictionary[@"use_kvc"] == nil ? YES : [dictionary[@"use_kvc"] boolValue]) && _useInstanceVariableAccess == NO; _useKeyValueCoding = useKVC && - [_getSelectorDescription.parameters count] == 0 && - (_setSelectorDescription == nil || [_setSelectorDescription.parameters count] == 1); + _getSelectorDescription.parameters.count == 0 && + (_setSelectorDescription == nil || _setSelectorDescription.parameters.count == 1); } return self; diff --git a/Pods/Mixpanel/Mixpanel/MPResources.h b/Pods/Mixpanel/Mixpanel/MPResources.h new file mode 100644 index 0000000..5dd01bd --- /dev/null +++ b/Pods/Mixpanel/Mixpanel/MPResources.h @@ -0,0 +1,20 @@ +// +// MPResources.h +// Mixpanel +// +// Created by Sam Green on 5/2/16. +// Copyright © 2016 Mixpanel. All rights reserved. +// + +#import +#import + +#import "Mixpanel.h" + +@interface MPResources : NSObject + ++ (UIStoryboard *)notificationStoryboard; ++ (UIStoryboard *)surveyStoryboard MIXPANEL_SURVEYS_DEPRECATED; ++ (UIImage *)imageNamed:(NSString *)name; + +@end diff --git a/Pods/Mixpanel/Mixpanel/MPResources.m b/Pods/Mixpanel/Mixpanel/MPResources.m new file mode 100644 index 0000000..c7c8867 --- /dev/null +++ b/Pods/Mixpanel/Mixpanel/MPResources.m @@ -0,0 +1,45 @@ +// +// MPResources.m +// Mixpanel +// +// Created by Sam Green on 5/2/16. +// Copyright © 2016 Mixpanel. All rights reserved. +// + +#import "MPResources.h" + +@implementation MPResources + ++ (UIStoryboard *)notificationStoryboard { + NSString *storyboardName = @"MPNotification~ipad"; + + if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) { + BOOL isLandscape = UIInterfaceOrientationIsLandscape([UIApplication sharedApplication].statusBarOrientation); + if (isLandscape) { + storyboardName = @"MPNotification~iphonelandscape"; + } else { + storyboardName = @"MPNotification~iphoneportrait"; + } + } + + return [MPResources storyboardWithName:storyboardName]; +} + ++ (UIStoryboard *)surveyStoryboard { + return [MPResources storyboardWithName:@"MPSurvey"]; +} + ++ (UIStoryboard *)storyboardWithName:(NSString *)name { + return [UIStoryboard storyboardWithName:name bundle:[MPResources frameworkBundle]]; +} + ++ (NSBundle *)frameworkBundle { + return [NSBundle bundleForClass:self.class]; +} + ++ (UIImage *)imageNamed:(NSString *)name { + NSString *imagePath = [[MPResources frameworkBundle] pathForResource:name ofType:@"png"]; + return [UIImage imageWithContentsOfFile:imagePath]; +} + +@end diff --git a/Pods/Mixpanel/Mixpanel/MPSurvey.h b/Pods/Mixpanel/Mixpanel/MPSurvey.h index d0863d6..4b55411 100644 --- a/Pods/Mixpanel/Mixpanel/MPSurvey.h +++ b/Pods/Mixpanel/Mixpanel/MPSurvey.h @@ -1,5 +1,9 @@ #import +#import "Mixpanel.h" + +MIXPANEL_SURVEYS_DEPRECATED + @interface MPSurvey : NSObject @property (nonatomic, readonly) NSUInteger ID; diff --git a/Pods/Mixpanel/Mixpanel/MPSurvey.m b/Pods/Mixpanel/Mixpanel/MPSurvey.m index 15a3228..de07d56 100644 --- a/Pods/Mixpanel/Mixpanel/MPSurvey.m +++ b/Pods/Mixpanel/Mixpanel/MPSurvey.m @@ -1,7 +1,3 @@ -#if ! __has_feature(objc_arc) -#error This file must be compiled with ARC. Either turn on ARC for the project or use -fobjc-arc flag on this file. -#endif - #import "MPLogger.h" #import "MPSurvey.h" #import "MPSurveyQuestion.h" @@ -22,32 +18,32 @@ @implementation MPSurvey + (MPSurvey *)surveyWithJSONObject:(NSDictionary *)object { if (object == nil) { - MixpanelError(@"survey json object should not be nil"); + MPLogError(@"survey json object should not be nil"); return nil; } NSNumber *ID = object[@"id"]; - if (!([ID isKindOfClass:[NSNumber class]] && [ID integerValue] > 0)) { - MixpanelError(@"invalid survey id: %@", ID); + if (!([ID isKindOfClass:[NSNumber class]] && ID.integerValue > 0)) { + MPLogError(@"invalid survey id: %@", ID); return nil; } NSString *name = object[@"name"]; if (![name isKindOfClass:[NSString class]]) { - MixpanelError(@"invalid survey name: %@", name); + MPLogError(@"invalid survey name: %@", name); return nil; } NSArray *collections = object[@"collections"]; - if (!([collections isKindOfClass:[NSArray class]] && [collections count] > 0)) { - MixpanelError(@"invalid survey collections: %@", collections); + if (!([collections isKindOfClass:[NSArray class]] && collections.count > 0)) { + MPLogError(@"invalid survey collections: %@", collections); return nil; } NSDictionary *collection = collections[0]; if (![collection isKindOfClass:[NSDictionary class]]) { - MixpanelError(@"invalid survey collection: %@", collection); + MPLogError(@"invalid survey collection: %@", collection); return nil; } NSNumber *collectionID = collection[@"id"]; - if (!([collectionID isKindOfClass:[NSNumber class]] && [collectionID integerValue] > 0)) { - MixpanelError(@"invalid survey collection id: %@", collectionID); + if (!([collectionID isKindOfClass:[NSNumber class]] && collectionID.integerValue > 0)) { + MPLogError(@"invalid survey collection id: %@", collectionID); return nil; } NSMutableArray *questions = [NSMutableArray array]; @@ -57,23 +53,23 @@ + (MPSurvey *)surveyWithJSONObject:(NSDictionary *)object [questions addObject:q]; } } - return [[MPSurvey alloc] initWithID:[ID unsignedIntegerValue] - name:name - collectionID:[collectionID unsignedIntegerValue] - andQuestions:[NSArray arrayWithArray:questions]]; + return [[MPSurvey alloc] initWithID:ID.unsignedIntegerValue + name:name + collectionID:collectionID.unsignedIntegerValue + andQuestions:[NSArray arrayWithArray:questions]]; } - (instancetype)initWithID:(NSUInteger)ID name:(NSString *)name collectionID:(NSUInteger)collectionID andQuestions:(NSArray *)questions { if (self = [super init]) { BOOL valid = YES; - if (!(name && name.length > 0)) { + if (name.length == 0) { valid = NO; - MixpanelError(@"Invalid survey name %@", name); + MPLogError(@"Invalid survey name %@", name); } - if (!(questions && [questions count] > 0)) { + if (questions.count == 0) { valid = NO; - MixpanelError(@"Survey must have at least one question %@", questions); + MPLogError(@"Survey must have at least one question %@", questions); } if (valid) { @@ -90,7 +86,7 @@ - (instancetype)initWithID:(NSUInteger)ID name:(NSString *)name collectionID:(NS - (NSString *)description { - return [NSString stringWithFormat:@"%@, (ID:%lu, collection:%lu questions:%lu)", self.name, (unsigned long)self.ID, (unsigned long)self.collectionID, (unsigned long)[self.questions count]]; + return [NSString stringWithFormat:@"%@, (ID:%lu, collection:%lu questions:%lu)", self.name, (unsigned long)self.ID, (unsigned long)self.collectionID, (unsigned long)self.questions.count]; } diff --git a/Pods/Mixpanel/Mixpanel/MPSurvey.storyboard b/Pods/Mixpanel/Mixpanel/MPSurvey.storyboard index f802de4..7516e82 100644 --- a/Pods/Mixpanel/Mixpanel/MPSurvey.storyboard +++ b/Pods/Mixpanel/Mixpanel/MPSurvey.storyboard @@ -1,8 +1,8 @@ - + - - + + @@ -18,7 +18,6 @@ -