From b8f9704cff587ac5c8f65785b27f92d92ed93ea1 Mon Sep 17 00:00:00 2001 From: Tiago Daniel Jacobs Date: Sun, 8 Jan 2023 21:04:11 -0300 Subject: [PATCH] Improve URL decoding and bump version for publication --- .../project.pbxproj | 8 ++--- react-native/app/routes/component.tsx | 36 +++++++++---------- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/ios/BigBlueButton Tablet.xcodeproj/project.pbxproj b/ios/BigBlueButton Tablet.xcodeproj/project.pbxproj index 27bf082..3e77a22 100644 --- a/ios/BigBlueButton Tablet.xcodeproj/project.pbxproj +++ b/ios/BigBlueButton Tablet.xcodeproj/project.pbxproj @@ -597,7 +597,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = "BigBlueButton Tablet.entitlements"; - CURRENT_PROJECT_VERSION = 15; + CURRENT_PROJECT_VERSION = 16; DEVELOPMENT_TEAM = N69T9W23TC; ENABLE_BITCODE = NO; INFOPLIST_FILE = BigBlueButtonTablet/Info.plist; @@ -635,7 +635,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = "BigBlueButton Tablet.entitlements"; - CURRENT_PROJECT_VERSION = 15; + CURRENT_PROJECT_VERSION = 16; DEVELOPMENT_TEAM = N69T9W23TC; ENABLE_BITCODE = NO; INFOPLIST_FILE = BigBlueButtonTablet/Info.plist; @@ -676,7 +676,7 @@ CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; CODE_SIGN_ENTITLEMENTS = "BigBlueButton Broadcast/BigBlueButton Broadcast.entitlements"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 15; + CURRENT_PROJECT_VERSION = 16; DEBUG_INFORMATION_FORMAT = dwarf; DEVELOPMENT_TEAM = N69T9W23TC; ENABLE_BITCODE = NO; @@ -718,7 +718,7 @@ CODE_SIGN_ENTITLEMENTS = "BigBlueButton Broadcast/BigBlueButton Broadcast.entitlements"; CODE_SIGN_STYLE = Automatic; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 15; + CURRENT_PROJECT_VERSION = 16; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEVELOPMENT_TEAM = N69T9W23TC; ENABLE_BITCODE = NO; diff --git a/react-native/app/routes/component.tsx b/react-native/app/routes/component.tsx index c6bd046..7f61f89 100644 --- a/react-native/app/routes/component.tsx +++ b/react-native/app/routes/component.tsx @@ -17,12 +17,15 @@ const DeepLink = ()=>{ initTranslation(); const SCHEME = 'bigbluebutton-tablet://'; - const SCHEME_DEFAULT = 'https://' - var lastDeepLinkPortalName = null; + var lastDeepLinkPortalName:String|undefined = undefined; const navigation = useNavigation(); const {portals, setPortals} = usePortal(); + function decodeUrlParameter(str:string) { + return decodeURIComponent(str.replace(/\+/g, '%20')); + } + async function createPortalFromDeepLink(link: string){ const linkWithoutScheme = link.replace(SCHEME, '').replace(/\+/g, ' '); @@ -30,33 +33,30 @@ const DeepLink = ()=>{ navigation.navigate(i18next.t('mobileApp.portals.drawerNavigation.button.label')) 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')) return Alert.alert(i18next.t('mobileApp.portals.handleWithoutURL')) } - let roomName = roomNameWBar[0].replace(/\//, '') - if(roomName === 'bigbluebutton'){ - roomName = i18next.t('mobileApp.portals.namePortal.deepLink'); - } - lastDeepLinkPortalName = roomName; - - let linkWithoutSchemeAndName = linkWithoutScheme.replace(/^[-.\w +]+\//, '') - - if (!linkWithoutSchemeAndName.includes('://')) { - linkWithoutSchemeAndName = SCHEME_DEFAULT + linkWithoutSchemeAndName - } + portalName=decodeUrlParameter(portalName); + portalLink= 'https://' + decodeUrlParameter(portalLink); // 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 = { - name: lastDeepLinkPortalName, - url: linkWithoutSchemeAndName, + name: portalName, + url: portalLink, temporary: isTemporary } + lastDeepLinkPortalName = portalName; + // Adding LinkedPortal to AsyncStorage const newPortals = await createNewPortal(portalToAdd)