Skip to content

Commit 77fbcc5

Browse files
authored
general code refactor following the SRP
2 parents 71a3940 + e243fa4 commit 77fbcc5

33 files changed

Lines changed: 1205 additions & 733 deletions

.github/.workflows/maven.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ jobs:
2323
- name: Check out code
2424
uses: actions/checkout@v4
2525

26-
# Step 2: Set up JDK 19
27-
- name: Set up JDK 19
26+
# Step 2: Set up JDK 25
27+
- name: Set up JDK 25
2828
uses: actions/setup-java@v4
2929
with:
30-
java-version: '19'
30+
java-version: '25'
3131
distribution: 'temurin' # Use the Temurin distribution for OpenJDK
3232
cache: maven # Cache Maven dependencies to speed up subsequent builds
3333

@@ -40,11 +40,11 @@ jobs:
4040
run: mvn test --file pom.xml # Run the tests to ensure the code works as expected
4141

4242
# Step 5: Upload the built JAR file as an artifact
43-
- name: Upload JAR Artifact
44-
uses: actions/upload-artifact@v3
45-
with:
46-
name: backupmanager-jar # Name of the artifact
47-
path: target/BackupManager-1.0-SNAPSHOT-jar-with-dependencies.jar # Path to the JAR file
43+
# - name: Upload JAR Artifact
44+
# uses: actions/upload-artifact@v3
45+
# with:
46+
# name: remindme-jar # Name of the artifact
47+
# path: target/RemindMe-1.0-SNAPSHOT-jar-with-dependencies.jar # Path to the JAR file
4848

4949
# Step 6: Static Code Analysis with SpotBugs (optional)
5050
- name: Static Code Analysis with SpotBugs

CONTRIBUTING.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Contributing to RemindMe
2+
3+
Thank you for your interest in contributing to **RemindMe**! Your ideas, bug reports, improvements, and patches are very welcome.
4+
5+
---
6+
7+
## How to contribute
8+
9+
1. **Open an Issue**
10+
If you find a bug or want to propose a new feature, please open an issue describing the problem or request clearly.
11+
12+
2. **Fork & Clone**
13+
Fork the repository and clone it locally:
14+
15+
```bash
16+
git clone https://github.com/DennisTurco/RemindMe.git
17+
cd RemindMe
18+
```
19+
20+
3. **Create a Branch**
21+
22+
```bash
23+
git checkout -b your-feature-or-fix-name
24+
```
25+
26+
4. **Write Code**
27+
* Follow the existing coding style.
28+
* Write clear comments.
29+
* Add automated tests if possible.
30+
5. **Commit & Push**
31+
Make clear, descriptive commits:
32+
33+
```bash
34+
git commit -m "Brief description of the change"
35+
git push origin your-feature-or-fix-name
36+
```
37+
38+
6. **Open a Pull Request (PR)**
39+
Open a PR on GitHub targeting the `master` branch. Describe what you did and why.
40+
41+
## Need Help?
42+
43+
If you have questions about contributing, contact: [dennisturco@gmail.com](dennisturco@gmail.com)
44+
45+
Thanks again for helping improve RemindMe!

RemindMe_convert_to_exe_launch4j.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@
2525
<maxVersion></maxVersion>
2626
</jre>
2727
<versionInfo>
28-
<fileVersion>1.2.1.0</fileVersion>
28+
<fileVersion>1.2.2.0</fileVersion>
2929
<txtFileVersion>2.0.RC1</txtFileVersion>
3030
<fileDescription>A lightweight executable that schedules and triggers custom, recurring reminders via pop-up notifications. </fileDescription>
3131
<copyright>Copyright © 2026 Shard</copyright>
32-
<productVersion>1.2.1.0</productVersion>
32+
<productVersion>1.2.2.0</productVersion>
3333
<txtProductVersion>2.0.RC1</txtProductVersion>
3434
<productName>Remind Me</productName>
3535
<companyName>Shard</companyName>

