Skip to content

Commit

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

See merge request mobile/android/android!2215
  • Loading branch information
javiergm1983 committed Jan 19, 2022
2 parents fde83b3 + 8cc5c43 commit a1eed50
Show file tree
Hide file tree
Showing 171 changed files with 2,772 additions and 3,277 deletions.
30 changes: 30 additions & 0 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,36 @@ sudo apt install build-essential swig automake libtool autoconf cmake

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

#### macOS setup

To build jni libs on macOS, you need install these dependencies via brew:

`brew install bash gnu-sed gnu-tar autoconf automake cmake coreutils libtool swig wget xz`

Then reboot MacOS to ensure newly installed latest bash(v5.x) overrides default v3.x in PATH

Then edit PATH env (Please make sure the gnu paths are setup in front of $PATH):

`export PATH="/usr/local/opt/gnu-tar/libexec/gnubin:$PATH"`
`export PATH="/usr/local/opt/gnu-sed/libexec/gnubin:$PATH"`

Then download and setup NDK follow guides above, then run this command to build:

`bash ./build.sh all`


##### If the build script fails to detect cmake when building ffmpeg extension on a mac

1. In Android studio, open the SDK manager (Or through Settings>Appearance & Behaviour>System Settings>Android SDK)
2. Go to the SDK Tools tab
3. Check the "Show package details" box
4. Expand the CMake section in the list
5. Select 3.10.2.4988404
6. Click "OK"
7. Add the following to your PATH:
`export PATH="/Users/{USERNAME}/Library/Android/sdk/cmake/3.10.2.4988404/bin:$PATH"`
8. Retry the build

### Notice

To use the *geolocation feature* you need a *Google Maps API key*:
Expand Down
41 changes: 27 additions & 14 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ android {
viewBinding = true
}



