Skip to content

Commit

Permalink
feat: iOS
Browse files Browse the repository at this point in the history
  • Loading branch information
SalavatR committed Dec 23, 2022
1 parent 0446d17 commit 4727d68
Show file tree
Hide file tree
Showing 28 changed files with 483 additions and 22 deletions.
10 changes: 9 additions & 1 deletion def_appsflyer_ad_revenue/ext.manifest
Original file line number Diff line number Diff line change
@@ -1 +1,9 @@
name: "AppsflyerAdRevenueExt"
name: "AppsflyerAdRevenueExt"

platforms:
ios:
context:
frameworks: ["AVFoundation", "CoreGraphics", "CoreMedia", "CoreMotion", "CoreTelephony", "Foundation", "MessageUI", "SafariServices", "StoreKit", "SystemConfiguration", "UIKit", "WebKit"]
flags: ["-fobjc-arc"]
linkFlags: ["-ObjC", '-Wl,-rpath,/usr/lib/swift', '-Wl,-rpath,@executable_path/Frameworks']
libs: ["z", "swiftCompatibility51", "swiftCompatibility50"]
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// Analyzer Flags
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES
CLANG_ANALYZER_GCD_PERFORMANCE = YES
CLANG_ANALYZER_NONNULL = YES_AGGRESSIVE
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#include "Shared/Platform/iOS.xcconfig"
#include "Shared/Target/StaticFramework.xcconfig"
#include "Shared/Version.xcconfig"

PRODUCT_NAME = AppsFlyerAdRevenue
PRODUCT_BUNDLE_IDENTIFIER = com.appsflyer.adrevenue.lib

CURRENT_PROJECT_VERSION = $(AFSDK_PROJECT_VERSION)

INFOPLIST_FILE = $(SRCROOT)/AppsFlyerAdRevenue/Info.plist
MODULEMAP_FILE = $(SRCROOT)/AppsFlyerAdRevenue/AppsFlyerAdRevenue.modulemap
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#include "Analyzer.xcconfig"
#include "Warnings.xcconfig"

// Disable legacy-compatible header searching
ALWAYS_SEARCH_USER_PATHS = NO

// Architectures to build
ARCHS = $(ARCHS_STANDARD)

// Whether to enable module imports
CLANG_ENABLE_MODULES = YES
CLANG_ENABLE_MODULE_DEBUGGING = NO

// Build Options
CLANG_ENABLE_OBJC_ARC = YES
CLANG_ENABLE_OBJC_WEAK = YES
GCC_VERSION = com.apple.compilers.llvm.clang.1_0

// Whether to run the static analyzer during builds
RUN_CLANG_STATIC_ANALYZER = YES

// Whether to strip out code that isn't called from anywhere
DEAD_CODE_STRIPPING = NO

// The format of debugging symbols
DEBUG_INFORMATION_FORMAT = dwarf-with-dsym

// C Language
GCC_C_LANGUAGE_STANDARD = gnu99

// C++ Language
CLANG_CXX_LANGUAGE_STANDARD = c++11
CLANG_CXX_LIBRARY = libc++

// Code Generation
GCC_DYNAMIC_NO_PIC = NO
GCC_INLINES_ARE_PRIVATE_EXTERN = YES
GCC_NO_COMMON_BLOCKS = YES
GCC_SYMBOLS_PRIVATE_EXTERN = NO

// MTL
MTL_FAST_MATH = YES

// Swift Settings
SWIFT_VERSION = 5.0
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#include "../Common.xcconfig"

// Architectures
ONLY_ACTIVE_ARCH = YES

// Deployment
COPY_PHASE_STRIP = NO

// Code Generation
GCC_OPTIMIZATION_LEVEL = 0

// Preprocessor
GCC_PREPROCESSOR_DEFINITIONS = DEBUG=1 $(inherited)

// Swift Testability
ENABLE_TESTABILITY = YES

// MTL
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
// Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
//
// You are hereby granted a non-exclusive, worldwide, royalty-free license to use,
// copy, modify, and distribute this software in source code or binary form for use
// in connection with the web services and APIs provided by Facebook.
//
// As with any software that integrates with the Facebook platform, your use of
// this software is subject to the Facebook Developer Principles and Policies
// [http://developers.facebook.com/policy/]. This copyright notice shall be
// included in all copies or substantial portions of the software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

// Cocoa Touch Framework
MACH_O_TYPE = mh_dylib
SKIP_INSTALL = YES
CODE_SIGNING_REQUIRED = NO
CODE_SIGN_IDENTITY =

// Required for dynamic frameworks to properly emit bitcode
ENABLE_BITCODE = YES

// Enables the framework to be included from any location as long as the
// loader’s runpath search paths includes it. For example from an application
// bundle (inside the "Frameworks" folder) or shared folder
// INSTALL_PATH = @rpath
LD_DYLIB_INSTALL_NAME = @rpath/$(PRODUCT_NAME).$(WRAPPER_EXTENSION)/$(PRODUCT_NAME)

