Allow Tor Caching + Our Own Linkify #316

Merged
erinn merged 7 commits from torcache into trunk 2022-01-18 23:06:25 +00:00
4 changed files with 36 additions and 4 deletions
Showing only changes of commit 303b70d751 - Show all commits

View File

@ -116,4 +116,27 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.''');
yield LicenseEntryWithLineBreaks(["flaticons"], "Icons made by Freepik (https://www.freepik.com) from Flaticon (www.flaticon.com)");
yield LicenseEntryWithLineBreaks(["flutter_linkify", "linkify"],
'''MIT License
Copyright (c) 2019/2020 Charles-William Crete
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.''');
}

View File

@ -30,7 +30,7 @@ import 'package:flutter/rendering.dart';
import 'linkify.dart';
export 'linkify.dart' show LinkifyElement, LinkifyOptions, LinkableElement, TextElement, Linkifier;
export 'linkify.dart' show LinkifyElement, LinkifyOptions, LinkableElement, TextElement, Linkifier, UrlElement, UrlLinkifier;
/// Callback clicked link
typedef LinkCallback = void Function(LinkableElement link);

View File

@ -23,7 +23,10 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
import 'package:cwtch/third_party/linkify/uri.dart';
import 'uri.dart';
export 'uri.dart' show UrlLinkifier, UrlElement;
abstract class LinkifyElement {
final String text;

View File

@ -25,7 +25,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
import 'package:cwtch/third_party/linkify/linkify.dart';
import 'linkify.dart';
final _urlRegex = RegExp(
r'^(.*?)((?:https?:\/\/|www\.)[^\s/$.?#].[^\s]*)',
@ -75,7 +75,13 @@ class UrlLinkifier extends Linkifier {
var url = originalUrl;
Review

code disagrees with the comment

code disagrees with the comment
list.add(UrlElement(originalUrl, url));
// If protocol has not been specified then append a protocol
// to the start of the URL so that it can be opened...
if (!url.startsWith("https://") && !url.startsWith("http://")) {
url = "https://"+url;
}
list.add(UrlElement(url, originalUrl));
sarah marked this conversation as resolved
Review

changing the text but not changing the underlying URL?

changing the text but not changing the underlying URL?
if (end != null) {
list.add(TextElement(end));