diff --git a/README.md b/README.md
index 5eda775..0223082 100644
--- a/README.md
+++ b/README.md
@@ -276,6 +276,25 @@ There are several ways you can use these samples in your own project.
1. Submodule or otherwise clone this repo into your project, and reference the projects directly as outlined above in the [Get Started section](#get-started)
2. Build the binding projects and consume the .dll assembly artifacts
+When packaging a native Android library (.aar) file, gradle/maven dependencies are _not_ automatically bundled into your library. This is important to note, as the application project will often need to explicitly reference these dependencies in order to run successfully. While this approach can work on an individual application basis, it is *not* recommended for library projects. Including specific versions of dependencies in a library can lead to version conflicts when the library is consumed by an application that also uses the same dependencies.
+
+The `facebook/android/native/mauifacebook/build.gradle.kts` file is configured to copy facebook dependencies into a `build/outputs/deps` folder. Some of this content is then referenced by the .NET MAUI sample project:
+
+```xml
+
+
+ false
+ false
+
+
+ false
+ false
+
+
+```
+
+In some cases first party NuGet packages will exist for missing dependencies. In other cases, you may need to manually include the dependencies in the project as demonstrated in the sample. We hope to improve this type of dependency inclusion guess work in the future by introducing support for `@(AndroidMavenPackage)` references in Android projects.
+
> NOTE: Getting this repository building in CI and producing assembly and/or NuGet artifacts is a near term goal but is not currently available.
diff --git a/eng/Common.android.targets b/eng/Common.android.targets
index 8af79da..5934073 100644
--- a/eng/Common.android.targets
+++ b/eng/Common.android.targets
@@ -22,7 +22,7 @@
<_AndroidGradleInputs Include="$(_AndroidProjectDirFullPath)/**/*.properties" Exclude="$(_AndroidProjectModuleBuildPath)/**/*" />
-
+
diff --git a/eng/Common.macios.targets b/eng/Common.macios.targets
index 1bd1bea..559b305 100644
--- a/eng/Common.macios.targets
+++ b/eng/Common.macios.targets
@@ -1,6 +1,8 @@
+ Release
+
.build
$(XcodeDefaultBuildDir)
@@ -23,6 +25,7 @@
<_XcArchiveiOSFullPath>$([System.IO.Path]::Combine($(_XcodeBuildDirFullPath), $(XcodeScheme)-ios.xcarchive))
<_XcArchiveiOSSimulatorFullPath>$([System.IO.Path]::Combine($(_XcodeBuildDirFullPath), $(XcodeScheme)-iossimulator.xcarchive))
<_XcArchiveMacCatalystFullPath>$([System.IO.Path]::Combine($(_XcodeBuildDirFullPath), $(XcodeScheme)-maccatalyst.xcarchive))
+ <_XcArchiveExtraArgs>ENABLE_BITCODE=NO SKIP_INSTALL=NO SWIFT_INSTALL_OBJC_HEADER=YES BUILD_LIBRARY_FOR_DISTRIBUTION=YES OTHER_LDFLAGS='-ObjC' OTHER_SWIFT_FLAGS='-no-verify-emitted-module-interface' OBJC_CFLAGS='-fno-objc-msgsend-selector-stubs -ObjC'
<_XcFrameworkFullPath>$([System.IO.Path]::Combine($(_XcodeBuildDirFullPath), $(XcodeScheme).xcframework))
@@ -34,22 +37,35 @@
<_XcodeProjectInputs Include="$(_XcodeProjectFullPath)/*.xcworkspace" />
-
+
+ <_GenerateBindingsDependsOn>
+ BuildXCFramework;
+ ObjSharpieBind;
+ $(_GenerateBindingsDependsOn);
+
+
+
+
-
-
-
+
+
+
-
-
-
+ <_CreateXcFxArgs Include="-create-xcframework" />
+ <_CreateXcFxArgs Condition=" '$(XcodeBuildiOS)' == 'True' " Include="-archive $(_XcArchiveiOSFullPath) -framework $(XcodeScheme).framework" />
+ <_CreateXcFxArgs Condition=" '$(XcodeBuildiOSSimulator)' == 'True' " Include="-archive $(_XcArchiveiOSSimulatorFullPath) -framework $(XcodeScheme).framework" />
+ <_CreateXcFxArgs Condition=" '$(XcodeBuildMacCatalyst)' == 'True' " Include="-archive $(_XcArchiveMacCatalystFullPath) -framework $(XcodeScheme).framework" />
+ <_CreateXcFxArgs Include="-output $(_XcFrameworkFullPath)" />
-
-
+
@@ -61,24 +77,18 @@
<_ObjSharpieInputs Include="$(ObjSharpieSourceHeader)" />
-
-
-
-
-
-
-
-
- $([System.Text.RegularExpressions.Regex]::Match($(_XcodeShowSdksOutput), `iphoneos[^; \n\r\t]+`))
- Binding
-
-
+
-
+ <_ObjSharpieArgs Include="--output=$(ObjSharpieBindOutputDir)" />
+ <_ObjSharpieArgs Include="--namespace=$(ObjSharpieBindNamespace)" />
+ <_ObjSharpieArgs Include="--framework $(_XcArchiveiOSFullPath)/Products/Library/Frameworks/$(XcodeScheme).framework" />
-
-
+
+
diff --git a/facebook/README.md b/facebook/README.md
new file mode 100644
index 0000000..a097f51
--- /dev/null
+++ b/facebook/README.md
@@ -0,0 +1,30 @@
+# Facebook Slim Binding
+This folder contains a slim binding for the Facebook SDK which demonstrates simple [App Events][0] usage.
+
+### Build and Run
+```shell
+ dotnet build sample -t:Run -f net8.0-android
+ dotnet build sample -t:Run -f net8.0-ios
+```
+
+### Configure
+The included sample requires some modification to fully function. You will need to log in to
+a Facebook developer account and configure an app to recieve App Events from this sample.
+For more details, reference the [Get Started (Android)][1] or [Get Started (iOS)][2] pages.
+
+#### Android
+The following app identifiers should be updated in the `strings.xml` file of the sample application:
+
+1. Replace the `YOUR_APP_ID` string in the `facebook/sample/Platforms/Android/Resources/values/strings.xml` file with your Facebook App ID.
+2. Replace the `YOUR_CLIENT_TOKEN` string in the `facebook/sample/Platforms/Android/Resources/values/strings.xml` file with your Facebook App Client Token.
+
+#### iOS
+The following app identifiers should be updated in the `Info.plist` file of the sample application:
+
+1. Replace the `YOUR_APP_ID` string in the `facebook/sample/Platforms/iOS/Info.plist` file with your Facebook App ID.
+2. Replace the `YOUR_CLIENT_TOKEN` string in the `facebook/sample/Platforms/iOS/Info.plist` file with your Facebook App Client Token.
+
+
+[0]: https://developers.facebook.com/docs/app-events/
+[1]: https://developers.facebook.com/docs/app-events/getting-started-app-events-android
+[2]: https://developers.facebook.com/docs/app-events/getting-started-app-events-ios
diff --git a/facebook/android/Facebook.Android.Binding/Facebook.Android.Binding.csproj b/facebook/android/Facebook.Android.Binding/Facebook.Android.Binding.csproj
index a14ec5d..348acd7 100644
--- a/facebook/android/Facebook.Android.Binding/Facebook.Android.Binding.csproj
+++ b/facebook/android/Facebook.Android.Binding/Facebook.Android.Binding.csproj
@@ -8,11 +8,11 @@
false
-
+
mauifacebook.aar
- True
- True
- False
+ true
+ true
+ false
diff --git a/facebook/android/native/.gitignore b/facebook/android/native/.gitignore
new file mode 100644
index 0000000..320cf03
--- /dev/null
+++ b/facebook/android/native/.gitignore
@@ -0,0 +1,15 @@
+*.iml
+.gradle
+/local.properties
+/.idea/caches
+/.idea/libraries
+/.idea/modules.xml
+/.idea/workspace.xml
+/.idea/navEditor.xml
+/.idea/assetWizardSettings.xml
+.DS_Store
+build
+captures
+.externalNativeBuild
+.cxx
+local.properties
diff --git a/facebook/android/native/build.gradle b/facebook/android/native/build.gradle
deleted file mode 100644
index f44f6bb..0000000
--- a/facebook/android/native/build.gradle
+++ /dev/null
@@ -1,5 +0,0 @@
-// Top-level build file where you can add configuration options common to all sub-projects/modules.
-plugins {
-id 'com.android.application' version '8.2.1' apply false
- id 'com.android.library' version '8.2.1' apply false
-}
\ No newline at end of file
diff --git a/facebook/android/native/build.gradle.kts b/facebook/android/native/build.gradle.kts
new file mode 100644
index 0000000..9d58ad7
--- /dev/null
+++ b/facebook/android/native/build.gradle.kts
@@ -0,0 +1,4 @@
+// Top-level build file where you can add configuration options common to all sub-projects/modules.
+plugins {
+ id("com.android.library") version "8.2.2" apply false
+}
diff --git a/facebook/android/native/mauifacebook/.gitignore b/facebook/android/native/mauifacebook/.gitignore
deleted file mode 100644
index 42afabf..0000000
--- a/facebook/android/native/mauifacebook/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/build
\ No newline at end of file
diff --git a/facebook/android/native/mauifacebook/build.gradle b/facebook/android/native/mauifacebook/build.gradle
deleted file mode 100644
index 57343ba..0000000
--- a/facebook/android/native/mauifacebook/build.gradle
+++ /dev/null
@@ -1,40 +0,0 @@
-plugins {
- id 'com.android.library'
-}
-
-android {
- namespace 'com.microsoft.mauifacebook'
- compileSdk 34
-
- defaultConfig {
- minSdk 21
- consumerProguardFiles "consumer-rules.pro"
- }
-
- buildTypes {
- release {
- minifyEnabled false
- proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
- }
- }
- compileOptions {
- sourceCompatibility JavaVersion.VERSION_1_8
- targetCompatibility JavaVersion.VERSION_1_8
- }
-
- libraryVariants.configureEach { variant ->
- variant.outputs.configureEach {
- if (variant.buildType.name == 'release') {
- outputFileName = "${project.name}.aar"
- } else if (variant.buildType.name == 'debug') {
- outputFileName = "${project.name}-${variant.name}.aar"
- }
- }
- }
-}
-
-dependencies {
- implementation 'androidx.appcompat:appcompat:1.6.1'
- implementation 'com.google.android.material:material:1.11.0'
- implementation 'com.facebook.android:facebook-android-sdk:latest.release'
-}
\ No newline at end of file
diff --git a/facebook/android/native/mauifacebook/build.gradle.kts b/facebook/android/native/mauifacebook/build.gradle.kts
new file mode 100644
index 0000000..2d08d6d
--- /dev/null
+++ b/facebook/android/native/mauifacebook/build.gradle.kts
@@ -0,0 +1,45 @@
+plugins {
+ id("com.android.library")
+}
+
+android {
+ namespace = "com.microsoft.mauifacebook"
+ compileSdk = 34
+
+ defaultConfig {
+ minSdk = 21
+ }
+
+ buildTypes {
+ release {
+ isMinifyEnabled = false
+ proguardFiles(
+ getDefaultProguardFile("proguard-android-optimize.txt"),
+ "proguard-rules.pro"
+ )
+ }
+ }
+ compileOptions {
+ sourceCompatibility = JavaVersion.VERSION_1_8
+ targetCompatibility = JavaVersion.VERSION_1_8
+ }
+}
+
+configurations {
+ create("copyDependencies")
+}
+
+dependencies {
+ implementation("androidx.appcompat:appcompat:1.6.1")
+ implementation("com.google.android.material:material:1.11.0")
+ implementation("com.facebook.android:facebook-android-sdk:latest.release")
+ "copyDependencies"("com.facebook.android:facebook-android-sdk:latest.release")
+}
+
+project.afterEvaluate {
+ tasks.register("copyDeps") {
+ from(configurations["copyDependencies"])
+ into("${projectDir}/build/outputs/deps")
+ }
+ tasks.named("preBuild") { finalizedBy("copyDeps") }
+}
diff --git a/facebook/android/native/mauifacebook/consumer-rules.pro b/facebook/android/native/mauifacebook/consumer-rules.pro
deleted file mode 100644
index e69de29..0000000
diff --git a/facebook/android/native/mauifacebook/src/main/java/com/xamcat/facebookwrapper/FacebookSdk.java b/facebook/android/native/mauifacebook/src/main/java/com/microsoft/mauifacebook/FacebookSdk.java
similarity index 78%
rename from facebook/android/native/mauifacebook/src/main/java/com/xamcat/facebookwrapper/FacebookSdk.java
rename to facebook/android/native/mauifacebook/src/main/java/com/microsoft/mauifacebook/FacebookSdk.java
index acdc3d9..49d0b91 100644
--- a/facebook/android/native/mauifacebook/src/main/java/com/xamcat/facebookwrapper/FacebookSdk.java
+++ b/facebook/android/native/mauifacebook/src/main/java/com/microsoft/mauifacebook/FacebookSdk.java
@@ -14,8 +14,9 @@ public class FacebookSdk {
static AppEventsLogger _logger;
- public static void initialize(Activity activity, Boolean isDebug) {
+ public static void initializeSDK(Activity activity, Boolean isDebug) {
Application application = activity.getApplication();
+ com.facebook.FacebookSdk.sdkInitialize(application);
if (isDebug) {
com.facebook.FacebookSdk.setIsDebugEnabled(true);
@@ -28,6 +29,10 @@ public static void initialize(Activity activity, Boolean isDebug) {
_logger = AppEventsLogger.newLogger(activity);
}
+ public static void enableAutoLogAppEvents(Boolean enabled) {
+ com.facebook.FacebookSdk.setAutoLogAppEventsEnabled(enabled);
+ }
+
public static void logEvent(String eventName) {
_logger.logEvent(eventName);
}
diff --git a/facebook/android/native/settings.gradle b/facebook/android/native/settings.gradle.kts
similarity index 92%
rename from facebook/android/native/settings.gradle
rename to facebook/android/native/settings.gradle.kts
index b61948a..ad09fdb 100644
--- a/facebook/android/native/settings.gradle
+++ b/facebook/android/native/settings.gradle.kts
@@ -14,4 +14,4 @@ dependencyResolutionManagement {
}
rootProject.name = "MauiFacebook"
-include ':mauifacebook'
+include(":mauifacebook")
diff --git a/facebook/macios/Facebook.MaciOS.Binding/Facebook.MaciOS.Binding.csproj b/facebook/macios/Facebook.MaciOS.Binding/Facebook.MaciOS.Binding.csproj
index 2654e94..9badedf 100644
--- a/facebook/macios/Facebook.MaciOS.Binding/Facebook.MaciOS.Binding.csproj
+++ b/facebook/macios/Facebook.MaciOS.Binding/Facebook.MaciOS.Binding.csproj
@@ -4,6 +4,9 @@
enable
true
true
+
+ $(MSBuildThisFileDirectory)../native/MauiFacebook.xcodeproj
+ Facebook
@@ -11,31 +14,9 @@
Framework
- True
+ true
-
- True
- $(MSBuildThisFileDirectory)../native/MauiFacebook.xcodeproj
- Facebook
- $(BuildXCFrameworkDependsOnTargets);NativeDependencies
-
-
-
-
-
- 17.0.0
- https://github.com/facebook/facebook-ios-sdk/releases/download/v$(FacebookiOSSdkVersion)/FacebookSDK_Dynamic.xcframework.zip
-
-
-
-
-
-
-
-
-
-
diff --git a/facebook/macios/native/MauiFacebook.xcodeproj/project.pbxproj b/facebook/macios/native/MauiFacebook.xcodeproj/project.pbxproj
index a8c9938..33794e1 100644
--- a/facebook/macios/native/MauiFacebook.xcodeproj/project.pbxproj
+++ b/facebook/macios/native/MauiFacebook.xcodeproj/project.pbxproj
@@ -3,24 +3,14 @@
archiveVersion = 1;
classes = {
};
- objectVersion = 60;
+ objectVersion = 56;
objects = {
/* Begin PBXBuildFile section */
- 6425FFBD2BBE067500F9DAB3 /* FBSDKCoreKit.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6425FFB72BBE067500F9DAB3 /* FBSDKCoreKit.xcframework */; };
- 6425FFBE2BBE067500F9DAB3 /* FBSDKCoreKit.xcframework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 6425FFB72BBE067500F9DAB3 /* FBSDKCoreKit.xcframework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
- 6425FFBF2BBE067500F9DAB3 /* FBSDKLoginKit.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6425FFB82BBE067500F9DAB3 /* FBSDKLoginKit.xcframework */; };
- 6425FFC02BBE067500F9DAB3 /* FBSDKLoginKit.xcframework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 6425FFB82BBE067500F9DAB3 /* FBSDKLoginKit.xcframework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
- 6425FFC12BBE067500F9DAB3 /* FBSDKShareKit.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6425FFB92BBE067500F9DAB3 /* FBSDKShareKit.xcframework */; };
- 6425FFC22BBE067500F9DAB3 /* FBSDKShareKit.xcframework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 6425FFB92BBE067500F9DAB3 /* FBSDKShareKit.xcframework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
- 6425FFC32BBE067600F9DAB3 /* FBSDKCoreKit_Basics.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6425FFBA2BBE067500F9DAB3 /* FBSDKCoreKit_Basics.xcframework */; };
- 6425FFC42BBE067600F9DAB3 /* FBSDKCoreKit_Basics.xcframework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 6425FFBA2BBE067500F9DAB3 /* FBSDKCoreKit_Basics.xcframework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
- 6425FFC52BBE067600F9DAB3 /* FBSDKGamingServicesKit.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6425FFBB2BBE067500F9DAB3 /* FBSDKGamingServicesKit.xcframework */; };
- 6425FFC62BBE067600F9DAB3 /* FBSDKGamingServicesKit.xcframework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 6425FFBB2BBE067500F9DAB3 /* FBSDKGamingServicesKit.xcframework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
- 6425FFC72BBE067600F9DAB3 /* FBAEMKit.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6425FFBC2BBE067500F9DAB3 /* FBAEMKit.xcframework */; };
- 6425FFC82BBE067600F9DAB3 /* FBAEMKit.xcframework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 6425FFBC2BBE067500F9DAB3 /* FBAEMKit.xcframework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
643C24B32B99104200C2A6AA /* MauiFacebook.h in Headers */ = {isa = PBXBuildFile; fileRef = 643C24B22B99104200C2A6AA /* MauiFacebook.h */; settings = {ATTRIBUTES = (Public, ); }; };
646787CA2B99125200677775 /* MauiFacebook.swift in Sources */ = {isa = PBXBuildFile; fileRef = 646787C92B99125200677775 /* MauiFacebook.swift */; };
+ D0AF2A9B2BDC4E5B002AA03E /* FacebookBasics in Frameworks */ = {isa = PBXBuildFile; productRef = D0AF2A9A2BDC4E5B002AA03E /* FacebookBasics */; };
+ D0AF2A9D2BDC4E5B002AA03E /* FacebookCore in Frameworks */ = {isa = PBXBuildFile; productRef = D0AF2A9C2BDC4E5B002AA03E /* FacebookCore */; };
/* End PBXBuildFile section */
/* Begin PBXCopyFilesBuildPhase section */
@@ -30,12 +20,6 @@
dstPath = "";
dstSubfolderSpec = 10;
files = (
- 6425FFC82BBE067600F9DAB3 /* FBAEMKit.xcframework in Embed Frameworks */,
- 6425FFC22BBE067500F9DAB3 /* FBSDKShareKit.xcframework in Embed Frameworks */,
- 6425FFC42BBE067600F9DAB3 /* FBSDKCoreKit_Basics.xcframework in Embed Frameworks */,
- 6425FFC62BBE067600F9DAB3 /* FBSDKGamingServicesKit.xcframework in Embed Frameworks */,
- 6425FFBE2BBE067500F9DAB3 /* FBSDKCoreKit.xcframework in Embed Frameworks */,
- 6425FFC02BBE067500F9DAB3 /* FBSDKLoginKit.xcframework in Embed Frameworks */,
);
name = "Embed Frameworks";
runOnlyForDeploymentPostprocessing = 0;
@@ -43,12 +27,6 @@
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
- 6425FFB72BBE067500F9DAB3 /* FBSDKCoreKit.xcframework */ = {isa = PBXFileReference; expectedSignature = "AppleDeveloperProgram:V9WTTPBFK9:Meta Platforms, Inc."; lastKnownFileType = wrapper.xcframework; name = FBSDKCoreKit.xcframework; path = .build/XCFrameworks/FBSDKCoreKit.xcframework; sourceTree = ""; };
- 6425FFB82BBE067500F9DAB3 /* FBSDKLoginKit.xcframework */ = {isa = PBXFileReference; expectedSignature = "AppleDeveloperProgram:V9WTTPBFK9:Meta Platforms, Inc."; lastKnownFileType = wrapper.xcframework; name = FBSDKLoginKit.xcframework; path = .build/XCFrameworks/FBSDKLoginKit.xcframework; sourceTree = ""; };
- 6425FFB92BBE067500F9DAB3 /* FBSDKShareKit.xcframework */ = {isa = PBXFileReference; expectedSignature = "AppleDeveloperProgram:V9WTTPBFK9:Meta Platforms, Inc."; lastKnownFileType = wrapper.xcframework; name = FBSDKShareKit.xcframework; path = .build/XCFrameworks/FBSDKShareKit.xcframework; sourceTree = ""; };
- 6425FFBA2BBE067500F9DAB3 /* FBSDKCoreKit_Basics.xcframework */ = {isa = PBXFileReference; expectedSignature = "AppleDeveloperProgram:V9WTTPBFK9:Meta Platforms, Inc."; lastKnownFileType = wrapper.xcframework; name = FBSDKCoreKit_Basics.xcframework; path = .build/XCFrameworks/FBSDKCoreKit_Basics.xcframework; sourceTree = ""; };
- 6425FFBB2BBE067500F9DAB3 /* FBSDKGamingServicesKit.xcframework */ = {isa = PBXFileReference; expectedSignature = "AppleDeveloperProgram:V9WTTPBFK9:Meta Platforms, Inc."; lastKnownFileType = wrapper.xcframework; name = FBSDKGamingServicesKit.xcframework; path = .build/XCFrameworks/FBSDKGamingServicesKit.xcframework; sourceTree = ""; };
- 6425FFBC2BBE067500F9DAB3 /* FBAEMKit.xcframework */ = {isa = PBXFileReference; expectedSignature = "AppleDeveloperProgram:V9WTTPBFK9:Meta Platforms, Inc."; lastKnownFileType = wrapper.xcframework; name = FBAEMKit.xcframework; path = .build/XCFrameworks/FBAEMKit.xcframework; sourceTree = ""; };
643C24AF2B99104200C2A6AA /* MauiFacebook.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = MauiFacebook.framework; sourceTree = BUILT_PRODUCTS_DIR; };
643C24B22B99104200C2A6AA /* MauiFacebook.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MauiFacebook.h; sourceTree = ""; };
646787C92B99125200677775 /* MauiFacebook.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MauiFacebook.swift; sourceTree = ""; };
@@ -59,12 +37,8 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
- 6425FFC72BBE067600F9DAB3 /* FBAEMKit.xcframework in Frameworks */,
- 6425FFC12BBE067500F9DAB3 /* FBSDKShareKit.xcframework in Frameworks */,
- 6425FFC32BBE067600F9DAB3 /* FBSDKCoreKit_Basics.xcframework in Frameworks */,
- 6425FFC52BBE067600F9DAB3 /* FBSDKGamingServicesKit.xcframework in Frameworks */,
- 6425FFBD2BBE067500F9DAB3 /* FBSDKCoreKit.xcframework in Frameworks */,
- 6425FFBF2BBE067500F9DAB3 /* FBSDKLoginKit.xcframework in Frameworks */,
+ D0AF2A9B2BDC4E5B002AA03E /* FacebookBasics in Frameworks */,
+ D0AF2A9D2BDC4E5B002AA03E /* FacebookCore in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -100,12 +74,6 @@
643C24B92B99121700C2A6AA /* Frameworks */ = {
isa = PBXGroup;
children = (
- 6425FFBC2BBE067500F9DAB3 /* FBAEMKit.xcframework */,
- 6425FFBA2BBE067500F9DAB3 /* FBSDKCoreKit_Basics.xcframework */,
- 6425FFB72BBE067500F9DAB3 /* FBSDKCoreKit.xcframework */,
- 6425FFBB2BBE067500F9DAB3 /* FBSDKGamingServicesKit.xcframework */,
- 6425FFB82BBE067500F9DAB3 /* FBSDKLoginKit.xcframework */,
- 6425FFB92BBE067500F9DAB3 /* FBSDKShareKit.xcframework */,
);
name = Frameworks;
sourceTree = "";
@@ -139,6 +107,10 @@
dependencies = (
);
name = MauiFacebook;
+ packageProductDependencies = (
+ D0AF2A9A2BDC4E5B002AA03E /* FacebookBasics */,
+ D0AF2A9C2BDC4E5B002AA03E /* FacebookCore */,
+ );
productName = MauiFacebook;
productReference = 643C24AF2B99104200C2A6AA /* MauiFacebook.framework */;
productType = "com.apple.product-type.framework";
@@ -167,6 +139,9 @@
Base,
);
mainGroup = 643C24A52B99104200C2A6AA;
+ packageReferences = (
+ D0AF2A992BDC4E5B002AA03E /* XCRemoteSwiftPackageReference "facebook-ios-sdk" */,
+ );
productRefGroup = 643C24B02B99104200C2A6AA /* Products */;
projectDirPath = "";
projectRoot = "";
@@ -321,6 +296,7 @@
643C24B72B99104200C2A6AA /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
+ BUILD_LIBRARY_FOR_DISTRIBUTION = YES;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
@@ -345,10 +321,11 @@
MARKETING_VERSION = 1.0;
MODULE_VERIFIER_SUPPORTED_LANGUAGES = "objective-c objective-c++";
MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu17 gnu++20";
+ OTHER_LDFLAGS = "-ObjC";
PRODUCT_BUNDLE_IDENTIFIER = com.microsoft.MauiFacebook;
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
SDKROOT = auto;
- SKIP_INSTALL = YES;
+ SKIP_INSTALL = NO;
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
SUPPORTS_MACCATALYST = YES;
SWIFT_EMIT_LOC_STRINGS = YES;
@@ -361,6 +338,7 @@
643C24B82B99104200C2A6AA /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
+ BUILD_LIBRARY_FOR_DISTRIBUTION = YES;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
@@ -385,10 +363,11 @@
MARKETING_VERSION = 1.0;
MODULE_VERIFIER_SUPPORTED_LANGUAGES = "objective-c objective-c++";
MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu17 gnu++20";
+ OTHER_LDFLAGS = "-ObjC";
PRODUCT_BUNDLE_IDENTIFIER = com.microsoft.MauiFacebook;
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
SDKROOT = auto;
- SKIP_INSTALL = YES;
+ SKIP_INSTALL = NO;
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
SUPPORTS_MACCATALYST = YES;
SWIFT_EMIT_LOC_STRINGS = YES;
@@ -419,6 +398,30 @@
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
+
+/* Begin XCRemoteSwiftPackageReference section */
+ D0AF2A992BDC4E5B002AA03E /* XCRemoteSwiftPackageReference "facebook-ios-sdk" */ = {
+ isa = XCRemoteSwiftPackageReference;
+ repositoryURL = "https://github.com/facebook/facebook-ios-sdk";
+ requirement = {
+ kind = upToNextMajorVersion;
+ minimumVersion = 14.1.0;
+ };
+ };
+/* End XCRemoteSwiftPackageReference section */
+
+/* Begin XCSwiftPackageProductDependency section */
+ D0AF2A9A2BDC4E5B002AA03E /* FacebookBasics */ = {
+ isa = XCSwiftPackageProductDependency;
+ package = D0AF2A992BDC4E5B002AA03E /* XCRemoteSwiftPackageReference "facebook-ios-sdk" */;
+ productName = FacebookBasics;
+ };
+ D0AF2A9C2BDC4E5B002AA03E /* FacebookCore */ = {
+ isa = XCSwiftPackageProductDependency;
+ package = D0AF2A992BDC4E5B002AA03E /* XCRemoteSwiftPackageReference "facebook-ios-sdk" */;
+ productName = FacebookCore;
+ };
+/* End XCSwiftPackageProductDependency section */
};
rootObject = 643C24A62B99104200C2A6AA /* Project object */;
}
diff --git a/facebook/macios/native/MauiFacebook.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/facebook/macios/native/MauiFacebook.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved
new file mode 100644
index 0000000..70800b1
--- /dev/null
+++ b/facebook/macios/native/MauiFacebook.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved
@@ -0,0 +1,15 @@
+{
+ "originHash" : "ca3cf5f8f83d297b47d2cb0edff3e06f294951e2e06fa55cfc82831103499b2a",
+ "pins" : [
+ {
+ "identity" : "facebook-ios-sdk",
+ "kind" : "remoteSourceControl",
+ "location" : "https://github.com/facebook/facebook-ios-sdk",
+ "state" : {
+ "revision" : "c19607d535864533523d1f437c84035e5fb101cf",
+ "version" : "14.1.0"
+ }
+ }
+ ],
+ "version" : 3
+}
diff --git a/facebook/sample/MainPage.xaml b/facebook/sample/MainPage.xaml
index bdeb85b..f702fde 100644
--- a/facebook/sample/MainPage.xaml
+++ b/facebook/sample/MainPage.xaml
@@ -14,21 +14,15 @@
SemanticProperties.Description="dot net bot in a race car number eight" />
-
-
diff --git a/facebook/sample/MainPage.xaml.cs b/facebook/sample/MainPage.xaml.cs
index 88750bc..7dd97dd 100644
--- a/facebook/sample/MainPage.xaml.cs
+++ b/facebook/sample/MainPage.xaml.cs
@@ -2,25 +2,51 @@
public partial class MainPage : ContentPage
{
- int count = 0;
+ bool facebookSdkIntialized = false;
public MainPage()
{
InitializeComponent();
-
- var fb = new Facebook.FacebookSdk();
-
}
- private void OnCounterClicked(object sender, EventArgs e)
+ async Task InitializeFacebookSdk()
{
- count++;
+ try
+ {
+#if ANDROID
+ Facebook.FacebookSdk.InitializeSDK(Microsoft.Maui.ApplicationModel.Platform.CurrentActivity, Java.Lang.Boolean.True);
+#elif IOS
+ string appId = Foundation.NSBundle.MainBundle.ObjectForInfoDictionary("FacebookAppID").ToString();
+ string clientToken = Foundation.NSBundle.MainBundle.ObjectForInfoDictionary("FacebookClientToken").ToString();
+ Facebook.FacebookSdk.SetupWithAppId(appId, clientToken);
+#endif
+ facebookSdkIntialized = true;
+ }
+ catch (Exception ex)
+ {
+ await DisplayAlert("Unable to initialize Facebook SDK!", ex.ToString(), "OK");
+ }
+ }
- if (count == 1)
- CounterBtn.Text = $"Clicked {count} time";
- else
- CounterBtn.Text = $"Clicked {count} times";
+ async void OnAppEventClicked(object sender, EventArgs e)
+ {
+ if (!facebookSdkIntialized)
+ {
+ await InitializeFacebookSdk();
+ }
- SemanticScreenReader.Announce(CounterBtn.Text);
+ try
+ {
+#if ANDROID
+ Facebook.FacebookSdk.LogEvent("OnAppEventClicked");
+#elif IOS
+ Facebook.FacebookSdk.LogEventWithEventName("OnAppEventClicked");
+#endif
+ await DisplayAlert("Attempted to send App Event", "", "OK");
+ }
+ catch (Exception ex)
+ {
+ await DisplayAlert("Failed to send App Event!", ex.ToString(), "OK");
+ }
}
-}
\ No newline at end of file
+}
diff --git a/facebook/sample/Platforms/Android/AndroidManifest.xml b/facebook/sample/Platforms/Android/AndroidManifest.xml
index e9937ad..d5781d1 100644
--- a/facebook/sample/Platforms/Android/AndroidManifest.xml
+++ b/facebook/sample/Platforms/Android/AndroidManifest.xml
@@ -1,6 +1,9 @@
-
+
+
+
+
-
\ No newline at end of file
+
diff --git a/facebook/sample/Platforms/Android/Resources/values/strings.xml b/facebook/sample/Platforms/Android/Resources/values/strings.xml
new file mode 100644
index 0000000..1a9b782
--- /dev/null
+++ b/facebook/sample/Platforms/Android/Resources/values/strings.xml
@@ -0,0 +1,5 @@
+
+
+ YOUR_APP_ID
+ YOUR_CLIENT_TOKEN
+
diff --git a/facebook/sample/Platforms/iOS/Info.plist b/facebook/sample/Platforms/iOS/Info.plist
index 0004a4f..4ea5445 100644
--- a/facebook/sample/Platforms/iOS/Info.plist
+++ b/facebook/sample/Platforms/iOS/Info.plist
@@ -28,5 +28,20 @@
XSAppIconAssets
Assets.xcassets/appicon.appiconset
+ CFBundleURLTypes
+
+
+ CFBundleURLSchemes
+
+ fbAPP-ID
+
+
+
+ FacebookAppID
+ YOUR_APP_ID
+ FacebookClientToken
+ YOUR_CLIENT_TOKEN
+ FacebookDisplayName
+ Facebook.Sample
diff --git a/facebook/sample/Sample.csproj b/facebook/sample/Sample.csproj
index 7d0fca6..08571ae 100644
--- a/facebook/sample/Sample.csproj
+++ b/facebook/sample/Sample.csproj
@@ -2,11 +2,6 @@
net8.0-ios;net8.0-android
-
-
-
-
-
+
+ false
+ false
+
+
+ false
+ false
+