-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(geo): add modularity for search and direction (#1669)
* feat(geo): add modularity for search and direction BREAKING CHANGE: - SearchState and SearchService no more provided in root. They depend on the SearchSource who are no more provided in the root. - Analytics capability is provided with the SearchService directly. - DirectionModule, provideDirectionsSourceService is removed, use the provideDirection.
- Loading branch information
Showing
27 changed files
with
252 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { Provider } from '@angular/core'; | ||
|
||
import { | ||
DirectionSourceFeature, | ||
DirectionSourceKind | ||
} from './directions-sources'; | ||
import { DirectionsService } from './shared'; | ||
import { provideDirectionsSourceService } from './shared/directions-source.service'; | ||
|
||
export function provideDirection( | ||
...sources: DirectionSourceFeature<DirectionSourceKind>[] | ||
): Provider[] { | ||
const providers: Provider[] = [ | ||
{ | ||
provide: DirectionsService, | ||
useClass: DirectionsService | ||
}, | ||
provideDirectionsSourceService() | ||
]; | ||
|
||
for (const source of sources) { | ||
providers.push(...source.providers); | ||
} | ||
|
||
return providers; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { Provider } from '@angular/core'; | ||
|
||
import { provideSearchSourceService } from './search-source-service.providers'; | ||
import { SearchService } from './search.service'; | ||
import { | ||
SearchSourceFeature, | ||
SearchSourceKind | ||
} from './sources/source.interfaces'; | ||
|
||
interface ISearchProviderOptions { | ||
/** Share the search term with analytics tracking */ | ||
analytics?: boolean; | ||
} | ||
|
||
export function provideSearch( | ||
sources: SearchSourceFeature<SearchSourceKind>[], | ||
options?: ISearchProviderOptions | ||
): Provider[] { | ||
const providers: Provider[] = [ | ||
options?.analytics && { | ||
provide: 'searchAnalytics', | ||
useValue: options.analytics | ||
}, | ||
{ | ||
provide: SearchService, | ||
useClass: SearchService | ||
}, | ||
provideSearchSourceService() | ||
].filter(Boolean); | ||
|
||
for (const source of sources) { | ||
providers.push(...source.providers); | ||
} | ||
|
||
return providers; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.