Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ bin
obj
output
tools
!tools/
tools/*
!tools/e2e/
tools/e2e/*
!tools/e2e/run-firebase-foundation.sh
tmp-nugets
*.userprefs
*.DS_Store
Expand All @@ -15,4 +20,5 @@ _._
externals
artifacts
*.user
GoogleService-Info.plist
GoogleService-Info.plist
!tests/E2E/Firebase.Foundation/FirebaseFoundationE2E/GoogleService-Info.plist
1 change: 1 addition & 0 deletions source/Firebase/Analytics/ApiDefinition.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ interface Analytics

// + (nullable NSString *)appInstanceID;
[Static]
[NullAllowed]
[Export ("appInstanceID")]
string AppInstanceId { get; }

Expand Down
5 changes: 4 additions & 1 deletion source/Firebase/AppCheck/ApiDefinition.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace Firebase.AppCheck {
// typedef void (^)(FIRAppCheckToken *_Nullable token, NSError *_Nullable error)
delegate void TokenCompletionHandler (AppCheckToken token, NSError error);
delegate void TokenCompletionHandler ([NullAllowed] AppCheckToken token, [NullAllowed] NSError error);

interface IAppCheckProviderFactory { }

Expand Down Expand Up @@ -97,6 +97,7 @@ interface AppCheckToken {
[BaseType (typeof (NSObject), Name = "FIRAppCheckDebugProvider")]
interface AppCheckDebugProvider : IAppCheckProvider {
// -(instancetype _Nullable)initWithApp:(FIRApp * _Nonnull)app;
[return: NullAllowed]
[Export ("initWithApp:")]
NativeHandle Constructor (App app);

Expand All @@ -120,6 +121,7 @@ interface AppCheckDebugProviderFactory : AppCheckProviderFactory {
[BaseType (typeof (NSObject), Name = "FIRDeviceCheckProvider")]
interface DeviceCheckProvider : AppCheckProvider {
// -(instancetype _Nullable)initWithApp:(FIRApp * _Nonnull)app;
[return: NullAllowed]
[Export ("initWithApp:")]
NativeHandle Constructor (App app);
}
Expand All @@ -130,6 +132,7 @@ interface DeviceCheckProvider : AppCheckProvider {
[BaseType (typeof (NSObject), Name = "FIRAppAttestProvider")]
interface AppAttestProvider : AppCheckProvider {
// -(instancetype _Nullable)initWithApp:(FIRApp * _Nonnull)app;
[return: NullAllowed]
[Export ("initWithApp:")]
NativeHandle Constructor (App app);
}
Expand Down
5 changes: 3 additions & 2 deletions source/Firebase/CloudFirestore/ApiDefinition.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ interface CollectionReference

// -(FIRDocumentReference * _Nonnull)addDocumentWithData:(NSDictionary<NSString *,id> * _Nonnull)data completion:(void (^ _Nullable)(NSError * _Nullable))completion;
[Export ("addDocumentWithData:completion:")]
DocumentReference AddDocument (NSDictionary<NSString, NSObject> nsData, AddDocumentCompletionHandler completion);
DocumentReference AddDocument (NSDictionary<NSString, NSObject> nsData, [NullAllowed] AddDocumentCompletionHandler completion);

[Wrap ("AddDocument (data == null ? null : NSDictionary<NSString, NSObject>.FromObjectsAndKeys (System.Linq.Enumerable.ToArray (data.Values), System.Linq.Enumerable.ToArray (data.Keys), data.Keys.Count), completion)")]
DocumentReference AddDocument (Dictionary<object, object> data, AddDocumentCompletionHandler completion);
DocumentReference AddDocument (Dictionary<object, object> data, [NullAllowed] AddDocumentCompletionHandler completion);
}

// @interface FIRDocumentChange : NSObject
Expand Down Expand Up @@ -247,6 +247,7 @@ interface DocumentSnapshot
SnapshotMetadata Metadata { get; }

// -(NSDictionary<NSString *,id> * _Nonnull)data;
[NullAllowed]
[Export ("data")]
NSDictionary<NSString, NSObject> Data { get; }

Expand Down
1 change: 1 addition & 0 deletions source/Firebase/CloudFunctions/ApiDefinition.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ interface CloudFunctions
HttpsCallable HttpsCallable(string name);

// @property(nonatomic, readonly, nullable) NSString *emulatorOrigin;
[NullAllowed]
[Export("emulatorOrigin")]
string EmulatorOrigin { get; }

Expand Down
8 changes: 4 additions & 4 deletions source/Firebase/CloudMessaging/ApiDefinition.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ interface IMessagingDelegate
[BaseType (typeof (NSObject), Name = "FIRMessagingDelegate")]
interface MessagingDelegate
{
// @optional -(void)messaging:(FIRMessaging * _Nonnull)messaging didReceiveRegistrationToken:(NSString * _Nonnull)fcmToken;
// @optional -(void)messaging:(FIRMessaging * _Nonnull)messaging didReceiveRegistrationToken:(NSString * _Nullable)fcmToken;
[Export ("messaging:didReceiveRegistrationToken:")]
void DidReceiveRegistrationToken (Messaging messaging, string fcmToken);
void DidReceiveRegistrationToken (Messaging messaging, [NullAllowed] string fcmToken);
}

// @interface FIRMessaging : NSObject
Expand Down Expand Up @@ -108,7 +108,7 @@ interface Messaging
// -(void)subscribeToTopic:(NSString * _Nonnull)topic completion:(nullable FIRMessagingTopicOperationCompletion)completion;
[Async]
[Export ("subscribeToTopic:completion:")]
void Subscribe (string topic, MessagingTopicOperationCompletionHandler completion);
void Subscribe (string topic, [NullAllowed] MessagingTopicOperationCompletionHandler completion);

// -(void)unsubscribeFromTopic:(NSString * _Nonnull)topic;
[Export ("unsubscribeFromTopic:")]
Expand All @@ -117,7 +117,7 @@ interface Messaging
//-(void)unsubscribeFromTopic:(NSString * _Nonnull)topic completion:(nullable FIRMessagingTopicOperationCompletion)completion;
[Async]
[Export ("unsubscribeFromTopic:completion:")]
void Unsubscribe (string topic, MessagingTopicOperationCompletionHandler completion);
void Unsubscribe (string topic, [NullAllowed] MessagingTopicOperationCompletionHandler completion);

// -(FIRMessagingMessageInfo * _Nonnull)appDidReceiveMessage:(NSDictionary * _Nonnull)message;
[Export ("appDidReceiveMessage:")]
Expand Down
2 changes: 1 addition & 1 deletion source/Firebase/Core/ApiDefinition.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ interface App : INativeObject

// +(FIRApp * _Nullable)defaultApp;
[Static]
[NullAllowed]
[Export ("defaultApp")]
App DefaultInstance { get; }

Expand Down Expand Up @@ -96,7 +97,6 @@ interface Options : INSCopying
string ApiKey { get; set; }

// @property(nonatomic, copy) NSString *bundleID;
[NullAllowed]
[Export ("bundleID")]
string BundleId { get; set; }

Expand Down
16 changes: 8 additions & 8 deletions source/Firebase/Crashlytics/ApiDefinition.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,17 @@ interface Crashlytics
[Export ("log:")]
void Log (string message);

// -(void)setCustomValue:(id _Nonnull)value forKey:(NSString * _Nonnull)key;
// -(void)setCustomValue:(id _Nullable)value forKey:(NSString * _Nonnull)key;
[Export ("setCustomValue:forKey:")]
void SetCustomValue (NSObject value, string key);
void SetCustomValue ([NullAllowed] NSObject value, string key);

// -(void)setCustomKeysAndValues:(NSDictionary * _Nonnull)keysAndValues;
[Export ("setCustomKeysAndValues:")]
void SetCustomKeysAndValues (NSDictionary<NSString, NSObject> keysAndValues);

// -(void)setUserID:(NSString * _Nonnull)userID;
// -(void)setUserID:(NSString * _Nullable)userID;
[Export ("setUserID:")]
void SetUserId (string userId);
void SetUserId ([NullAllowed] string userId);

// -(void)recordError:(NSError * _Nonnull)error __attribute__((swift_name("record(error:)")));
[Export ("recordError:")]
Expand Down Expand Up @@ -131,16 +131,16 @@ interface CrashlyticsReport {
[Export ("log:")]
void Log (string msg);

// -(void)setCustomValue:(id _Nonnull)value forKey:(NSString * _Nonnull)key;
// -(void)setCustomValue:(id _Nullable)value forKey:(NSString * _Nonnull)key;
[Export ("setCustomValue:forKey:")]
void SetCustomValue (NSObject value, string key);
void SetCustomValue ([NullAllowed] NSObject value, string key);

// -(void)setCustomKeysAndValues:(NSDictionary * _Nonnull)keysAndValues;
[Export ("setCustomKeysAndValues:")]
void SetCustomKeysAndValues (NSDictionary<NSString, NSObject> keysAndValues);

// -(void)setUserID:(NSString * _Nonnull)userID;
// -(void)setUserID:(NSString * _Nullable)userID;
[Export ("setUserID:")]
void SetUserID (string userID);
void SetUserID ([NullAllowed] string userID);
}
}
3 changes: 2 additions & 1 deletion source/Firebase/Database/ApiDefinition.cs
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ interface DatabaseReference

// -(void)runTransactionBlock:(FIRTransactionResult * _Nonnull (^ _Nonnull)(FIRMutableData * _Nonnull))block andCompletionBlock:(void (^ _Nullable)(NSError * _Nullable, BOOL, FIRDataSnapshot * _Nullable))completionBlock withLocalEvents:(BOOL)localEvents;
[Export ("runTransactionBlock:andCompletionBlock:withLocalEvents:")]
void RunTransaction (DatabaseReferenceTransactionHandler transactionHandler, DatabaseReferenceTransactionCompletionHandler completionBlock, bool localEvents);
void RunTransaction (DatabaseReferenceTransactionHandler transactionHandler, [NullAllowed] DatabaseReferenceTransactionCompletionHandler completionBlock, bool localEvents);

// -(NSString * _Nonnull)description;
[New]
Expand All @@ -480,6 +480,7 @@ interface DatabaseReference
DatabaseReference Root { get; }

// @property (readonly, nonatomic, strong) NSString * _Nonnull key;
[NullAllowed]
[Export ("key", ArgumentSemantic.Strong)]
string Key { get; }

Expand Down
1 change: 1 addition & 0 deletions source/Firebase/PerformanceMonitoring/ApiDefinition.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ namespace Firebase.PerformanceMonitoring
interface HttpMetric : PerformanceAttributable
{
// -(instancetype _Nullable)initWithURL:(NSURL * _Nonnull)URL HTTPMethod:(FIRHTTPMethod)httpMethod;
[return: NullAllowed]
[Export ("initWithURL:HTTPMethod:")]
NativeHandle Constructor (NSUrl url, HttpMethod httpMethod);

Expand Down
6 changes: 3 additions & 3 deletions source/Firebase/Storage/ApiDefinition.cs
Original file line number Diff line number Diff line change
Expand Up @@ -295,15 +295,15 @@ interface StorageReference
[Export ("writeToFile:completion:")]
StorageDownloadTask WriteToFile (NSUrl fileURL, [NullAllowed] StorageWriteToFileCompletionHandler completion);

// -(void)listAllWithCompletion:(void (^ _Nonnull)(FIRStorageListResult * _Nonnull, NSError * _Nullable))completion;
// -(void)listAllWithCompletion:(void (^ _Nonnull)(FIRStorageListResult * _Nullable, NSError * _Nullable))completion;
[Export ("listAllWithCompletion:")]
void ListAll (Action<StorageListResult, NSError> completion);

// -(void)listWithMaxResults:(int64_t)maxResults completion:(void (^ _Nonnull)(FIRStorageListResult * _Nonnull, NSError * _Nullable))completion;
// -(void)listWithMaxResults:(int64_t)maxResults completion:(void (^ _Nonnull)(FIRStorageListResult * _Nullable, NSError * _Nullable))completion;
[Export ("listWithMaxResults:completion:")]
void List (long maxResults, Action<StorageListResult, NSError> completion);

// -(void)listWithMaxResults:(int64_t)maxResults pageToken:(NSString * _Nonnull)pageToken completion:(void (^ _Nonnull)(FIRStorageListResult * _Nonnull, NSError * _Nullable))completion;
// -(void)listWithMaxResults:(int64_t)maxResults pageToken:(NSString * _Nonnull)pageToken completion:(void (^ _Nonnull)(FIRStorageListResult * _Nullable, NSError * _Nullable))completion;
[Export ("listWithMaxResults:pageToken:completion:")]
void List (long maxResults, string pageToken, Action<StorageListResult, NSError> completion);

Expand Down
26 changes: 26 additions & 0 deletions tests/E2E/Firebase.Foundation/FirebaseFoundationE2E/AppDelegate.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
using Foundation;
using UIKit;

namespace FirebaseFoundationE2E;

[Register("AppDelegate")]
public sealed class AppDelegate : UIApplicationDelegate
{
public override UIWindow? Window { get; set; }

public override bool FinishedLaunching(UIApplication application, NSDictionary? launchOptions)
{
#pragma warning disable CA1422
Window = new UIWindow(UIScreen.MainScreen.Bounds);
#pragma warning restore CA1422

var statusViewController = new StatusViewController();
Window.RootViewController = statusViewController;
Window.MakeKeyAndVisible();
statusViewController.LoadViewIfNeeded();

_ = FirebaseSelfTestRunner.RunAsync(statusViewController);

return true;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
namespace FirebaseFoundationE2E;

public sealed class FirebaseE2ERunResult
{
public string BundleId { get; set; } = string.Empty;
public string? DefaultAppName { get; set; }
public string? GoogleAppId { get; set; }
public string? ProjectId { get; set; }
public string? FirebaseVersion { get; set; }
public string? InstallationsIdPreview { get; set; }
public bool Success { get; set; }
public DateTimeOffset StartedAtUtc { get; set; }
public DateTimeOffset CompletedAtUtc { get; set; }
public string? FatalError { get; set; }
public List<FirebaseE2ETestCaseResult> Cases { get; } = new();
}

public sealed class FirebaseE2ETestCaseResult
{
public string Name { get; set; } = string.Empty;
public bool Success { get; set; }
public long DurationMs { get; set; }
public string? Message { get; set; }
public string? ExceptionType { get; set; }
public string? Detail { get; set; }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
namespace FirebaseFoundationE2E;

public static class E2ELogger
{
public static void WriteLine(string message)
{
Console.WriteLine(message);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net9.0-ios;net9.0-maccatalyst</TargetFrameworks>
<RuntimeIdentifiers Condition="!Exists('$(ProjectAssetsFile)')">iossimulator-arm64;ios-arm64;maccatalyst-arm64</RuntimeIdentifiers>
<RuntimeIdentifiers Condition="Exists('$(ProjectAssetsFile)')"></RuntimeIdentifiers>
<OutputType>Exe</OutputType>
<Nullable>enable</Nullable>
<ImplicitUsings>true</ImplicitUsings>
<SupportedOSPlatformVersion>15.0</SupportedOSPlatformVersion>
<RootNamespace>FirebaseFoundationE2E</RootNamespace>
<AssemblyName>FirebaseFoundationE2E</AssemblyName>
<IPhoneResourcePrefix>Resources</IPhoneResourcePrefix>
<Platforms>AnyCPU;iPhoneSimulator;iPhone</Platforms>
<Configurations>Debug;Release</Configurations>
<IsPackable>false</IsPackable>
<ProvisioningType>manual</ProvisioningType>
<EnableNullabilityValidation>false</EnableNullabilityValidation>
</PropertyGroup>

<PropertyGroup Condition="'$(EnableNullabilityValidation)' == 'true'">
<DefineConstants>$(DefineConstants);ENABLE_NULLABILITY_VALIDATION</DefineConstants>
</PropertyGroup>

<PropertyGroup Condition="'$(TargetFramework)' == 'net9.0-ios' and '$(Platform)' == ''">
<Platform>iPhoneSimulator</Platform>
</PropertyGroup>

<PropertyGroup Condition="'$(TargetFramework)' == 'net9.0-ios' and '$(RuntimeIdentifier)' == ''">
<RuntimeIdentifier>iossimulator-arm64</RuntimeIdentifier>
</PropertyGroup>

<PropertyGroup Condition="'$(TargetFramework)' == 'net9.0-maccatalyst' and '$(RuntimeIdentifier)' == ''">
<RuntimeIdentifier>maccatalyst-arm64</RuntimeIdentifier>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)' == 'Release'">
<MtouchLink>None</MtouchLink>
</PropertyGroup>

<ItemGroup>
<None Remove="GoogleService-Info.plist" Condition="Exists('GoogleService-Info.plist')" />
<BundleResource Include="GoogleService-Info.plist" Condition="Exists('GoogleService-Info.plist')" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="AdamE.Firebase.iOS.Analytics" Version="12.6.0" />
<PackageReference Include="AdamE.Firebase.iOS.Core" Version="12.6.0" />
<PackageReference Include="AdamE.Firebase.iOS.Installations" Version="12.6.0" />
<PackageReference Include="AdamE.Google.iOS.GoogleAppMeasurement" Version="12.6.0" />
<PackageReference Include="AdamE.Google.iOS.GoogleDataTransport" Version="10.1.0.5" />
<PackageReference Include="AdamE.Google.iOS.GoogleUtilities" Version="8.1.0.3" />
<PackageReference Include="AdamE.Google.iOS.Nanopb" Version="3.30910.0.5" />
<PackageReference Include="AdamE.Google.iOS.PromisesObjC" Version="2.4.0.5" />
</ItemGroup>

<ItemGroup Condition="'$(EnableNullabilityValidation)' == 'true'">
<PackageReference Include="AdamE.Firebase.iOS.CloudFirestore" Version="12.6.0" />
</ItemGroup>

<ItemGroup Condition="'$(EnableNullabilityValidation)' == 'true'">
<PackageReference Include="AdamE.Firebase.iOS.AppCheck" Version="12.6.0" />
<PackageReference Include="AdamE.Firebase.iOS.CloudMessaging" Version="12.6.0" />
<PackageReference Include="AdamE.Firebase.iOS.Crashlytics" Version="12.6.0" />
<PackageReference Include="AdamE.Firebase.iOS.Database" Version="12.6.0" />
<PackageReference Include="AdamE.Firebase.iOS.PerformanceMonitoring" Version="12.6.0" />
</ItemGroup>
</Project>
Loading
Loading