diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml
index 1e1c3d564..57aa6aee2 100644
--- a/android/app/src/main/AndroidManifest.xml
+++ b/android/app/src/main/AndroidManifest.xml
@@ -40,7 +40,7 @@
-
+
diff --git a/app/utils/url.js b/app/utils/url.js
index a30fd4d31..da2baf0ed 100644
--- a/app/utils/url.js
+++ b/app/utils/url.js
@@ -9,6 +9,7 @@ import {Files} from 'mattermost-redux/constants';
import {DeepLinkTypes} from 'app/constants';
const ytRegex = /(?:http|https):\/\/(?:www\.|m\.)?(?:(?:youtube\.com\/(?:(?:v\/)|(?:(?:watch|embed\/watch)(?:\/|.*v=))|(?:embed\/)|(?:user\/[^/]+\/u\/[0-9]\/)))|(?:youtu\.be\/))([^#&?]*)/;
+const APP_SCHEME = 'mattermost-beta';
export function isValidUrl(url = '') {
const regex = /^https?:\/\//i;
@@ -103,7 +104,7 @@ export function matchDeepLink(url, serverURL, siteURL) {
return null;
}
- const linkRoot = `(?:${escapeRegex('mattermost:/')}|${escapeRegex(serverURL)}|${escapeRegex(siteURL)})?`;
+ const linkRoot = `(?:${escapeRegex(APP_SCHEME)}:\\/|${escapeRegex(serverURL)}|${escapeRegex(siteURL)})?`;
let match = new RegExp('^' + linkRoot + '\\/([^\\/]+)\\/channels\\/(\\S+)').exec(url);
diff --git a/fastlane/Fastfile b/fastlane/Fastfile
index 26d1a3e01..f7e360ee3 100644
--- a/fastlane/Fastfile
+++ b/fastlane/Fastfile
@@ -167,6 +167,14 @@ lane :configure do
# Save the config.json file
save_config_json('../dist/assets/config.json', json)
+ # Set deep link prefix for URL lookups
+ app_scheme = ENV['APP_SCHEME'] || 'mattermost-beta'
+ find_replace_string(
+ path_to_file: './app/utils/url.js',
+ old_string: "APP_SCHEME = 'mattermost-beta'",
+ new_string: "APP_SCHEME = '#{app_scheme}'",
+ )
+
configured = true
end
@@ -276,7 +284,7 @@ end
desc 'Create GitHub release'
lane :github do
tag = ENV['CIRCLE_TAG'] || ENV['TAG']
-
+
if tag
version = get_version_number(xcodeproj: './ios/Mattermost.xcodeproj', target: 'Mattermost')
build = get_build_number(xcodeproj: './ios/Mattermost.xcodeproj')
@@ -330,6 +338,7 @@ platform :ios do
ENV['APP_NAME'] = 'Mattermost'
ENV['REPLACE_ASSETS'] = 'true'
ENV['BUILD_FOR_RELEASE'] = 'true'
+ ENV['APP_SCHEME'] = 'mattermost-mobile'
update_identifiers
replace_assets
@@ -392,6 +401,17 @@ platform :ios do
new_string: app_bundle_id
)
+ # Set the deep link prefix
+ app_scheme = ENV['APP_SCHEME'] || 'mattermost-beta'
+ update_info_plist(
+ xcodeproj: './ios/Mattermost.xcodeproj',
+ plist_path: 'Mattermost/Info.plist',
+ block: proc do |plist|
+ urlScheme = plist["CFBundleURLTypes"].find{|scheme| scheme["CFBundleURLName"] == "com.mattermost"}
+ urlScheme[:CFBundleURLSchemes] = [app_scheme]
+ end
+ )
+
# If set update the development team
unless ENV['FASTLANE_TEAM_ID'].nil? || ENV['FASTLANE_TEAM_ID'].empty?
update_project_team(
@@ -420,7 +440,6 @@ platform :ios do
new_string: app_group_id
)
-
update_app_group_identifiers(
entitlements_file: './ios/MattermostShare/MattermostShare.entitlements',
app_group_identifiers: [app_group_id]
@@ -490,7 +509,7 @@ platform :ios do
end
end
- def build_ios()
+ def build_ios
app_name = ENV['APP_NAME'] || 'Mattermost Beta'
app_name_sub = app_name.gsub(" ", "_")
config_mode = ENV['BUILD_FOR_RELEASE'] == 'true' ? 'Release' : 'Debug'
@@ -538,6 +557,7 @@ platform :android do
ENV['APP_NAME'] = 'Mattermost'
ENV['REPLACE_ASSETS'] = 'true'
ENV['BUILD_FOR_RELEASE'] = 'true'
+ ENV['APP_SCHEME'] = 'mattermost-mobile'
update_identifiers
replace_assets
@@ -585,6 +605,13 @@ platform :android do
android_change_package_identifier(newIdentifier: package_id, manifest: './android/app/src/main/AndroidManifest.xml')
android_update_application_id(app_folder_name: 'android/app', application_id: package_id)
+ app_scheme = ENV['APP_SCHEME'] || 'mattermost-beta'
+ find_replace_string(
+ path_to_file: "./android/app/src/main/AndroidManifest.xml",
+ old_string: 'scheme="mattermost-beta"',
+ new_string: "scheme=\'#{app_scheme}\'"
+ )
+
beta_dir = './android/app/src/main/java/com/mattermost/rnbeta/'
release_dir = "./android/app/src/main/java/#{package_id.gsub '.', '/'}/"
if ENV['BUILD_FOR_RELEASE'] == 'true'
@@ -661,7 +688,7 @@ platform :android do
})
end
- def build_android()
+ def build_android
config_mode = ENV['BUILD_FOR_RELEASE'] == 'true' ? 'Release' : 'Debug'
gradle(
diff --git a/fastlane/env_vars_example b/fastlane/env_vars_example
index e178149d4..b109c6976 100644
--- a/fastlane/env_vars_example
+++ b/fastlane/env_vars_example
@@ -5,6 +5,7 @@ export BRANCH_TO_BUILD=master
export GIT_LOCAL_BRANCH=build
export APP_NAME="Mattermost Beta"
+export APP_SCHEME=mattermost-beta
#export INCREMENT_BUILD_NUMBER=false
## This sets the version number ex: 1.22.0 if not set it uses the one in the code base
diff --git a/ios/Mattermost/Info.plist b/ios/Mattermost/Info.plist
index 44d658493..c5aaaaf15 100644
--- a/ios/Mattermost/Info.plist
+++ b/ios/Mattermost/Info.plist
@@ -29,7 +29,7 @@
com.mattermost
CFBundleURLSchemes
- mattermost
+ mattermost-beta