Skip to content

Commit

Permalink
Merge branch 'release/v4.1.1' into 'master'
Browse files Browse the repository at this point in the history
Release v4.1.1

See merge request mobile/android/android!1760
  • Loading branch information
javiergm1983 committed Apr 19, 2021
2 parents 564278b + 51082b1 commit 436ffd8
Show file tree
Hide file tree
Showing 4,949 changed files with 17,664 additions and 49,229 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
2 changes: 1 addition & 1 deletion Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export JAVA_HOME=/path/to/jdk
ln -s /path/to/jdk ${HOME}/android-java
```

6. Download the link https://mega.nz/file/t81HSYJI#KQNzSEqmGVSXfwmQx2HMJy3Jo2AcDfYm4oiMP_CFW6s, uncompress it and put the folder `webrtc` in the path `app/src/main/jni/megachat/`.
6. Download the link https://mega.nz/file/RsMEgZqA#s0P754Ua7AqvWwamCeyrvNcyhmPjHTQQIxtqziSU4HI, uncompress it and put the folder `webrtc` in the path `app/src/main/jni/megachat/`.

7. Before running the building script, install the required packages. For example for Ubuntu or other Debian-based distro:

Expand Down
18 changes: 7 additions & 11 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -146,15 +146,13 @@ dependencies {
// Architecture Components
implementation "androidx.fragment:fragment-ktx:$fragmentKtxVersion"

implementation "androidx.lifecycle:lifecycle-extensions:$lifecycleVersion"
implementation "androidx.lifecycle:lifecycle-livedata-ktx:$lifecycleVersion"
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycleVersion"
implementation "androidx.lifecycle:lifecycle-runtime-ktx:$lifecycleVersion"
implementation "androidx.lifecycle:lifecycle-reactivestreams-ktx:$lifecycleVersion"
implementation "androidx.lifecycle:lifecycle-livedata-core-ktx:$lifecycleVersion"
implementation "androidx.lifecycle:lifecycle-common-java8:$lifecycleVersion"
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycleVersion"
implementation "androidx.lifecycle:lifecycle-process:$lifecycleVersion"
implementation "androidx.lifecycle:lifecycle-service:$lifecycleVersion"

implementation "androidx.navigation:navigation-runtime-ktx:$navigationVersion"
implementation "androidx.navigation:navigation-fragment-ktx:$navigationVersion"
Expand All @@ -173,30 +171,29 @@ dependencies {
// Other libs
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.exifinterface:exifinterface:1.3.0'
implementation 'com.google.android.material:material:1.2.1'
implementation 'androidx.recyclerview:recyclerview:1.1.0'
implementation 'com.github.nirhart:parallaxscroll:1.0'
implementation 'androidx.palette:palette-ktx:1.0.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'com.vdurmont:emoji-java:4.0.0'
implementation 'com.google.android.exoplayer:exoplayer-core:2.11.8'
implementation 'com.google.android.exoplayer:exoplayer-ui:2.11.8'
implementation(name: 'exoplayer-extension-ffmpeg-2.11.8', ext: 'aar')
implementation 'com.google.android.exoplayer:exoplayer-core:2.12.1'
implementation 'com.google.android.exoplayer:exoplayer-ui:2.12.1'
implementation(name: 'exoplayer-extension-ffmpeg-2.12.1', ext: 'aar')
implementation(name: 'exoplayer-extension-flac-2.12.1', ext: 'aar')
implementation 'com.google.zxing:core:3.4.0'
implementation 'com.budiyev.android:code-scanner:1.8.3'
implementation 'me.leolin:ShortcutBadger:1.1.22@aar'
implementation 'com.brandongogetap:stickyheaders:0.6.1'
implementation 'com.github.ittianyu:BottomNavigationViewEx:2.0.4'
implementation 'androidx.multidex:multidex:2.0.1'
implementation 'androidx.emoji:emoji:1.1.0'
implementation 'androidx.emoji:emoji-appcompat:1.1.0'
implementation 'androidx.emoji:emoji-bundled:1.1.0'
implementation 'androidx.preference:preference-ktx:1.1.1'
implementation 'io.supercharge:shimmerlayout:2.1.0'
implementation 'net.opacapp:multiline-collapsingtoolbar:27.1.1'
implementation 'com.github.tony19:named-regexp:0.2.5'
implementation 'org.hamcrest:hamcrest-library:1.3'
implementation 'com.google.code.gson:gson:2.8.5'
implementation 'com.google.android:flexbox:2.0.1'
implementation 'jp.wasabeef:blurry:2.1.0'
implementation 'com.github.meganz.AndroidDocumentScanner:documentscanner:2.0.6'

Expand All @@ -220,8 +217,7 @@ dependencies {

implementation 'com.squareup.retrofit2:retrofit:2.9.0'
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'

implementation "android.arch.lifecycle:common-java8:$lifecycleVersion"
implementation files('src/main/libs/libwebrtc.jar')

implementation "com.jeremyliao:live-event-bus-x:$liveEventBus"

Expand Down
25 changes: 13 additions & 12 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,9 @@

<activity
android:name="mega.privacy.android.app.lollipop.FileExplorerActivityLollipop"
android:launchMode="singleTask"
android:configChanges="orientation|screenSize"
android:label="@string/app_name"
android:launchMode="singleTask"
android:windowSoftInputMode="adjustNothing">

<intent-filter>
Expand Down Expand Up @@ -335,8 +336,7 @@
</activity>
<activity
android:name=".activities.OfflineFileInfoActivity"
android:label="@string/app_name"
android:configChanges="orientation|screenSize" />
android:label="@string/app_name" />

<activity
android:name="mega.privacy.android.app.lollipop.VersionsFileActivity"
Expand Down Expand Up @@ -384,12 +384,15 @@
</activity>

<activity
android:name="mega.privacy.android.app.lollipop.AudioVideoPlayerLollipop"
android:label="@string/app_name"
android:name=".mediaplayer.VideoPlayerActivity"
android:windowSoftInputMode="adjustNothing"
android:theme="@style/Theme.Dark.FullScreen.Draggable" />

<activity
android:name=".mediaplayer.AudioPlayerActivity"
android:windowSoftInputMode="adjustNothing"
android:launchMode="singleTop"
android:configChanges="orientation|screenSize"
android:theme="@style/Theme.Dark.FullScreen.Draggable">
</activity>
android:screenOrientation="portrait" />

<activity
android:name="mega.privacy.android.app.lollipop.qrcode.QRCodeActivity"
Expand Down Expand Up @@ -527,10 +530,8 @@
android:exported="false" >
</service>

<service
android:name="MegaStreamingService"
android:exported="false" >
</service>
<service android:name=".mediaplayer.service.AudioPlayerService" android:exported="false" />
<service android:name=".mediaplayer.service.VideoPlayerService" android:exported="false" />

<service
android:name=".jobservices.CameraUploadsService"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ private String getTransferPath(MegaTransfer transfer) {
MegaNode parentNode = app.getMegaApi().getNodeByHandle(transfer.getParentHandle());

if (parentNode != null) {
return removeLastFileSeparator(getParentFolderPath(parentNode));
return removeLastFileSeparator(getNodeFolderPath(parentNode));
}
break;

Expand Down
47 changes: 44 additions & 3 deletions app/src/main/java/mega/privacy/android/app/BaseActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import com.google.android.material.snackbar.Snackbar;

import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.text.HtmlCompat;
Expand All @@ -36,6 +37,10 @@
import android.widget.LinearLayout;
import android.widget.TextView;

import org.jetbrains.annotations.NotNull;

import mega.privacy.android.app.interfaces.ActivityLauncher;
import mega.privacy.android.app.interfaces.PermissionRequester;
import mega.privacy.android.app.listeners.ChatLogoutListener;
import mega.privacy.android.app.lollipop.LoginActivityLollipop;
import mega.privacy.android.app.lollipop.ManagerActivityLollipop;
Expand All @@ -46,6 +51,7 @@
import mega.privacy.android.app.snackbarListeners.SnackbarNavigateOption;
import mega.privacy.android.app.utils.PermissionUtils;
import mega.privacy.android.app.utils.ColorUtils;
import mega.privacy.android.app.utils.StringResourcesUtils;
import mega.privacy.android.app.utils.Util;
import nz.mega.sdk.MegaAccountDetails;
import nz.mega.sdk.MegaApiAndroid;
Expand All @@ -66,7 +72,7 @@
import static nz.mega.sdk.MegaApiJava.*;
import static nz.mega.sdk.MegaChatApiJava.MEGACHAT_INVALID_HANDLE;

public class BaseActivity extends AppCompatActivity {
public class BaseActivity extends AppCompatActivity implements ActivityLauncher, PermissionRequester {

private static final String EXPIRED_BUSINESS_ALERT_SHOWN = "EXPIRED_BUSINESS_ALERT_SHOWN";
private static final String TRANSFER_OVER_QUOTA_WARNING_SHOWN = "TRANSFER_OVER_QUOTA_WARNING_SHOWN";
Expand Down Expand Up @@ -163,6 +169,9 @@ protected void onCreate(Bundle savedInstanceState) {
registerReceiver(resumeTransfersReceiver,
new IntentFilter(BROADCAST_ACTION_RESUME_TRANSFERS));

registerReceiver(cookieSettingsReceiver,
new IntentFilter(BROADCAST_ACTION_COOKIE_SETTINGS_SAVED));

if (savedInstanceState != null) {
isExpiredBusinessAlertShown = savedInstanceState.getBoolean(EXPIRED_BUSINESS_ALERT_SHOWN, false);
if (isExpiredBusinessAlertShown) {
Expand Down Expand Up @@ -517,6 +526,23 @@ public void onReceive(Context context, Intent intent) {
}
};

/**
* Broadcast to show a snackbar when the Cookie settings has been saved
*/
protected BroadcastReceiver cookieSettingsReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
if (isPaused || !isActivityInForeground() || intent == null) {
return;
}

View view = getWindow().getDecorView().findViewById(android.R.id.content);
if (view != null) {
showSnackbar(view, StringResourcesUtils.getString(R.string.dialog_cookie_snackbar_saved));
}
}
};

/**
* Method to display an alert dialog indicating that the MEGA SSL key
* can't be verified (API_ESSL Error) and giving the user several options.
Expand Down Expand Up @@ -929,7 +955,7 @@ private void showConfirmationEnableLogs(boolean sdk, boolean karere) {
if (!hasPermissions(baseActivity, Manifest.permission.WRITE_EXTERNAL_STORAGE)) {
permissionLoggerSDK = sdk;
permissionLoggerKarere = karere;
requestPermission(baseActivity, REQUEST_WRITE_STORAGE,
requestPermission(baseActivity, REQUEST_WRITE_STORAGE_FOR_LOGS,
Manifest.permission.WRITE_EXTERNAL_STORAGE);
break;
}
Expand Down Expand Up @@ -1029,7 +1055,7 @@ protected void navigateToUpgradeAccount() {
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
logDebug("Request Code: " + requestCode);
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
if (requestCode == REQUEST_WRITE_STORAGE) {
if (requestCode == REQUEST_WRITE_STORAGE_FOR_LOGS) {
if (permissionLoggerKarere) {
permissionLoggerKarere = false;
if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
Expand Down Expand Up @@ -1111,4 +1137,19 @@ private void refreshSession() {
startActivity(intent);
finish();
}

@Override
public void launchActivity(@NotNull Intent intent) {
startActivity(intent);
}

@Override
public void launchActivityForResult(@NotNull Intent intent, int requestCode) {
startActivityForResult(intent, requestCode);
}

@Override
public void askPermissions(@NotNull String[] permissions, int requestCode) {
ActivityCompat.requestPermissions(this, permissions, requestCode);
}
}
16 changes: 7 additions & 9 deletions app/src/main/java/mega/privacy/android/app/DownloadService.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
import androidx.core.app.NotificationCompat;
import androidx.core.content.ContextCompat;
import androidx.core.content.FileProvider;

import android.widget.RemoteViews;

import io.reactivex.rxjava3.core.Single;
Expand All @@ -45,7 +44,6 @@

import mega.privacy.android.app.components.transferWidget.TransfersManagement;
import mega.privacy.android.app.fragments.offline.OfflineFragment;
import mega.privacy.android.app.lollipop.AudioVideoPlayerLollipop;
import mega.privacy.android.app.lollipop.LoginActivityLollipop;
import mega.privacy.android.app.lollipop.ManagerActivityLollipop;
import mega.privacy.android.app.lollipop.PdfViewerActivityLollipop;
Expand All @@ -72,7 +70,6 @@
import nz.mega.sdk.MegaTransferListenerInterface;

import static mega.privacy.android.app.components.transferWidget.TransfersManagement.*;
import static mega.privacy.android.app.lollipop.AudioVideoPlayerLollipop.*;
import static mega.privacy.android.app.constants.BroadcastConstants.*;
import static mega.privacy.android.app.lollipop.ManagerActivityLollipop.*;
import static mega.privacy.android.app.utils.CacheFolderManager.*;
Expand Down Expand Up @@ -101,11 +98,11 @@ public class DownloadService extends Service implements MegaTransferListenerInte
public static final String EXTRA_TARGET_URI = "target_uri";
public static final String EXTRA_PATH = "SAVE_PATH";
public static final String EXTRA_FOLDER_LINK = "FOLDER_LINK";
public static final String EXTRA_FROM_MV = "fromMV";
public static final String EXTRA_CONTACT_ACTIVITY = "CONTACT_ACTIVITY";
public static final String EXTRA_ZIP_FILE_TO_OPEN = "FILE_TO_OPEN";
public static final String EXTRA_OPEN_FILE = "OPEN_FILE";
public static final String EXTRA_CONTENT_URI = "CONTENT_URI";
public static final String EXTRA_SERIALIZE_STRING = "SERIALIZE_STRING";

private static int errorEBloqued = 0;
private int errorCount = 0;
Expand Down Expand Up @@ -340,7 +337,7 @@ protected void onHandleIntent(final Intent intent) {
}

boolean highPriority = intent.getBooleanExtra(HIGH_PRIORITY_TRANSFER, false);
boolean fromMV = intent.getBooleanExtra("fromMV", false);
boolean fromMV = intent.getBooleanExtra(EXTRA_FROM_MV, false);
logDebug("fromMV: " + fromMV);

megaApi = app.getMegaApi();
Expand Down Expand Up @@ -813,13 +810,13 @@ else if (MimeTypeList.typeForName(currentFile.getName()).isVideoReproducible() |
}
} else {
internalIntent = true;
mediaIntent = new Intent(this, AudioVideoPlayerLollipop.class);
mediaIntent = getMediaIntent(this, currentFile.getName());
}

mediaIntent.putExtra(IS_PLAYLIST, false);
mediaIntent.putExtra(INTENT_EXTRA_KEY_IS_PLAYLIST, false);
mediaIntent.putExtra("HANDLE", handle);
mediaIntent.putExtra("fromDownloadService", true);
mediaIntent.putExtra(AudioVideoPlayerLollipop.PLAY_WHEN_READY,app.isActivityVisible());
mediaIntent.putExtra(INTENT_EXTRA_KEY_FILE_NAME, currentFile.getName());
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N && !externalFile) {
mediaIntent.setDataAndType(FileProvider.getUriForFile(this, "mega.privacy.android.app.providers.fileprovider", currentFile), MimeTypeList.typeForName(currentFile.getName()).getType());
} else {
Expand Down Expand Up @@ -1325,7 +1322,8 @@ private void updateProgressNotification() {
message = getString(R.string.download_preparing_files);
}
else{
int inProgress = totalTransfers - pendingTransfers + 1;
int inProgress = pendingTransfers == 0 ? totalTransfers
: totalTransfers - pendingTransfers + 1;

if (megaApi.areTransfersPaused(MegaTransfer.TYPE_DOWNLOAD)) {
message = getResources().getQuantityString(R.plurals.download_service_paused_notification, totalTransfers, inProgress, totalTransfers);
Expand Down
Loading

0 comments on commit 436ffd8

Please sign in to comment.