Implement 'register app' functionality
Closed this issue · 1 comments
dmitrizagidulin commented
profile.loadAppRegistry()
is already implemented. Now add support for registering an app, something like:
var options = {
name: 'Contact Manager 3.0',
shordesc: '...',
// See other fields in https://github.com/solid/solid/issues/109
}
var types = [ // list of types / RDF classes that this app will handle
vocab.vcard('AddressBook'),
vocab.solid('Contact')
]
var isListed = true
var app = new AppRegistration(options, types, isListed)
profile.registerApp(app)
.then(function (updatedProfile) {
console.log('The app has been registered.')
})
.catch(function (error) {
console.log('Error registering app:', error)
})
This will create an entry in the corresponding app registry (in this case, the listed (public) app registry).
See solid/solid#109 for additional specs.
To query the app registry:
profile.appsForType(vocab.vcard('AddressBook'))
.then(function (registeredApps) {
// registeredApps -> [ registration1, registration2, ... ]
var app = registeredApps[0]
app.name // -> 'Contact Manager 3.0'
app.homepage // -> 'https://example.com/...'
app.icon // -> 'https://...'
// Most importantly:
app.redirectTemplateUri // -> 'https://solid.github.io/contacts/?uri={uri}'
}
The idea being - if multiple apps are registered for the same type, we can present the user with an 'Open with...' screen allowing them to choose between the registered apps.
dmitrizagidulin commented
Implemented. closing.