diff --git a/BuildFeed/App_Start/FilterConfig.cs b/BuildFeed/App_Start/FilterConfig.cs index f668540..89c58c4 100644 --- a/BuildFeed/App_Start/FilterConfig.cs +++ b/BuildFeed/App_Start/FilterConfig.cs @@ -1,12 +1,13 @@ using System.Web.Mvc; +using BuildFeed.Code; namespace BuildFeed { - public class FilterConfig - { - public static void RegisterGlobalFilters(GlobalFilterCollection filters) - { - filters.Add(new HandleErrorAttribute()); - } - } + public class FilterConfig + { + public static void RegisterGlobalFilters(GlobalFilterCollection filters) + { + filters.Add(new AiHandleErrorAttribute()); + } + } } \ No newline at end of file diff --git a/BuildFeed/BuildFeed.csproj b/BuildFeed/BuildFeed.csproj index 10bb8ed..3baf66c 100644 --- a/BuildFeed/BuildFeed.csproj +++ b/BuildFeed/BuildFeed.csproj @@ -192,6 +192,7 @@ + diff --git a/BuildFeed/Code/AiHandleErrorAttribute.cs b/BuildFeed/Code/AiHandleErrorAttribute.cs new file mode 100644 index 0000000..918c2ed --- /dev/null +++ b/BuildFeed/Code/AiHandleErrorAttribute.cs @@ -0,0 +1,25 @@ +using System; +using System.Web.Mvc; +using Microsoft.ApplicationInsights; + +namespace BuildFeed.Code +{ + [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = true)] + public class AiHandleErrorAttribute : HandleErrorAttribute + { + public override void OnException(ExceptionContext filterContext) + { + if (filterContext?.HttpContext != null && filterContext.Exception != null) + { + //If customError is Off, then AI HTTPModule will report the exception + if (filterContext.HttpContext.IsCustomErrorEnabled) + { + // Note: A single instance of telemetry client is sufficient to track multiple telemetry items. + TelemetryClient ai = new TelemetryClient(); + ai.TrackException(filterContext.Exception); + } + } + base.OnException(filterContext); + } + } +} \ No newline at end of file diff --git a/BuildFeed/Controllers/apiController.cs b/BuildFeed/Controllers/apiController.cs index 7db994c..101d333 100644 --- a/BuildFeed/Controllers/apiController.cs +++ b/BuildFeed/Controllers/apiController.cs @@ -100,7 +100,11 @@ public async Task AddWin10Builds(NewBuildPost apiModel) AppId = Guid.Parse(ConfigurationManager.AppSettings["push:AppId"]), IncludedSegments = new List { +#if DEBUG + "Testers" +#else "All" +#endif }, Headings = { @@ -110,12 +114,7 @@ public async Task AddWin10Builds(NewBuildPost apiModel) { {LanguageCodes.English, build.AlternateBuildString} }, - Url = "https://www.buildfeed.net" + Url.Route(nameof(FrontController.ViewBuild), - new - { - controller = "Front", - id = build.Id - }) + Url = $"https://buildfeed.net{Url.Route(nameof(FrontController.ViewBuild), new { controller = "Front", id = build.Id })}?utm_source=notification&utm_campaign=new_build" }); } return true; diff --git a/BuildFeed/Controllers/frontController.cs b/BuildFeed/Controllers/frontController.cs index 953fb92..fc9fdad 100644 --- a/BuildFeed/Controllers/frontController.cs +++ b/BuildFeed/Controllers/frontController.cs @@ -422,7 +422,11 @@ public async Task AddBuild(Build build) AppId = Guid.Parse(ConfigurationManager.AppSettings["push:AppId"]), IncludedSegments = new List { +#if DEBUG + "Testers" +#else "All" +#endif }, Headings = { @@ -432,11 +436,7 @@ public async Task AddBuild(Build build) { {LanguageCodes.English, build.AlternateBuildString} }, - Url = "https://www.buildfeed.net" + Url.Action(nameof(ViewBuild), - new - { - id = build.Id - }) + Url = $"https://buildfeed.net{Url.Action(nameof(ViewBuild), new { id = build.Id })}?utm_source=notification&utm_campaign=new_build" }); return RedirectToAction(nameof(ViewBuild), diff --git a/BuildFeed/Views/shared/_default.cshtml b/BuildFeed/Views/shared/_default.cshtml index ccc655f..28d3f70 100644 --- a/BuildFeed/Views/shared/_default.cshtml +++ b/BuildFeed/Views/shared/_default.cshtml @@ -2,51 +2,42 @@ @using BuildFeed.Code.Options @using BuildFeed.Controllers @{ - bool isRtl = CultureInfo.CurrentUICulture.TextInfo.IsRightToLeft; + bool isRtl = CultureInfo.CurrentUICulture.TextInfo.IsRightToLeft; - Response.PushPromise("/res/css/default.css"); - Response.PushPromise(VirtualPathUtility.ToAbsolute(((Theme)ViewBag.Theme).CssPath)); - if (isRtl) - { - Response.PushPromise("/res/css/rtl.css"); - } + Response.PushPromise("/res/css/default.css"); + Response.PushPromise(VirtualPathUtility.ToAbsolute(((Theme)ViewBag.Theme).CssPath)); + if (isRtl) + { + Response.PushPromise("/res/css/rtl.css"); + } - Response.PushPromise("/res/ts/bfs.js"); + Response.PushPromise("/res/ts/bfs.js"); } + ? "rtl" + : "ltr")" lang="@CultureInfo.CurrentUICulture.TwoLetterISOLanguageName"> - - - - - - - - - - + + + + + + + + + + + - - - @if (isRtl) - { - - } - @ViewBag.Title - @RenderSection("head", false) - + + + @if (isRtl) + { + + } + @ViewBag.Title + @RenderSection("head", false) @@ -54,6 +45,8 @@ var OneSignal = window.OneSignal || []; OneSignal.push(["init", { appId: "94384f83-dced-4d66-a88c-c2b6e3cdfbaa", + safari_web_id: "web.onesignal.auto.4cc30974-98f9-47ba-8e02-4635d2d477f2", + persistNotification: false, allowLocalhostAsSecureOrigin: true, autoRegister: true, notifyButton: { @@ -61,204 +54,214 @@ } }]); + - - + -
-
- @RenderBody() -
-
-
-
- +
+
- + - - - @RenderSection("scripts", false) - + +@RenderSection("scripts", false) + - + \ No newline at end of file diff --git a/BuildFeed/content/tile/notify.png b/BuildFeed/content/tile/notify.png index 0ba6e8c..54cfb5c 100644 Binary files a/BuildFeed/content/tile/notify.png and b/BuildFeed/content/tile/notify.png differ diff --git a/BuildFeed/manifest.json b/BuildFeed/manifest.json index 2f00900..7911015 100644 --- a/BuildFeed/manifest.json +++ b/BuildFeed/manifest.json @@ -1,7 +1,16 @@ { "name": "BuildFeed", "short_name": "BuildFeed", - "start_url": "/", + "background_color": "#373736", + "theme_color": "#373736", + "description": "Learn what Dona Sarkar won't tell you. Keep up to date with the latest Microsoft Windows developments with BuildFeed, the comprehensive build tracker.", + "icons": [ + { + "src": "https://buildfeed.net/content/tile/notify.png", + "sizes": "any" + } + ], + "start_url": "https://buildfeed.net/", "display": "standalone", "gcm_sender_id": "482941778795" } \ No newline at end of file