Skip to content

Commit

Permalink
✨ introduce v3.15.0
Browse files Browse the repository at this point in the history
  • Loading branch information
xavierfoucrier authored Dec 7, 2024
2 parents 5892c05 + 1b22674 commit a4be1fe
Show file tree
Hide file tree
Showing 25 changed files with 547 additions and 349 deletions.
20 changes: 16 additions & 4 deletions .github/labels.yml → .github/issues/labels.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
- name: a11y
description: about accessibility
color: fef2c0
- name: await test repository
description: waiting for a minimal test repository
color: 5319e7
- name: bug
description: bug to fix
color: fbca04
Expand All @@ -9,7 +15,7 @@
color: 00209a
- name: critical
description: critical failure to fix as soon as possible
color: d93f0b
color: b60205
- name: dependencies
description: update/upgrade one or more dependency
color: 0366d6
Expand All @@ -19,24 +25,30 @@
- name: documentation
description: regarding the project documentation
color: 27d19b
- name: duplicate
description: a similar issue already exists
color: ededed
- name: feature
description: feature request to implement
color: 1d76db
- name: help
description: need help, any contribution are welcome
color: 5319e7
- name: source map
description: about source mapping
color: ebe4da
- name: motion
description: motion request
description: about motion and animation
color: 32deca
- name: optimization
description: optimization request
color: 128a0c
- name: post-it
description: reminder or todo
color: fcf49c
- name: platform
- name: environment
description: regarding the environment or target platform
color: f1f1f1
- name: wontfix
description: negligible issue or that will never be fixed
color: 444444
color: 000000
43 changes: 40 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Github workflow for Continuous Integration

name: CI
name: 🤖 continuous integration

on:
push:
Expand All @@ -13,7 +13,7 @@ on:
- dev

jobs:
build:
build-debug:
runs-on: windows-latest
defaults:
run:
Expand All @@ -35,11 +35,48 @@ jobs:
run: |
msbuild.exe InboxNotifier.sln /p:configuration="Debug" /p:platform="Any CPU" /m
build-x86:
runs-on: windows-latest
needs: build-debug
defaults:
run:
working-directory: code
steps:
- name: Checkout the repository
uses: actions/checkout@v4

- name: Setup MSBuild
uses: microsoft/setup-msbuild@v2

- name: Setup NuGet
uses: NuGet/setup-nuget@v2

- name: Restore NuGet packages
run: nuget restore InboxNotifier.sln

- name: Build solution — Release 32 bits (x86)
run: |
msbuild.exe InboxNotifier.sln /p:configuration="Release x86" /p:platform="Any CPU" /m
build-x64:
runs-on: windows-latest
needs: build-x86
defaults:
run:
working-directory: code
steps:
- name: Checkout the repository
uses: actions/checkout@v4

- name: Setup MSBuild
uses: microsoft/setup-msbuild@v2

- name: Setup NuGet
uses: NuGet/setup-nuget@v2

- name: Restore NuGet packages
run: nuget restore InboxNotifier.sln

- name: Build solution — Release 64 bits (x64)
run: |
msbuild.exe InboxNotifier.sln /p:configuration="Release x64" /p:platform="Any CPU" /m
12 changes: 9 additions & 3 deletions .github/workflows/sync-labels.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,26 @@
# Github workflow to automatically sync labels in a declarative way
# https://github.com/micnncim/action-label-syncer

name: Sync labels
name: 🏷️ synchronize labels

on:
push:
branches:
- main
paths:
- '.github/labels.yml'
- .github/issues/labels.yml

permissions:
contents: write
issues: write

jobs:
labels:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: micnncim/action-label-syncer@v1
with:
manifest: .github/issues/labels.yml
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ github.token }}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Note that this version of the .NET Framework **evolve in time**: the application
#### Setup installer
The setup installer contains both `32 bits (x86)` and `64 bits (x64)` versions: this is the better way to install Windows application and allow you to **cleanly install/uninstall** the application with ease.

