Skip to content

Conversation

@abdofallah
Copy link
Collaborator

@abdofallah abdofallah commented Feb 8, 2025

Optimize:

  • Organize classes better

Added:

  • Full size vs Small Size
  • mute all other apps when adhan is playing
  • always on top
  • update popup if versions do not match with git release (make sure the git release tag follows the same structure as now = starts with V and then version number)

Preview:
image
image
image
image

- Organize classes better

Added:
- Implement Full size vs Small Size
- Implement mute all other apps when adhan is playing

Todo:
- Implement always on top
… yes opens the browser and starts the download (currently installation is done manually by user)
@abdofallah abdofallah changed the title Widget Mode, Mute Other apps on adhan play, always on top Widget Mode, Mute Other apps on adhan play, always on top, Update checker Feb 8, 2025
@iysaleh
Copy link
Contributor

iysaleh commented Feb 10, 2025

MashaaAllah brother, I'm only looking at screenshots right now, but I love this!!!!!! I can't believe you implemented the updater/version-checker feature!!!! 😁 !!!!! And this minified mode of the app display is also very neat. JazzakAllahukhayr!

I'm a bit busy right now so it'll likely be a few days before I get to properly reviewing this, but just know I'm not ignoring it.

Looking forward to getting this merged in inshaaAllah!!!! 😄
-Ibraheem

@abdofallah
Copy link
Collaborator Author

MashaaAllah brother, I'm only looking at screenshots right now, but I love this!!!!!! I can't believe you implemented the updater/version-checker feature!!!! 😁 !!!!! And this minified mode of the app display is also very neat. JazzakAllahukhayr!

I'm a bit busy right now so it'll likely be a few days before I get to properly reviewing this, but just know I'm not ignoring it.

Looking forward to getting this merged in inshaaAllah!!!! 😄 -Ibraheem

All good brother take your time.

@abdofallah
Copy link
Collaborator Author

^

Copy link
Contributor

@iysaleh iysaleh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall this looks very nice, great refactors and good new features...

There are just few problems that need to be addressed before this can be merged:

Looks like the unit tests & RegistrySettingsHandler app fails to install:
image

Just as an FYI, the purpose of the RegistrySettingsHandler application is to install the registry keys as administrator when the app is first installed on a new computer -- It also opens the permissions for those keys so the OpenAdhan app can modify/update them as users please without admin privileges.

Also, maybe I'm wrong here, but is the small-mode/normal-mode toggle button a little brighter than the rest of the white used in the app? It feels distracting, can you please make it darker/greyer so it doesn't steal focus?
image

Sorry about the super late review -- things have been super busy here. Ramadan Mubarak!!!! 😄

SaveRegistryValue(automaticDaylightSavingsAdjustmentKey, "0", "int");
SaveRegistryValue(normalAdhanFilePathkey, oass.normalAdhanFilePath, "string");
SaveRegistryValue(fajrAdhanFilePathKey, oass.fajrAdhanFilePath, "string");
SaveRegistryValue(muteAllAppsOnAdhanPlayingKey, oass.muteAllAppsOnAdhanPlaying ? "1" : "0", "int");
Copy link
Contributor

@iysaleh iysaleh Mar 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's turn this off by default -- The adhan often plays in the middle of important work happening, including meetings that people are having-- muting the meeting/work fully is likely undesired default behavior.

nextPrayerLabel.BackColor = Color.Transparent;
nextPrayerNameLabel.BackColor = Color.Transparent;
nextPrayerInLabel.BackColor = Color.Transparent;
nextPrayerInTimeLabel.BackColor = Color.Transparent;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, the label renames here should make things clearer.

this.timers.RemoveRange(0, this.timers.Count);
}
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 nice refactor

Comment on lines -152 to +106
//System.Diagnostics.Debug.WriteLine("RSH CalcMethod: " + calcMethod);
//System.Diagnostics.Debug.WriteLine("RSH JuristicMethod: " + juristicMethod);
//System.Diagnostics.Debug.WriteLine("RSH Lat: " + lat);
//System.Diagnostics.Debug.WriteLine("RSH Lon: " + lon);
//System.Diagnostics.Debug.WriteLine("RSH TZ: " + tz);
//System.Diagnostics.Debug.WriteLine("RSH Date is DST: " + TimeZoneInfo.Local.IsDaylightSavingTime(cc));
string jsonString = await response.Content.ReadAsStringAsync();

string searchTagName = "\"tag_name\":";
int tagNameIndex = jsonString.IndexOf(searchTagName);

String[] prayer_times_strings = p.getDatePrayerTimes(y, m, d, lon, lat, tz);
// This only returns HH:MM -- all date info is lost.

//System.Diagnostics.Debug.WriteLine("PrayTimes Fajr: " + prayer_times_strings[fajr]);

double daylightSavingsTimeAdjustment = 0.0;
if (autoDst)
{
if (TimeZoneInfo.Local.IsDaylightSavingTime(cc))
if (tagNameIndex != -1)
{
daylightSavingsTimeAdjustment = +60.0;
}
}
int start = tagNameIndex + searchTagName.Length;
int end = jsonString.IndexOf(",", start);

