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

Commit 10c3e52

Browse files
committed
Merge branch 'release/0.8.10'
2 parents ffd1866 + 3c97b99 commit 10c3e52

37 files changed

+1143
-341
lines changed

CHANGES.rst

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,25 @@
1+
Changes in Riot 0.8.10 (2018-01-06)
2+
===================================================
3+
4+
Improvements:
5+
* Update matrix-sdk.aar lib (v0.9.5).
6+
* GDPR compliance:
7+
* Account deactivation is now managed natively in a dedicated screen
8+
9+
Features:
10+
* Send stickers to a Room
11+
12+
Bug Fix:
13+
* Gif do not play anymore (#2168)
14+
115
Changes in Riot 0.8.9 (2018-05-25)
216
===================================================
317

418
Improvements:
19+
* Update matrix-sdk.aar lib (v0.9.4).
520
* GDPR compliance:
621
* Manage M_CONSENT_NOT_GIVEN matrix error
7-
* Sending analytics is no opt-in
22+
* Sending analytics is now opt-in
823
* Possibility to deactivate account (redirected to the web client for the moment)
924
* Reply to feature: display only
1025

build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ buildscript {
1919

2020
// global properties used in sub modules
2121
ext {
22-
versionCodeProp = 80900
23-
versionNameProp = "0.8.9"
22+
versionCodeProp = 81000
23+
versionNameProp = "0.8.10"
2424
versionBuild = System.getenv("BUILD_NUMBER") as Integer ?: 0
2525
buildNumberProp = "${versionBuild}"
2626
}

build_riot_apks.sh

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,17 @@
11
#!/bin/bash
2+
3+
# Clean all existing APK
24
rm *.apk
3-
./gradlew clean
45

5-
./gradlew lintAppRelease assembleAppMatrixorg
6-
./gradlew lintAppfdroidRelease assembleAppfdroidMatrixorg
6+
# Clean
7+
./gradlew clean
8+
9+
# Run Lint and build the APK for the PlayStore
10+
./gradlew lintAppMatrixorg assembleAppMatrixorg --stacktrace
11+
12+
# Run Lint and build the APK for FDroid
13+
./gradlew lintAppfdroidMatrixorg assembleAppfdroidMatrixorg --stacktrace
714

8-
#cp app/build/outputs/apk/app-alpha-matrixorg.apk ./alpha.apk
15+
# Copy (and rename) the built APKs to the root folder
916
cp vector/build/outputs/apk/app/matrixorg/vector-app-matrixorg.apk ./riotGooglePlay.apk
1017
cp vector/build/outputs/apk/appfdroid/matrixorg/vector-appfdroid-matrixorg.apk ./riotFDroid.apk

settings.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ include ':vector'
33

44
// uncomment theses lines to compile matrix SDK as project sources instead of external lib
55
// see build.gradle section Matrix SDK management
6-
include ':matrix-sdk'
7-
project(':matrix-sdk').projectDir = new File(settingsDir, '../matrix-android-sdk/matrix-sdk')
6+
//include ':matrix-sdk'
7+
//project(':matrix-sdk').projectDir = new File(settingsDir, '../matrix-android-sdk/matrix-sdk')

tools/debug_dump_filesystem.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/usr/bin/env bash
2+
3+
adb shell am broadcast -a im.vector.receiver.DEBUG_ACTION_DUMP_FILESYSTEM

tools/debug_dump_prefs.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/usr/bin/env bash
2+
3+
adb shell am broadcast -a im.vector.receiver.DEBUG_ACTION_DUMP_PREFERENCES

vector/libs/matrix-sdk.aar

3.38 KB
Binary file not shown.
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
/*
2+
* Copyright 2018 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.receiver
18+
19+
import android.content.*
20+
import android.preference.PreferenceManager
21+
import android.util.Log
22+
import im.vector.util.lsFiles
23+
24+
/**
25+
* Receiver to handle some command from ADB
26+
*/
27+
class DebugReceiver : BroadcastReceiver() {
28+
29+
override fun onReceive(context: Context, intent: Intent) {
30+
when (intent.action) {
31+
DEBUG_ACTION_DUMP_FILESYSTEM -> lsFiles(context)
32+
DEBUG_ACTION_DUMP_PREFERENCES -> dumpPreferences(context)
33+
}
34+
}
35+
36+
private fun dumpPreferences(context: Context) {
37+
logPrefs("DefaultSharedPreferences", PreferenceManager.getDefaultSharedPreferences(context))
38+
logPrefs("Vector.LoginStorage", context.getSharedPreferences("Vector.LoginStorage", Context.MODE_PRIVATE))
39+
logPrefs("GcmRegistrationManager", context.getSharedPreferences("GcmRegistrationManager", Context.MODE_PRIVATE))
40+
}
41+
42+
private fun logPrefs(name: String, sharedPreferences: SharedPreferences?) {
43+
Log.d(LOG_TAG, "SharedPreferences $name:")
44+
45+
sharedPreferences?.let { prefs ->
46+
prefs.all.keys.forEach { key ->
47+
Log.d(LOG_TAG, "$key : ${prefs.all[key]}")
48+
}
49+
}
50+
}
51+
52+
companion object {
53+
private const val LOG_TAG = "DebugReceiver"
54+
55+
private const val DEBUG_ACTION_DUMP_FILESYSTEM = "im.vector.receiver.DEBUG_ACTION_DUMP_FILESYSTEM"
56+
private const val DEBUG_ACTION_DUMP_PREFERENCES = "im.vector.receiver.DEBUG_ACTION_DUMP_PREFERENCES"
57+
58+
fun getIntentFilter() = IntentFilter().apply {
59+
addAction(DEBUG_ACTION_DUMP_FILESYSTEM)
60+
addAction(DEBUG_ACTION_DUMP_PREFERENCES)
61+
}
62+
}
63+
}

vector/src/main/java/im/vector/Matrix.java

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,15 @@
2121
import android.content.Context;
2222
import android.content.Intent;
2323
import android.content.pm.PackageInfo;
24+
import android.support.annotation.NonNull;
2425
import android.text.TextUtils;
2526

2627
import org.matrix.androidsdk.crypto.IncomingRoomKeyRequest;
2728
import org.matrix.androidsdk.crypto.IncomingRoomKeyRequestCancellation;
2829
import org.matrix.androidsdk.crypto.MXCrypto;
2930
import org.matrix.androidsdk.rest.callback.ApiCallback;
3031
import org.matrix.androidsdk.rest.callback.SimpleApiCallback;
32+
import org.matrix.androidsdk.rest.client.LoginRestClient;
3133
import org.matrix.androidsdk.rest.model.MatrixError;
3234
import org.matrix.androidsdk.ssl.Fingerprint;
3335
import org.matrix.androidsdk.ssl.UnrecognizedCertificateException;
@@ -465,6 +467,40 @@ public static boolean hasValidSessions() {
465467
// Session management
466468
//==============================================================================================================
467469

470+
/**
471+
* Deactivate a session.
472+
*
473+
* @param context the context.
474+
* @param session the session to deactivate.
475+
* @param userPassword the user password
476+
* @param eraseUserData true to also erase all the user data
477+
* @param aCallback the success and failure callback
478+
*/
479+
public void deactivateSession(final Context context,
480+
final MXSession session,
481+
final String userPassword,
482+
final boolean eraseUserData,
483+
final @NonNull ApiCallback<Void> aCallback) {
484+
Log.d(LOG_TAG, "## deactivateSession() " + session.getMyUserId());
485+
486+
session.deactivateAccount(context, LoginRestClient.LOGIN_FLOW_TYPE_PASSWORD, userPassword, eraseUserData, new SimpleApiCallback<Void>(aCallback) {
487+
@Override
488+
public void onSuccess(Void info) {
489+
mLoginStorage.removeCredentials(session.getHomeServerConfig());
490+
491+
session.getDataHandler().removeListener(mLiveEventListener);
492+
493+
VectorApp.removeSyncingSession(session);
494+
495+
synchronized (LOG_TAG) {
496+
mMXSessions.remove(session);
497+
}
498+
499+
aCallback.onSuccess(info);
500+
}
501+
});
502+
}
503+
468504
/**
469505
* Clear a session.
470506
*

vector/src/main/java/im/vector/activity/AbstractWidgetActivity.kt

Lines changed: 59 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import butterknife.BindView
2727
import com.google.gson.reflect.TypeToken
2828
import im.vector.Matrix
2929
import im.vector.R
30+
import im.vector.activity.util.INTEGRATION_MANAGER_ACTIVITY_REQUEST_CODE
3031
import im.vector.types.JsonDict
3132
import im.vector.types.WidgetEventData
3233
import im.vector.util.AssetReader
@@ -167,6 +168,11 @@ abstract class AbstractWidgetActivity : RiotAppCompatActivity() {
167168
}
168169

169170
override fun onPageFinished(view: WebView, url: String) {
171+
// Check that the Activity is still alive
172+
if (isDestroyed) {
173+
return
174+
}
175+
170176
hideWaitingView()
171177

172178
val js = AssetReader.readAssetFile(this@AbstractWidgetActivity, "postMessageAPI.js")
@@ -236,7 +242,42 @@ abstract class AbstractWidgetActivity : RiotAppCompatActivity() {
236242
*
237243
* @return true if the message is handled (it means an answer has been sent), false if not
238244
*/
239-
abstract fun dealsWithWidgetRequest(eventData: JsonDict<Any>): Boolean
245+
@CallSuper
246+
open fun dealsWithWidgetRequest(eventData: JsonDict<Any>): Boolean {
247+
val action = eventData["action"] as String?
248+
249+
when (action) {
250+
"integration_manager_open" -> {
251+
var integType: String? = null
252+
var integId: String? = null
253+
254+
val data = eventData["data"]
255+
256+
data
257+
.takeIf { it is Map<*, *> }
258+
?.let {
259+
val dict = data as Map<*, *>
260+
261+
dict["integType"]
262+
.takeIf { it is String }
263+
?.let { integType = it as String }
264+
265+
dict["integId"]
266+
.takeIf { it is String }
267+
?.let { integId = it as String }
268+
269+
// Add "type_" as a prefix
270+
integType?.let { integType = "type_$integType" }
271+
}
272+
273+
openIntegrationManager(integId, integType)
274+
return true
275+
}
276+
}
277+
278+
// Not handled
279+
return false
280+
}
240281

241282
/*
242283
* *********************************************************************************************
@@ -350,6 +391,23 @@ abstract class AbstractWidgetActivity : RiotAppCompatActivity() {
350391
sendObjectResponse(any.toJsonMap(), eventData)
351392
}
352393

394+
/* ==========================================================================================
395+
* Protected methods
396+
* ========================================================================================== */
397+
398+
/**
399+
* Open integration manager
400+
*/
401+
protected fun openIntegrationManager(widgetId: String?, screenId: String?) {
402+
val intent = IntegrationManagerActivity.getIntent(context = this,
403+
matrixId = mSession!!.myUserId,
404+
roomId = mRoom!!.roomId,
405+
widgetId = widgetId,
406+
screenId = screenId)
407+
408+
startActivityForResult(intent, INTEGRATION_MANAGER_ACTIVITY_REQUEST_CODE)
409+
}
410+
353411
/* ==========================================================================================
354412
* INNER CLASSES
355413
* ========================================================================================== */

0 commit comments

Comments
 (0)