Commit 268659ed authored by armin's avatar armin
Browse files

Merge branch 'master' into 'production'

1.2 production

See merge request !196
parents cedcc5b4 10573a3f
Pipeline #732 passed with stage
in 2 minutes and 4 seconds
File deleted
*.user
/fairchat/android/.idea
/fairchat/translations/*.qm
.DS_Store
._.DS_Store
**/.DS_Store
......
......@@ -9,14 +9,14 @@ docker:build:Qt:5.9:
stage: build
script:
- ls
- docker create --name ci-$CI_COMMIT_SHA-qt-android-docker -v ~/.gradle:/root/.gradle -v ~/.ccache:/root/.ccache afelder/qt-android-docker /bin/bash -c "mkdir -p /src/build && cd /src/build && ls /src && /opt/Qt/5.9.5/android_armv7/bin/qmake -spec android-g++ ../RocketChatMobileModular.pro && make -j9 && make install INSTALL_ROOT=/src/build/android-build/ &&/opt/Qt/5.9.5/android_armv7/bin/androiddeployqt --input fairchat/android-libfairchat.so-deployment-settings.json --output android-build --deployment bundled --android-platform android-26 --jdk /usr/lib/jvm/java-8-oracle --gradle"
- docker create --name ci-$CI_COMMIT_SHA-qt-android-docker -v ~/.gradle:/root/.gradle -v ~/.ccache:/root/.ccache afelder/qt-android-docker /bin/bash -c "mkdir -p /src/build && cd /src/build && ls /src && /opt/Qt/5.9.7/android_armv7/bin/qmake -spec android-g++ ../RocketChatMobileModular.pro && make -j9 && make install INSTALL_ROOT=/src/build/android-build/ &&/opt/Qt/5.9.7/android_armv7/bin/androiddeployqt --input fairchat/android-libfairchat.so-deployment-settings.json --output android-build --deployment bundled --android-platform android-28 --jdk /usr/lib/jvm/java-8-oracle --gradle"
- docker cp ./ ci-$CI_COMMIT_SHA-qt-android-docker:/src/
- docker start ci-$CI_COMMIT_SHA-qt-android-docker -a
after_script:
- docker rm ci-$CI_COMMIT_SHA-qt-android-docker
deploy:
.deploy:
image: augusteo/centos-rsync-openssh
stage: deploy
before_script:
......
......@@ -7,4 +7,13 @@ contains(ANDROID_TARGET_ARCH,armeabi-v7a) {
$$PWD/openssl/android-arm/libcrypto.so \
$$PWD/openssl/android-arm/libssl.so
}
contains(ANDROID_TARGET_ARCH,armeabi-v8a) {
ANDROID_EXTRA_LIBS = \
$$PWD/../openssl/android-arm64/libssl.so \
$$PWD/../openssl/android-arm64/libcrypto.so
}
contains(ANDROID_TARGET_ARCH,) {
ANDROID_EXTRA_LIBS = \
$$PWD/../openssl/android-arm64/libssl.so \
$$PWD/../openssl/android-arm64/libcrypto.so
}
Subproject commit 22ddc54fa1c6bc6721fa28ffd0a60a0181d2a6f7
Subproject commit 026a42e136f6f1901a6ed74ea72987a5de55f186
......@@ -74,9 +74,17 @@
<action android:name="com.google.firebase.MESSAGING_EVENT"/>
</intent-filter>
</service>
<provider android:name="android.support.v4.content.FileProvider"
android:authorities="com.osalliance.rocketchatMobile.fileprovider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/file_paths"/>
</provider>
</application>
<uses-sdk android:minSdkVersion="17" android:targetSdkVersion="26"/>
<uses-sdk android:minSdkVersion="17" android:targetSdkVersion="28"/>
<supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:smallScreens="true"/>
<!-- The following comment will be replaced upon deployment with default permissions based on the dependencies of the application.
......
......@@ -21,7 +21,10 @@ def versionMajor = QtApp.VER_MAJ.toInteger()
def versionMinor = QtApp.VER_MIN.toInteger()
def versionPatch = QtApp.VER_PAT.toInteger()
def android_armv7 = QtApp.ANDROID_ARMv7.toInteger()
def android_armv8 = QtApp.ANDROID_ARM64.toInteger()
def android_x86 = QtApp.ANDROID_x86.toInteger()
def android_x86_64 = QtApp.ANDROID_x86_64.toInteger()
buildscript {
repositories {
......@@ -31,8 +34,8 @@ buildscript {
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.0'
classpath 'com.google.gms:google-services:3.2.1'
classpath 'com.android.tools.build:gradle:3.2.1'
classpath 'com.google.gms:google-services:4.1.0'
classpath 'io.fabric.tools:gradle:1.+'
}
}
......@@ -65,19 +68,18 @@ crashlytics {
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile('com.crashlytics.sdk.android:crashlytics:2.7.1@aar') {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation('com.crashlytics.sdk.android:crashlytics:2.7.1@aar') {
transitive = true
}
compile('com.crashlytics.sdk.android:crashlytics-ndk:1.1.6@aar') {
implementation('com.crashlytics.sdk.android:crashlytics-ndk:1.1.6@aar') {
transitive = true
}
compile 'com.android.support:appcompat-v7:27.1.1'
compile 'com.google.firebase:firebase-core:15.0.2'
compile 'com.google.firebase:firebase-crash:15.0.2'
compile 'com.google.firebase:firebase-messaging:15.0.2'
compile 'me.leolin:ShortcutBadger:1.1.21@aar'
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.google.firebase:firebase-core:16.0.5'
implementation 'com.google.firebase:firebase-messaging:17.3.4'
implementation 'me.leolin:ShortcutBadger:1.1.22@aar'
implementation 'com.android.support:appcompat-v7:28.0.0'
}
......@@ -102,9 +104,25 @@ android {
buildToolsVersion androidBuildToolsVersion
defaultConfig {
ndk {
abiFilters 'armeabi-v7a', 'x86', 'x86_64'
if (android_armv7 == 1) {
ndk {
abiFilters 'armeabi-v7a'
}
} else if (android_armv8 == 1){
ndk {
abiFilters 'arm64-v8a'
}
} else if(android_x86 == 1){
ndk {
abiFilters 'x86'
}
}else if(android_x86_64 == 1){
ndk {
abiFilters 'x86_64'
}
}
versionCode versionMajor * 100000 + versionMinor * 1000 + versionPatch * 100
versionName QtApp.VERSION
}
......
#Mon Feb 20 10:43:22 EST 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.9-bin.zip
<paths xmlns:android="http://schemas.android.com/apk/res/android">
<files-path name="fairchat images" path="images/"/>
<files-path name="fairchat docs" path="docs/"/>
<cache-path name="fairchat cache" path="rocketChat" />
</paths>
......@@ -46,7 +46,7 @@ import static android.app.Notification.DEFAULT_ALL;
public class FcmMessageReceiver extends FirebaseMessagingService {
public static final int NOTIFICATION_ID = 1;
public static final String TAG = "Ucom";
public static final String TAG = "RocketChatMobile";
private static NotificationManager mNotificationManager;
private static Notification.Builder builder;
public static int badgeCount = 0;
......@@ -69,7 +69,7 @@ public class FcmMessageReceiver extends FirebaseMessagingService {
Map<String,String> msg = remoteMessage.getData();
SharedPreferences sharedPref = context.getSharedPreferences(
new String(appname+".preferences"), Context.MODE_PRIVATE);
appname+".preferences", Context.MODE_PRIVATE);
String title = msg.get("title");
String message = msg.get("message");
......@@ -78,11 +78,11 @@ public class FcmMessageReceiver extends FirebaseMessagingService {
if(msgCount !=null) {
SharedPreferences.Editor editor = sharedPref.edit();
int count = Integer.valueOf(msgCount);
int badgecount = sharedPref.getInt(new String("badgecount"), 0);
int badgecount = sharedPref.getInt("badgecount", 0);
badgecount++;
FcmMessageReceiver.badgeCount += count;
editor.putInt(new String("badgecount"),badgecount);
editor.commit();
editor.putInt("badgecount",badgecount);
editor.apply();
//MainActivity.setShortCutBadge();
ShortcutBadger.applyCount(this, badgecount);
......@@ -136,7 +136,7 @@ public class FcmMessageReceiver extends FirebaseMessagingService {
int icon = appContext.getResources().getIdentifier("ic_stat_name","drawable",MainActivity.getAndroidPackageName(context));
NotificationCompat.Builder mBuilder =
new NotificationCompat.Builder(this)
new NotificationCompat.Builder(this,"channel0")
.setSmallIcon(icon)
.setColor(0x004f5d)
.setContentTitle(title)
......
......@@ -22,6 +22,7 @@ package com.osalliance.rocketchatMobile;
import android.app.Activity;
import android.Manifest;
import android.app.NotificationChannel;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
......@@ -29,6 +30,7 @@ import android.content.pm.ApplicationInfo;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.pm.ResolveInfo;
import android.content.ContentResolver;
import android.graphics.Color;
import android.net.Uri;
import android.os.AsyncTask;
......@@ -50,7 +52,7 @@ import android.view.WindowManager.LayoutParams;
import android.view.WindowManager;
import android.view.Window;
import android.view.View;
import java.io.File;
import android.view.accessibility.AccessibilityEvent;
import android.app.Dialog;
import android.app.Fragment;
......@@ -60,12 +62,11 @@ import android.content.res.Configuration;
import android.content.res.Resources.Theme;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import com.google.firebase.crash.FirebaseCrash;
import java.nio.file.Files;
import android.content.pm.PackageManager;
import android.app.NotificationManager;
import android.webkit.CookieManager;
import android.support.v4.content.FileProvider;
import org.qtproject.qt5.android.bindings.QtActivity;
import android.support.v4.app.ActivityCompat;
......@@ -147,7 +148,7 @@ public class MainActivity extends QtActivity {
}
MainActivity.window = this.getWindow();
MainActivity.view = new View(context);
MainActivity.setStatusBarColor(Color.parseColor("#314210"));
MainActivity.setStatusBarColor(Color.parseColor("#314210"));
// ATTENTION: This was auto-generated to implement the App Indexing API.
// See https://g.co/AppIndexing/AndroidStudio for more information.
......@@ -160,6 +161,8 @@ public class MainActivity extends QtActivity {
Intent intent = getIntent();
lastIntent = intent;
createNotificationChannel();
mNotificationManager = (NotificationManager)
this.getSystemService(Context.NOTIFICATION_SERVICE);
......@@ -167,9 +170,30 @@ public class MainActivity extends QtActivity {
}
private void createNotificationChannel() {
// Create the NotificationChannel, but only on API 26+ because
// the NotificationChannel class is new and not in the support library
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
CharSequence name = "RocketChatMobileNotificationChannel";
String description = "RocketChatMobile push notifications";
int importance = NotificationManager.IMPORTANCE_DEFAULT;
NotificationChannel channel = new NotificationChannel("channel0", name, importance);
channel.setDescription(description);
// Register the channel with the system; you can't change the importance
// or other notification behaviors after this
NotificationManager notificationManager = getSystemService(NotificationManager.class);
notificationManager.createNotificationChannel(channel);
}
}
public static void setStatusBarColor(String color){
int colorInt = Color.parseColor(color);
MainActivity.setStatusBarColor(colorInt);
final int colorInt = Color.parseColor(color);
m_instance.runOnUiThread(new Runnable() {
public void run() {
MainActivity.setStatusBarColor(colorInt);
//window.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS,WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
}
});
}
public static void setStatusBarColor(int color) {
......@@ -191,31 +215,31 @@ public class MainActivity extends QtActivity {
}
public void requestPermission(String permission) {
if (ActivityCompat.checkSelfPermission(this,
permission)
!= PackageManager.PERMISSION_GRANTED) {
if (ActivityCompat.checkSelfPermission(this,
permission)
!= PackageManager.PERMISSION_GRANTED) {
// Should we show an explanation?
if (ActivityCompat.shouldShowRequestPermissionRationale(this,
permission)) {
// Should we show an explanation?
if (ActivityCompat.shouldShowRequestPermissionRationale(this,
permission)) {
// Show an explanation to the user *asynchronously* -- don't block
// this thread waiting for the user's response! After the user
// sees the explanation, try again to request the permission.
// Show an explanation to the user *asynchronously* -- don't block
// this thread waiting for the user's response! After the user
// sees the explanation, try again to request the permission.
} else {
} else {
// No explanation needed, we can request the permission.
// No explanation needed, we can request the permission.
ActivityCompat.requestPermissions(this,
new String[]{permission},
1);
ActivityCompat.requestPermissions(this,
new String[]{permission},
1);
// MY_PERMISSIONS_REQUEST_READ_CONTACTS is an
// app-defined int constant. The callback method gets the
// result of the request.
// MY_PERMISSIONS_REQUEST_READ_CONTACTS is an
// app-defined int constant. The callback method gets the
// result of the request.
}
}
}
}
public static byte[] uriToData(String url){
byte[] imageBuffer = new byte[0];
......@@ -241,7 +265,46 @@ public class MainActivity extends QtActivity {
// Check device for Play Services APK.
//checkPlayServices();
}
public String openFile(String path){
File file = new File(path);
if (file.exists()) {
try {
final Intent intent = new Intent(Intent.ACTION_DEFAULT);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
String mimeType;
if(android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
mimeType = Files.probeContentType(file.toPath());
}else{
Uri uri = Uri.fromFile(file);
ContentResolver cR = context.getContentResolver();
mimeType = cR.getType(uri);
}
intent.setData(Uri.fromFile(file));
Uri fileUri = FileProvider.getUriForFile(
getApplicationContext(),
"com.osalliance.rocketchatMobile.fileprovider",
file);
intent.setDataAndType(fileUri, mimeType);
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
System.out.println(fileUri+" with "+mimeType);
getApplicationContext().startActivity(intent);
return "sucess";
} catch (IOException exception) {
exception.printStackTrace();
return "failure";
} catch (Exception e) {
e.printStackTrace();
return "failure";
}
} else {
System.out.println("File not found "+path);
return "failure";
}
}
public boolean test(String message){
System.out.println(message);
return true;
}
private boolean checkPlayServices() {
/*int resultCode = GooglePlayServicesUtil.isGooglePlayServicesAvailable(this);
if (resultCode != ConnectionResult.SUCCESS) {
......@@ -270,7 +333,7 @@ public class MainActivity extends QtActivity {
return applicationInfo.packageName;
}
public static int checkCameraPermission() {
int permissionCheck = ContextCompat.checkSelfPermission(m_instance,
Manifest.permission.CAMERA);
......@@ -325,7 +388,7 @@ public class MainActivity extends QtActivity {
public static void setShortCutBadge() {
try {
ShortcutBadger.applyCount(context, FcmMessageReceiver.badgeCount);
} catch (Exception ex) {
//Log.i(TAG,ex.toString());
}
......@@ -368,9 +431,24 @@ public class MainActivity extends QtActivity {
}
}
public static void clearWebviewCookies(){
final int sdk_ver = android.os.Build.VERSION.SDK_INT;
m_instance.runOnUiThread(new Runnable() {
public void run() {
if (sdk_ver >= Build.VERSION_CODES.LOLLIPOP){
CookieManager.getInstance().removeAllCookies(null);
CookieManager.getInstance().flush();
}else {
CookieManager.getInstance().removeAllCookie();
}
}
});
}
public static void catchError(String error) {
Log.i(TAG, error);
FirebaseCrash.report(new Exception(error));
}
/**
......@@ -495,7 +573,7 @@ public class MainActivity extends QtActivity {
@Override
public boolean onCreateThumbnail(Bitmap outBitmap, Canvas canvas)
{
return super.onCreateThumbnail(outBitmap, canvas);
return super.onCreateThumbnail(outBitmap, canvas);
}
@Override
......@@ -513,7 +591,7 @@ public class MainActivity extends QtActivity {
@Override
public boolean onKeyDown(int keyCode, KeyEvent event)
{
return super.onKeyDown(keyCode, event);
return super.onKeyDown(keyCode, event);
}
@Override
......@@ -543,7 +621,7 @@ public class MainActivity extends QtActivity {
@Override
public boolean onMenuOpened(int featureId, Menu menu)
{
return super.onMenuOpened(featureId, menu);
return super.onMenuOpened(featureId, menu);
}
@Override
......@@ -597,7 +675,7 @@ public class MainActivity extends QtActivity {
@Override
public boolean onPreparePanel(int featureId, View view, Menu menu)
{
return super.onPreparePanel(featureId, view, menu);
return super.onPreparePanel(featureId, view, menu);
}
@Override
......
QT += qml quick core network websockets sql quickcontrols2 multimedia svg xml concurrent webview
CONFIG += c++17 static
SOURCES += \
main.cpp \
......@@ -24,11 +25,31 @@ else:unix: PRE_TARGETDEPS += $$OUT_PWD/../engine/libengine.a
TARGET = fairchat
VER_MAJ = 1
VER_MIN = 1
VER_PAT = 10
VER_MIN = 2
VER_PAT = 0
VERSION = $$sprintf("%1.%2.%3",$$VER_MAJ,$$VER_MIN,$$VER_PAT)
ANDROID_ARM64 = 0
ANDROID_ARMv7 = 0
ANDROID_x86 = 0
ANDROID_x86_64 = 0
contains(ANDROID_TARGET_ARCH,armeabi-v8a) {
ANDROID_ARM64 = 1
}
contains(ANDROID_TARGET_ARCH,armeabi-v7a) {
ANDROID_ARMv7 = 1
}
contains(ANDROID_TARGET_ARCH,x86) {
ANDROID_x86 = 1
}
contains(ANDROID_TARGET_ARCH,x86_64) {
ANDROID_x86_64 = 1
}
DEFINES += VERSION=\\\"$$VERSION\\\"
DEFINES += ALLOWANDROIDARM64=\\\"$$ALLOWANDROIDARM64\\\"
TRANSLATIONS += fairchat_de.ts
......@@ -46,10 +67,10 @@ android{
RESOURCES += android.qrc
DISTFILES += android/AndroidManifest.xml \
android/gradle/wrapper/gradle-wrapper.jar \
android/gradle/wrapper/gradle-wrapper.properties \
android/gradlew \
android/res/values/libs.xml \
android/build.gradle \
android/gradle/wrapper/gradle-wrapper.properties \
android/gradlew.bat
QT_varfile = ""
......@@ -69,8 +90,14 @@ contains(ANDROID_TARGET_ARCH,armeabi-v7a) {
$$PWD/../openssl/android-arm/libssl.so \
$$PWD/../openssl/android-arm/libcrypto.so
}
contains(ANDROID_TARGET_ARCH,armeabi-v8a) {
ANDROID_EXTRA_LIBS = \
$$PWD/../openssl/android-arm64/libssl.so \
$$PWD/../openssl/android-arm64/libcrypto.so
}
ios{
QT += gui-private
SOURCES += notifications/ios/applepushnotifications.cpp \
......@@ -88,7 +115,8 @@ ios{
notifications/ios/iosnotificationreceiver.h \
notifications/ios/DelegateClass.h \
ios/src/IosBadges.h \
ios/src/ioshelper.h
ios/src/ioshelper.h \
ios/src/CookieHelper.h
......@@ -99,8 +127,8 @@ ios{
ios/src/fileopener.mm \
ios/src/shareheplersingelton.mm \
ios/src/IosBadges.mm \
ios/src/shareheplersingelton.mm
ios/src/shareheplersingelton.mm \
ios/src/CookieHelper.mm
LIBS += -framework UserNotifications -framework Photos
......@@ -108,11 +136,8 @@ ios{
QMAKE_INFO_PLIST = ios/Info.plist
ios_icon.files = $$files($$PWD/ios/icons/AppIcon*.png)
app_launch_images.files = $$PWD/ios/Launch.xib $$files($$PWD/ios/launch/LaunchImage*.png)
QMAKE_BUNDLE_DATA += app_launch_images
QMAKE_BUNDLE_DATA += ios_icon
MY_ENTITLEMENTS.name = CODE_SIGN_ENTITLEMENTS
MY_ENTITLEMENTS.value = $$PWD/ios/fairchat.entitlements
......@@ -121,7 +146,7 @@ ios{
QMAKE_ASSET_CATALOGS = $$PWD/ios/Images.xcassets
QMAKE_ASSET_CATALOGS_APP_ICON = "Appicon"
QMAKE_IOS_DEPLOYMENT_TARGET = 10
QMAKE_IOS_DEPLOYMENT_TARGET = 10.0
QMAKE_APPLE_TARGETED_DEVICE_FAMILY = 1
PRODUCT_NAME = fairchat
#PRODUCT_BUNDLE_IDENTIFIER = com.osalliance.RocketChatMobile
......@@ -129,8 +154,30 @@ ios{
}
winrt{
RESOURCES += winrt.qrc
RESOURCES +=
QMAKE_CXXFLAGS += /O2 /ZW /AI"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcpackages"
QMAKE_LFLAGS += /FORCE:MULTIPLE
}
DISTFILES += \
qml/style/StyledToolButton.qml \
qml/style/StyledToolButton.qml \
qml/style/qmldir \
qml/style/ColorsObject.qml \
qml/style/FontsObject.qml \
qml/style/StyledButton.qml \
qml/style/StyledComboBox.qml \
qml/style/StyledMenu.qml \
qml/style/StyledMenuItem.qml \
qml/style/StyledSwitch.qml \
qml/style/StyledTabButton.qml \
qml/style/StyledText.qml \
qml/style/StyledToolButton.qml \
android/res/xml/file_paths.xml
contains(ANDROID_TARGET_ARCH,arm64-v8a) {
ANDROID_EXTRA_LIBS = \
$$PWD/../openssl/android-arm64/libcrypto.so \
$$PWD/../openssl/android-arm64/libssl.so
}