Skip to content

Commit

Permalink
fix: make TouchBarPopover and TouchBarGroup work (#27901) (#28411)
Browse files Browse the repository at this point in the history
* fix: use correct `orderedItem` touchbar property

* fix: correct parent in touchbar group and popover

* fix: preserve property hook order
  • Loading branch information
erickzhao committed Mar 29, 2021
1 parent bb612d7 commit dd24a4b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions lib/browser/api/touch-bar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ const hiddenProperties = Symbol('hidden touch bar props');
const extendConstructHook = (target: any, hook: Function) => {
const existingHook = target._hook;
target._hook = function () {
hook.call(this);
if (existingHook) existingHook.call(this);
hook.call(this);
};
};

Expand Down Expand Up @@ -135,7 +135,7 @@ class TouchBarGroup extends TouchBarItem<Electron.TouchBarGroupConstructorOption
}
}
for (const item of newChild.orderedItems) {
item._addParent(item);
item._addParent(self);
}
})
child!: TouchBar;
Expand Down Expand Up @@ -179,7 +179,7 @@ class TouchBarPopover extends TouchBarItem<Electron.TouchBarPopoverConstructorOp
}
}
for (const item of newChild.orderedItems) {
item._addParent(item);
item._addParent(self);
}
})
child!: TouchBar;
Expand Down
6 changes: 3 additions & 3 deletions shell/browser/ui/cocoa/electron_touch_bar.mm
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,7 @@ - (void)updatePopover:(NSPopoverTouchBarItem*)item

gin_helper::PersistentDictionary child;
std::vector<gin_helper::PersistentDictionary> items;
if (settings.Get("child", &child) && child.Get("ordereredItems", &items)) {
if (settings.Get("child", &child) && child.Get("orderedItems", &items)) {
item.popoverTouchBar =
[self touchBarFromItemIdentifiers:[self identifiersFromSettings:items]];
}
Expand All @@ -572,7 +572,7 @@ - (NSTouchBarItem*)makeGroupForID:(NSString*)id
if (!settings.Get("child", &child))
return nil;
std::vector<gin_helper::PersistentDictionary> items;
if (!child.Get("ordereredItems", &items))
if (!child.Get("orderedItems", &items))
return nil;

NSMutableArray* generatedItems = [NSMutableArray array];
Expand Down Expand Up @@ -601,7 +601,7 @@ - (void)updateGroup:(NSGroupTouchBarItem*)item
if (!settings.Get("child", &child))
return;
std::vector<gin_helper::PersistentDictionary> items;
if (!child.Get("ordereredItems", &items))
if (!child.Get("orderedItems", &items))
return;

item.groupTouchBar =
Expand Down

0 comments on commit dd24a4b

Please sign in to comment.