-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[firebase] Update sample and use one binding project (#16)
The analytics and messaging native projects have been merged into a single MauiFirebase Xcode project. The sample has been updated to use bound APIs from both the analytics and messaging SDKs.
- Loading branch information
Showing
34 changed files
with
491 additions
and
966 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
#nullable enable | ||
using System; | ||
using Foundation; | ||
|
||
namespace Firebase | ||
{ | ||
// @interface MauiFIRAnalytics : NSObject | ||
[BaseType (typeof(NSObject))] | ||
interface MauiFIRAnalytics | ||
{ | ||
// +(void)logEventWithEventName:(NSString * _Nonnull)eventName parameters:(NSDictionary<NSString *,id> * _Nonnull)parameters; | ||
[Static] | ||
[Export ("logEventWithEventName:parameters:")] | ||
void LogEvent (string eventName, NSDictionary parameters); | ||
|
||
// +(void)getAppInstanceIdWithCompletion:(void (^ _Nonnull)(NSString * _Nullable))completion; | ||
[Static] | ||
[Export ("getAppInstanceIdWithCompletion:")] | ||
[Async] | ||
void GetAppInstanceId (Action<NSString?> completion); | ||
|
||
// +(void)setUserIdWithUserId:(NSString * _Nonnull)userId; | ||
[Static] | ||
[Export ("setUserIdWithUserId:")] | ||
void SetUserId (string userId); | ||
|
||
// +(void)setUserPropertyWithPropertyName:(NSString * _Nonnull)propertyName value:(NSString * _Nonnull)value; | ||
[Static] | ||
[Export ("setUserPropertyWithPropertyName:value:")] | ||
void SetUserProperty (string propertyName, string value); | ||
|
||
// +(void)setSessionTimeoutWithSeconds:(NSInteger)seconds; | ||
[Static] | ||
[Export ("setSessionTimeoutWithSeconds:")] | ||
void SetSessionTimeout (nint seconds); | ||
|
||
// +(void)resetAnalyticsData; | ||
[Static] | ||
[Export ("resetAnalyticsData")] | ||
void ResetAnalyticsData (); | ||
} | ||
|
||
// @interface MauiFIRApp : NSObject | ||
[BaseType (typeof(NSObject))] | ||
interface MauiFIRApp | ||
{ | ||
// +(void)autoConfigure; | ||
[Static] | ||
[Export ("autoConfigure")] | ||
void AutoConfigure (); | ||
|
||
// +(void)configure:(NSString * _Nonnull)googleAppId gcmSenderId:(NSString * _Nonnull)gcmSenderId; | ||
[Static] | ||
[Export ("configure:gcmSenderId:")] | ||
void Configure (string googleAppId, string gcmSenderId); | ||
} | ||
|
||
// @interface MauiFIRMessaging : NSObject | ||
[BaseType (typeof(NSObject))] | ||
interface MauiFIRMessaging | ||
{ | ||
// +(BOOL)getIsAutoInitEnabled __attribute__((warn_unused_result(""))); | ||
// +(void)setIsAutoInitEnabled:(BOOL)enabled; | ||
[Static] | ||
[Export ("getIsAutoInitEnabled")] | ||
bool IsAutoInitEnabled { get; [Bind("setIsAutoInitEnabled:")] set; } | ||
|
||
// +(NSString * _Nullable)getFcmToken __attribute__((warn_unused_result(""))); | ||
[Static] | ||
[NullAllowed, Export ("getFcmToken")] | ||
string FcmToken { get; } | ||
|
||
// +(void)register:(NSData * _Nonnull)apnsToken completion:(void (^ _Nonnull)(NSString * _Nullable, NSError * _Nullable))completion; | ||
[Static] | ||
[Export ("register:completion:")] | ||
[Async] | ||
void Register (NSData apnsToken, Action<string?, NSError?> completion); | ||
|
||
// +(void)unregister:(void (^ _Nonnull)(NSError * _Nullable))completion; | ||
[Static] | ||
[Export ("unregister:")] | ||
[Async] | ||
void Unregister (Action<NSError?> completion); | ||
|
||
// +(void)subscribe:(NSString * _Nonnull)topic completion:(void (^ _Nonnull)(NSError * _Nullable))completion; | ||
[Static] | ||
[Export ("subscribe:completion:")] | ||
[Async] | ||
void Subscribe (string topic, Action<NSError?> completion); | ||
|
||
// +(void)unsubscribe:(NSString * _Nonnull)topic completion:(void (^ _Nonnull)(NSError * _Nullable))completion; | ||
[Static] | ||
[Export ("unsubscribe:completion:")] | ||
[Async] | ||
void Unsubscribe (string topic, Action<NSError?> completion); | ||
} | ||
} |
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
54 changes: 0 additions & 54 deletions
54
firebase/macios/FirebaseAnalytics.Binding/ApiDefinitions.cs
This file was deleted.
Oops, something went wrong.
38 changes: 0 additions & 38 deletions
38
firebase/macios/FirebaseMessaging.Binding/ApiDefinitions.cs
This file was deleted.
Oops, something went wrong.
27 changes: 0 additions & 27 deletions
27
firebase/macios/FirebaseMessaging.Binding/FirebaseMessaging.Binding.csproj
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,7 +1,20 @@ | ||
# MAUI | ||
A set of examples for slim binding native libraries for use with .NET MAUI apps | ||
# Firebase Slim Binding | ||
This folder contains a slim binding for the Firebase SDK which demonstrates simple [Analytics][0] and [Messaging][1] usage. | ||
|
||
### Build and Run | ||
```shell | ||
dotnet build sample -t:Run -f net8.0-ios | ||
``` | ||
|
||
## Testing | ||
Add your GoogleService-Info.plist to the sample project and change <ApplicationId> to your | ||
iOS app identifier in the Sample.csproj | ||
### Configure | ||
The included sample requires some modification to fully function. You will need to log in to | ||
a Firebase developer account and configure an app to interface with this sample. | ||
For more details, reference the [Get Started (iOS)][2] page. | ||
|
||
1. Download your `GoogleService-Info.plist` and replace `Platforms/iOS/GoogleService-Info.plist` with it. | ||
2. Change the `<ApplicationId>` value in `Sample.csproj` to your Firebase iOS app identifier. | ||
|
||
|
||
[0]: https://firebase.google.com/docs/analytics/get-started?platform=ios | ||
[1]: https://firebase.google.com/docs/cloud-messaging/ios/client | ||
[2]: https://firebase.google.com/docs/ios/setup |
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,3 @@ | ||
.build/ | ||
build/ | ||
deps/ |
Oops, something went wrong.