mirror of
https://github.com/balzack/databag.git
synced 2025-02-14 12:39:17 +00:00
Merge branch 'main' into webrtc
This commit is contained in:
commit
d7a264c7ee
@ -507,7 +507,7 @@
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CODE_SIGN_ENTITLEMENTS = Databag/Databag.entitlements;
|
||||
CURRENT_PROJECT_VERSION = 34;
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
DEVELOPMENT_TEAM = 3P65PQ7SUR;
|
||||
ENABLE_BITCODE = NO;
|
||||
INFOPLIST_FILE = Databag/Info.plist;
|
||||
@ -516,7 +516,7 @@
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 1.9;
|
||||
MARKETING_VERSION = 1.10;
|
||||
OTHER_LDFLAGS = (
|
||||
"$(inherited)",
|
||||
"-ObjC",
|
||||
@ -541,7 +541,7 @@
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CODE_SIGN_ENTITLEMENTS = Databag/Databag.entitlements;
|
||||
CURRENT_PROJECT_VERSION = 34;
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
DEVELOPMENT_TEAM = 3P65PQ7SUR;
|
||||
INFOPLIST_FILE = Databag/Info.plist;
|
||||
INFOPLIST_KEY_CFBundleDisplayName = Databag;
|
||||
@ -549,7 +549,7 @@
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 1.9;
|
||||
MARKETING_VERSION = 1.10;
|
||||
OTHER_LDFLAGS = (
|
||||
"$(inherited)",
|
||||
"-ObjC",
|
||||
@ -571,7 +571,7 @@
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "c++17";
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "c++14";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
@ -643,7 +643,7 @@
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "c++17";
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "c++14";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
|
@ -21,7 +21,7 @@
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>34</string>
|
||||
<string>1</string>
|
||||
<key>LSRequiresIPhoneOS</key>
|
||||
<true/>
|
||||
<key>NSAppTransportSecurity</key>
|
||||
|
@ -200,21 +200,24 @@ export function useTopicItem(item, hosting, remove, contentKey) {
|
||||
};
|
||||
|
||||
const clickableText = (text) => {
|
||||
var pattern = new RegExp('^(https?:\\/\\/)?'+ // protocol
|
||||
const urlPatternn = new RegExp('^(https?:\\/\\/)?'+ // protocol
|
||||
'((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|'+ // domain name
|
||||
'((\\d{1,3}\\.){3}\\d{1,3}))'+ // OR ip (v4) address
|
||||
'(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*'+ // port and path
|
||||
'(\\?[;&a-z\\d%_.~+=-]*)?'+ // query string
|
||||
'(\\#[-a-z\\d_]*)?$','i'); // fragment locator
|
||||
|
||||
const hostPattern = new RegExp('^https?:\\/\\/', 'i');
|
||||
|
||||
let clickable = [];
|
||||
let group = '';
|
||||
const words = text == null ? [''] : text.split(' ');
|
||||
words.forEach((word, index) => {
|
||||
if (!!pattern.test(word)) {
|
||||
if (!!urlPatternn.test(word)) {
|
||||
clickable.push(<Text key={index}>{ group }</Text>);
|
||||
group = '';
|
||||
clickable.push(<Text key={'link-' + index} onPress={() => Linking.openURL(sanitizeUrl(word))} style={{ fontStyle: 'italic' }}>{ sanitizeUrl(word) + ' ' }</Text>);
|
||||
const url = !!hostPattern.test(word) ? word : `https://${word}`;
|
||||
clickable.push(<Text key={'link-' + index} onPress={() => Linking.openURL(sanitizeUrl(url))} style={{ fontStyle: 'italic' }}>{ sanitizeUrl(word) + ' ' }</Text>);
|
||||
}
|
||||
else {
|
||||
group += `${word} `;
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { useContext, useState, useEffect } from 'react';
|
||||
import { AppContext } from 'context/AppContext';
|
||||
import { getAvailable } from 'api/getAvailable';
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import { useLocation, useNavigate } from "react-router-dom";
|
||||
|
||||
export function useLogin() {
|
||||
|
||||
@ -14,6 +14,7 @@ export function useLogin() {
|
||||
});
|
||||
|
||||
const navigate = useNavigate();
|
||||
const { search } = useLocation();
|
||||
const app = useContext(AppContext);
|
||||
|
||||
const updateState = (value) => {
|
||||
@ -69,6 +70,30 @@ export function useLogin() {
|
||||
// eslint-disable-next-line
|
||||
}, [])
|
||||
|
||||
const access = async (token) => {
|
||||
if (!state.busy) {
|
||||
updateState({ busy: true });
|
||||
try {
|
||||
await app.actions.access(token);
|
||||
}
|
||||
catch (err) {
|
||||
console.log(err);
|
||||
updateState({ busy: false });
|
||||
throw new Error('access failed: check your token');
|
||||
}
|
||||
updateState({ busy: false });
|
||||
}
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
let params = new URLSearchParams(search);
|
||||
let token = params.get("access");
|
||||
if (token) {
|
||||
access(token);
|
||||
}
|
||||
// eslint-disable-next-line
|
||||
}, [])
|
||||
|
||||
return { state, actions };
|
||||
}
|
||||
|
||||
|
@ -134,21 +134,24 @@ export function useConversation(cardId, channelId) {
|
||||
}, [state.contentKey]);
|
||||
|
||||
const clickableText = (text) => {
|
||||
var pattern = new RegExp('^(https?:\\/\\/)?'+ // protocol
|
||||
const urlPattern = new RegExp('^(https?:\\/\\/)?'+ // protocol
|
||||
'((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|'+ // domain name
|
||||
'((\\d{1,3}\\.){3}\\d{1,3}))'+ // OR ip (v4) address
|
||||
'(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*'+ // port and path
|
||||
'(\\?[;&a-z\\d%_.~+=-]*)?'+ // query string
|
||||
'(\\#[-a-z\\d_]*)?$','i'); // fragment locator
|
||||
|
||||
const hostPattern = new RegExp('^https?:\\/\\/', 'i');
|
||||
|
||||
let group = '';
|
||||
let clickable = [];
|
||||
const words = text == null ? '' : DOMPurify.sanitize(text).split(' ');
|
||||
words.forEach((word, index) => {
|
||||
if (!!pattern.test(word)) {
|
||||
if (!!urlPattern.test(word)) {
|
||||
clickable.push(<span key={index}>{ group }</span>);
|
||||
group = '';
|
||||
clickable.push(<a key={'link-'+index} target="_blank" rel="noopener noreferrer" href={word}>{ `${word} ` }</a>);
|
||||
const url = !!hostPattern.test(word) ? word : `https://${word}`;
|
||||
clickable.push(<a key={'link-'+index} target="_blank" rel="noopener noreferrer" href={url}>{ `${word} ` }</a>);
|
||||
}
|
||||
else {
|
||||
group += `${word} `;
|
||||
|
Loading…
Reference in New Issue
Block a user