-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 6a060da
Showing
32 changed files
with
1,234 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2023 Sean Tai | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission 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. |
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,13 @@ | ||
# SDK Playground | ||
|
||
<img src="./assets/app-icon.png" width="128" alt="The App icon of the SDK Playground iOS app. The icon includes a blue playground slide on a white background."> | ||
|
||
A demo iOS app to test Facebook SDK integration for app events and deep links. | ||
|
||
- Send standard and custom app events | ||
- Test automatic advanced matching | ||
- Test deep link | ||
|
||
<img src="./assets/screenshots.png" width="1024" alt="Screenshot of the SDK Playground app and its features."> | ||
|
||
<img src="./assets/devices.png" width="600" alt="Screenshots of the SDK Playground app running on iPad and iPhones."> |
Large diffs are not rendered by default.
Oops, something went wrong.
7 changes: 7 additions & 0 deletions
7
SDK Playground.xcodeproj/project.xcworkspace/contents.xcworkspacedata
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
8 changes: 8 additions & 0 deletions
8
SDK Playground.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
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,8 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>IDEDidComputeMac32BitWarning</key> | ||
<true/> | ||
</dict> | ||
</plist> |
Binary file added
BIN
+56.7 KB
...odeproj/project.xcworkspace/xcuserdata/seantai.xcuserdatad/UserInterfaceState.xcuserstate
Binary file not shown.
Binary file added
BIN
+105 KB
...d.xcodeproj/project.xcworkspace/xcuserdata/tai.xcuserdatad/UserInterfaceState.xcuserstate
Binary file not shown.
14 changes: 14 additions & 0 deletions
14
SDK Playground.xcodeproj/xcuserdata/seantai.xcuserdatad/xcschemes/xcschememanagement.plist
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,14 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>SchemeUserState</key> | ||
<dict> | ||
<key>Sean Playground.xcscheme_^#shared#^_</key> | ||
<dict> | ||
<key>orderHint</key> | ||
<integer>0</integer> | ||
</dict> | ||
</dict> | ||
</dict> | ||
</plist> |
19 changes: 19 additions & 0 deletions
19
SDK Playground.xcodeproj/xcuserdata/tai.xcuserdatad/xcschemes/xcschememanagement.plist
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,19 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>SchemeUserState</key> | ||
<dict> | ||
<key>SDK Playground.xcscheme_^#shared#^_</key> | ||
<dict> | ||
<key>orderHint</key> | ||
<integer>0</integer> | ||
</dict> | ||
<key>Sean Playground.xcscheme_^#shared#^_</key> | ||
<dict> | ||
<key>orderHint</key> | ||
<integer>0</integer> | ||
</dict> | ||
</dict> | ||
</dict> | ||
</plist> |
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,18 @@ | ||
// | ||
// AppDelegate.swift | ||
// SDK Playground | ||
// | ||
// Created by Sean Tai on 5/1/23. | ||
// | ||
|
||
import SwiftUI | ||
|
||
class AppDelegate: NSObject, UIApplicationDelegate { | ||
func application( | ||
_ application: UIApplication, | ||
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil | ||
) -> Bool { | ||
// AppDelegate didFinishLaunchingWithOptions | ||
return true | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
SDK Playground/Assets.xcassets/AccentColor.colorset/Contents.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 @@ | ||
{ | ||
"colors" : [ | ||
{ | ||
"idiom" : "universal" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
SDK Playground/Assets.xcassets/AppIcon.appiconset/Contents.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,14 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"filename" : "sdk-playground.png", | ||
"idiom" : "universal", | ||
"platform" : "ios", | ||
"size" : "1024x1024" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,6 @@ | ||
{ | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
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 @@ | ||
// | ||
// ContentView.swift | ||
// SDK Playground | ||
// | ||
// Created by Sean Tai on 5/1/23. | ||
// | ||
|
||
import SwiftUI | ||
|
||
struct ContentView: View { | ||
@EnvironmentObject private var appData: AppData | ||
|
||
var body: some View { | ||
TabView(selection: $appData.activeTab) { | ||
SendEvents().tag(Tab.sendEvents).tabItem { | ||
Label(Tab.sendEvents.label, systemImage: Tab.sendEvents.symbolImage) | ||
} | ||
DeepLink().tag(Tab.deepLink).tabItem { | ||
Label(Tab.deepLink.label, systemImage: Tab.deepLink.symbolImage) | ||
} | ||
About().tag(Tab.about).tabItem { | ||
Label(Tab.about.label, systemImage: Tab.about.symbolImage) | ||
} | ||
} | ||
} | ||
} | ||
|
||
struct ContentView_Previews: PreviewProvider { | ||
static var previews: some View { | ||
ContentView().environmentObject(AppData()) | ||
} | ||
} |
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,72 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>CFBundleDevelopmentRegion</key> | ||
<string>$(DEVELOPMENT_LANGUAGE)</string> | ||
<key>CFBundleDisplayName</key> | ||
<string>Playground</string> | ||
<key>CFBundleExecutable</key> | ||
<string>$(EXECUTABLE_NAME)</string> | ||
<key>CFBundleIdentifier</key> | ||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string> | ||
<key>CFBundleInfoDictionaryVersion</key> | ||
<string>1.0</string> | ||
<key>CFBundleName</key> | ||
<string>$(PRODUCT_NAME)</string> | ||
<key>CFBundlePackageType</key> | ||
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string> | ||
<key>CFBundleShortVersionString</key> | ||
<string>$(MARKETING_VERSION)</string> | ||
<key>CFBundleURLTypes</key> | ||
<array> | ||
<dict> | ||
<key>CFBundleTypeRole</key> | ||
<string>Editor</string> | ||
<key>CFBundleURLSchemes</key> | ||
<array> | ||
<string>sdkpark</string> | ||
</array> | ||
</dict> | ||
<dict> | ||
<key>CFBundleTypeRole</key> | ||
<string>Editor</string> | ||
<key>CFBundleURLSchemes</key> | ||
<array> | ||
<string>sdkpg</string> | ||
</array> | ||
</dict> | ||
</array> | ||
<key>CFBundleVersion</key> | ||
<string>$(CURRENT_PROJECT_VERSION)</string> | ||
<key>LSRequiresIPhoneOS</key> | ||
<true/> | ||
<key>UIApplicationSceneManifest</key> | ||
<dict> | ||
<key>UIApplicationSupportsMultipleScenes</key> | ||
<true/> | ||
<key>UISceneConfigurations</key> | ||
<dict/> | ||
</dict> | ||
<key>UIApplicationSupportsIndirectInputEvents</key> | ||
<true/> | ||
<key>UILaunchScreen</key> | ||
<dict> | ||
<key>UILaunchScreen</key> | ||
<dict/> | ||
</dict> | ||
<key>UISupportedInterfaceOrientations~ipad</key> | ||
<array> | ||
<string>UIInterfaceOrientationPortrait</string> | ||
<string>UIInterfaceOrientationPortraitUpsideDown</string> | ||
<string>UIInterfaceOrientationLandscapeLeft</string> | ||
<string>UIInterfaceOrientationLandscapeRight</string> | ||
</array> | ||
<key>UISupportedInterfaceOrientations~iphone</key> | ||
<array> | ||
<string>UIInterfaceOrientationPortrait</string> | ||
<string>UIInterfaceOrientationLandscapeLeft</string> | ||
<string>UIInterfaceOrientationLandscapeRight</string> | ||
</array> | ||
</dict> | ||
</plist> |
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,14 @@ | ||
// | ||
// AppData.swift | ||
// SDK Playground | ||
// | ||
// Created by Sean Tai on 5/1/23. | ||
// | ||
|
||
import SwiftUI | ||
|
||
class AppData: ObservableObject { | ||
@Published var activeTab: Tab = .sendEvents | ||
@Published var deepLinkContent: String = "" | ||
@State private var showWebView = false | ||
} |
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,53 @@ | ||
// | ||
// ReadInfo.swift | ||
// SDK Playground | ||
// | ||
// Created by Sean Tai on 5/1/23. | ||
// | ||
|
||
import SwiftUI | ||
|
||
extension UIApplication { | ||
static var appVersion: String? { | ||
return Bundle.main.object(forInfoDictionaryKey: "CFBundleInfoDictionaryVersion") as? String | ||
} | ||
|
||
static let externalURLSchemes: [String] = { | ||
guard let urlTypes = Bundle.main.infoDictionary?["CFBundleURLTypes"] as? [[String: Any]] else { | ||
return [] | ||
} | ||
|
||
var result: [String] = [] | ||
for urlTypeDictionary in urlTypes { | ||
guard let urlSchemes = urlTypeDictionary["CFBundleURLSchemes"] as? [String] else { continue } | ||
guard let externalURLScheme = urlSchemes.first else { continue } | ||
result.append(externalURLScheme) | ||
} | ||
|
||
return result | ||
}() | ||
|
||
static var FacebookAppID: String { | ||
(Bundle.main.object(forInfoDictionaryKey: "FacebookAppID") as? String) ?? "Not Found" | ||
} | ||
|
||
static var FacebookDisplayName: String { | ||
(Bundle.main.object(forInfoDictionaryKey: "FacebookDisplayName") as? String) ?? "Not Found" | ||
} | ||
|
||
static var FacebookAutoLogAppEventsEnabled: String { | ||
if let value = Bundle.main.object(forInfoDictionaryKey: "FacebookAutoLogAppEventsEnabled") as? Bool { | ||
return String(value) | ||
} else { | ||
return "Not Found" | ||
} | ||
} | ||
|
||
static var FacebookAdvertiserIDCollectionEnabled: String { | ||
if let value = Bundle.main.object(forInfoDictionaryKey: "FacebookAdvertiserIDCollectionEnabled") as? Bool { | ||
return String(value) | ||
} else { | ||
return "Not Found" | ||
} | ||
} | ||
} |
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 @@ | ||
// | ||
// Tab.swift | ||
// SDK Playground | ||
// | ||
// Created by Sean Tai on 5/1/23. | ||
// | ||
|
||
import SwiftUI | ||
|
||
enum Tab: String, CaseIterable { | ||
case sendEvents = "sendEvents" | ||
case deepLink = "deepLink" | ||
case about = "about" | ||
|
||
var symbolImage: String { | ||
switch self { | ||
case .sendEvents: return "paperplane.fill" | ||
case .deepLink: return "app.connected.to.app.below.fill" | ||
case .about: return "info.circle.fill" | ||
} | ||
} | ||
|
||
var label: String { | ||
switch self { | ||
case .sendEvents: return "Send Events" | ||
case .deepLink: return "Test Deep Link" | ||
case .about: return "About" | ||
} | ||
} | ||
|
||
static func convert(from: String) -> Self? { | ||
return Tab.allCases.first { tab in | ||
tab.rawValue.lowercased() == from.lowercased() | ||
} | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
SDK Playground/Preview Content/Preview Assets.xcassets/Contents.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,6 @@ | ||
{ | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
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,34 @@ | ||
// | ||
// SDKPlaygroundApp.swift | ||
// SDK Playground | ||
// | ||
// Created by Sean Tai on 5/1/23. | ||
// | ||
|
||
import SwiftUI | ||
|
||
@main | ||
struct SDKPlaygroundApp: App { | ||
@UIApplicationDelegateAdaptor(AppDelegate.self) var appDelegate | ||
@StateObject private var appData: AppData = .init() | ||
|
||
var body: some Scene { | ||
WindowGroup { | ||
ContentView().environmentObject(appData).onOpenURL { url in | ||
// Deep link URL detected | ||
appData.deepLinkContent = url.absoluteString | ||
print("Deep Link opened: \(url.absoluteString)") | ||
|
||
// Open tab via deep link | ||
for component in url.query!.components(separatedBy: "&") { | ||
if component.contains("tab=") { | ||
let tabRawValue = component.replacingOccurrences(of: "tab=", with: "") | ||
if let requestedTab = Tab.convert(from: tabRawValue) { | ||
appData.activeTab = requestedTab | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.