RemindMe_installer_inno_setup.iss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44

55
[Setup]
66
AppName=RemindMe
7-
AppVersion=1.2.1
7+
AppVersion=1.2.2
88
AppPublisher=Shard
99
AppPublisherURL=https://www.shardpc.it/
1010
DefaultDirName={userdocs}\Shard\RemindMe
1111
DisableDirPage=yes
1212
DisableProgramGroupPage=no
1313
PrivilegesRequired=lowest
14-
OutputBaseFilename=RemindMe_v1.2.1_Setup
14+
OutputBaseFilename=RemindMe_v1.2.2_Setup
1515
SetupIconFile=src\main\resources\res\img\logo.ico
1616
SetupLogging=yes
1717
Compression=lzma

pom.xml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,11 +90,17 @@
9090
<version>11.2.1</version>
9191
</dependency>
9292

93-
<!-- JUnit for testing -->
93+
<!-- JUnit 5 dependency -->
9494
<dependency>
95-
<groupId>junit</groupId>
96-
<artifactId>junit</artifactId>
97-
<version>[4.13.1,)</version>
95+
<groupId>org.junit.jupiter</groupId>
96+
<artifactId>junit-jupiter-api</artifactId>
97+
<version>5.10.0</version>
98+
<scope>test</scope>
99+
</dependency>
100+
<dependency>
101+
<groupId>org.junit.jupiter</groupId>
102+
<artifactId>junit-jupiter-engine</artifactId>
103+
<version>5.10.0</version>
98104
<scope>test</scope>
99105
</dependency>
100106
</dependencies>

src/main/java/remindme/Controllers/AppController.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public class AppController {
2222

2323
public static AppController startBackgroundProcess() throws IOException {
2424
return new AppController();
25-
}
25+
}
2626

