Merge branch 'main' into webrtc

This commit is contained in:
Roland Osborne 2023-04-05 10:50:18 -07:00
commit d7a264c7ee
5 changed files with 45 additions and 14 deletions

View File

@ -507,7 +507,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Databag/Databag.entitlements; CODE_SIGN_ENTITLEMENTS = Databag/Databag.entitlements;
CURRENT_PROJECT_VERSION = 34; CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = 3P65PQ7SUR; DEVELOPMENT_TEAM = 3P65PQ7SUR;
ENABLE_BITCODE = NO; ENABLE_BITCODE = NO;
INFOPLIST_FILE = Databag/Info.plist; INFOPLIST_FILE = Databag/Info.plist;
@ -516,7 +516,7 @@
"$(inherited)", "$(inherited)",
"@executable_path/Frameworks", "@executable_path/Frameworks",
); );
MARKETING_VERSION = 1.9; MARKETING_VERSION = 1.10;
OTHER_LDFLAGS = ( OTHER_LDFLAGS = (
"$(inherited)", "$(inherited)",
"-ObjC", "-ObjC",
@ -541,7 +541,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Databag/Databag.entitlements; CODE_SIGN_ENTITLEMENTS = Databag/Databag.entitlements;
CURRENT_PROJECT_VERSION = 34; CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = 3P65PQ7SUR; DEVELOPMENT_TEAM = 3P65PQ7SUR;
INFOPLIST_FILE = Databag/Info.plist; INFOPLIST_FILE = Databag/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = Databag; INFOPLIST_KEY_CFBundleDisplayName = Databag;
@ -549,7 +549,7 @@
"$(inherited)", "$(inherited)",
"@executable_path/Frameworks", "@executable_path/Frameworks",
); );
MARKETING_VERSION = 1.9; MARKETING_VERSION = 1.10;
OTHER_LDFLAGS = ( OTHER_LDFLAGS = (
"$(inherited)", "$(inherited)",
"-ObjC", "-ObjC",
@ -571,7 +571,7 @@
buildSettings = { buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO; ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_CXX_LANGUAGE_STANDARD = "c++17"; CLANG_CXX_LANGUAGE_STANDARD = "c++14";
CLANG_CXX_LIBRARY = "libc++"; CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES; CLANG_ENABLE_OBJC_ARC = YES;
@ -643,7 +643,7 @@
buildSettings = { buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO; ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_CXX_LANGUAGE_STANDARD = "c++17"; CLANG_CXX_LANGUAGE_STANDARD = "c++14";
CLANG_CXX_LIBRARY = "libc++"; CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES; CLANG_ENABLE_OBJC_ARC = YES;

View File

@ -21,7 +21,7 @@
<key>CFBundleSignature</key> <key>CFBundleSignature</key>
<string>????</string> <string>????</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>34</string> <string>1</string>
<key>LSRequiresIPhoneOS</key> <key>LSRequiresIPhoneOS</key>
<true/> <true/>
<key>NSAppTransportSecurity</key> <key>NSAppTransportSecurity</key>

View File

@ -200,21 +200,24 @@ export function useTopicItem(item, hosting, remove, contentKey) {
}; };
const clickableText = (text) => { 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 '((([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{1,3}\\.){3}\\d{1,3}))'+ // OR ip (v4) address
'(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*'+ // port and path '(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*'+ // port and path
'(\\?[;&a-z\\d%_.~+=-]*)?'+ // query string '(\\?[;&a-z\\d%_.~+=-]*)?'+ // query string
'(\\#[-a-z\\d_]*)?$','i'); // fragment locator '(\\#[-a-z\\d_]*)?$','i'); // fragment locator
const hostPattern = new RegExp('^https?:\\/\\/', 'i');
let clickable = []; let clickable = [];
let group = ''; let group = '';
const words = text == null ? [''] : text.split(' '); const words = text == null ? [''] : text.split(' ');
words.forEach((word, index) => { words.forEach((word, index) => {
if (!!pattern.test(word)) { if (!!urlPatternn.test(word)) {
clickable.push(<Text key={index}>{ group }</Text>); clickable.push(<Text key={index}>{ group }</Text>);
group = ''; 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 { else {
group += `${word} `; group += `${word} `;

View File

@ -1,7 +1,7 @@
import { useContext, useState, useEffect } from 'react'; import { useContext, useState, useEffect } from 'react';
import { AppContext } from 'context/AppContext'; import { AppContext } from 'context/AppContext';
import { getAvailable } from 'api/getAvailable'; import { getAvailable } from 'api/getAvailable';
import { useNavigate } from "react-router-dom"; import { useLocation, useNavigate } from "react-router-dom";
export function useLogin() { export function useLogin() {
@ -14,6 +14,7 @@ export function useLogin() {
}); });
const navigate = useNavigate(); const navigate = useNavigate();
const { search } = useLocation();
const app = useContext(AppContext); const app = useContext(AppContext);
const updateState = (value) => { const updateState = (value) => {
@ -69,6 +70,30 @@ export function useLogin() {
// eslint-disable-next-line // 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 }; return { state, actions };
} }

View File

@ -134,21 +134,24 @@ export function useConversation(cardId, channelId) {
}, [state.contentKey]); }, [state.contentKey]);
const clickableText = (text) => { 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 '((([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{1,3}\\.){3}\\d{1,3}))'+ // OR ip (v4) address
'(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*'+ // port and path '(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*'+ // port and path
'(\\?[;&a-z\\d%_.~+=-]*)?'+ // query string '(\\?[;&a-z\\d%_.~+=-]*)?'+ // query string
'(\\#[-a-z\\d_]*)?$','i'); // fragment locator '(\\#[-a-z\\d_]*)?$','i'); // fragment locator
const hostPattern = new RegExp('^https?:\\/\\/', 'i');
let group = ''; let group = '';
let clickable = []; let clickable = [];
const words = text == null ? '' : DOMPurify.sanitize(text).split(' '); const words = text == null ? '' : DOMPurify.sanitize(text).split(' ');
words.forEach((word, index) => { words.forEach((word, index) => {
if (!!pattern.test(word)) { if (!!urlPattern.test(word)) {
clickable.push(<span key={index}>{ group }</span>); clickable.push(<span key={index}>{ group }</span>);
group = ''; 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 { else {
group += `${word} `; group += `${word} `;