// Where to find embedded frameworks
LD_RUNPATH_SEARCH_PATHS = $(inherited) @executable_path/Frameworks @loader_path/Frameworks

// Language
CLANG_WARN_DOCUMENTATION_COMMENTS = YES

// Packaging
DEFINES_MODULE = YES
CLANG_MODULES_AUTOLINK = NO

// Whether function calls should be position-dependent
// (should always be disabled for library code)
GCC_DYNAMIC_NO_PIC = NO
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
//
// AppsFlyerAdRevenue.h
// AppsFlyerAdRevenue
//
// Created by Andrii Hahan on 8/29/19.
// Copyright © 2019 AppsFlyer. All rights reserved.
// v0.5.0

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

typedef NS_ENUM(NSUInteger, AFADRAdNetworkType) {
AFADRFacebookAudienceAdNetworkType,
AFADRUnityAdsAdNetworkType,
AFADRMoPubAdNetworkType
};

typedef NS_CLOSED_ENUM(NSUInteger, AppsFlyerAdRevenueMediationNetworkType) {
AppsFlyerAdRevenueMediationNetworkTypeGoogleAdMob = 1,
AppsFlyerAdRevenueMediationNetworkTypeIronSource = 2,
AppsFlyerAdRevenueMediationNetworkTypeApplovinMax= 3,
AppsFlyerAdRevenueMediationNetworkTypeFyber = 4,
AppsFlyerAdRevenueMediationNetworkTypeAppodeal = 5,
AppsFlyerAdRevenueMediationNetworkTypeAdmost = 6,
AppsFlyerAdRevenueMediationNetworkTypeTopon = 7,
AppsFlyerAdRevenueMediationNetworkTypeTradplus = 8,
AppsFlyerAdRevenueMediationNetworkTypeYandex = 9,
AppsFlyerAdRevenueMediationNetworkTypeChartBoost = 10,
AppsFlyerAdRevenueMediationNetworkTypeUnity = 11,
AppsFlyerAdRevenueMediationNetworkTypeCustom = 12
} NS_SWIFT_NAME(MediationNetworkType);

#define kAppsFlyerAdRevenueMonetizationNetwork @"monetization_network"
#define kAppsFlyerAdRevenueMediationNetwork @"mediation_network"
#define kAppsFlyerAdRevenueEventRevenue @"event_revenue"
#define kAppsFlyerAdRevenueEventRevenueCurrency @"event_revenue_currency"
#define kAppsFlyerAdRevenueCustomParameters @"custom_parameters"

//Pre-defined keys for non-mandatory dictionary

//Code ISO 3166-1 format
#define kAppsFlyerAdRevenueCountry @"country"

//ID of the ad unit for the impression
#define kAppsFlyerAdRevenueAdUnit @"ad_unit"

//Format of the ad
#define kAppsFlyerAdRevenueAdType @"ad_type"

//ID of the ad placement for the impression
#define kAppsFlyerAdRevenuePlacement @"placement"

//Provided by Facebook Audience Network only, and will be reported to publishers
//approved by Facebook Audience Network within the closed beta
#define kAppsFlyerAdRevenueECPMPayload @"ecpm_payload"


@class AFADREvent;
@class AFADRWrapper;

@protocol AppsFlyerAdRevenueDelegate

- (BOOL)shouldSendEvent:(AFADREvent *)event;

@end

@interface AppsFlyerAdRevenue : NSObject

@property BOOL isDebug;
@property BOOL isOnlyRecordImpressionData;

+ (instancetype)shared;

- (instancetype)init NS_UNAVAILABLE;
+ (instancetype)new NS_UNAVAILABLE;

+ (void)start;

- (void)trackEvent:(AFADREvent *)event;

/**
* An API to provide the data from the impression payload to AdRevenue
*
* @param monetizationNetwork network which monetized the impression (@"facebook")
* @param mediationNetwork mediation source that mediated the monetization network for the impression (AppsFlyerAdRevenueMediationNetworkTypeGoogleAdMob)
* @param eventRevenue reported impression’s revenue (@(0.001994303))
* @param revenueCurrency reported impression’s revenue currency ISO 4217 format (@"USD")
* @param additionalParameters non-mandatory dictionary which can include pre-defined keys (kAppsFlyerAdRevenueCountry, etc)
*/
- (void)logAdRevenueWithMonetizationNetwork:(NSString * _Nonnull)monetizationNetwork
mediationNetwork:(AppsFlyerAdRevenueMediationNetworkType)mediationNetwork
eventRevenue:(NSNumber * _Nonnull)eventRevenue
revenueCurrency:(NSString * _Nonnull)revenueCurrency
additionalParameters:(NSDictionary * _Nullable)additionalParameters
NS_SWIFT_NAME(logAdRevenue(monetizationNetwork:mediationNetwork:eventRevenue:revenueCurrency:additionalParameters:));

