Improve URL decoding and bump version for publication

This commit is contained in:
Tiago Daniel Jacobs 2023-01-08 21:04:11 -03:00
parent 6f9b779248
commit b8f9704cff
2 changed files with 22 additions and 22 deletions

View File

@ -597,7 +597,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = "BigBlueButton Tablet.entitlements"; CODE_SIGN_ENTITLEMENTS = "BigBlueButton Tablet.entitlements";
CURRENT_PROJECT_VERSION = 15; CURRENT_PROJECT_VERSION = 16;
DEVELOPMENT_TEAM = N69T9W23TC; DEVELOPMENT_TEAM = N69T9W23TC;
ENABLE_BITCODE = NO; ENABLE_BITCODE = NO;
INFOPLIST_FILE = BigBlueButtonTablet/Info.plist; INFOPLIST_FILE = BigBlueButtonTablet/Info.plist;
@ -635,7 +635,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = "BigBlueButton Tablet.entitlements"; CODE_SIGN_ENTITLEMENTS = "BigBlueButton Tablet.entitlements";
CURRENT_PROJECT_VERSION = 15; CURRENT_PROJECT_VERSION = 16;
DEVELOPMENT_TEAM = N69T9W23TC; DEVELOPMENT_TEAM = N69T9W23TC;
ENABLE_BITCODE = NO; ENABLE_BITCODE = NO;
INFOPLIST_FILE = BigBlueButtonTablet/Info.plist; INFOPLIST_FILE = BigBlueButtonTablet/Info.plist;
@ -676,7 +676,7 @@
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CODE_SIGN_ENTITLEMENTS = "BigBlueButton Broadcast/BigBlueButton Broadcast.entitlements"; CODE_SIGN_ENTITLEMENTS = "BigBlueButton Broadcast/BigBlueButton Broadcast.entitlements";
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 15; CURRENT_PROJECT_VERSION = 16;
DEBUG_INFORMATION_FORMAT = dwarf; DEBUG_INFORMATION_FORMAT = dwarf;
DEVELOPMENT_TEAM = N69T9W23TC; DEVELOPMENT_TEAM = N69T9W23TC;
ENABLE_BITCODE = NO; ENABLE_BITCODE = NO;
@ -718,7 +718,7 @@
CODE_SIGN_ENTITLEMENTS = "BigBlueButton Broadcast/BigBlueButton Broadcast.entitlements"; CODE_SIGN_ENTITLEMENTS = "BigBlueButton Broadcast/BigBlueButton Broadcast.entitlements";
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
COPY_PHASE_STRIP = NO; COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 15; CURRENT_PROJECT_VERSION = 16;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEVELOPMENT_TEAM = N69T9W23TC; DEVELOPMENT_TEAM = N69T9W23TC;
ENABLE_BITCODE = NO; ENABLE_BITCODE = NO;

View File

@ -17,12 +17,15 @@ const DeepLink = ()=>{
initTranslation(); initTranslation();
const SCHEME = 'bigbluebutton-tablet://'; const SCHEME = 'bigbluebutton-tablet://';
const SCHEME_DEFAULT = 'https://' var lastDeepLinkPortalName:String|undefined = undefined;
var lastDeepLinkPortalName = null;
const navigation = useNavigation(); const navigation = useNavigation();
const {portals, setPortals} = usePortal(); const {portals, setPortals} = usePortal();
function decodeUrlParameter(str:string) {
return decodeURIComponent(str.replace(/\+/g, '%20'));
}
async function createPortalFromDeepLink(link: string){ async function createPortalFromDeepLink(link: string){
const linkWithoutScheme = link.replace(SCHEME, '').replace(/\+/g, ' '); const linkWithoutScheme = link.replace(SCHEME, '').replace(/\+/g, ' ');
@ -30,33 +33,30 @@ const DeepLink = ()=>{
navigation.navigate(i18next.t('mobileApp.portals.drawerNavigation.button.label')) navigation.navigate(i18next.t('mobileApp.portals.drawerNavigation.button.label'))
return Alert.alert(i18next.t('mobileApp.portals.handleWithoutURL')) return Alert.alert(i18next.t('mobileApp.portals.handleWithoutURL'))
} }
let roomNameWBar = linkWithoutScheme.match(/^[-.\w +]+\//)
if(!roomNameWBar) { const linkParts = linkWithoutScheme.split('/https://');
let portalName = linkParts[0];
let portalLink = linkParts[1];
if(!portalName || !portalLink) {
navigation.navigate(i18next.t('mobileApp.portals.drawerNavigation.button.label')) navigation.navigate(i18next.t('mobileApp.portals.drawerNavigation.button.label'))
return Alert.alert(i18next.t('mobileApp.portals.handleWithoutURL')) return Alert.alert(i18next.t('mobileApp.portals.handleWithoutURL'))
} }
let roomName = roomNameWBar[0].replace(/\//, '')
if(roomName === 'bigbluebutton'){ portalName=decodeUrlParameter(portalName);
roomName = i18next.t('mobileApp.portals.namePortal.deepLink'); portalLink= 'https://' + decodeUrlParameter(portalLink);
}
lastDeepLinkPortalName = roomName;
let linkWithoutSchemeAndName = linkWithoutScheme.replace(/^[-.\w +]+\//, '')
if (!linkWithoutSchemeAndName.includes('://')) {
linkWithoutSchemeAndName = SCHEME_DEFAULT + linkWithoutSchemeAndName
}
// Join links are temporary (discarded on next app launch) // Join links are temporary (discarded on next app launch)
const isTemporary = linkWithoutScheme.includes('/bigbluebutton/api/join?'); const isTemporary = portalLink.includes('/bigbluebutton/api/join?');
const portalToAdd:IPortal = { const portalToAdd:IPortal = {
name: lastDeepLinkPortalName, name: portalName,
url: linkWithoutSchemeAndName, url: portalLink,
temporary: isTemporary temporary: isTemporary
} }
lastDeepLinkPortalName = portalName;
// Adding LinkedPortal to AsyncStorage // Adding LinkedPortal to AsyncStorage
const newPortals = await createNewPortal(portalToAdd) const newPortals = await createNewPortal(portalToAdd)