Skip to content

Commit ea16a4d

Browse files
Merge pull request #86 from AbdelrahmanBayoumi/dev
Update v1.3.0
2 parents eab7abd + 74acb49 commit ea16a4d

File tree

139 files changed

+4114
-1806
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

139 files changed

+4114
-1806
lines changed

.editorconfig

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
@ -0,0 +1,34 @@
2+
# Root-level configuration file
3+
root = true
4+
5+
# Settings for CSS files
6+
[*.css]
7+
indent_style = space
8+
indent_size = 4
9+
max_line_length = 80

Azkar/jarFiles/db/locations.db

0 Bytes
Binary file not shown.

Azkar/pom.xml

Lines changed: 14 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,16 @@
66

77
<groupId>com.bayoumi</groupId>
88
<artifactId>Azkar</artifactId>
9-
<version>1.2.9-SNAPSHOT</version>
9+
<version>1.3.0-SNAPSHOT</version>
1010

1111
<properties>
1212
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
13-
<maven.compiler.target>1.8</maven.compiler.target>
14-
<maven.compiler.source>1.8</maven.compiler.source>
1513
<jdk.version>1.8</jdk.version>
1614
<app.name>Azkar</app.name>
1715
<mainClass>com.bayoumi.Launcher</mainClass>
1816
</properties>
1917

18+
<packaging>jar</packaging>
2019

2120
<repositories>
2221
<repository>
@@ -26,64 +25,63 @@
2625
</repositories>
2726

2827
<dependencies>
29-
30-
<!-- Adhan High precision prayer time library (No internet needed) -->
28+
<!-- Adhan High precision prayer time library -->
3129
<dependency>
3230
<groupId>com.batoulapps.adhan</groupId>
3331
<artifactId>adhan</artifactId>
3432
<version>1.2.1</version>
3533
</dependency>
3634

37-
<!-- Install4J Runtime for scripting installers and uninstallers, developing extensions and for accessing runtime services. -->
35+
<!-- Install4J Runtime for scripting installers and uninstallers -->
3836
<dependency>
3937
<groupId>com.install4j</groupId>
4038
<artifactId>install4j-runtime</artifactId>
4139
<version>9.0.2</version>
4240
</dependency>
4341

44-
<!-- JFoenix is an open source Java library, that implements Google Material Design using Java components. -->
42+
<!-- JFoenix (Google Material Design for JavaFX) -->
4543
<dependency>
4644
<groupId>com.jfoenix</groupId>
4745
<artifactId>jfoenix</artifactId>
4846
<version>8.0.10</version>
4947
</dependency>
5048

51-
<!-- FontawesomeFX for font Icons. -->
49+
<!-- FontawesomeFX for font Icons -->
5250
<dependency>
5351
<groupId>de.jensd</groupId>
5452
<artifactId>fontawesomefx</artifactId>
5553
<version>8.9</version>
5654
</dependency>
5755

58-
<!-- ControlsFX High quality UI controls to complement the core JavaFX distribution. -->
56+
<!-- ControlsFX High quality UI controls -->
5957
<dependency>
6058
<groupId>org.controlsfx</groupId>
6159
<artifactId>controlsfx</artifactId>
6260
<version>8.40.18</version>
6361
</dependency>
6462

65-
<!-- sqlite SQL database engine. -->
63+
<!-- SQLite JDBC database engine -->
6664
<dependency>
6765
<groupId>org.xerial</groupId>
6866
<artifactId>sqlite-jdbc</artifactId>
6967
<version>3.42.0.0</version>
7068
</dependency>
7169

72-
<!-- Sentry.io Open-source error tracking with full stackTraces & asynchronous context. -->
70+
<!-- Sentry for error tracking -->
7371
<dependency>
7472
<groupId>io.sentry</groupId>
7573
<artifactId>sentry</artifactId>
7674
<version>6.21.0</version>
7775
</dependency>
7876

79-
<!-- Unirest in Java: Simplified, lightweight HTTP client library. -->
77+
<!-- Unirest lightweight HTTP client -->
8078
<dependency>
8179
<groupId>com.konghq</groupId>
8280
<artifactId>unirest-java</artifactId>
8381
<version>3.14.2</version>
8482
</dependency>
8583

86-
<!-- jgforms Support submitting Google Forms through Java API. For submitting feedback and bugs. -->
84+
<!-- jgforms for submitting Google Forms -->
8785
<dependency>
8886
<groupId>io.github.stepio.jgforms</groupId>
8987
<artifactId>jgforms</artifactId>
@@ -97,22 +95,21 @@
9795
<version>9.22.3</version>
9896
</dependency>
9997