@end





NS_ASSUME_NONNULL_END
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
framework module AppsFlyerAdRevenue {
umbrella header "AppsFlyerAdRevenue.h"

export *
module * { export * }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#include "../Common.xcconfig"

// Architectures
ONLY_ACTIVE_ARCH = NO

// Deployment
COPY_PHASE_STRIP = YES
STRIP_INSTALLED_PRODUCT = YES

// Code Generation
GCC_OPTIMIZATION_LEVEL = s

// Preprocessor
GCC_PREPROCESSOR_DEFINITIONS = $(inherited)

// Swift Testability
ENABLE_TESTABILITY = YES

// MTL
MTL_ENABLE_DEBUG_INFO = NO

// AppsFlyer
GCC_GENERATE_DEBUGGING_SYMBOLS = NO
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
//
// You are hereby granted a non-exclusive, worldwide, royalty-free license to use,
// copy, modify, and distribute this software in source code or binary form for use
// in connection with the web services and APIs provided by Facebook.
//
// As with any software that integrates with the Facebook platform, your use of
// this software is subject to the Facebook Developer Principles and Policies
// [http://developers.facebook.com/policy/]. This copyright notice shall be
// included in all copies or substantial portions of the software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

// Cocoa Touch Framework
MACH_O_TYPE = staticlib
SKIP_INSTALL = YES
CODE_SIGNING_REQUIRED = NO
CODE_SIGN_IDENTITY =

// Language
CLANG_WARN_DOCUMENTATION_COMMENTS = YES

// Packaging
DEFINES_MODULE = YES

// Whether function calls should be position-dependent
// (should always be disabled for library code)
GCC_DYNAMIC_NO_PIC = NO
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// The versions of AppsFlyer
AFSDK_PROJECT_VERSION=6.3.4

Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// Warnings
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES
CLANG_WARN_BOOL_CONVERSION = YES
CLANG_WARN_COMMA = YES
CLANG_WARN_CONSTANT_CONVERSION = YES
CLANG_WARN_CXX0X_EXTENSIONS = NO
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR
CLANG_WARN_DOCUMENTATION_COMMENTS = YES
CLANG_WARN_EMPTY_BODY = YES
CLANG_WARN_ENUM_CONVERSION = YES
CLANG_WARN_INFINITE_RECURSION = YES
CLANG_WARN_INT_CONVERSION = YES
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES
// Should be `YES`. Temporary `NO`
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = NO
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES
CLANG_WARN_STRICT_PROTOTYPES = YES
CLANG_WARN_SUSPICIOUS_MOVE = YES
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE
CLANG_WARN_UNREACHABLE_CODE = YES
CLANG_WARN_UNUSED_VARIABLE = YES
GCC_TREAT_WARNINGS_AS_ERRORS = YES
GCC_WARN_64_TO_32_BIT_CONVERSION = YES
GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = YES
GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR
GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES
GCC_WARN_MISSING_PARENTHESES = YES
GCC_WARN_SHADOW = YES
GCC_WARN_UNDECLARED_SELECTOR = YES
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE
GCC_WARN_UNUSED_FUNCTION = YES
GCC_WARN_UNUSED_VARIABLE = YES
ENABLE_STRICT_OBJC_MSGSEND = YES
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//

SDKROOT = iphoneos
IPHONEOS_DEPLOYMENT_TARGET = 9.0

// Supported device families (1 is iPhone, 2 is iPad, 3 is Apple TV)
TARGETED_DEVICE_FAMILY = 1,2,3

// Where to find embedded frameworks
LD_RUNPATH_SEARCH_PATHS = $(inherited) @executable_path/Frameworks @loader_path/Frameworks

// Bitcode Support
ENABLE_BITCODE = YES

AFSDK_BITCODE_FLAG = -fembed-bitcode
OTHER_CFLAGS = $(inherited) $(AFSDK_BITCODE_FLAG)
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//

SDKROOT = appletvos
TVOS_DEPLOYMENT_TARGET = 10.0

// Supported device families (1 is iPhone, 2 is iPad, 3 is Apple TV)
TARGETED_DEVICE_FAMILY = 3

// Where to find embedded frameworks
LD_RUNPATH_SEARCH_PATHS = $(inherited) @executable_path/Frameworks @loader_path/Frameworks

// Bitcode Support
// unlike iphoneos, appletvos requires this flag despite the explicit -fembed-bitcode.
ENABLE_BITCODE = YES
AFSDK_BITCODE_FLAG = -fembed-bitcode -Wno-error=unused-command-line-argument
OTHER_CFLAGS = $(inherited) $(AFSDK_BITCODE_FLAG)
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Empty file.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#Thu Dec 22 21:24:14 ALMT 2022
gradle.version=7.4.2
Empty file.
Loading

0 comments on commit 4727d68

Please sign in to comment.