defaultConfig {
applicationId "mega.privacy.android.app"

Expand Down Expand Up @@ -85,20 +87,16 @@ android {
// abortOnError false
}

dexOptions{
jumboMode = true
}

compileOptions {
// Flag to enable support for the new language APIs
coreLibraryDesugaringEnabled true
// Sets Java compatibility to Java 8
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
// Sets Java compatibility to Java 11
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
}

kotlinOptions {
jvmTarget = "1.8"
jvmTarget = "11"
}
// task megaSDK(type: Exec, description: 'Compile MEGA SDK via NDK') {
// workingDir 'src/main/jni'
Expand All @@ -109,6 +107,12 @@ android {
// compileTask -> compileTask.dependsOn megaSDK
// }

testOptions {
unitTests {
includeAndroidResources = true
}
}

flavorDimensions "service"
productFlavors {
gms {
Expand All @@ -131,7 +135,7 @@ android {
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation fileTree(dir: "$rootProject.projectDir/app/src/main/jni/ExoPlayer/", include: ['*.aar'])

// App dependencies
implementation "androidx.appcompat:appcompat:$appCompatVersion"
Expand Down Expand Up @@ -168,17 +172,15 @@ dependencies {
implementation "com.google.dagger:hilt-android:$hiltVersion"
kapt "com.google.dagger:hilt-android-compiler:$hiltVersion"
implementation "androidx.hilt:hilt-lifecycle-viewmodel:$hiltAndroidXVersion"
kapt "androidx.hilt:hilt-compiler:$hiltAndroidXVersion"
kapt "androidx.hilt:hilt-compiler:$hiltAndroidXCompilerVersion"

// Other libs
implementation 'androidx.exifinterface:exifinterface:1.3.0'
implementation 'com.github.nirhart:parallaxscroll:1.0'
implementation 'androidx.palette:palette-ktx:1.0.0'
implementation 'com.vdurmont:emoji-java:4.0.0'
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.android.exoplayer:exoplayer-core:$exoPlayerVersion"
implementation "com.google.android.exoplayer:exoplayer-ui:$exoPlayerVersion"
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'
Expand Down Expand Up @@ -247,7 +249,18 @@ dependencies {
// Testing dependencies
testImplementation "junit:junit:$junitVersion"
testImplementation "com.google.truth:truth:$truthVersion"
testImplementation "androidx.test.ext:truth:$androidxTestVersion"
testImplementation "androidx.arch.core:core-testing:$androidxArchCoreVersion"
testImplementation "androidx.test:core-ktx:$androidxTestVersion"
testImplementation "androidx.test:core:$androidxTestVersion"
testImplementation "org.robolectric:robolectric:$roboletricVersion"
testImplementation "androidx.test.ext:junit-ktx:$androidxTestExtVersion"
testImplementation "org.mockito:mockito-core:$mockitoVersion"
testImplementation "org.mockito.kotlin:mockito-kotlin:$mockitoKotlinVersion"

androidTestImplementation "androidx.test.ext:junit:$androidxTestExtVersion"
androidTestImplementation "com.google.truth:truth:$truthVersion"
androidTestImplementation "androidx.test.espresso:espresso-core:$espressoVersion"
}

def taskRequests = gradle.getStartParameter().getTaskRequests().toString()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package test.mega.privacy.android.app

import android.content.Context
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.platform.app.InstrumentationRegistry
import com.google.common.truth.Truth.assertThat
import mega.privacy.android.app.R
import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith

@RunWith(AndroidJUnit4::class)
class InstrumentedTestExampleTest {

private lateinit var appContext: Context

@Before
fun setup() {
// Context of the app under test.
appContext = InstrumentationRegistry.getInstrumentation().targetContext
}

@Test
fun test_readPackageIdFromContext() {
assertThat(appContext.packageName).isEqualTo("mega.privacy.android.app")
}

@Test
fun test_readStringFromContext_LocalizedString() {
assertThat(appContext.getString(R.string.app_name)).isEqualTo("MEGA")

assertThat(appContext.getString(R.string.prolite_account)).isEqualTo("Pro Lite")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,27 @@ package mega.privacy.android.app.service.crashreporter

import com.google.firebase.crashlytics.FirebaseCrashlytics
import mega.privacy.android.app.middlelayer.crashreporter.CrashReporter
import mega.privacy.android.app.utils.LogUtil

class CrashReporterImpl : CrashReporter {

private val crashlytics: FirebaseCrashlytics = FirebaseCrashlytics.getInstance()
private var crashlytics: FirebaseCrashlytics? = null

init {
try {
crashlytics = FirebaseCrashlytics.getInstance()
} catch (e: Exception) {
e.printStackTrace()
LogUtil.logError(e.message)
}
}

override fun report(e: Throwable) {
crashlytics.recordException(e)
crashlytics.sendUnsentReports()
crashlytics?.recordException(e)
crashlytics?.sendUnsentReports()
}

override fun setEnabled(enabled: Boolean) {
crashlytics.setCrashlyticsCollectionEnabled(enabled)
crashlytics?.setCrashlyticsCollectionEnabled(enabled)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,26 @@ package mega.privacy.android.app.service.crashreporter

import com.huawei.agconnect.crash.AGConnectCrash
import mega.privacy.android.app.middlelayer.crashreporter.CrashReporter
import mega.privacy.android.app.utils.LogUtil

class CrashReporterImpl : CrashReporter {

private val agConnectCrash = AGConnectCrash.getInstance()
private var agConnectCrash: AGConnectCrash? = null

init {
try {
agConnectCrash = AGConnectCrash.getInstance()
} catch (e: Exception) {
e.printStackTrace()
LogUtil.logError(e.message)
}
}

override fun report(e: Throwable) {
agConnectCrash.recordException(e)
agConnectCrash?.recordException(e)
}

override fun setEnabled(enabled: Boolean) {
agConnectCrash.enableCrashCollection(enabled)
agConnectCrash?.enableCrashCollection(enabled)
}
}
3 changes: 1 addition & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,7 @@
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.CAPTURE_VIDEO_OUTPUT" />
<uses-permission android:name="android.permission.FLAG_SHOW_WHEN_LOCKED" />
<uses-permission android:name="android.permission.MANAGE_DOCUMENTS"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
Expand Down Expand Up @@ -575,6 +573,7 @@

<service
android:name=".jobservices.CameraUploadsService"
android:foregroundServiceType="dataSync"
android:exported="false" />
<service
android:name=".jobservices.CuSyncInactiveHeartbeatService"
Expand Down
4 changes: 3 additions & 1 deletion app/src/main/java/com/shockwave/pdfium/PdfiumCore.java
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,9 @@ private void recursiveGetBookmark(List<PdfDocument.Bookmark> tree, PdfDocument d
public List<PdfDocument.Link> getPageLinks(PdfDocument doc, int pageIndex) {
synchronized (lock) {
List<PdfDocument.Link> links = new ArrayList<>();
long[] linkPtrs = nativeGetPageLinks(doc.mNativePagesPtr.get(pageIndex));
Long pagePtr = doc.mNativePagesPtr.get(pageIndex);
if (pagePtr == null) return links;
long[] linkPtrs = nativeGetPageLinks(pagePtr);
for (long linkPtr : linkPtrs) {
Integer index = nativeGetDestPageIndex(doc.mNativeDocPtr, linkPtr);
String uri = nativeGetLinkURI(doc.mNativeDocPtr, linkPtr);
Expand Down
Loading

0 comments on commit a1eed50

Please sign in to comment.