100-
<!-- Ummalqura-Calendar for Hijri Calendar. -->
98+
<!-- Ummalqura-Calendar for Hijri Calendar -->
10199
<dependency>
102100
<groupId>com.github.msarhan</groupId>
103101
<artifactId>ummalqura-calendar</artifactId>
104102
<version>2.0.2</version>
105103
</dependency>
106104

107-
<!-- For JSON parsing -->
105+
<!-- Jackson for JSON parsing -->
108106
<dependency>
109107
<groupId>com.fasterxml.jackson.core</groupId>
110108
<artifactId>jackson-databind</artifactId>
111109
<version>2.17.0</version>
112110
</dependency>
113-
114-
115111
</dependencies>
112+
116113
<build>
117114
<finalName>${app.name}</finalName>
118115

@@ -122,17 +119,7 @@
122119
<artifactId>javafx-maven-plugin</artifactId>
123120
<version>8.8.3</version>
124121
<configuration>
125-
<vendor>${app.name}</vendor>
126-
<appName>${app.name}</appName>
127-
<title>${app.name}</title>
128-
<description>${app.name}</description>
129-
<needMenu>true</needMenu>
130-
<needShortcut>true</needShortcut>
131122
<mainClass>${mainClass}</mainClass>
132-
<additionalAppResources>jarFiles</additionalAppResources>
133-
<bundleArguments>
134-
<icon>${project.basedir}/src/main/deploy/package/windows/Azkar.ico</icon>
135-
</bundleArguments>
136123
</configuration>
137124
</plugin>
138125
</plugins>
-14.6 KB
Binary file not shown.

Azkar/src/main/java/com/bayoumi/Launcher.java

Lines changed: 66 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -3,33 +3,38 @@
33
import com.bayoumi.controllers.components.audio.ChooseAudioController;
44
import com.bayoumi.controllers.dialog.DownloadResourcesController;
55
import com.bayoumi.controllers.home.HomeController;
6-
import com.bayoumi.models.Onboarding;
7-
import com.bayoumi.models.preferences.Preferences;
86
import com.bayoumi.models.settings.Settings;
97
import com.bayoumi.preloader.CustomPreloaderMain;
8+
import com.bayoumi.repositry.OnboardingRepository;
109
import com.bayoumi.services.TimedAzkarService;
10+
import com.bayoumi.services.update.UpdateService;
11+
import com.bayoumi.storage.DatabaseManager;
12+
import com.bayoumi.storage.LocationsDBManager;
13+
import com.bayoumi.storage.preferences.Preferences;
14+
import com.bayoumi.storage.preferences.PreferencesType;
1115
import com.bayoumi.util.Constants;
1216
import com.bayoumi.util.Logger;
1317
import com.bayoumi.util.SentryUtil;
1418
import com.bayoumi.util.Utility;
15-
import com.bayoumi.util.db.DatabaseManager;
16-
import com.bayoumi.util.db.LocationsDBManager;
19+
import com.bayoumi.util.file.FileUtils;
1720
import com.bayoumi.util.gui.ArabicTextSupport;
21+
import com.bayoumi.util.gui.BuilderUI;
1822
import com.bayoumi.util.gui.HelperMethods;
1923
import com.bayoumi.util.gui.load.Loader;
2024
import com.bayoumi.util.gui.load.LoaderComponent;
2125
import com.bayoumi.util.gui.load.Locations;
2226
import com.bayoumi.util.gui.tray.TrayUtil;
2327
import com.bayoumi.util.validation.SingleInstance;
28+
import com.bayoumi.util.web.server.ServerService;
2429
import com.install4j.api.launcher.StartupNotification;
2530
import com.sun.javafx.application.LauncherImpl;
2631
import javafx.application.Application;
2732
import javafx.application.Preloader;
2833
import javafx.beans.property.SimpleBooleanProperty;
2934
import javafx.fxml.FXMLLoader;
3035
import javafx.scene.Scene;
31-
import javafx.stage.Modality;
3236
import javafx.stage.Stage;
37+
import kong.unirest.Unirest;
3338

3439
import java.util.Objects;
3540