// if specific date isn't null (IE, not calculating for today):
if (specificDate != null)
{
prayer_times_strings[fajr] = cc.Date.ToShortDateString() + " " + prayer_times_strings[fajr];
prayer_times_strings[shurook] = cc.Date.ToShortDateString() + " " + prayer_times_strings[shurook];
prayer_times_strings[dhuhr] = cc.Date.ToShortDateString() + " " + prayer_times_strings[dhuhr];
prayer_times_strings[asr] = cc.Date.ToShortDateString() + " " + prayer_times_strings[asr];
prayer_times_strings[sunset] = cc.Date.ToShortDateString() + " " + prayer_times_strings[sunset];
prayer_times_strings[maghrib] = cc.Date.ToShortDateString() + " " + prayer_times_strings[maghrib];
prayer_times_strings[isha] = cc.Date.ToShortDateString() + " " + prayer_times_strings[isha];
}
string latestVersion = jsonString.ToLower().Substring(start, end - start).Trim('"').Trim('v');

// Parse DateTimes
this.prayer_datetimes = new DateTime[7];
try
{
this.prayer_datetimes[fajr] = DateTime.Parse(prayer_times_strings[fajr]).AddMinutes(this.rsh.SafeLoadFloatRegistryValue(RegistrySettingsHandler.fajrAdjustmentKey)).AddMinutes(daylightSavingsTimeAdjustment);
this.prayer_datetimes[shurook] = DateTime.Parse(prayer_times_strings[shurook]).AddMinutes(this.rsh.SafeLoadFloatRegistryValue(RegistrySettingsHandler.shurookAdjustmentKey)).AddMinutes(daylightSavingsTimeAdjustment);
this.prayer_datetimes[dhuhr] = DateTime.Parse(prayer_times_strings[dhuhr]).AddMinutes(this.rsh.SafeLoadFloatRegistryValue(RegistrySettingsHandler.dhuhrAdjustmentKey)).AddMinutes(daylightSavingsTimeAdjustment);
this.prayer_datetimes[asr] = DateTime.Parse(prayer_times_strings[asr]).AddMinutes(this.rsh.SafeLoadFloatRegistryValue(RegistrySettingsHandler.asrAdjustmentKey)).AddMinutes(daylightSavingsTimeAdjustment);
this.prayer_datetimes[sunset] = DateTime.Parse(prayer_times_strings[sunset]).AddMinutes(daylightSavingsTimeAdjustment);
this.prayer_datetimes[maghrib] = DateTime.Parse(prayer_times_strings[maghrib]).AddMinutes(this.rsh.SafeLoadFloatRegistryValue(RegistrySettingsHandler.maghribAdjustmentKey)).AddMinutes(daylightSavingsTimeAdjustment);
this.prayer_datetimes[isha] = DateTime.Parse(prayer_times_strings[isha]).AddMinutes(this.rsh.SafeLoadFloatRegistryValue(RegistrySettingsHandler.ishaAdjustmentKey)).AddMinutes(daylightSavingsTimeAdjustment);
if (latestVersion != currentVersion)
{
string message = "A new version of OpenAdhan is available.\n\n" +
"Current Version: " + currentVersion + "\n" +
"Latest Version: " + latestVersion + "\n\n" +
"Would you like to update now?";

if (MessageBox.Show(message, "OpenAdhan", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
{
System.Diagnostics.Process.Start("https://github.com/HICalSoft/OpenAdhan/releases/download/V" + latestVersion + "/OpenAdhanInstaller.exe");
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome! 😄

Not quite full auto-updating just yet, but atleast the user knows there's a new version that should probably be downloaded.

@iysaleh
Copy link
Contributor

iysaleh commented Mar 9, 2025

Btw, don't you think it looks better with the sun in front of the timeline? (the top one, what we had before these changes) @abdofallah
image

@abdofallah
Copy link
Collaborator Author

Overall this looks very nice, great refactors and good new features...

There are just few problems that need to be addressed before this can be merged:

Looks like the unit tests & RegistrySettingsHandler app fails to install: image

Just as an FYI, the purpose of the RegistrySettingsHandler application is to install the registry keys as administrator when the app is first installed on a new computer -- It also opens the permissions for those keys so the OpenAdhan app can modify/update them as users please without admin privileges.

Also, maybe I'm wrong here, but is the small-mode/normal-mode toggle button a little brighter than the rest of the white used in the app? It feels distracting, can you please make it darker/greyer so it doesn't steal focus? image

Sorry about the super late review -- things have been super busy here. Ramadan Mubarak!!!! 😄

No worries! Ramadan Mubarak to you as well.

I noticed RegistrySettingsHandler was being used and fixed it back so it should work as expected.

Still not used to having tests in my application so xD let me check what is causing them to fail.

  • The toggle button seems to have same contract as prayer labels so yeah makes sense to make it darker.

sure we can turn muteAllAppsOnAdhanPlaying off by default and maybe have application exclusion list when the settings page is revamped as well.

We could try to implement a complete installation feature somehow as well but it will require run as admin or etc permissions.

@abdofallah
Copy link
Collaborator Author

Btw, don't you think it looks better with the sun in front of the timeline? (the top one, what we had before these changes) @abdofallah image

as that is weird...

for me the line is below the sun:
image

@iysaleh
Copy link
Contributor

iysaleh commented Mar 13, 2025

Btw, don't you think it looks better with the sun in front of the timeline? (the top one, what we had before these changes) @abdofallah image

as that is weird...

for me the line is below the sun: image

Hmm, I thought that maybe it's because I'm on a new Windows 11 computer now (was previously building on Windows 10) --- but I just built the main branch on my Windows 11 computer and the sun is in front of the line as expected --- it only goes behind the line on this branch... Something must have changed I think.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants