Skip to content
This repository was archived by the owner on Jan 30, 2025. It is now read-only.

Commit dbbb129

Browse files
committed
Kill Riot-Android (for F-Droid users) (Fixes #3507)
1 parent 9a68b05 commit dbbb129

File tree

13 files changed

+135
-2
lines changed

13 files changed

+135
-2
lines changed

CHANGES.rst

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
1-
Changes in Riot 0.9.13 (2020-XX-XX)
1+
Changes in Riot 0.9.13 (2020-08-25)
22
===================================================
33

4+
Riot-Android is now deprecated, and not maintained by the core team anymore.
5+
The version 0.9.13 contains code to inform F-Droid users that the application is deprecated and they have to install Element Android instead (#3507).
6+
This branch will never be merged on develop.
7+
48
MatrixSdk 🚀:
59
- Upgrade MatrixSdk to version 0.X.Y.
610
- Changelog: https://github.com/matrix-org/matrix-android-sdk/releases/tag/v0.X.Y

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ buildscript {
2424
// global properties used in sub modules
2525
ext {
2626
versionCodeProp = 90913
27-
versionNameProp = "0.9.13-dev"
27+
versionNameProp = "0.9.13"
2828
versionBuild = System.getenv("BUILD_NUMBER") as Integer ?: 0
2929
buildNumberProp = "${versionBuild}"
3030
}

vector/src/main/AndroidManifest.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@
4343
<!-- disable the battery optimisation on some devices to let the background sync works -->
4444
<uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS" />
4545

46+
<!-- To be able to delete the app -->
47+
<uses-permission android:name="android.permission.REQUEST_DELETE_PACKAGES" />
48+
4649
<!-- videocall feature -->
4750
<!-- android.permission.CAMERA defines android.hardware.camera -->
4851
<uses-feature

vector/src/main/java/im/vector/activity/LoginActivity.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,8 @@
106106
import im.vector.util.PhoneNumberUtils;
107107
import im.vector.util.ViewUtilKt;
108108

109+
import static im.vector.disclaimer.DisclaimerDialogKt.showDisclaimerDialog;
110+
109111
/**
110112
* Displays the login screen.
111113
*/
@@ -1072,6 +1074,8 @@ protected void onResume() {
10721074
}
10731075

10741076
refreshDisplay(true);
1077+
1078+
showDisclaimerDialog(this, false);
10751079
}
10761080

10771081
/**

vector/src/main/java/im/vector/activity/VectorHomeActivity.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,8 @@
142142
import im.vector.view.UnreadCounterBadgeView;
143143
import im.vector.view.VectorPendingCallView;
144144

145+
import static im.vector.disclaimer.DisclaimerDialogKt.showDisclaimerDialog;
146+
145147
/**
146148
* Displays the main screen of the app, with rooms the user has joined and the ability to create
147149
* new rooms.
@@ -570,6 +572,8 @@ private void showFloatingActionMenuIfRequired() {
570572
}
571573
}
572574

575+
private Boolean disclaimerShown = false;
576+
573577
@Override
574578
protected void onResume() {
575579
super.onResume();
@@ -635,6 +639,11 @@ public void onClick(DialogInterface dialog, int which) {
635639
} catch (Exception e) {
636640
Log.e(LOG_TAG, "## onResume() : appCrashedAlert failed " + e.getMessage(), e);
637641
}
642+
} else {
643+
if (!disclaimerShown) {
644+
disclaimerShown = true;
645+
showDisclaimerDialog(this, true);
646+
}
638647
}
639648

640649
if (null != mMemberIdToOpen) {
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
/*
2+
* Copyright 2019 New Vector Ltd
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package im.vector.disclaimer
18+
19+
import android.app.Activity
20+
import android.content.ActivityNotFoundException
21+
import android.content.Intent
22+
import android.net.Uri
23+
import android.os.Build
24+
import androidx.appcompat.app.AlertDialog
25+
import im.vector.BuildConfig
26+
import im.vector.R
27+
import im.vector.util.openPlayStore
28+
import org.jetbrains.anko.toast
29+
30+
fun showDisclaimerDialog(activity: Activity, allowAppAccess: Boolean) {
31+
// Element is only available on Android 5.0
32+
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
33+
return
34+
}
35+
36+
val dialogLayout = activity.layoutInflater.inflate(R.layout.dialog_disclaimer_content, null)
37+
38+
AlertDialog.Builder(activity)
39+
.setView(dialogLayout)
40+
.setCancelable(allowAppAccess)
41+
.apply {
42+
if (allowAppAccess) {
43+
setNegativeButton(R.string.element_disclaimer_negative_button, null)
44+
} else {
45+
setNegativeButton(R.string.action_close) { _, _ -> activity.finish() }
46+
setNeutralButton(R.string.element_disclaimer_uninstall_button) { _, _ -> uninstall(activity) }
47+
}
48+
}
49+
.setPositiveButton(R.string.element_disclaimer_positive_button) { _, _ ->
50+
openPlayStore(activity, "im.vector.app")
51+
}
52+
.show()
53+
}
54+
55+
private fun uninstall(activity: Activity) {
56+
@Suppress("DEPRECATION")
57+
val intent = Intent(Intent.ACTION_UNINSTALL_PACKAGE)
58+
intent.data = Uri.parse("package:" + BuildConfig.APPLICATION_ID)
59+
try {
60+
activity.startActivity(intent)
61+
} catch (anfe: ActivityNotFoundException) {
62+
activity.toast(R.string.error_no_external_application_found)
63+
}
64+
}
6.29 KB
Loading
4.26 KB
Loading
8.44 KB
Loading
14.1 KB
Loading

0 commit comments

Comments
 (0)