diff --git a/.github/workflows/admin-sample.cd.yml b/.github/workflows/admin-sample.cd.yml index 6bfd9c9de6..75289dacaa 100644 --- a/.github/workflows/admin-sample.cd.yml +++ b/.github/workflows/admin-sample.cd.yml @@ -137,7 +137,7 @@ jobs: cd src\Templates\Boilerplate && dotnet build -c Release dotnet pack -c Release -o . -p:ReleaseVersion=0.0.0 -p:PackageVersion=0.0.0 dotnet new install Bit.Boilerplate.0.0.0.nupkg - cd ..\..\..\ && dotnet new bit-bp --name AdminPanel --database SqlServer --sample Admin --windows --appInsights --serverUrl adminpanel.bitplatform.dev + cd ..\..\..\ && dotnet new bit-bp --name AdminPanel --database SqlServer --sample Admin --windows --appInsights --appCenter --serverUrl adminpanel.bitplatform.dev - name: Update appsettings.json api server address uses: devops-actions/variable-substitution@v1.2 @@ -151,6 +151,10 @@ jobs: - name: Generate CSS/JS files run: dotnet build AdminPanel\src\Client\AdminPanel.Client.Core\AdminPanel.Client.Core.csproj -t:InstallNodejsDependencies,BeforeBuildTasks -p:Version="${{ vars.APPLICATION_DISPLAY_VERSION}}" --no-restore + - name: Set app center secret + run: (Get-Content AdminPanel\src\Client\AdminPanel.Client.Windows\Program.cs) -Replace 'appCenterSecret = null;', 'appCenterSecret = "a9ed2257-fb82-496a-ba10-78c2d9ef33a6";' | Out-File -Encoding utf8 AdminPanel\src\Client\AdminPanel.Client.Windows\Program.cs + shell: pwsh + - name: Publish run: | cd AdminPanel\src\Client\AdminPanel.Client.Windows\ @@ -194,7 +198,7 @@ jobs: cd src/Templates/Boilerplate && dotnet build -c Release dotnet pack -c Release -o . -p:ReleaseVersion=0.0.0 -p:PackageVersion=0.0.0 dotnet new install Bit.Boilerplate.0.0.0.nupkg - cd ../../../ && dotnet new bit-bp --name AdminPanel --database SqlServer --sample Admin --appInsights --serverUrl adminpanel.bitplatform.dev + cd ../../../ && dotnet new bit-bp --name AdminPanel --database SqlServer --sample Admin --appInsights --appCenter --serverUrl adminpanel.bitplatform.dev - uses: actions/setup-node@v4 with: @@ -215,6 +219,10 @@ jobs: ApiServerAddress: ${{ env.API_SERVER_ADDRESS }} ApplicationInsights.ConnectionString: ${{ secrets.APPLICATION_INSIGHTS_CONNECTION_STRING }} + - name: Set app center secret + run: | + sed -i 's/appCenterSecret = null;/appCenterSecret = "ea9b98ea-93a0-48c7-982a-0a72f4ad6d04";/g' AdminPanel/src/Client/AdminPanel.Client.Maui/MauiProgram.cs + - name: Install maui run: cd src && dotnet workload install maui-android @@ -262,7 +270,7 @@ jobs: cd src/Templates/Boilerplate && dotnet build -c Release dotnet pack -c Release -o . -p:ReleaseVersion=0.0.0 -p:PackageVersion=0.0.0 dotnet new install Bit.Boilerplate.0.0.0.nupkg - cd ../../../ && dotnet new bit-bp --name AdminPanel --database SqlServer --sample Admin --appInsights --serverUrl adminpanel.bitplatform.dev + cd ../../../ && dotnet new bit-bp --name AdminPanel --database SqlServer --sample Admin --appInsights --appCenter --serverUrl adminpanel.bitplatform.dev - name: Update appsettings.json api server address uses: devops-actions/variable-substitution@v1.2 @@ -272,6 +280,10 @@ jobs: ApiServerAddress: ${{ env.API_SERVER_ADDRESS }} ApplicationInsights.ConnectionString: ${{ secrets.APPLICATION_INSIGHTS_CONNECTION_STRING }} + - name: Set app center secret + run: | + sed -i 's/appCenterSecret = null;/appCenterSecret = "0bc0d910-dc84-4887-a3a0-eee6b1b55797";/g' AdminPanel/src/Client/AdminPanel.Client.Maui/MauiProgram.cs + - name: Install maui run: cd src && dotnet workload install maui diff --git a/.github/workflows/bit.full.ci.yml b/.github/workflows/bit.full.ci.yml index 3767cbe540..a1a159c7b5 100644 --- a/.github/workflows/bit.full.ci.yml +++ b/.github/workflows/bit.full.ci.yml @@ -54,7 +54,7 @@ jobs: - name: Release build admin panel sample + SqlServer database run: | - dotnet new bit-bp --name AdminBPSqlServer --database sqlserver --sample admin --pipeline github --serverUrl adminpanel.bitplatform.dev + dotnet new bit-bp --name AdminBPSqlServer --database sqlserver --sample admin --pipeline github --serverUrl adminpanel.bitplatform.dev --appInsights --appCenter dotnet build AdminBPSqlServer/AdminBPSqlServer.sln -c Release - name: Install Nodejs dependencies diff --git a/.github/workflows/todo-sample.cd.yml b/.github/workflows/todo-sample.cd.yml index c491fec905..f03af9c7dd 100644 --- a/.github/workflows/todo-sample.cd.yml +++ b/.github/workflows/todo-sample.cd.yml @@ -152,7 +152,7 @@ jobs: cd src\Templates\Boilerplate && dotnet build -c Release dotnet pack -c Release -o . -p:ReleaseVersion=0.0.0 -p:PackageVersion=0.0.0 dotnet new install Bit.Boilerplate.0.0.0.nupkg - cd ..\..\..\ && dotnet new bit-bp --name TodoSample --database SqlServer --sample Todo --windows --appInsights --serverUrl todo.bitplatform.dev + cd ..\..\..\ && dotnet new bit-bp --name TodoSample --database SqlServer --sample Todo --windows --appInsights --appCenter --serverUrl todo.bitplatform.dev - name: Update appsettings.json api server address uses: devops-actions/variable-substitution@v1.2 @@ -162,6 +162,10 @@ jobs: ApiServerAddress: ${{ env.API_SERVER_ADDRESS }} WindowsUpdateSettings.FilesUrl: https://windows-todo.bitplatform.dev ApplicationInsights.ConnectionString: ${{ secrets.APPLICATION_INSIGHTS_CONNECTION_STRING }} + + - name: Set app center secret + run: (Get-Content TodoSample\src\Client\TodoSample.Client.Windows\Program.cs) -Replace 'appCenterSecret = null;', 'appCenterSecret = "39f576f2-7c16-4990-af3f-7b70509d41e2";' | Out-File -Encoding utf8 TodoSample\src\Client\TodoSample.Client.Windows\Program.cs + shell: pwsh - name: Generate CSS/JS files run: dotnet build TodoSample\src\Client\TodoSample.Client.Core\TodoSample.Client.Core.csproj -t:InstallNodejsDependencies,BeforeBuildTasks -p:Version="${{ vars.APPLICATION_DISPLAY_VERSION}}" --no-restore @@ -213,7 +217,7 @@ jobs: cd src/Templates/Boilerplate && dotnet build -c Release dotnet pack -c Release -o . -p:ReleaseVersion=0.0.0 -p:PackageVersion=0.0.0 dotnet new install Bit.Boilerplate.0.0.0.nupkg - cd ../../../ && dotnet new bit-bp --name TodoSample --database SqlServer --sample Todo --appInsights --serverUrl todo.bitplatform.dev + cd ../../../ && dotnet new bit-bp --name TodoSample --database SqlServer --sample Todo --appInsights --appCenter --serverUrl todo.bitplatform.dev - name: Extract Android signing key from env uses: timheuer/base64-to-file@v1.2 @@ -230,6 +234,10 @@ jobs: ApiServerAddress: ${{ env.API_SERVER_ADDRESS }} ApplicationInsights.ConnectionString: ${{ secrets.APPLICATION_INSIGHTS_CONNECTION_STRING }} + - name: Set app center secret + run: | + sed -i 's/appCenterSecret = null;/appCenterSecret = "de0219a6-fdcd-44f7-8c28-c108331ed27c";/g' TodoSample/src/Client/TodoSample.Client.Maui/MauiProgram.cs + - name: Install maui run: cd src && dotnet workload install maui-android @@ -297,7 +305,7 @@ jobs: cd src/Templates/Boilerplate && dotnet build -c Release dotnet pack -c Release -o . -p:ReleaseVersion=0.0.0 -p:PackageVersion=0.0.0 dotnet new install Bit.Boilerplate.0.0.0.nupkg - cd ../../../ && dotnet new bit-bp --name TodoSample --database SqlServer --sample Todo --appInsights --serverUrl todo.bitplatform.dev + cd ../../../ && dotnet new bit-bp --name TodoSample --database SqlServer --sample Todo --appInsights --appCenter --serverUrl todo.bitplatform.dev - name: Update appsettings.json api server address uses: devops-actions/variable-substitution@v1.2 @@ -307,6 +315,10 @@ jobs: ApiServerAddress: ${{ env.API_SERVER_ADDRESS }} ApplicationInsights.ConnectionString: ${{ secrets.APPLICATION_INSIGHTS_CONNECTION_STRING }} + - name: Set app center secret + run: | + sed -i 's/appCenterSecret = null;/appCenterSecret = "f72e6774-1c83-404c-bca8-6e5198fb8e0e";/g' TodoSample/src/Client/TodoSample.Client.Maui/MauiProgram.cs + - name: Install maui run: cd src && dotnet workload install maui diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/.template.config/template.json b/src/Templates/Boilerplate/Bit.Boilerplate/.template.config/template.json index 04088874d0..60daff6ad1 100644 --- a/src/Templates/Boilerplate/Bit.Boilerplate/.template.config/template.json +++ b/src/Templates/Boilerplate/Bit.Boilerplate/.template.config/template.json @@ -177,6 +177,12 @@ "datatype": "bool", "defaultValue": "false" }, + "appCenter": { + "displayName": "Add Visual Studio AppCenter to project?", + "type": "parameter", + "datatype": "bool", + "defaultValue": "false" + }, "nameToLower": { "type": "generated", "generator": "casing", diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/appsettings.Development.json b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/appsettings.Development.json index edb7165eee..7a623fb31e 100644 --- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/appsettings.Development.json +++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/appsettings.Development.json @@ -3,6 +3,13 @@ "LogLevel": { "Default": "Information" }, + //#if (appCenter == true) + "AppCenterLoggerProvider": { + "LogLevel": { + "Default": "Information" + } + }, + //#endif //#if (appInsights == true) "ApplicationInsights": { "LogLevel": { diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/appsettings.json b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/appsettings.json index ab140adea9..d537e93a44 100644 --- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/appsettings.json +++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/appsettings.json @@ -5,6 +5,15 @@ "Boilerplate.Client.Core.Components.AuthenticationStateLogger": "Information", "Microsoft.EntityFrameworkCore.Database.Command": "Information" }, + //#if (appCenter == true) + "AppCenterLoggerProvider": { + "LogLevel": { + "Default": "Warning", + "Boilerplate.Client.Core.Components.AuthenticationStateLogger": "Information", + "Microsoft.EntityFrameworkCore.Database.Command": "Information" + } + }, + //#endif //#if (appInsights == true) "ApplicationInsights": { "LogLevel": { diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Maui/Boilerplate.Client.Maui.csproj b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Maui/Boilerplate.Client.Maui.csproj index d0cfd72e02..61f641df69 100644 --- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Maui/Boilerplate.Client.Maui.csproj +++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Maui/Boilerplate.Client.Maui.csproj @@ -145,6 +145,9 @@ + + + diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Maui/MauiProgram.Services.cs b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Maui/MauiProgram.Services.cs index 7d666b7b93..a6f48bd6b2 100644 --- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Maui/MauiProgram.Services.cs +++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Maui/MauiProgram.Services.cs @@ -48,6 +48,14 @@ public static void ConfigureServices(this MauiAppBuilder builder) builder.Logging.AddEventSourceLogger(); //+:cnd:noEmit + + //#if (appCenter == true) + if (Microsoft.AppCenter.AppCenter.Configured) + { + builder.Logging.AddAppCenter(options => { }); + } + //#endif + //#if (appInsights == true) builder.Logging.AddApplicationInsights(config => { diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Maui/MauiProgram.cs b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Maui/MauiProgram.cs index f422cfae46..50c08296d4 100644 --- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Maui/MauiProgram.cs +++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Maui/MauiProgram.cs @@ -1,8 +1,8 @@ //-:cnd:noEmit -using Microsoft.Maui.LifecycleEvents; using Maui.AppStores; using Maui.InAppReviews; using Maui.Android.InAppUpdates; +using Microsoft.Maui.LifecycleEvents; using Boilerplate.Client.Core; #if IOS || MACCATALYST using UIKit; @@ -16,6 +16,16 @@ public static partial class MauiProgram { public static MauiApp CreateMauiApp() { + //+:cnd:noEmit + //#if (appCenter == true) + string? appCenterSecret = null; + if (appCenterSecret is not null) + { + Microsoft.AppCenter.AppCenter.Start(appCenterSecret, typeof(Microsoft.AppCenter.Crashes.Crashes), typeof(Microsoft.AppCenter.Analytics.Analytics)); + } + //#endif + //-:cnd:noEmit + AppRenderMode.IsBlazorHybrid = true; var builder = MauiApp.CreateBuilder(); @@ -117,28 +127,28 @@ private static void SetupBlazorWebView() } } #elif ANDROID - webView.SetBackgroundColor(Android.Graphics.Color.Transparent); + webView.SetBackgroundColor(Android.Graphics.Color.Transparent); - webView.OverScrollMode = Android.Views.OverScrollMode.Never; + webView.OverScrollMode = Android.Views.OverScrollMode.Never; - webView.HapticFeedbackEnabled = false; + webView.HapticFeedbackEnabled = false; - Android.Webkit.WebSettings settings = webView.Settings; + Android.Webkit.WebSettings settings = webView.Settings; - settings.AllowFileAccessFromFileURLs = - settings.AllowUniversalAccessFromFileURLs = - settings.AllowContentAccess = - settings.AllowFileAccess = - settings.DatabaseEnabled = - settings.JavaScriptCanOpenWindowsAutomatically = - settings.DomStorageEnabled = true; + settings.AllowFileAccessFromFileURLs = + settings.AllowUniversalAccessFromFileURLs = + settings.AllowContentAccess = + settings.AllowFileAccess = + settings.DatabaseEnabled = + settings.JavaScriptCanOpenWindowsAutomatically = + settings.DomStorageEnabled = true; - if (BuildConfiguration.IsDebug()) - { - settings.MixedContentMode = Android.Webkit.MixedContentHandling.AlwaysAllow; - } + if (BuildConfiguration.IsDebug()) + { + settings.MixedContentMode = Android.Webkit.MixedContentHandling.AlwaysAllow; + } - settings.BlockNetworkLoads = settings.BlockNetworkImage = false; + settings.BlockNetworkLoads = settings.BlockNetworkImage = false; #endif }); } diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Windows/Boilerplate.Client.Windows.csproj b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Windows/Boilerplate.Client.Windows.csproj index d5a6f370e1..13ae2565dc 100644 --- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Windows/Boilerplate.Client.Windows.csproj +++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Windows/Boilerplate.Client.Windows.csproj @@ -33,6 +33,9 @@ + + + diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Windows/Program.Services.cs b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Windows/Program.Services.cs index 15e278e558..9acea3dc5b 100644 --- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Windows/Program.Services.cs +++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Windows/Program.Services.cs @@ -48,6 +48,12 @@ public static void ConfigureServices(this IServiceCollection services) loggingBuilder.AddDebug(); } loggingBuilder.AddConsole(); + //#if (appCenter == true) + if (Microsoft.AppCenter.AppCenter.Configured) + { + loggingBuilder.AddAppCenter(options => { }); + } + //#endif //#if (appInsights == true) loggingBuilder.AddApplicationInsights(config => { diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Windows/Program.cs b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Windows/Program.cs index 470cc4ccab..51a109df34 100644 --- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Windows/Program.cs +++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Windows/Program.cs @@ -8,6 +8,16 @@ public partial class Program [STAThread] public static void Main(string[] args) { + //+:cnd:noEmit + //#if (appCenter == true) + string? appCenterSecret = null; + if (appCenterSecret is not null) + { + Microsoft.AppCenter.AppCenter.Start(appCenterSecret, typeof(Microsoft.AppCenter.Crashes.Crashes), typeof(Microsoft.AppCenter.Analytics.Analytics)); + } + //#endif + //-:cnd:noEmit + // https://github.com/velopack/velopack VelopackApp.Build().Run(); var application = new App(); diff --git a/src/Websites/Platform/src/Bit.Websites.Platform.Client/Pages/Templates/Templates04CreateProjectPage.razor b/src/Websites/Platform/src/Bit.Websites.Platform.Client/Pages/Templates/Templates04CreateProjectPage.razor index 9afa8114f6..18387a0c4f 100644 --- a/src/Websites/Platform/src/Bit.Websites.Platform.Client/Pages/Templates/Templates04CreateProjectPage.razor +++ b/src/Websites/Platform/src/Bit.Websites.Platform.Client/Pages/Templates/Templates04CreateProjectPage.razor @@ -35,6 +35,7 @@ dotnet new bit-bp
  • --offlineDb defaults to false: '--offlineDb true' adds sqlite database support to the client mobile, web and desktop apps
  • --windows default to false: '--windows true' adds support for exe output for windows 7+
  • --appInsights defaults to false: '--appInsights true' adds support for Azure application insights in all clients (Android, iOS, Windows, macOS, Web)
  • +
  • --appCenter defaults to false: '--appCenter true' adds support for Visual Studio AppCenter in hybrid clients (Android, iOS, Windows, macOS)
  • Examples: