Skip to content

Commit

Permalink
Fix remaining popup on SugarizerOS
Browse files Browse the repository at this point in the history
  • Loading branch information
Lionel Laské committed May 12, 2024
1 parent 1234319 commit cbae7bf
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Localization error in FoodChain #1608
- Alignment issue in Abacus #1607
- Blank screen on iOS when opening a PDF #1618
- Journal instance pop up remain after launching a PDF or an external app #1619

## [1.8.0] - 2024-04-10
### Added
Expand Down
13 changes: 10 additions & 3 deletions js/homeview.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ enyo.kind({
this.restrictedModeInfo = { start: 0 };
util.hideNativeToolbar();
this.tutorialActivity = null;
this.forbiddenActivity = null;
this.eeMode = null;

// Load and sort journal
Expand Down Expand Up @@ -546,7 +547,7 @@ enyo.kind({
util.vibrate();
var help = activity.id == tutorial.activityId;
preferences.runActivity(activity, undefined, null, null, help);
this.postRunActivity(activity.isNative);
this.postRunActivity(activity.id, activity.isNative);
},
runOldActivity: function(activity, instance) {
// Run an old activity instance
Expand All @@ -561,12 +562,14 @@ enyo.kind({
util.vibrate();
var help = tutorial.isLaunched() && activity.id == tutorial.activityId;
preferences.runActivity(activity, null, null, null, help);
this.postRunActivity(activity.isNative);
this.postRunActivity(activity.id, activity.isNative);
},
postRunActivity: function(isNative) {
postRunActivity: function(id, isNative) {
// When run a native activity, should update journal and view to reflect journal change
if (window.sugarizerOS && isNative) {
sugarizerOS.popupTimer = new Date();
this.getPopup().hidePopup();
this.forbiddenActivity = id;
this.loadJournal();
activities.loadEntries();
this.draw();
Expand All @@ -582,12 +585,16 @@ enyo.kind({
showActivityPopup: function(icon) {
// Create popup
if (window.sugarizerOS) {
if (this.forbiddenActivity && this.forbiddenActivity == icon.icon.id) {
return;
}
var now = new Date();
if (sugarizerOS.popupTimer && now.getTime() - sugarizerOS.popupTimer.getTime() < 3000) {
return;
}
sugarizerOS.popupTimer = now;
}
this.forbiddenActivity = null;
var title;
var activity = icon.icon; // HACK: activity is stored as an icon
if (activity.instances !== undefined && activity.instances.length > 0 && activity.instances[0].metadata.title !== undefined) {
Expand Down
6 changes: 6 additions & 0 deletions js/listview.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ enyo.kind({
this.scrollbar_session_value = 0;
this.scroll_count = 0;
this.favoriteActivityButton = null;
this.forbiddenActivity = null;
if (!window.sugarizerOS) {
this.activitiesChanged();
this.computeSize();
Expand Down Expand Up @@ -207,12 +208,17 @@ enyo.kind({
// Start a new activity instance
util.vibrate();
this.$.activityPopup.hidePopup();
this.forbiddenActivity = activity.id;
preferences.runActivity(activity, null);
},

// Popup menu handling
showActivityPopup: function(icon) {
// Create popup
if (window.sugarizerOS && this.forbiddenActivity && this.forbiddenActivity == icon.icon.id) {
return;
}
this.forbiddenActivity = null;
var activity = icon.icon;
this.$.activityPopup.setHeader({
icon: activity,
Expand Down

0 comments on commit cbae7bf

Please sign in to comment.