Skip to content
This repository has been archived by the owner on Jan 14, 2022. It is now read-only.

Commit

Permalink
SDK updated to 4.1.0
Browse files Browse the repository at this point in the history
– ApiDefinitions of Bindings updated
- AppCenter classes updated
  • Loading branch information
nor0x committed Jan 6, 2021
1 parent bdd8e36 commit e516e1a
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ interface IMSACService { }
// typedef NSString * (^MSACLogMessageProvider)();
delegate string MSACLogMessageProvider();

// typedef (void (^)(BOOL))completionHandler();
delegate void MSACSetLogLevelCompletionHandlerCallback(bool result);

// typedef void (^MSACLogHandler)(MSACLogMessageProvider, MSACLogLevel, const char *, const char *, uint);
unsafe delegate void MSACLogHandler(MSACLogMessageProvider arg0, MSACLogLevel arg1, IntPtr arg2, IntPtr arg3, uint arg4);
//Note: Objective Sharpie tried to bind the above as:
Expand Down Expand Up @@ -258,6 +261,11 @@ interface MSACAppCenter
[Static]
[Export("setCustomProperties:")]
void SetCustomProperties([NullAllowed] MSACCustomProperties properties);

// +(void)setMaxStorageSize:(long)sizeInBytes completionHandler(void (^)(BOOL))completionHandler;
[Static]
[Export("setMaxStorageSize:completionHandler:")]
void SetMaxStorageSize(long sizeInBytes, MSACSetLogLevelCompletionHandlerCallback callback);
}

// @protocol MSACService <NSObject>
Expand Down
8 changes: 8 additions & 0 deletions SDK/AppCenter/Microsoft.AppCenter.MacOS/AppCenter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -184,9 +184,17 @@ static void PlatformSetCustomProperties(CustomProperties customProperties)
{
MacOSAppCenter.SetCustomProperties(customProperties?.IOSCustomProperties);
}

internal static void PlatformUnsetInstance()
{
MacOSAppCenter.ResetSharedInstance();
}

static Task<bool> PlatformSetMaxStorageSizeAsync(long sizeInBytes)
{
TaskCompletionSource<bool> taskCompletionSource = new TaskCompletionSource<bool>();
MacOSAppCenter.SetMaxStorageSize(sizeInBytes, (result) => taskCompletionSource.SetResult(result));
return taskCompletionSource.Task;
}
}
}
18 changes: 18 additions & 0 deletions SDK/AppCenter/Microsoft.AppCenter.Shared/AppCenter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,24 @@ public static void SetCustomProperties(CustomProperties customProperties)
PlatformSetCustomProperties(customProperties);
}

/// <summary>
/// Set the maximum size of the internal storage.
/// This method must be called before App Center is started. This method is only intended for applications.
/// </summary>
/// <remarks>
/// This only sets the maximum size of the database, but App Center modules might store additional data.
/// The value passed to this method is not persisted on disk. The default maximum database size is 10485760 bytes (10 MiB).
/// </remarks>
/// <param name="sizeInBytes">
/// Maximum size of the internal storage in bytes. This will be rounded up to the nearest multiple of a SQLite page size (default is 4096 bytes).
/// Values below 20,480 bytes (20 KiB) will be ignored.
/// </param>
/// <returns><code>true</code> if changing the size was successful.</returns>
public static Task<bool> SetMaxStorageSizeAsync(long sizeInBytes)
{
return PlatformSetMaxStorageSizeAsync(sizeInBytes);
}

internal static void UnsetInstance()
{
PlatformUnsetInstance();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ namespace Microsoft.AppCenter.iOS.Bindings
{
interface IMSACService { }

// typedef (void (^)(BOOL))completionHandler();
delegate void MSACSetLogLevelCompletionHandlerCallback(bool result);

// typedef NSString * (^MSACLogMessageProvider)();
delegate string MSACLogMessageProvider();

Expand Down Expand Up @@ -261,6 +264,11 @@ interface MSACAppCenter
[Static]
[Export("setCustomProperties:")]
void SetCustomProperties([NullAllowed] MSACCustomProperties properties);

// +(void)setMaxStorageSize:(long)sizeInBytes completionHandler(void (^)(BOOL))completionHandler;
[Static]
[Export("setMaxStorageSize:completionHandler:")]
void SetMaxStorageSize(long sizeInBytes, MSACSetLogLevelCompletionHandlerCallback callback);
}

// @protocol MSACService <NSObject>
Expand Down
7 changes: 7 additions & 0 deletions SDK/AppCenter/Microsoft.AppCenter.iOS/AppCenter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -193,5 +193,12 @@ internal static void PlatformUnsetInstance()
{
iOSAppCenter.ResetSharedInstance();
}

static Task<bool> PlatformSetMaxStorageSizeAsync(long sizeInBytes)
{
TaskCompletionSource<bool> taskCompletionSource = new TaskCompletionSource<bool>();
iOSAppCenter.SetMaxStorageSize(sizeInBytes, (result) => taskCompletionSource.SetResult(result));
return taskCompletionSource.Task;
}
}
}
5 changes: 5 additions & 0 deletions SDK/AppCenter/Microsoft.AppCenter/AppCenter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,11 @@ static void PlatformSetCustomProperties(CustomProperties customProperties)
{
}

static Task<bool> PlatformSetMaxStorageSizeAsync(long sizeInBytes)
{
return Task.FromResult(false);
}

internal static void PlatformUnsetInstance()
{
}
Expand Down

0 comments on commit e516e1a

Please sign in to comment.