Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ android {
applicationId 'com.nextcloud.talk2'
dimension "default"
}
unifiedpush {
applicationId 'com.nextcloud.talk2'
dimension "default"
}
qa {
applicationId "com.nextcloud.talk2.qa"
dimension "default"
Expand Down Expand Up @@ -336,6 +340,8 @@ dependencies {
gplayImplementation 'com.google.android.gms:play-services-base:18.0.1'
gplayImplementation "com.google.firebase:firebase-messaging:23.0.5"

unifiedpushImplementation 'com.github.UnifiedPush:android-connector:2.0.1'

// implementation 'androidx.activity:activity-ktx:1.4.0'
}

Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/com/nextcloud/talk/utils/ApiUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ public static String getUrlNextcloudPush(String baseUrl) {

public static String getUrlPushProxy() {
return NextcloudTalkApplication.Companion.getSharedApplication().
getApplicationContext().getResources().getString(R.string.nc_push_server_url) + "/devices";
appPreferences.getPushServerUrl() + "/devices";
}

public static String getUrlForNotificationWithId(String baseUrl, String notificationId) {
Expand Down
3 changes: 1 addition & 2 deletions app/src/main/java/com/nextcloud/talk/utils/PushUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,7 @@ public PushUtils() {
String keyPath = NextcloudTalkApplication.Companion.getSharedApplication().getDir("PushKeystore", Context.MODE_PRIVATE).getAbsolutePath();
publicKeyFile = new File(keyPath, "push_key.pub");
privateKeyFile = new File(keyPath, "push_key.priv");
proxyServer = NextcloudTalkApplication.Companion.getSharedApplication().getResources().
getString(R.string.nc_push_server_url);
proxyServer = appPreferences.getPushServerUrl();
}

public SignatureVerification verifySignature(byte[] signatureBytes, byte[] subjectBytes) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,17 @@ public interface AppPreferences {
@RemoveMethod
void removePushToken();

@KeyByString("push_server_url")
@DefaultValue(R.string.nc_push_server_url)
String getPushServerUrl();

@KeyByString("push_server_url")
void setPushServerUrl(String pushServerUrl);

@KeyByString("push_server_url")
@RemoveMethod
void removePushServerUrl();

@KeyByString("tempClientCertAlias")
String getTemporaryClientCertAlias();

Expand Down
56 changes: 56 additions & 0 deletions app/src/unifiedpush/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<!--
~ Nextcloud Talk application
~
~ @author Mario Danic
~ @author Tim Krüger
~ Copyright (C) 2022 Tim Krüger <t@timkrueger.me>
~ Copyright (C) 2017-2019 Mario Danic <mario@lovelyhq.com>
~
~ This program 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.
~
~ This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
-->

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.nextcloud.talk">

<application
android:name=".application.NextcloudTalkApplication"
android:allowBackup="true"
android:fullBackupContent="@xml/backup_config"
android:icon="@mipmap/ic_launcher"
android:label="@string/nc_app_name"
android:networkSecurityConfig="@xml/network_security_config"
android:supportsRtl="true"
android:theme="@style/AppTheme.Launcher"
tools:replace="label, icon, theme, name, allowBackup"
tools:ignore="UnusedAttribute, ExportedService">

<service
android:name=".services.unifiedpush.ChatAndCallMessagingService"
android:exported="false"
android:foregroundServiceType="phoneCall"
android:permission="android.permission.BIND_JOB_SERVICE" />

<receiver
android:name=".utils.unifiedpush.UnifiedPushMessagingReceiver"
android:exported="true">
<intent-filter>
<action android:name="org.unifiedpush.android.connector.MESSAGE"/>
<action android:name="org.unifiedpush.android.connector.UNREGISTERED"/>
<action android:name="org.unifiedpush.android.connector.NEW_ENDPOINT"/>
<action android:name="org.unifiedpush.android.connector.REGISTRATION_REFUSED"/>
</intent-filter>
</receiver>
</application>
</manifest>
Loading