Skip to content

Commit

Permalink
Merge pull request #1292 from meganz/release/v3.7.7
Browse files Browse the repository at this point in the history
Release v3.7.7
  • Loading branch information
ash-mega authored Jul 30, 2020
2 parents 26a3339 + 7ecf61e commit e9945ba
Show file tree
Hide file tree
Showing 151 changed files with 4,665 additions and 2,303 deletions.
16 changes: 16 additions & 0 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
## General Information

- **MEGA Version:**

- **OS Version(s):**

- **Devices/Simulators:**

- **Reproducible? (Yes/No):**

## What happened?
...

## What did you expect to happen?
...

20 changes: 20 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
## What does this implement/fix? Explain your changes.
...

## Does this solve any currently open issues?
...

## Any relevant logs, error output, etc?
...

## Any other comments?
...

## Where has this been tested?

- **Devices/Simulators:**

- **OS Version:**

- **MEGA Version:**

24 changes: 15 additions & 9 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,28 +15,34 @@ This document will guide you to build the application on a Linux machine with An

### Build & Run the application

* Get the source code.
1. Get the source code.

```
git clone --recursive https://github.com/meganz/android.git
```

* Install in your system the Android NDK 14 and Android NDK 16.
2. Install in your system the [Android NDK 14](https://dl.google.com/android/repository/android-ndk-r14b-linux-x86_64.zip) and [Android NDK 16](https://dl.google.com/android/repository/android-ndk-r16b-linux-x86_64.zip).

* Configure the variable `NDK_ROOT32` to point to your Android NDK 14 installation path and the variable `NDK_ROOT64` to point to your Android NDK 16 installation path at `app/src/main/jni/build.sh`.
3. Configure the variable `NDK_ROOT32` to point to your Android NDK 14 installation path and the variable `NDK_ROOT64` to point to your Android NDK 16 installation path at `app/src/main/jni/build.sh`.

* Download the link https://mega.nz/#!wixgSaZZ!6zRMV_d8ogouBaEidHzGws1KvLrBwBiKEm0VIVgXEPk, uncompress it and put the folder `webrtc` in the path `app/src/main/jni/megachat/`.
4. Download the link https://mega.nz/#!wixgSaZZ!6zRMV_d8ogouBaEidHzGws1KvLrBwBiKEm0VIVgXEPk, uncompress it and put the folder `webrtc` in the path `app/src/main/jni/megachat/`.

* Go to `app/src/main/jni/` and execute: `./build.sh clean` and `./build.sh all`.
5. Before running the building script, install the required packages. For example for Ubuntu or other Debian-based distro:

* Download the link https://mega.nz/#!1tcl3CrL!i23zkmx7ibnYy34HQdsOOFAPOqQuTo1-2iZ5qFlU7-k, uncompress it and put the folders `debug` and `release` in the path `app/src/`.
```
sudo apt install build-essential swig automake libtool autoconf cmake
```

6. Build SDK by running `./build.sh all` at `app/src/main/jni/`. You could also run `./build.sh clean` to clean the previous configuration. **IMPORTANT:** check that the build process finished successfully, it should finish with the **Task finished OK** message. Otherwise, modify `LOG_FILE` variable in `build.sh` from `/dev/null` to a certain text file and run `./build.sh all` again for viewing the build errors.

7. Download the link https://mega.nz/#!1tcl3CrL!i23zkmx7ibnYy34HQdsOOFAPOqQuTo1-2iZ5qFlU7-k, uncompress it and put the folders `debug` and `release` in the path `app/src/`.

* Open the project with Android Studio, let it build the project and hit _*Run*_.
8. Open the project with Android Studio, let it build the project and hit _*Run*_.

### Notice

To use the *geolocation feature* you need a *Google Maps API key*:

* To get one, follow the directions here: https://developers.google.com/maps/documentation/android/signup.
1. To get one, follow the directions here: https://developers.google.com/maps/documentation/android/signup.

* Once you have your key, replace the "google_maps_key" string in these files: `app/src/debug/res/values/google_maps_api.xml` and `app/src/release/res/values/google_maps_api.xml`.
2. Once you have your key, replace the "google_maps_key" string in these files: `app/src/debug/res/values/google_maps_api.xml` and `app/src/release/res/values/google_maps_api.xml`.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ android {
applicationId "mega.privacy.android.app"
minSdkVersion 21
targetSdkVersion 29
versionCode 316
versionName "3.7.6 (316)"
versionCode 318
versionName "3.7.7 (318)"
multiDexEnabled true
ndk.abiFilters 'armeabi-v7a','x86', 'x86_64', 'arm64-v8a'
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -972,6 +972,14 @@ public void deleteAllSecondarySyncRecords(int type){
db.execSQL(sql);
}

public void deleteAllPrimarySyncRecords(int type) {
String sql = "DELETE FROM " + TABLE_SYNC_RECORDS + " WHERE " + KEY_SYNC_SECONDARY + " ='" + encrypt("false") + "'";
if (type != SyncRecord.TYPE_ANY) {
sql += " AND " + KEY_SYNC_TYPE + " = " + type;
}
db.execSQL(sql);
}

public void deleteVideoRecordsByState(int state){
String sql = "DELETE FROM " + TABLE_SYNC_RECORDS + " WHERE "
+ KEY_SYNC_STATE + " = " + state + " AND "
Expand Down
30 changes: 12 additions & 18 deletions app/src/main/java/mega/privacy/android/app/DownloadService.java
Original file line number Diff line number Diff line change
Expand Up @@ -366,21 +366,18 @@ protected void onHandleIntent(final Intent intent) {

currentDir = getDir(currentDocument, intent);
currentDir.mkdirs();
if (currentDir.isDirectory()){
logDebug("currentDir is Directory");
currentFile = new File(currentDir, megaApi.escapeFsIncompatible(currentDocument.getName()));
}
else{
logDebug("currentDir is File");
currentFile = currentDir;
}
if (currentDir.isDirectory()) {
currentFile = new File(currentDir, megaApi.escapeFsIncompatible(currentDocument.getName(), currentDir.getAbsolutePath() + SEPARATOR));
} else {
currentFile = currentDir;
}

if(intent.getBooleanExtra(EXTRA_DOWNLOAD_TO_SDCARD, false)) {
targetPaths.put(currentFile.getAbsolutePath(), intent.getStringExtra(EXTRA_TARGET_PATH));
targetUris.put(currentFile.getAbsolutePath(), intent.getStringExtra(EXTRA_TARGET_URI));
}

logDebug("dir: " + currentDir.getAbsolutePath() + " file: " + currentDocument.getName() + " Size: " + currentDocument.getSize());
if(!checkCurrentFile(currentDocument)){
if(!checkCurrentFile(currentDocument)){
logDebug("checkCurrentFile == false");

alreadyDownloaded++;
Expand Down Expand Up @@ -1808,16 +1805,13 @@ else if (request.getType() == MegaRequest.TYPE_FETCH_NODES){
else {
MegaNode node = request.getPublicMegaNode();

if(node!=null){
if (currentDir.isDirectory()){
currentFile = new File(currentDir, megaApi.escapeFsIncompatible(node.getName()));
logDebug("node.getName(): " + node.getName());

}
else{
if (node != null) {
if (currentDir.isDirectory()) {
currentFile = new File(currentDir, megaApi.escapeFsIncompatible(node.getName(), currentDir.getAbsolutePath() + SEPARATOR));
} else {
currentFile = currentDir;
logDebug("CURREN");
}

if(intent.getBooleanExtra(EXTRA_DOWNLOAD_TO_SDCARD, false)) {
targetPaths.put(currentFile.getAbsolutePath(), intent.getStringExtra(EXTRA_TARGET_PATH));
targetUris.put(currentFile.getAbsolutePath(), intent.getStringExtra(EXTRA_TARGET_URI));
Expand Down
90 changes: 85 additions & 5 deletions app/src/main/java/mega/privacy/android/app/MegaApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
import mega.privacy.android.app.fcm.KeepAliveService;
import mega.privacy.android.app.lollipop.LoginActivityLollipop;
import mega.privacy.android.app.lollipop.ManagerActivityLollipop;
import mega.privacy.android.app.lollipop.megachat.AppRTCAudioManager;
import mega.privacy.android.app.lollipop.MyAccountInfo;
import mega.privacy.android.app.lollipop.controllers.AccountController;
import mega.privacy.android.app.lollipop.megachat.BadgeIntentService;
Expand Down Expand Up @@ -82,6 +83,7 @@

import static mega.privacy.android.app.utils.CacheFolderManager.*;
import static mega.privacy.android.app.constants.BroadcastConstants.*;
import static mega.privacy.android.app.utils.ChatUtil.*;
import static mega.privacy.android.app.utils.Constants.*;
import static mega.privacy.android.app.utils.DBUtil.*;
import static mega.privacy.android.app.utils.IncomingCallNotification.*;
Expand All @@ -99,7 +101,7 @@ public class MegaApplication extends MultiDexApplication implements MegaChatRequ

final String TAG = "MegaApplication";

static final public String USER_AGENT = "MEGAAndroid/3.7.6_316";
static final public String USER_AGENT = "MEGAAndroid/3.7.7_318";

DatabaseHandler dbH;
MegaApiAndroid megaApi;
Expand Down Expand Up @@ -159,7 +161,9 @@ public class MegaApplication extends MultiDexApplication implements MegaChatRequ
private NetworkStateReceiver networkStateReceiver;
private BroadcastReceiver logoutReceiver;
private ChatAudioManager chatAudioManager = null;
private static MegaApplication singleApplicationInstance;
private AppRTCAudioManager rtcAudioManager = null;

private static MegaApplication singleApplicationInstance;

private PowerManager.WakeLock wakeLock;

Expand Down Expand Up @@ -235,9 +239,12 @@ else if(request.getType() == MegaRequest.TYPE_FETCH_NODES){
logDebug("TYPE_FETCH_NODES");
if (e.getErrorCode() == MegaError.API_OK){
askForFullAccountInfo();
GetAttrUserListener listener = new GetAttrUserListener(getApplicationContext(), true);
if (dbH != null && dbH.getMyChatFilesFolderHandle() == INVALID_HANDLE) {
megaApi.getMyChatFilesFolder(new GetAttrUserListener(getApplicationContext(), true));
megaApi.getMyChatFilesFolder(listener);
}
//Ask for MU and CU folder when App in init state
megaApi.getUserAttribute(USER_ATTR_CAMERA_UPLOADS_FOLDER,listener);
}
}
else if(request.getType() == MegaRequest.TYPE_GET_ATTR_USER){
Expand Down Expand Up @@ -444,7 +451,7 @@ public void onReceive(Context context, Intent intent) {
}

if (callStatus == MegaChatCall.CALL_STATUS_RING_IN || callStatus == MegaChatCall.CALL_STATUS_REQUEST_SENT) {
createChatAudioManager();
createChatAudioManager();
setAudioManagerValues(callStatus);
}

Expand Down Expand Up @@ -1294,6 +1301,7 @@ private void checkSeveralCall(MegaHandleList listAllCalls, int callStatus) {
private void removeValues(long chatId) {
removeStatusVideoAndSpeaker(chatId);
removeChatAudioManager();
removeRTCAudioManager();
}

private void checkCallDestroyed(long chatId, long callId, int termCode, boolean isIgnored, boolean isLocalTermCode) {
Expand Down Expand Up @@ -1333,22 +1341,94 @@ private void removeStatusVideoAndSpeaker(long chatId){
hashMapVideo.remove(chatId);
}

/**
* Create or update the AppRTCAudioManager for the in progress call.
*
* @param isSpeakerOn the speaker status.
*/
public void createRTCAudioManager(boolean isSpeakerOn) {
if (rtcAudioManager != null) {
logDebug("Updating RTC Audio Manager values...");
rtcAudioManager.updateSpeakerStatus(isSpeakerOn);
return;
}

logDebug("Creating RTC Audio Manager...");
rtcAudioManager = AppRTCAudioManager.create(this, isSpeakerOn);
startProximitySensor();
rtcAudioManager.setOnProximitySensorListener(isNear -> {
Intent intent = new Intent(BROADCAST_ACTION_INTENT_PROXIMITY_SENSOR);
intent.putExtra(UPDATE_PROXIMITY_SENSOR_STATUS, isNear);
LocalBroadcastManager.getInstance(getApplicationContext()).sendBroadcast(intent);
});
}

/**
* Remove the AppRTCAudioManager.
*/
public void removeRTCAudioManager() {
if (rtcAudioManager == null)
return;

try {
logDebug("Removing RTC Audio Manager...");
unregisterProximitySensor();
rtcAudioManager.stop();
rtcAudioManager = null;
} catch (Exception e) {
logError("Exception stopping speaker audio manager", e);
}
}

/**
* Activate the proximity sensor.
*/
public void startProximitySensor() {
if (rtcAudioManager != null) {
logDebug("Starting proximity sensor...");
rtcAudioManager.startProximitySensor();
}
}

/**
* Deactivates the proximity sensor
*/
public void unregisterProximitySensor() {
if (rtcAudioManager != null) {
logDebug("Stopping proximity sensor...");
rtcAudioManager.unregisterProximitySensor();
}
}

/**
* Create the ChatAudioManager for the incoming and outgoing call.
*/
public void createChatAudioManager() {
if (chatAudioManager != null)
return;

logDebug("Creating Chat Audio Manager...");
chatAudioManager = ChatAudioManager.create(getApplicationContext());
}

/**
* Remove the ChatAudioManager.
*/
public void removeChatAudioManager() {
if (chatAudioManager == null) {
return;
}

logDebug("Removing Chat Audio Manager...");
chatAudioManager.stopAudioSignals();
chatAudioManager = null;
}

/**
* Update the values of the ChatAudioManager depending on the call status.
*
* @param callStatus The current call status.
*/
public void setAudioManagerValues(int callStatus){
if (chatAudioManager != null) {
MegaHandleList listCallsRequest = megaChatApi.getChatCalls(MegaChatCall.CALL_STATUS_REQUEST_SENT);
Expand Down Expand Up @@ -1378,7 +1458,7 @@ public void launchCallActivity(MegaChatCall call) {
startActivity(i);

MegaChatRoom chatRoom = megaChatApi.getChatRoom(call.getChatid());
logDebug("Launch call: " + chatRoom.getTitle());
logDebug("Launch call: " + getTitleChat(chatRoom));
if (call.getStatus() == MegaChatCall.CALL_STATUS_REQUEST_SENT || call.getStatus() == MegaChatCall.CALL_STATUS_RING_IN) {
setCallLayoutStatus(call.getChatid(), true);
}
Expand Down
Loading

0 comments on commit e9945ba

Please sign in to comment.