* :package: [Inbox Notifier 3.11.0](https://github.com/xavierfoucrier/inbox-notifier/releases/download/v3.11.0/Inbox.Notifier.3.11.0.exe)
* :package: [Inbox Notifier 3.15.0](https://github.com/xavierfoucrier/inbox-notifier/releases/download/v3.15.0/Inbox.Notifier.3.15.0.exe)

> Note that you will need **administrator rights** to properly complete the installation.
Expand Down
4 changes: 0 additions & 4 deletions code/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,6 @@
</userSettings>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="log4net" publicKeyToken="669e0ddf0bb1aa2a" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-1.2.15.0" newVersion="1.2.15.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-11.0.0.0" newVersion="12.0.0.0"/>
Expand Down
2 changes: 1 addition & 1 deletion code/Computer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public void BindSessionSwitch() {
}

// synchronize the inbox and renew the token
await UI.GmailService.Inbox.Sync(true, true);
await UI.GmailService.Inbox.Sync(token: true);

// enable the timer properly
UI.timer.Enabled = true;
Expand Down
37 changes: 30 additions & 7 deletions code/Core.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ static Core() {
// initialize the application version number, based on scheme Semantic Versioning - https://semver.org
string[] ProductVersion = Application.ProductVersion.Split('.');

string VersionMajor = ProductVersion[0];
string VersionMinor = ProductVersion[1];
string VersionPatch = ProductVersion[2];
MajorVersion = int.Parse(ProductVersion[0]);
MinorVersion = int.Parse(ProductVersion[1]);
PatchVersion = int.Parse(ProductVersion[2]);

Version = $"v{VersionMajor}.{VersionMinor}.{VersionPatch}";
Version = $"v{MajorVersion}.{MinorVersion}.{PatchVersion}";
}

/// <summary>
Expand All @@ -34,13 +34,15 @@ static Core() {
public static void RestartApplication() {

// start a new process
Process.Start(new ProcessStartInfo("cmd.exe", $"/C ping 127.0.0.1 -n 2 && \"{Application.ExecutablePath}\"") {
Process.Start(new ProcessStartInfo {
FileName = Application.ExecutablePath,
UseShellExecute = true,
WindowStyle = ProcessWindowStyle.Hidden,
CreateNoWindow = true
});

// exit the application
Application.Exit();
// exit the environment
Environment.Exit(0);
}

/// <summary>
Expand Down Expand Up @@ -71,6 +73,27 @@ public static string Version {
get;
} = "";

/// <summary>
/// Major application version number
/// </summary>
public static int MajorVersion {
get;
} = 0;

/// <summary>
/// Minor application version number
/// </summary>
public static int MinorVersion {
get;
} = 0;

/// <summary>
/// Patch application version number
/// </summary>
public static int PatchVersion {
get;
} = 0;

#endregion
}
}
40 changes: 21 additions & 19 deletions code/Gmail.cs
Original file line number Diff line number Diff line change
Expand Up @@ -123,12 +123,13 @@ public async Task Authentication() {
// enable the main timer
UI.timer.Enabled = true;

// synchronize the user mailbox, after checking for update depending on the user settings, or by default after the asynchronous authentication
// check for update depending on the user settings
if (Settings.Default.UpdateService && Update.IsPeriodSetToStartup()) {
await UI.UpdateService.Check(!Settings.Default.UpdateDownload, true);
} else {
await Inbox.Sync();
}

// synchronize the user mailbox
await Inbox.Sync();
}

/// <summary>
Expand All @@ -139,7 +140,7 @@ public async Task<bool> RefreshToken() {

// refresh the token and update the token delivery date and time on the interface
try {
if (Credential.Token.IsExpired(Credential.Flow.Clock)) {
if (Credential.Token.IsStale) {
if (await Credential.RefreshTokenAsync(new CancellationToken())) {
UI.labelTokenDelivery.Text = Credential.Token.IssuedUtc.ToLocalTime().ToString();
}
Expand Down Expand Up @@ -188,21 +189,22 @@ private static async Task<UserCredential> AuthorizationBroker() {
using (FileStream stream = new FileStream($"{Path.GetDirectoryName(Application.ExecutablePath)}/client_secret.json", FileMode.Open, FileAccess.Read)) {

// define a cancellation token source
CancellationTokenSource cancellation = new CancellationTokenSource();
cancellation.CancelAfter(TimeSpan.FromSeconds(Settings.Default.OAUTH_TIMEOUT));

// wait for the user validation, only if the user has not already authorized the application
UserCredential credential = await GoogleWebAuthorizationBroker.AuthorizeAsync(
GoogleClientSecrets.FromStream(stream).Secrets,
new string[] { GmailService.Scope.GmailModify },
"user",
cancellation.Token,
new FileDataStore(Core.ApplicationDataFolder, true),
new LocalServerCodeReceiver(Resources.oauth_message)
);

// return the user credential
return credential;
using (CancellationTokenSource cancellation = new CancellationTokenSource()) {
cancellation.CancelAfter(TimeSpan.FromSeconds(Settings.Default.OAUTH_TIMEOUT));

// wait for the user validation, only if the user has not already authorized the application
UserCredential credential = await GoogleWebAuthorizationBroker.AuthorizeAsync(
GoogleClientSecrets.FromStream(stream).Secrets,
new string[] { GmailService.Scope.GmailModify },
"user",
cancellation.Token,
new FileDataStore(Core.ApplicationDataFolder, true),
new LocalServerCodeReceiver(Resources.oauth_message)
);

// return the user credential
return credential;
}
}
}

Expand Down
Loading

0 comments on commit a4be1fe

Please sign in to comment.