-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2394 from ripcurlx/show-new-badge-on-dao-menu-item
Show DAO news badge
- Loading branch information
Showing
7 changed files
with
76 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
desktop/src/main/java/bisq/desktop/main/presentation/DaoPresentation.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package bisq.desktop.main.presentation; | ||
|
||
import bisq.core.app.BisqEnvironment; | ||
import bisq.core.user.Preferences; | ||
|
||
import javax.inject.Inject; | ||
|
||
import javafx.beans.property.BooleanProperty; | ||
import javafx.beans.property.SimpleBooleanProperty; | ||
|
||
import javafx.collections.MapChangeListener; | ||
|
||
public class DaoPresentation { | ||
|
||
private final Preferences preferences; | ||
public static final String DAO_NEWS = "daoNewsVersion0.9.4"; | ||
|
||
private final SimpleBooleanProperty showNotification = new SimpleBooleanProperty(false); | ||
|
||
@Inject | ||
public DaoPresentation(Preferences preferences) { | ||
this.preferences = preferences; | ||
preferences.getDontShowAgainMapAsObservable().addListener((MapChangeListener<? super String, ? super Boolean>) change -> { | ||
if (change.getKey().equals(DAO_NEWS) && !BisqEnvironment.isDAOActivatedAndBaseCurrencySupportingBsq()) { | ||
showNotification.set(!change.wasAdded()); | ||
} | ||
}); | ||
} | ||
|
||
public BooleanProperty getShowDaoUpdatesNotification() { | ||
return showNotification; | ||
} | ||
|
||
public void setup() { | ||
if (!BisqEnvironment.isDAOActivatedAndBaseCurrencySupportingBsq()) | ||
showNotification.set(preferences.showAgain(DAO_NEWS)); | ||
} | ||
} |