@@ -70,20 +75,23 @@ public void init() {
7075

7176
try {
7277
// --- Create Needed Folder if not exist ---
73-
Utility.createDirectory(Constants.assetsPath + "/logs");
74-
Utility.createDirectory(Constants.assetsPath + "/db");
75-
Utility.createDirectory(Constants.assetsPath + "/audio");
76-
Utility.createDirectory(Constants.assetsPath + "/azkar");
78+
FileUtils.createDirectory(Constants.assetsPath + "/logs");
79+
FileUtils.createDirectory(Constants.assetsPath + "/db");
80+
FileUtils.createDirectory(Constants.assetsPath + "/audio/adhan");
81+
FileUtils.createDirectory(Constants.assetsPath + "/azkar");
7782

7883
// To save the audio file in the temp directory to be able to play it
79-
Utility.createDirectory(System.getProperty("java.io.tmpdir") + "/" + Constants.APP_NAME);
84+
FileUtils.createDirectory(System.getProperty("java.io.tmpdir") + "/" + Constants.APP_NAME);
8085
incrementPreloader();
8186

8287
// --- initialize Logger ---
8388
Logger.init();
8489
Logger.info("App Launched");
8590
incrementPreloader();
8691

92+
// --- initialize Unirest ---
93+
Unirest.config().connectTimeout(30_000).socketTimeout(120_000);
94+
8795
// --- initialize database connection ---
8896
DatabaseManager databaseManager = DatabaseManager.getInstance();
8997
if (!databaseManager.init()) {
@@ -95,6 +103,9 @@ public void init() {
95103
Preferences.init();
96104
incrementPreloader();
97105

106+
// --- initialize Auto Update Check ---
107+
UpdateService.checkForUpdate();
108+
98109
// --- initialize database connection (locationsDB) ---
99110
try {
100111
LocationsDBManager.getInstance();
@@ -106,7 +117,7 @@ public void init() {
106117
// --- load Homepage FXML ---
107118
FXMLLoader loader = new FXMLLoader(getClass().getResource(Locations.Home.toString()));
108119
scene = new Scene(loader.load());
109-
scene.getStylesheets().add("/com/bayoumi/css/style.css");
120+
scene.getStylesheets().setAll(Settings.getInstance().getThemeFilesCSS());
110121
homeController = loader.getController();
111122
incrementPreloader();
112123
// --- initialize Sentry for error tracking ---
@@ -116,6 +127,8 @@ public void init() {
116127
Logger.debug(ex.getLocalizedMessage());
117128
}
118129
incrementPreloader();
130+
if (Constants.RUNNING_MODE.equals(Constants.Mode.PRODUCTION)) ServerService.init();
131+
incrementPreloader();
119132

120133
TimedAzkarService.init();
121134
incrementPreloader();
@@ -135,9 +148,8 @@ private void incrementPreloader() {
135148
}
136149

137150
private void handleLocationDBError() {
138-
if (!locationsDBError) {
139-
return;
140-
}
151+
if (!locationsDBError) return;
152+
141153
try {
142154
final LoaderComponent popUp = Loader.getInstance().getPopUp(Locations.DownloadResources);
143155
((DownloadResourcesController) popUp.getController())
@@ -148,19 +160,34 @@ private void handleLocationDBError() {
148160
}
149161
}
150162

151-
private void showOnboardingIfFirstTimeOpened() {
152-
if (Onboarding.isFirstTimeOpened()) {
153-
try {
154-
Stage onboardingStage = new Stage();
155-
onboardingStage.setScene(new Scene(FXMLLoader.load(Objects.requireNonNull(getClass().getResource(Locations.Onboarding.toString())))));
156-
onboardingStage.initModality(Modality.APPLICATION_MODAL);
157-
HelperMethods.SetIcon(onboardingStage);
158-
onboardingStage.setTitle("Onboarding - " + Constants.APP_NAME);
159-
onboardingStage.show();
160-
onboardingStage.setOnCloseRequest(event -> ChooseAudioController.stopIfPlaying());
161-
} catch (Exception ex) {
162-
Logger.error(ex.getLocalizedMessage(), ex, getClass().getName() + "start() => show Onboarding stage");
163-
}
163+
private void showOnboardingIfFirstTimeOpened(boolean isFirstTimeOpened) {
164+
if (!isFirstTimeOpened) return;
165+
166+
try {
167+
final Scene onboardingScene = new Scene(FXMLLoader.load(Objects.requireNonNull(getClass().getResource(Locations.Onboarding.toString()))));
168+
onboardingScene.getStylesheets().setAll(Settings.getInstance().getThemeFilesCSS());
169+
final Stage onboardingStage = BuilderUI.initStageDecorated(onboardingScene, "Onboarding - " + Constants.APP_NAME);
170+
onboardingStage.show();
171+
onboardingStage.setOnCloseRequest(event -> ChooseAudioController.stopIfPlaying());
172+
Preferences.getInstance().set(PreferencesType.APP_VERSION, Constants.VERSION);
173+
} catch (Exception ex) {
174+
Logger.error(ex.getLocalizedMessage(), ex, getClass().getName() + "start() => show Onboarding stage");
175+
}
176+
}
177+
178+
private void showVersionInstalled(boolean isFirstTimeOpened, boolean isNewVersion) {
179+
if (isFirstTimeOpened || !isNewVersion) {
180+
return;
181+
}
182+
183+
try {
184+
final Scene versionScene = new Scene(FXMLLoader.load(Objects.requireNonNull(getClass().getResource(Locations.VersionInstalled.toString()))));
185+
versionScene.getStylesheets().setAll(Settings.getInstance().getThemeFilesCSS());
186+
final Stage stage = BuilderUI.initStageDecorated(versionScene, Constants.APP_NAME + " - " + Constants.VERSION);
187+
stage.show();
188+
Preferences.getInstance().set(PreferencesType.APP_VERSION, Constants.VERSION);
189+
} catch (Exception ex) {
190+
Logger.error(ex.getLocalizedMessage(), ex, getClass().getName() + "start() => show VersionInstalled stage");
164191
}
165192
}
166193

@@ -174,20 +201,27 @@ public void start(Stage primaryStage) throws Exception {
174201
}
175202
// add loaded scene to primaryStage
176203
primaryStage.setScene(scene);
204+
177205
// set Title and Icon to primaryStage
178206
HelperMethods.SetAppDecoration(primaryStage);
179-
if (Onboarding.isFirstTimeOpened() || !Settings.getInstance().getMinimized()) {
207+
208+
// show primaryStage
209+
final boolean isFirstTimeOpened = OnboardingRepository.isFirstTimeOpened();
210+
final boolean isNewVersion = !Constants.VERSION.equals(Preferences.getInstance().get(PreferencesType.APP_VERSION));
211+
if (isFirstTimeOpened || isNewVersion || !Settings.getInstance().getMinimized()) {
180212
primaryStage.show();
181213
}
214+
182215
// assign current primaryStage to SingleInstance Class
183216
SingleInstance.getInstance().setCurrentStage(primaryStage);
184217

185218
// show Onboarding stage
186-
showOnboardingIfFirstTimeOpened();
219+
showOnboardingIfFirstTimeOpened(isFirstTimeOpened);
220+
221+
// show VersionInstalled stage
222+
showVersionInstalled(isFirstTimeOpened, isNewVersion);
187223

188224
StartupNotification.registerStartupListener(s ->
189225
SingleInstance.getInstance().openCurrentStage());
190226
}
191-
192-
193-
}
227+
}

Azkar/src/main/java/com/bayoumi/controllers/alert/ok/OkAlertController.java

Lines changed: 0 additions & 4 deletions
This file was deleted.

Azkar/src/main/java/com/bayoumi/controllers/azkar/absolute/AbsoluteAzkarController.java

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,16 @@
1414
import javafx.geometry.NodeOrientation;
1515
import javafx.scene.control.ContentDisplay;
1616
import javafx.scene.control.Label;
17-
import javafx.scene.control.TreeItem;
1817
import javafx.scene.control.TreeTableColumn;
1918
import javafx.scene.control.cell.TreeItemPropertyValueFactory;
20-
import javafx.scene.layout.AnchorPane;
19+
import javafx.scene.layout.VBox;
2120

2221
import java.net.URL;
2322
import java.util.ResourceBundle;
2423

2524
public class AbsoluteAzkarController implements Initializable {
2625
@FXML
27-
private AnchorPane root;
26+
private VBox root;
2827
@FXML
2928
private Label absoluteAzkar;
3029
@FXML
@@ -63,13 +62,9 @@ public void initialize(URL location, ResourceBundle resources) {
6362

6463
private void tableConfiguration() {
6564
zekrCol.setCellValueFactory(new TreeItemPropertyValueFactory<>("text"));
66-
zekrCol.setStyle("-fx-alignment: center;");
6765
editCol.setCellValueFactory(new TreeItemPropertyValueFactory<>("edit"));
68-
editCol.setStyle("-fx-alignment: center;");
6966
deleteCol.setCellValueFactory(new TreeItemPropertyValueFactory<>("delete"));
70-
deleteCol.setStyle("-fx-alignment: center;");
71-
TreeItem<AbsoluteZekr> root = new RecursiveTreeItem<>(AbsoluteZekr.absoluteZekrObservableList, RecursiveTreeObject::getChildren);
72-
azkarTable.setRoot(root);
67+
azkarTable.setRoot(new RecursiveTreeItem<>(AbsoluteZekr.absoluteZekrObservableList, RecursiveTreeObject::getChildren));
7368
azkarTable.setShowRoot(false);
7469
}
7570

0 commit comments

Comments
 (0)