This repository was archived by the owner on Sep 11, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 823
fallback to event text in location body when map unavailable #7982
Merged
Merged
Changes from all commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
d3c81cf
center icon better
9c0c90d
remove debug
267e63e
retrigger all builds
259ce9a
set assetType on share event
095e40f
use pin marker on map for pin drop share
4856623
lint
b4f3576
test events
700d9c8
pin drop helper text
a902773
use generic location type
99688d8
add navigationcontrol when in pin mode
a22117e
allow pin drop without location permissions
18c7aa6
remove geolocate control when pin dropping without geo perms
b7c1a4c
test locationpicker
eed8c4e
test marker type, tidy
a9f1ec1
move findMapStyleUrl
87a53e8
fallback to event content when cant render map
9cbbd89
Merge branch 'psf-683/send-pin-drop-events' into psf-657/bad_map_styl…
b5226ba
update mocks in location picker, show same messages as timeline
537398f
style error message in location share menu
99fd6ac
Merge branch 'develop' into psf-683/send-pin-drop-events
b46a9b8
Merge branch 'psf-683/send-pin-drop-events' into psf-657/bad_map_styl…
a8b25ad
i18n
b27d473
forgotten copyright
a749c72
add copyright
4a96d10
Merge branch 'develop' into psf-657/bad_map_style_url
a8b653b
update style
77a2c82
icon bigger
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 @@ | ||
/* | ||
Copyright 2022 The Matrix.org Foundation C.I.C. | ||
|
||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
|
||
http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
.mx_MapError { | ||
padding: 100px $spacing-32 0; | ||
text-align: center; | ||
|
||
p { | ||
margin: $spacing-16 0 $spacing-32; | ||
} | ||
} | ||
|
||
.mx_MapError_heading { | ||
padding-top: $spacing-24; | ||
} | ||
|
||
.mx_MapError_icon { | ||
height: 58px; | ||
|
||
path { | ||
fill: $secondary-content; | ||
} | ||
} |
This file contains hidden or 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 hidden or 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 hidden or 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,34 @@ | ||
/* | ||
Copyright 2022 The Matrix.org Foundation C.I.C | ||
|
||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
|
||
http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
import { _t } from "../../../languageHandler"; | ||
|
||
export enum LocationShareError { | ||
MapStyleUrlNotConfigured = 'MapStyleUrlNotConfigured', | ||
MapStyleUrlNotReachable = 'MapStyleUrlNotReachable', | ||
Default = 'Default' | ||
} | ||
|
||
export const getLocationShareErrorMessage = (errorType?: LocationShareError): string => { | ||
switch (errorType) { | ||
case LocationShareError.MapStyleUrlNotConfigured: | ||
return _t('This homeserver is not configured to display maps.'); | ||
case LocationShareError.MapStyleUrlNotReachable: | ||
default: | ||
return _t(`This homeserver is not configured correctly to display maps, ` | ||
+ `or the configured map server may be unreachable.`); | ||
} | ||
}; |
This file contains hidden or 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,39 @@ | ||
/* | ||
Copyright 2022 The Matrix.org Foundation C.I.C. | ||
|
||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
|
||
http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
import React from 'react'; | ||
|
||
import { Icon as WarningBadge } from '../../../../res/img/element-icons/warning-badge.svg'; | ||
import { _t } from '../../../languageHandler'; | ||
import AccessibleButton from '../elements/AccessibleButton'; | ||
import Heading from '../typography/Heading'; | ||
import { getLocationShareErrorMessage, LocationShareError } from './LocationShareErrors'; | ||
|
||
interface Props { | ||
onFinished: () => void; | ||
error: LocationShareError; | ||
} | ||
|
||
export const MapError: React.FC<Props> = ({ | ||
onFinished, error, | ||
}) => (<div data-test-id='location-picker-error' className="mx_MapError"> | ||
<WarningBadge className="mx_MapError_icon" /> | ||
<Heading className="mx_MapError_heading" size='h3'>{ _t("Unable to load map") }</Heading> | ||
<p> | ||
{ getLocationShareErrorMessage(error) } | ||
</p> | ||
<AccessibleButton element='button' kind="primary" onClick={onFinished}>{ _t("OK") }</AccessibleButton> | ||
</div>); |
This file contains hidden or 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,41 @@ | ||
/* | ||
Copyright 2022 The Matrix.org Foundation C.I.C. | ||
|
||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
|
||
http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
import { logger } from "matrix-js-sdk/src/logger"; | ||
|
||
import SdkConfig from "../../../SdkConfig"; | ||
import { getTileServerWellKnown } from "../../../utils/WellKnownUtils"; | ||
import { LocationShareError } from "./LocationShareErrors"; | ||
|
||
/** | ||
* Look up what map tile server style URL was provided in the homeserver's | ||
* .well-known location, or, failing that, in our local config, or, failing | ||
* that, defaults to the same tile server listed by matrix.org. | ||
*/ | ||
export function findMapStyleUrl(): string { | ||
const mapStyleUrl = ( | ||
getTileServerWellKnown()?.map_style_url ?? | ||
SdkConfig.get().map_style_url | ||
); | ||
|
||
if (!mapStyleUrl) { | ||
logger.error("'map_style_url' missing from homeserver .well-known area, and " + | ||
"missing from from config.json."); | ||
throw new Error(LocationShareError.MapStyleUrlNotConfigured); | ||
} | ||
|
||
return mapStyleUrl; | ||
} |
This file contains hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
needs copyright