diff --git a/android/app/BUCK b/android/app/BUCK index a6c817857..6ec4e7437 100644 --- a/android/app/BUCK +++ b/android/app/BUCK @@ -46,13 +46,13 @@ android_library( android_build_config( name = 'build_config', - package = 'com.mattermost', + package = 'com.mattermost.rnbeta', ) android_resource( name = 'res', res = 'src/main/res', - package = 'com.mattermost', + package = 'com.mattermost.rnbeta', ) android_binary( diff --git a/android/app/build.gradle b/android/app/build.gradle index f13b9fb79..78bf5c7c9 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -88,7 +88,7 @@ android { buildToolsVersion "25.0.1" defaultConfig { - applicationId "com.mattermost.react.native" + applicationId "com.mattermost.rnbeta" minSdkVersion 16 targetSdkVersion 23 versionCode 39 diff --git a/android/app/google-services.json b/android/app/google-services.json index 775b64e25..9f083952d 100644 --- a/android/app/google-services.json +++ b/android/app/google-services.json @@ -36,6 +36,68 @@ "status": 2 } } + }, + { + "client_info": { + "mobilesdk_app_id": "1:184930218130:android:c7debfa7ea3f75a7", + "android_client_info": { + "package_name": "com.mattermost.rnbeta" + } + }, + "oauth_client": [ + { + "client_id": "184930218130-8nahrspll1opff0uogtkh2qsv8coqngo.apps.googleusercontent.com", + "client_type": 3 + } + ], + "api_key": [ + { + "current_key": "AIzaSyCkZkU2ECVg-mmdCG5OoHHQXtKiENuvWPE" + } + ], + "services": { + "analytics_service": { + "status": 1 + }, + "appinvite_service": { + "status": 1, + "other_platform_oauth_client": [] + }, + "ads_service": { + "status": 2 + } + } + }, + { + "client_info": { + "mobilesdk_app_id": "1:184930218130:android:2db4058a5b5d6506", + "android_client_info": { + "package_name": "com.mattermost.rn" + } + }, + "oauth_client": [ + { + "client_id": "184930218130-8nahrspll1opff0uogtkh2qsv8coqngo.apps.googleusercontent.com", + "client_type": 3 + } + ], + "api_key": [ + { + "current_key": "AIzaSyCkZkU2ECVg-mmdCG5OoHHQXtKiENuvWPE" + } + ], + "services": { + "analytics_service": { + "status": 1 + }, + "appinvite_service": { + "status": 1, + "other_platform_oauth_client": [] + }, + "ads_service": { + "status": 2 + } + } } ], "configuration_version": "1" diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 63c94bf54..013facf04 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -1,5 +1,5 @@ diff --git a/android/app/src/main/java/com/mattermost/CustomPushNotification.java b/android/app/src/main/java/com/mattermost/rnbeta/CustomPushNotification.java similarity index 99% rename from android/app/src/main/java/com/mattermost/CustomPushNotification.java rename to android/app/src/main/java/com/mattermost/rnbeta/CustomPushNotification.java index a92fbe716..b56ef87b2 100644 --- a/android/app/src/main/java/com/mattermost/CustomPushNotification.java +++ b/android/app/src/main/java/com/mattermost/rnbeta/CustomPushNotification.java @@ -1,4 +1,4 @@ -package com.mattermost; +package com.mattermost.rnbeta; import android.app.PendingIntent; import android.content.Context; diff --git a/android/app/src/main/java/com/mattermost/MainActivity.java b/android/app/src/main/java/com/mattermost/rnbeta/MainActivity.java similarity index 98% rename from android/app/src/main/java/com/mattermost/MainActivity.java rename to android/app/src/main/java/com/mattermost/rnbeta/MainActivity.java index 2bb98165f..2c1c60a84 100644 --- a/android/app/src/main/java/com/mattermost/MainActivity.java +++ b/android/app/src/main/java/com/mattermost/rnbeta/MainActivity.java @@ -1,4 +1,4 @@ -package com.mattermost; +package com.mattermost.rnbeta; import com.github.yamill.orientation.OrientationPackage; import com.psykar.cookiemanager.CookieManagerPackage; diff --git a/android/app/src/main/java/com/mattermost/MainApplication.java b/android/app/src/main/java/com/mattermost/rnbeta/MainApplication.java similarity index 98% rename from android/app/src/main/java/com/mattermost/MainApplication.java rename to android/app/src/main/java/com/mattermost/rnbeta/MainApplication.java index 5d12ea907..7b8a04ab0 100644 --- a/android/app/src/main/java/com/mattermost/MainApplication.java +++ b/android/app/src/main/java/com/mattermost/rnbeta/MainApplication.java @@ -1,4 +1,4 @@ -package com.mattermost; +package com.mattermost.rnbeta; import android.app.Application; import android.util.Log; diff --git a/android/app/src/main/java/com/mattermost/NotificationsLifecycleFacade.java b/android/app/src/main/java/com/mattermost/rnbeta/NotificationsLifecycleFacade.java similarity index 98% rename from android/app/src/main/java/com/mattermost/NotificationsLifecycleFacade.java rename to android/app/src/main/java/com/mattermost/rnbeta/NotificationsLifecycleFacade.java index 2fd8ad9e4..a34e975df 100644 --- a/android/app/src/main/java/com/mattermost/NotificationsLifecycleFacade.java +++ b/android/app/src/main/java/com/mattermost/rnbeta/NotificationsLifecycleFacade.java @@ -1,4 +1,4 @@ -package com.mattermost; +package com.mattermost.rnbeta; import android.app.Activity; import android.util.Log; diff --git a/android/app/src/main/res/values/strings.xml b/android/app/src/main/res/values/strings.xml index ca34c2ca4..840999c66 100644 --- a/android/app/src/main/res/values/strings.xml +++ b/android/app/src/main/res/values/strings.xml @@ -1,5 +1,6 @@ + - Mattermost + Mattermost Beta diff --git a/android/build.gradle b/android/build.gradle index 238f98527..ef0e6d195 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -6,7 +6,7 @@ buildscript { } dependencies { classpath 'com.android.tools.build:gradle:2.2.+' - classpath 'com.google.gms:google-services:3.0.0' + classpath 'com.google.gms:google-services:3.1.0' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files diff --git a/app/mattermost.js b/app/mattermost.js index 602e0956d..baeb9c497 100644 --- a/app/mattermost.js +++ b/app/mattermost.js @@ -176,8 +176,16 @@ export default class Mattermost { }; onRegisterDevice = (data) => { - const prefix = Platform.OS === 'ios' ? General.PUSH_NOTIFY_APPLE_REACT_NATIVE : General.PUSH_NOTIFY_ANDROID_REACT_NATIVE; const {dispatch, getState} = store; + let prefix; + if (Platform.OS === 'ios') { + prefix = General.PUSH_NOTIFY_APPLE_REACT_NATIVE; + if (DeviceInfo.getBundleId().includes('rnbeta')) { + prefix = `${prefix}beta`; + } + } else { + prefix = General.PUSH_NOTIFY_ANDROID_REACT_NATIVE; + } setDeviceToken(`${prefix}:${data.token}`)(dispatch, getState); this.isConfigured = true; }; diff --git a/app/screens/select_server/select_server.js b/app/screens/select_server/select_server.js index ee05bd3c8..32f950e37 100644 --- a/app/screens/select_server/select_server.js +++ b/app/screens/select_server/select_server.js @@ -10,6 +10,7 @@ import { Keyboard, KeyboardAvoidingView, Platform, + StatusBar, TouchableWithoutFeedback, View } from 'react-native'; @@ -21,7 +22,6 @@ import {Client, Client4} from 'mattermost-redux/client'; import ErrorText from 'app/components/error_text'; import FormattedText from 'app/components/formatted_text'; -import StatusBar from 'app/components/status_bar'; import TextInputWithLocalizedPlaceholder from 'app/components/text_input_with_localized_placeholder'; import {GlobalStyles} from 'app/styles'; import {isValidUrl, stripTrailingSlashes} from 'app/utils/url'; @@ -186,7 +186,7 @@ class SelectServer extends PureComponent { style={{flex: 1}} keyboardVerticalOffset={0} > - + = 1.4.4, < 2.0.0) xcpretty (>= 0.2.4, < 1.0.0) xcpretty-travis-formatter (>= 0.0.3) + fastlane-plugin-android_change_package_identifier (0.1.0) + fastlane-plugin-android_change_string_app_name (0.1.1) + nokogiri + fastlane-plugin-find_replace_string (0.1.0) gh_inspector (1.0.3) google-api-client (0.12.0) addressable (~> 2.5, >= 2.5.1) @@ -87,10 +91,13 @@ GEM mime-types-data (~> 3.2015) mime-types-data (3.2016.0521) mini_magick (4.5.1) + mini_portile (0.6.2) multi_json (1.12.1) multi_xml (0.6.0) multipart-post (2.0.0) nanaimo (0.2.3) + nokogiri (1.6.6.2) + mini_portile (~> 0.6.0) os (0.9.6) plist (3.3.0) public_suffix (2.0.5) @@ -133,6 +140,10 @@ PLATFORMS DEPENDENCIES fastlane + fastlane-plugin-android_change_package_identifier + fastlane-plugin-android_change_string_app_name + fastlane-plugin-find_replace_string + nokogiri BUNDLED WITH 1.13.7 diff --git a/fastlane/Pluginfile b/fastlane/Pluginfile index f4b8ec74d..32d574554 100644 --- a/fastlane/Pluginfile +++ b/fastlane/Pluginfile @@ -2,3 +2,6 @@ # # Ensure this file is checked in to source control! +gem 'fastlane-plugin-android_change_package_identifier' +gem 'fastlane-plugin-android_change_string_app_name' +gem 'fastlane-plugin-find_replace_string' diff --git a/fastlane/actions/android_update_application_id.rb b/fastlane/actions/android_update_application_id.rb new file mode 100644 index 000000000..61773f1c8 --- /dev/null +++ b/fastlane/actions/android_update_application_id.rb @@ -0,0 +1,110 @@ +# rubocop:disable Style/CaseEquality +# rubocop:disable Style/MultilineTernaryOperator +# rubocop:disable Style/NestedTernaryOperator + +require 'tempfile' +require 'fileutils' + +module Fastlane + module Actions + class AndroidUpdateApplicationIdAction < Action + def self.run(params) + app_folder_name ||= params[:app_folder_name] + UI.message("The update_application_id plugin is looking inside your project folder (#{app_folder_name})!") + + new_application_id ||= params[:application_id] + UI.message("new applicationId = #{new_application_id}") + + temp_file = Tempfile.new('fastlaneUpdateApplicationId') + foundApplicationId = "false" + Dir.glob("#{app_folder_name}/build.gradle") do |path| + UI.message(" -> Found a build.gradle file at path: (#{path})!") + begin + temp_file = Tempfile.new('fastlaneUpdateApplicationId') + File.open(path, 'r') do |file| + file.each_line do |line| + if line.include? "applicationId " and foundApplicationId=="false" + + applicationComponents = line.strip.split(' ') + application_id = applicationComponents[1].tr("\"","") + line.replace line.sub(application_id, new_application_id.to_s) + foundApplicationId = "true" + temp_file.puts line + else + temp_file.puts line + end + end + + if foundApplicationId=="true" + break + end + file.close + end + temp_file.rewind + temp_file.close + FileUtils.mv(temp_file.path, path) + temp_file.unlink + ensure + if foundApplicationId=="true" + + break + end + + end + end + + + if new_application_id.empty? + UI.user_error!("Impossible to update the applicationId in the current project folder #{app_folder_name} 😭") + else + # Store the version name in the shared hash + Actions.lane_context["ANDROID_APPLICATION_ID"]=new_application_id + UI.success("☝️ application_id has been changed to #{new_application_id}") + end + + return new_application_id + end + + def self.description + "Update the applicationId of your android project." + end + + def self.authors + ["Elias Nahum"] + end + + def self.available_options + [ + FastlaneCore::ConfigItem.new(key: :app_folder_name, + env_name: "APPLICATIONID_APP_FOLDER_NAME", + description: "The name of the application source folder in the Android project (default: app)", + optional: true, + type: String, + default_value:"app"), + FastlaneCore::ConfigItem.new(key: :application_id, + env_name: "APPLICATIONID_VALUE", + description: "Change to a specific applicationId", + optional: false, + type: String, + default_value: '') + ] + end + + def self.output + [ + ['ANDROID_APPLICATION_ID', 'The new applicationId of the project'] + ] + end + + def self.is_supported?(platform) + [:android].include?(platform) + end + end + end +end + + + +# rubocop:enable Style/CaseEquality +# rubocop:enable Style/MultilineTernaryOperator +# rubocop:enable Style/NestedTernaryOperator diff --git a/ios/Mattermost.xcodeproj/project.pbxproj b/ios/Mattermost.xcodeproj/project.pbxproj index 0c913b271..556675a54 100644 --- a/ios/Mattermost.xcodeproj/project.pbxproj +++ b/ios/Mattermost.xcodeproj/project.pbxproj @@ -1338,7 +1338,7 @@ "-ObjC", "-lc++", ); - PRODUCT_BUNDLE_IDENTIFIER = com.mattermost.react.native; + PRODUCT_BUNDLE_IDENTIFIER = com.mattermost.rnbeta; PRODUCT_NAME = Mattermost; PROVISIONING_PROFILE = ""; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -1371,7 +1371,7 @@ "-ObjC", "-lc++", ); - PRODUCT_BUNDLE_IDENTIFIER = com.mattermost.react.native; + PRODUCT_BUNDLE_IDENTIFIER = com.mattermost.rnbeta; PRODUCT_NAME = Mattermost; PROVISIONING_PROFILE = ""; PROVISIONING_PROFILE_SPECIFIER = ""; diff --git a/ios/Mattermost/Info.plist b/ios/Mattermost/Info.plist index f1cd78d88..c1664cb3b 100644 --- a/ios/Mattermost/Info.plist +++ b/ios/Mattermost/Info.plist @@ -1,94 +1,96 @@ - - CFBundleDevelopmentRegion - en - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - APPL - CFBundleShortVersionString - 1.0 - CFBundleSignature - ???? - CFBundleVersion - 39 - ITSAppUsesNonExemptEncryption - - LSRequiresIPhoneOS - - NSAllowsArbitraryLoads - - NSAppTransportSecurity - - NSAllowsArbitraryLoads - - NSExceptionDomains - - localhost - - NSExceptionAllowsInsecureHTTPLoads - - - - - NSCameraUsageDescription - Take a Photo or Video and upload it to your mattermost instance - NSLocationWhenInUseUsageDescription - - NSPhotoLibraryUsageDescription - Upload Photos and Videos to your Mattermost instance - UIAppFonts - - Entypo.ttf - EvilIcons.ttf - FontAwesome.ttf - Foundation.ttf - Ionicons.ttf - MaterialIcons.ttf - Octicons.ttf - Zocial.ttf - Entypo.ttf - EvilIcons.ttf - FontAwesome.ttf - Foundation.ttf - Ionicons.ttf - MaterialCommunityIcons.ttf - MaterialIcons.ttf - Octicons.ttf - SimpleLineIcons.ttf - Zocial.ttf - OpenSans-Bold.ttf - OpenSans-BoldItalic.ttf - OpenSans-ExtraBold.ttf - OpenSans-ExtraBoldItalic.ttf - OpenSans-Italic.ttf - OpenSans-Light.ttf - OpenSans-LightItalic.ttf - OpenSans-Regular.ttf - OpenSans-Semibold.ttf - OpenSans-SemiboldItalic.ttf - - UILaunchStoryboardName - LaunchScreen - UIRequiredDeviceCapabilities - - armv7 - - UISupportedInterfaceOrientations - - UIInterfaceOrientationPortrait - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - - UIViewControllerBasedStatusBarAppearance - - + + CFBundleDevelopmentRegion + en + CFBundleDisplayName + Mattermost Beta + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 39 + ITSAppUsesNonExemptEncryption + + LSRequiresIPhoneOS + + NSAllowsArbitraryLoads + + NSAppTransportSecurity + + NSAllowsArbitraryLoads + + NSExceptionDomains + + localhost + + NSExceptionAllowsInsecureHTTPLoads + + + + + NSCameraUsageDescription + Take a Photo or Video and upload it to your mattermost instance + NSLocationWhenInUseUsageDescription + + NSPhotoLibraryUsageDescription + Upload Photos and Videos to your Mattermost instance + UIAppFonts + + Entypo.ttf + EvilIcons.ttf + FontAwesome.ttf + Foundation.ttf + Ionicons.ttf + MaterialIcons.ttf + Octicons.ttf + Zocial.ttf + Entypo.ttf + EvilIcons.ttf + FontAwesome.ttf + Foundation.ttf + Ionicons.ttf + MaterialCommunityIcons.ttf + MaterialIcons.ttf + Octicons.ttf + SimpleLineIcons.ttf + Zocial.ttf + OpenSans-Bold.ttf + OpenSans-BoldItalic.ttf + OpenSans-ExtraBold.ttf + OpenSans-ExtraBoldItalic.ttf + OpenSans-Italic.ttf + OpenSans-Light.ttf + OpenSans-LightItalic.ttf + OpenSans-Regular.ttf + OpenSans-Semibold.ttf + OpenSans-SemiboldItalic.ttf + + UILaunchStoryboardName + LaunchScreen + UIRequiredDeviceCapabilities + + armv7 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UIViewControllerBasedStatusBarAppearance + +