2727
private AppController() throws IOException {
2828
logger.info("Starting RemindMe application");

src/main/java/remindme/Controllers/TrayController.java

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,7 @@ public class TrayController {
3131

3232
private boolean paused = false;
3333

34-
public TrayController(
35-
Runnable onOpen,
36-
Runnable onPause,
37-
Runnable onResume,
38-
Runnable onExit
39-
) {
34+
public TrayController(Runnable onOpen, Runnable onPause, Runnable onResume, Runnable onExit) {
4035
this.onOpen = onOpen;
4136
this.onPause = onPause;
4237
this.onResume = onResume;

src/main/java/remindme/Dialogs/ManageRemind.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
import remindme.Enums.TranslationLoaderEnum.TranslationCategory;
1313
import remindme.Enums.TranslationLoaderEnum.TranslationKey;
1414
import remindme.Helpers.TimeRange;
15-
import remindme.Managers.RemindManager;
1615
import remindme.Managers.SoundPlayer;
16+
import remindme.Services.TimeIntervalService;
1717

1818
public class ManageRemind extends javax.swing.JDialog {
1919

@@ -100,7 +100,7 @@ public Remind getRemindInserted() {
100100
range = TimeRange.of(timeFromLocalTime, timeToLocalTime);
101101
}
102102

103-
LocalDateTime nextExecution = RemindManager.getNextExecutionBasedOnMethod(executionMethod, range, timeInterval);
103+
LocalDateTime nextExecution = TimeIntervalService.getNextExecutionBasedOnMethod(executionMethod, range, timeInterval);
104104

105105
return new Remind(name, description, remindCount, active, topLevel, lastExecution, nextExecution, creationDate, lastUpdateDate, timeInterval, icon, sound, executionMethod, range, maxExecutionsPerDay);
106106
}

src/main/java/remindme/Dialogs/PreferencesDialog.java

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import remindme.Enums.TranslationLoaderEnum;
88
import remindme.Enums.TranslationLoaderEnum.TranslationCategory;
99
import remindme.Enums.TranslationLoaderEnum.TranslationKey;
10+
import remindme.GUI.Controllers.MainController;
1011
import remindme.Managers.ThemeManager;
1112

1213
import java.awt.Image;
@@ -19,22 +20,22 @@
1920
import org.slf4j.LoggerFactory;
2021

2122
import remindme.Managers.ExceptionManager;
22-
import remindme.Managers.RemindManager;
2323

2424
public class PreferencesDialog extends javax.swing.JDialog {
2525

2626
private static final Logger logger = LoggerFactory.getLogger(PreferencesDialog.class);
27-
private final RemindManager remindManager;
2827

29-
public PreferencesDialog(java.awt.Frame parent, boolean modal, RemindManager remindManager) {
28+
private final MainController mainController;
29+
30+
public PreferencesDialog(java.awt.Frame parent, boolean modal, MainController mainController) {
3031
super(parent, modal);
31-
this.remindManager = remindManager;
32+
this.mainController = mainController;
3233

3334
initComponents();
3435

3536
// logo application
3637
Image icon = new ImageIcon(this.getClass().getResource(ConfigKey.LOGO_IMG.getValue())).getImage();
37-
this.setIconImage(icon);
38+
this.setIconImage(icon);
3839

3940
ThemeManager.updateThemeDialog(this);
4041
setLanguages();
@@ -152,8 +153,8 @@ private void applyBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRS
152153
ThemeManager.updateThemeDialog(this);
153154

154155
// update globally
155-
Preferences.updatePreferencesToJSON();
156-
remindManager.reloadPreferences();
156+
Preferences.updatePreferencesToJson();
157+
mainController.reloadPreferences();
157158
} catch (IOException ex) {
158159
logger.error("An error occurred during applying preferences: " + ex.getMessage(), ex);
159160
ExceptionManager.openExceptionMessage(ex.getMessage(), Arrays.toString(ex.getStackTrace()));

src/main/java/remindme/Dialogs/ReminderDialog.java

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,9 @@
99
import org.slf4j.Logger;
1010
import org.slf4j.LoggerFactory;
1111

12-
import remindme.Entities.Remind;
1312
import remindme.Entities.RemindNotification;
1413
import remindme.Enums.ConfigKey;
15-
import remindme.Managers.RemindManager;
14+
import remindme.GUI.Controllers.MainController;
1615
import remindme.Managers.SoundPlayer;
1716
import remindme.Managers.ThemeManager;
1817

@@ -58,24 +57,8 @@ private void initDialog(RemindNotification remind) {
5857
timeLabel.setText(LocalDateTime.now().format(timeFormatter));
5958
}
6059

61-
private void updateRemindAfterShow(RemindNotification remind) {
62-
RemindManager remindManager = new RemindManager();
63-
64-
for (Remind rem : RemindManager.reminds) {
65-
if (remind.name().equals(rem.getName())) {
66-
rem.setLastExecution(LocalDateTime.now());
67-
rem.setRemindCount(rem.getRemindCount()+1);
68-
69-
switch (rem.getExecutionMethod()) {
70-
case ONE_TIME_PER_DAY -> rem.setNextExecution(LocalDateTime.of(LocalDateTime.now().toLocalDate().plusDays(1), rem.getTimeRange().start()));
71-
case CUSTOM_TIME_RANGE -> rem.setNextExecution(RemindManager.getNextExecutionByTimeIntervalFromSpecificTime(rem.getTimeInterval(), rem.getTimeRange().start()));
72-
case PC_STARTUP -> rem.setNextExecution(RemindManager.getNextExecutionByTimeInterval(rem.getTimeInterval()));
73-
default -> rem.setNextExecution(LocalDateTime.of(LocalDateTime.now().toLocalDate().plusDays(1), rem.getTimeRange().start()));
74-
}
75-
}
76-
}
77-
78-
remindManager.updateRemindList();
60+
private static void updateRemindAfterShow(RemindNotification remind) {
61+
MainController.updateRemindAfterShow(remind.name());
7962
}
8063

8164
private void setNameLabelText(String text) {

0 commit comments

Comments
 (0)