onny / nextcloud-app-radio

6 stars 2 forks source link

Nextcloud 14 beta search provider broken #14

Closed onny closed 6 years ago

onny commented 6 years ago

Hey, I'm trying to get my radio app working with Nextcloud 14, already fixed several things :) I also noticed some changes to the search functionality. I'm not sure what I have to change so I tried this but it's not working:

    SearchProxy = {
        attach: function(search) {
            search.setFilter('radio', function(query) {
        alert("test");
      });
        }
  };

  OC.Plugins.register('OCA.Search.Core', SearchProxy);

Inside my main.js file, see here: https://git.project-insanity.org/onny/nextcloud-app-radio/blob/master/js/main.js What things do I have to consider to get the search icon and search bar back into the app. Best regards, Jonas

onny commented 6 years ago

Can you help me with this @ChristophWurst ?

ChristophWurst commented 6 years ago

Whoops. This is broken for Mail as well and I hadn't noticed before.

@danxuliu @juliushaertl @skjnldsv did we change any of that search registration code?

skjnldsv commented 6 years ago

Yes! :) We made the search available for every app withotu having to use the SearchProvider :)

@onny Sorry for the inconvenience: new OCA.Search(searchCallback, resetCallback)

Just plug your function into the searchCallback to do the search display/filter on your side of the app and the resetCallback when the form is reset. You don't need to watch any events or anything, the searchCallback have the search query passed when launched, and the reset just run the resetCallback function :)

Example: https://github.com/nextcloud/contacts/blob/master/js/services/search_service.js#L47

ChristophWurst commented 6 years ago

FYI: https://github.com/nextcloud/mail/pull/1013

onny commented 6 years ago

Thanks it's working now :+1: