Commit 96a7f2b7 authored by armin's avatar armin
Browse files

Merge branch 'removeGoogle' into 'production-fdroid'

Remove google

See merge request !45
parents b3045f7c bec2a21b
Pipeline #124 passed with stage
in 1 minute and 55 seconds
image: docker:stable
variables:
GIT_SUBMODULE_STRATEGY: recursive
stages:
- build
docker:build:Qt:5.9:
image: afelder/qt-android-docker
stage: build
script:
- mkdir build
- cd build
- /opt/Qt/5.9.3/android_armv7/bin/qmake -spec android-g++ ../RocketChatMobileModular.pro
- make -j9
- make install INSTALL_ROOT=$(pwd)/android-build
- /opt/Qt/5.9.3/android_armv7/bin/androiddeployqt --input fairchat/android-libfairchat.so-deployment-settings.json --output android-build --deployment bundled --android-platform android-25 --jdk /usr/lib/jvm/java-8-oracle --gradle
artifacts:
name: "$CI_COMMIT_REF_NAME"
paths:
- build/android-build/build/outputs/apk/android-build-debug.apk
expire_in: 6 week
\ No newline at end of file
[![pipeline status](https://git.fairkom.net/chat/fairchat/badges/master/pipeline.svg)](https://git.fairkom.net/chat/fairchat/commits/master)
## fairchat App
Qt based mobile app for Android, iOS, Windows Phone.
......
Subproject commit fbe3688fafa48684390480209d112529d4c02787
Subproject commit ae67df7f380b389b35f33640399da4e6b16a27c0
......@@ -115,23 +115,23 @@
</activity>
<!-- For adding service(s) please check: https://wiki.qt.io/AndroidServices -->
<meta-data
<!--<meta-data
android:name="io.fabric.ApiKey"
android:value="b4bbd1f1832dad4f404daee41a3842d73924053c" /><!-- ATTENTION: This was auto-generated to add Google Play services to your project for
android:value="b4bbd1f1832dad4f404daee41a3842d73924053c" />--><!-- ATTENTION: This was auto-generated to add Google Play services to your project for
App Indexing. See https://g.co/AppIndexing/AndroidStudio for more information. -->
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
<service android:name="com.osalliance.rocketchatMobile.FcmMessageTokenHandler">
<intent-filter>
<action android:name="com.google.firebase.INSTANCE_ID_EVENT"/>
</intent-filter>
</service>
<service android:name="com.osalliance.rocketchatMobile.FcmMessageReceiver">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>
<!-- <meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
<service android:name="com.osalliance.rocketchatMobile.FcmMessageTokenHandler">
<intent-filter>
<action android:name="com.google.firebase.INSTANCE_ID_EVENT"/>
</intent-filter>
</service>
<service android:name="com.osalliance.rocketchatMobile.FcmMessageReceiver">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>-->
</application>
<uses-sdk
......
......@@ -27,6 +27,8 @@ buildscript {
repositories {
jcenter()
maven { url 'https://maven.fabric.io/public' }
maven { url 'https://maven.google.com' }
}
dependencies {
......@@ -41,6 +43,8 @@ allprojects {
jcenter()
mavenCentral()
maven { url 'https://maven.fabric.io/public' }
maven { url 'https://maven.google.com' }
}
}
......@@ -48,29 +52,32 @@ apply plugin: 'com.android.application'
repositories {
maven { url 'https://maven.fabric.io/public' }
maven { url 'https://maven.google.com' }
}
/*
apply plugin: 'io.fabric'
crashlytics {
enableNdk true
androidNdkOut '.'
androidNdkLibsOut './crashlytics/'
}
}*/
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile('com.crashlytics.sdk.android:crashlytics:2.7.1@aar') {
/* compile('com.crashlytics.sdk.android:crashlytics:2.9.1@aar') {
transitive = true
}
compile('com.crashlytics.sdk.android:crashlytics-ndk:1.1.6@aar') {
compile('com.crashlytics.sdk.android:crashlytics-ndk:2.0.1@aar') {
transitive = true
}
}*/
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.google.android.gms:play-services-gcm:10.2.4'
compile 'com.google.firebase:firebase-core:10.2.4'
compile 'com.google.firebase:firebase-crash:10.2.4'
compile 'com.google.firebase:firebase-messaging:10.2.4'
/*compile 'com.google.android.gms:play-services-gcm:11.8.0'
compile 'com.google.firebase:firebase-core:11.8.0'
compile 'com.google.firebase:firebase-crash:11.8.0'
compile 'com.google.firebase:firebase-messaging:11.8.0'*/
compile 'com.android.support:multidex:1.0.1'
compile 'me.leolin:ShortcutBadger:1.1.19@aar'
......@@ -126,15 +133,15 @@ android {
apply plugin: 'com.google.gms.google-services'
//apply plugin: 'com.google.gms.google-services'
copy {
from 'build/intermediates/exploded-aar/com.crashlytics.sdk.android/crashlytics-ndk/1.1.6/jni/'
into 'libs'
include '**/*'
}
copy {
from 'libs'
into 'crashlytics'
include '**/*'
}
//copy {
// from 'build/intermediates/exploded-aar/com.crashlytics.sdk.android/crashlytics-ndk/2.0.1/jni/'
// into 'libs'
// include '**/*'
//}
//copy {
// from 'libs'
// into 'crashlytics'
// include '**/*'
//}
/********************************************************************************************
* *
* Copyright (C) 2017 Armin Felder, Dennis Beier *
* This file is part of RocketChatMobileEngine <https://git.fairkom.net/chat/fairchat>. *
* *
* RocketChatMobileEngine is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* RocketChatMobileEngine is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with RocketChatMobileEngine. If not, see <http://www.gnu.org/licenses/>. *
* *
********************************************************************************************/
package com.osalliance.rocketchatMobile;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.support.v4.app.NotificationCompat;
import android.util.Log;
import com.google.firebase.messaging.FirebaseMessagingService;
import com.google.firebase.messaging.RemoteMessage;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.HashMap;
import java.util.Map;
import me.leolin.shortcutbadger.ShortcutBadger;
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";
private static NotificationManager mNotificationManager;
private static Notification.Builder builder;
public static int badgeCount = 0;
public static Context context;
public FcmMessageReceiver() {
super();
context = this;
}
public static void cleanNotifications(){
//mNotificationManager.cancelAll();
}
@Override
public void onMessageReceived(RemoteMessage remoteMessage){
super.onMessageReceived(remoteMessage);
String appname = MainActivity.getApplicationName(context);
Map<String,String> msg = remoteMessage.getData();
SharedPreferences sharedPref = context.getSharedPreferences(
new String(appname+".preferences"), Context.MODE_PRIVATE);
String title = msg.get("title");
String message = msg.get("message");
String ejson = msg.get("ejson");
String msgCount = msg.get("msgcnt");
if(msgCount !=null) {
SharedPreferences.Editor editor = sharedPref.edit();
int count = Integer.valueOf(msgCount);
int badgecount = sharedPref.getInt(new String("badgecount"), 0);
badgecount++;
FcmMessageReceiver.badgeCount += count;
editor.putInt(new String("badgecount"),badgecount);
editor.commit();
//MainActivity.setShortCutBadge();
ShortcutBadger.applyCount(this, badgecount);
}
String rid = "";
String server = "";
String name = "";
String type = "";
try {
if(ejson != null) {
JSONObject reader = new JSONObject(ejson);
rid = reader.getString("rid");
server = reader.getString("host");
name = reader.getString("name");
type = reader.getString("type");
if (name.compareTo("null") == 0 || name.length() == 0) {
JSONObject sender = reader.getJSONObject("sender");
name = sender.getString("username");
} else {
name = "";
}
}
}
catch (JSONException ex){
Log.i(TAG,ex.toString());
}
mNotificationManager = (NotificationManager)
this.getSystemService(Context.NOTIFICATION_SERVICE);
if(title !=null&& message !=null&&server !=null&&type !=null&&rid !=null) {
Intent intent = new Intent(this, MainActivity.class);
if(rid.length()>0)
intent.putExtra("rid", rid);
if(server.length()>0)
intent.putExtra("server", server);
if(name.length()>0)
intent.putExtra("name", name);
if(type.length()>0)
intent.putExtra("type", type);
PendingIntent contentIntent = PendingIntent.getActivity(this,
(int) System.currentTimeMillis(),
intent, 0);
Context appContext = context.getApplicationContext();
int icon = appContext.getResources().getIdentifier("ic_stat_name","drawable",MainActivity.getAndroidPackageName(context));
NotificationCompat.Builder mBuilder =
new NotificationCompat.Builder(this)
.setSmallIcon(icon)
.setColor(0x004f5d)
.setContentTitle(title)
.setStyle(new NotificationCompat.BigTextStyle()
.bigText(message))
.setContentText(message)
.setAutoCancel(true)
.setDefaults(DEFAULT_ALL);
mBuilder.setContentIntent(contentIntent);
mNotificationManager.notify(NOTIFICATION_ID, mBuilder.build());
}
}
@Override
public void onMessageSent(String msgId){
super.onMessageSent(msgId);
Log.i("push","push message sent");
}
}
......@@ -61,11 +61,11 @@ import android.content.res.Resources.Theme;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.GooglePlayServicesUtil;
import com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.gms.gcm.GoogleCloudMessaging;
import com.google.firebase.crash.FirebaseCrash;
//import com.google.android.gms.common.ConnectionResult;
//import com.google.android.gms.common.GooglePlayServicesUtil;
//import com.google.android.gms.common.api.GoogleApiClient;
//import com.google.android.gms.gcm.GoogleCloudMessaging;
//import com.google.firebase.crash.FirebaseCrash;
import android.content.pm.PackageManager;
import android.app.NotificationManager;
......@@ -80,13 +80,13 @@ import android.support.v4.app.ActivityCompat;
import java.io.IOException;
import java.util.List;
import io.fabric.sdk.android.Fabric;
//import io.fabric.sdk.android.Fabric;
import me.leolin.shortcutbadger.ShortcutBadger;
import com.crashlytics.android.Crashlytics;
/*import com.crashlytics.android.Crashlytics;
import com.crashlytics.android.ndk.CrashlyticsNdk;
*/
/**
* Main UI for the demo app.
*/
......@@ -111,7 +111,7 @@ public class MainActivity extends QtActivity {
* ATTENTION: This was auto-generated to implement the App Indexing API.
* See https://g.co/AppIndexing/AndroidStudio for more information.
*/
private GoogleApiClient client;
//private GoogleApiClient client;
public MainActivity() {
......@@ -134,8 +134,8 @@ public class MainActivity extends QtActivity {
e.printStackTrace();
}*/
Fabric fabric = new Fabric.Builder(this).debuggable(true).kits(new Crashlytics(), new CrashlyticsNdk()).build();
Fabric.with(fabric);
/* Fabric fabric = new Fabric.Builder(this).debuggable(true).kits(new Crashlytics(), new CrashlyticsNdk()).build();
Fabric.with(fabric);*/
//Fabric.with(this, new Crashlytics(), new CrashlyticsNdk());
//Fabric.with(this, new Crashlytics(), new CrashlyticsNdk());
......@@ -234,7 +234,7 @@ public class MainActivity extends QtActivity {
}
private boolean checkPlayServices() {
int resultCode = GooglePlayServicesUtil.isGooglePlayServicesAvailable(this);
/* int resultCode = GooglePlayServicesUtil.isGooglePlayServicesAvailable(this);
if (resultCode != ConnectionResult.SUCCESS) {
if (GooglePlayServicesUtil.isUserRecoverableError(resultCode)) {
GooglePlayServicesUtil.getErrorDialog(resultCode, this,
......@@ -245,7 +245,8 @@ public class MainActivity extends QtActivity {
}
return false;
}
return true;
return true;*/
return false;
}
public static String getApplicationName(Context context) {
......@@ -305,7 +306,7 @@ public class MainActivity extends QtActivity {
if (number >= 0) {
editor.putInt(new String("badgecount"),number);
editor.commit();
FcmMessageReceiver.badgeCount = number;
//FcmMessageReceiver.badgeCount = number;
setShortCutBadge();
if(number==0){
mNotificationManager.cancelAll();
......@@ -315,7 +316,7 @@ public class MainActivity extends QtActivity {
public static void setShortCutBadge() {
try {
ShortcutBadger.applyCount(context, FcmMessageReceiver.badgeCount);
//ShortcutBadger.applyCount(context, FcmMessageReceiver.badgeCount);
} catch (Exception ex) {
//Log.i(TAG,ex.toString());
......@@ -337,7 +338,7 @@ public class MainActivity extends QtActivity {
if (rid != null && name != null && type != null && server != null) {
if (server.length() > 0 && rid.length() > 0 && name.length() > 0 && type.length() > 0) {
ReceiveTextMessage.sendNotificationToCpp(server, rid, name, type);
//ReceiveTextMessage.sendNotificationToCpp(server, rid, name, type);
}
}
}
......@@ -353,7 +354,7 @@ public class MainActivity extends QtActivity {
if (rid != null && name != null && type != null && server != null) {
if (server.length() > 0 && rid.length() > 0 && name.length() > 0 && type.length() > 0) {
ReceiveTextMessage.sendNotificationToCpp(server, rid, name, type);
//ReceiveTextMessage.sendNotificationToCpp(server, rid, name, type);
}
}
}
......@@ -361,7 +362,7 @@ public class MainActivity extends QtActivity {
public static void catchError(String error) {
Log.i(TAG, error);
FirebaseCrash.report(new Exception(error));
// FirebaseCrash.report(new Exception(error));
}
/**
......
/********************************************************************************************
* *
* Copyright (C) 2017 Armin Felder, Dennis Beier *
* This file is part of RocketChatMobileEngine <https://git.fairkom.net/chat/fairchat>. *
* *
* RocketChatMobileEngine is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* RocketChatMobileEngine is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with RocketChatMobileEngine. If not, see <http://www.gnu.org/licenses/>. *
* *
********************************************************************************************/
package com.osalliance.rocketchatMobile;
import android.os.AsyncTask;
import com.google.android.gms.gcm.GoogleCloudMessaging;
import java.io.IOException;
public class RegisterTask extends AsyncTask<Void, Void, String> {
private static final String TAG = RegisterTask.class.getSimpleName();
private final GoogleCloudMessaging m_gcm;
private final String m_senderId;
public RegisterTask(){
this(null,null);
}
public RegisterTask(GoogleCloudMessaging gcm, String senderId){
m_gcm = gcm;
m_senderId = senderId;
}
@Override
protected String doInBackground(Void... voids){
try{
String regid = m_gcm.register(m_senderId);
return regid;
} catch(IOException ex){
handleRegisterError(ex.getMessage());
return "";
}
}
@Override
protected void onPostExecute(String result){
handleRegisterId(result);
}
private static native void handleRegisterId(String registrationId);
private static native void handleRegisterError(String error);
}
/********************************************************************************************
* *
* Copyright (C) 2017 Armin Felder, Dennis Beier *
* This file is part of RocketChatMobileEngine <https://git.fairkom.net/chat/fairchat>. *
* *
* RocketChatMobileEngine is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* RocketChatMobileEngine is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with RocketChatMobileEngine. If not, see <http://www.gnu.org/licenses/>. *
* *
********************************************************************************************/
#ifndef CONFIG1_H
#define CONFIG1_H
......
......@@ -25,7 +25,7 @@ else:unix: PRE_TARGETDEPS += $$OUT_PWD/../engine/libengine.a
TARGET = fairchat
VER_MAJ = 1
VER_MIN = 1
VER_PAT = 3
VER_PAT = 5
VERSION = $$sprintf("%1.%2.%3",$$VER_MAJ,$$VER_MIN,$$VER_PAT)
DEFINES += VERSION=\\\"$$VERSION\\\"
......
File mode changed from 100644 to 100755
/********************************************************************************************
* *
* Copyright (C) 2017 Armin Felder, Dennis Beier *
* This file is part of RocketChatMobileEngine <https://git.fairkom.net/chat/fairchat>. *
* *
* RocketChatMobileEngine is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* RocketChatMobileEngine is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with RocketChatMobileEngine. If not, see <http://www.gnu.org/licenses/>. *
* *
********************************************************************************************/
//
// IosBadges.h
// ucom
//
// Created by armin on 26/06/2017.
//
//
/********************************************************************************************
* *
* Copyright (C) 2017 Armin Felder, Dennis Beier *
* This file is part of RocketChatMobileEngine <https://git.fairkom.net/chat/fairchat>. *
* *
* RocketChatMobileEngine is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* RocketChatMobileEngine is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with RocketChatMobileEngine. If not, see <http://www.gnu.org/licenses/>. *
* *
********************************************************************************************/
#ifndef IosBadges_h
#define IosBadges_h
class IosBadges{
public:
IosBadges()= delete;
~IosBadges() = delete;