How to pin a bundle of cards

爱⌒轻易说出口 提交于 2019-12-14 01:54:58

问题


With a couple of timeline items sharing the same bundle ID, I create the bundle cover with:

TimelineItem timelineCover = new TimelineItem();
timelineCover.setText("Help Options");
timelineCover.setBundleId(bundleId);
timelineCover.setNotification(new NotificationConfig().setLevel("DEFAULT"));
timelineCover.setIsBundleCover(true);
timelineCover.setIsPinned(true);
MirrorClient.insertTimelineItem(credential, timelineCover);

It comes through to the timeline properly bundled but with isPinned = false.

I tried updating the isPinned field to true in the timeline playground but it stays false.

Is it possible to pin a bundle?


回答1:


You can only pin a bundle by setting a non-cover item of the bundle to have the menu action TOGGLE_PINNED, and then the user has to tap on the cover, drill into a child card that can be pinned, tap it for the pin option and then pin it. This has the result of pinning the entire bundle, including the cover which as David pointed out in a comment, even when set to be able to be pinned, can't since clicking it just goes into the bundle.

Something else related in that it's also kind of weird and related to bundles, is that if you allow a user to delete the cover of a bundle, and they do, the children do not get deleted, instead the most recently added card becomes the new cover.

I think this is a great question. Thanks for it Daniel.




回答2:


The isPinned property cannot be directly set to true. Your user must pin the card themselves using the TOGGLE_PINNED built-in menu item.

Your code for the timeline item insert would look like this:

TimelineItem timelineCover = new TimelineItem();
timelineCover.setText("Help Options");
timelineCover.setBundleId(bundleId);
timelineCover.setNotification(new NotificationConfig().setLevel("DEFAULT"));
timelineCover.setIsBundleCover(true);

List<MenuItem> menuItemList = new ArrayList<MenuItem>();
menuItemList.add(new MenuItem().setAction("TOGGLE_PINNED"));
timelineCover.setMenuItems(menuItemList);

MirrorClient.insertTimelineItem(credential, timelineCover);

Once inserted your user could use the menu to make this card pinned.



来源:https://stackoverflow.com/questions/16951022/how-to-pin-a-bundle-of-cards

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!