-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: provide
SWIFTPM_MODULE_BUNDLE
macro for Objective-C targets wi…
…th resources (#781) - Generate `SWIFTPM_MODULE_BUNDLE` macro [inspired by the one provided by SPM](https://github.com/apple/swift-package-manager/blob/8387798811c6cc43761c5e1b48df2d3412dc5de4/Sources/Build/BuildDescription/ClangTargetBuildDescription.swift#L390). - Ensure that the macro is available to all of the ObjC code by adding the `-include` flag to the `copts` with the location of the resource accessor header file. - Update the `resources_example` to use a vendored version of [AppLovin-MAX-Swift-Package](https://github.com/AppLovin/AppLovin-MAX-Swift-Package). This package has an ObjC target with resources that expects the `SWIFTPM_MODULE_BUNDLE` macro to be present. Closes #372. Closes #774.
- Loading branch information
Showing
61 changed files
with
1,492 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
examples/resources_example/third_party/app_lovin_sdk/Package.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
// swift-tools-version:5.3 | ||
// The swift-tools-version declares the minimum version of Swift required to build this package. | ||
|
||
import PackageDescription | ||
|
||
let package = Package( | ||
name: "AppLovinSDK", | ||
defaultLocalization: "en", | ||
products: [ | ||
.library( | ||
name: "AppLovinSDK", | ||
targets: ["AppLovinSDKResources"] | ||
), | ||
], | ||
dependencies: [], | ||
targets: [ | ||
// This is a wrapper target to configure various settings and resources required by main binary target. | ||
.target( | ||
name: "AppLovinSDKResources", | ||
dependencies: [ | ||
.target(name: "AppLovinSDK") | ||
], | ||
resources: [ | ||
.process("AppLovinSDKResources.bundle") | ||
], | ||
linkerSettings: [ | ||
.linkedFramework("AdSupport"), | ||
.linkedFramework("AppTrackingTransparency"), | ||
.linkedFramework("AudioToolbox"), | ||
.linkedFramework("AVFoundation"), | ||
.linkedFramework("CoreGraphics"), | ||
.linkedFramework("CoreMedia"), | ||
.linkedFramework("CoreMotion"), | ||
.linkedFramework("CoreTelephony"), | ||
.linkedFramework("Foundation"), | ||
.linkedFramework("MessageUI"), | ||
.linkedFramework("SafariServices"), | ||
.linkedFramework("StoreKit"), | ||
.linkedFramework("SystemConfiguration"), | ||
.linkedFramework("UIKit"), | ||
.linkedFramework("WebKit"), | ||
|
||
.linkedLibrary("z"), | ||
|
||
// NOTE: Swift Package Manager currently does not allow dependencies with unsafeFlags, unless a specific branch/commit is used. | ||
// For now, these flags should be added manually to the project for integration. | ||
// .unsafeFlags(["-ObjC"]) | ||
] | ||
), | ||
.binaryTarget( | ||
name: "AppLovinSDK", | ||
url: "https://artifacts.applovin.com/ios/com/applovin/applovin-sdk/AppLovinSDK-12.0.0.xcframework.zip", | ||
checksum: "4dd0cc968a7b90b98024661f8b2c3f2ffe6c25af63369e53f84980321c902b3d" | ||
) | ||
] | ||
) |
30 changes: 30 additions & 0 deletions
30
examples/resources_example/third_party/app_lovin_sdk/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
NOTE: This is a vendored verision of https://github.com/AppLovin/AppLovin-MAX-Swift-Package. | ||
Unfortunatley, the code in the repository had [a bug in an | ||
init](https://github.com/AppLovin/AppLovin-MAX-Swift-Package/blob/ef3d2fd34380552067c834afad3c8b732e62569b/Sources/AppLovinSDKResources/ALResourceManager.m#L22) | ||
that prevented us from depending upon it directly. This vendored code has applied a fix. | ||
|
||
=== | ||
|
||
# AppLovin MAX iOS SDK | ||
|
||
AppLovin MAX iOS SDK for Swift Package Manager. | ||
|
||
## Installation | ||
|
||
The [Swift Package Manager](https://swift.org/package-manager/) is a tool for managing the distribution of Swift code. It’s integrated with the Swift build system to automate the process of downloading, compiling, and linking dependencies. | ||
|
||
To integrate the AppLovin MAX SDK into your Xcode project using Swift Package Manager: | ||
|
||
1. Add it to the `dependencies` of your `Package.swift`: | ||
|
||
```swift | ||
dependencies: [ | ||
.package(url: "https://github.com/AppLovin/AppLovin-MAX-Swift-Package.git", .upToNextMajor(from: "10.3.6")) | ||
] | ||
``` | ||
|
||
2. Enable the `-ObjC` flag in Xcode: click on your project settings, go to **Build Settings**, search for **Other Linker Flags** and add `-ObjC`. | ||
|
||
Check out our integration [docs](https://dash.applovin.com/documentation/mediation/ios/getting-started/integration) for more info on getting started with the AppLovin MAX SDK. | ||
|
||
Note, this Swift package only includes the main AppLovin MAX SDK. We currently do not support installing MAX mediation network adapters using Swift Package Manager. |
9 changes: 9 additions & 0 deletions
9
examples/resources_example/third_party/app_lovin_sdk/Sources/AppLovinSDK/AppLovinSDK.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// | ||
// AppLovinSDK.h | ||
// AppLovinSDK | ||
// | ||
// Created by Ritam Sarmah on 7/2/21. | ||
// Copyright © 2021 AppLovin Corporation. All rights reserved. | ||
// | ||
|
||
#import <AppLovinSDK/AppLovinSDK.h> |
27 changes: 27 additions & 0 deletions
27
...ources_example/third_party/app_lovin_sdk/Sources/AppLovinSDKResources/ALResourceManager.m
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// | ||
// ALResourceManager.m | ||
// AppLovinSDK | ||
// | ||
// Created by Ritam Sarmah on 11/3/21. | ||
// Copyright © 2021 AppLovin Corporation. All rights reserved. | ||
// | ||
|
||
#import "ALResourceManager.h" | ||
|
||
@implementation ALResourceManager | ||
|
||
static NSURL *ALResourceBundleURL; | ||
|
||
+ (void)initialize | ||
{ | ||
[super initialize]; | ||
|
||
ALResourceBundleURL = [SWIFTPM_MODULE_BUNDLE URLForResource: @"AppLovinSDKResources" withExtension: @"bundle"]; | ||
} | ||
|
||
+ (NSURL *)resourceBundleURL | ||
{ | ||
return ALResourceBundleURL; | ||
} | ||
|
||
@end |
11 changes: 11 additions & 0 deletions
11
..._lovin_sdk/Sources/AppLovinSDKResources/AppLovinSDKResources.bundle/ALConsentFlowATT.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"states": [{ | ||
"id": 14, | ||
"is_initial_state": true, | ||
"type": "att", | ||
"destination_state_id": 99 | ||
}, { | ||
"id": 99, | ||
"type": "reinit" | ||
}] | ||
} |
32 changes: 32 additions & 0 deletions
32
.../Sources/AppLovinSDKResources/AppLovinSDKResources.bundle/ALConsentFlowPrivacyPolicy.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
{ | ||
"states": [{ | ||
"id": 1, | ||
"is_initial_state": true, | ||
"type": "alert", | ||
"title": { | ||
"key": "PP_TITLE", | ||
"key_unified_flow": "PP_TITLE_UNIFIED_FLOW", | ||
"replacements": ["<APP_NAME>"] | ||
}, | ||
"message": { | ||
"key": "AGREE_MESSAGE", | ||
"key_unified_flow": "AGREE_MESSAGE_UNIFIED_FLOW" | ||
}, | ||
"transitions": [{ | ||
"title": { | ||
"key": "AGREE_TO_TERMS_BUTTON_TITLE", | ||
"key_unified_flow": "CONTINUE_BUTTON_TITLE_UNIFIED_FLOW" | ||
}, | ||
"style": "default", | ||
"destination_state_id": 12 | ||
}] | ||
}, { | ||
"id": 12, | ||
"type": "event", | ||
"name": "tos_ok", | ||
"destination_state_id": 99 | ||
}, { | ||
"id": 99, | ||
"type": "reinit" | ||
}] | ||
} |
36 changes: 36 additions & 0 deletions
36
...es/AppLovinSDKResources/AppLovinSDKResources.bundle/ALConsentFlowPrivacyPolicyAndATT.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
{ | ||
"states": [{ | ||
"id": 1, | ||
"is_initial_state": true, | ||
"type": "alert", | ||
"title": { | ||
"key": "PP_TITLE", | ||
"key_unified_flow": "PP_TITLE_UNIFIED_FLOW", | ||
"replacements": ["<APP_NAME>"] | ||
}, | ||
"message": { | ||
"key": "AGREE_MESSAGE", | ||
"key_unified_flow": "AGREE_MESSAGE_UNIFIED_FLOW" | ||
}, | ||
"transitions": [{ | ||
"title": { | ||
"key": "AGREE_TO_TERMS_BUTTON_TITLE", | ||
"key_unified_flow": "CONTINUE_BUTTON_TITLE_UNIFIED_FLOW" | ||
}, | ||
"style": "default", | ||
"destination_state_id": 12 | ||
}] | ||
}, { | ||
"id": 12, | ||
"type": "event", | ||
"name": "tos_ok", | ||
"destination_state_id": 14 | ||
}, { | ||
"id": 14, | ||
"type": "att", | ||
"destination_state_id": 99 | ||
}, { | ||
"id": 99, | ||
"type": "reinit" | ||
}] | ||
} |
32 changes: 32 additions & 0 deletions
32
...SDKResources/AppLovinSDKResources.bundle/ALConsentFlowTermsOfServiceAndPrivacyPolicy.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
{ | ||
"states": [{ | ||
"id": 1, | ||
"is_initial_state": true, | ||
"type": "alert", | ||
"title": { | ||
"key": "PP_AND_TOS_TITLE", | ||
"key_unified_flow": "PP_AND_TOS_TITLE_UNIFIED_FLOW", | ||
"replacements": ["<APP_NAME>"] | ||
}, | ||
"message": { | ||
"key": "AGREE_MESSAGE", | ||
"key_unified_flow": "AGREE_MESSAGE_UNIFIED_FLOW" | ||
}, | ||
"transitions": [{ | ||
"title": { | ||
"key": "AGREE_TO_TERMS_BUTTON_TITLE", | ||
"key_unified_flow": "CONTINUE_BUTTON_TITLE_UNIFIED_FLOW" | ||
}, | ||
"style": "default", | ||
"destination_state_id": 12 | ||
}] | ||
}, { | ||
"id": 12, | ||
"type": "event", | ||
"name": "tos_ok", | ||
"destination_state_id": 99 | ||
}, { | ||
"id": 99, | ||
"type": "reinit" | ||
}] | ||
} |
36 changes: 36 additions & 0 deletions
36
...ources/AppLovinSDKResources.bundle/ALConsentFlowTermsOfServiceAndPrivacyPolicyAndATT.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
{ | ||
"states": [{ | ||
"id": 1, | ||
"is_initial_state": true, | ||
"type": "alert", | ||
"title": { | ||
"key": "PP_AND_TOS_TITLE", | ||
"key_unified_flow": "PP_AND_TOS_TITLE_UNIFIED_FLOW", | ||
"replacements": ["<APP_NAME>"] | ||
}, | ||
"message": { | ||
"key": "AGREE_MESSAGE", | ||
"key_unified_flow": "AGREE_MESSAGE_UNIFIED_FLOW" | ||
}, | ||
"transitions": [{ | ||
"title": { | ||
"key": "AGREE_TO_TERMS_BUTTON_TITLE", | ||
"key_unified_flow": "CONTINUE_BUTTON_TITLE_UNIFIED_FLOW" | ||
}, | ||
"style": "default", | ||
"destination_state_id": 12 | ||
}] | ||
}, { | ||
"id": 12, | ||
"type": "event", | ||
"name": "tos_ok", | ||
"destination_state_id": 14 | ||
}, { | ||
"id": 14, | ||
"type": "att", | ||
"destination_state_id": 99 | ||
}, { | ||
"id": 99, | ||
"type": "reinit" | ||
}] | ||
} |
Oops, something went wrong.