Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -116,3 +116,4 @@ dependencies {
}

apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)
// apply plugin: 'com.google.gms.google-services'
18 changes: 16 additions & 2 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PROJECTION" />
<uses-permission android:name="android.permission.CAPTURE_VIDEO_OUTPUT" />

<application
android:name=".MainApplication"
Expand All @@ -21,5 +28,12 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<service
android:name="com.doublesymmetry.trackplayer.service.MusicService"
android:foregroundServiceType="mediaProjection"
android:exported="true"
android:permission="android.permission.FOREGROUND_SERVICE_MEDIA_PROJECTION"
tools:replace="android:foregroundServiceType"
/>
</application>
</manifest>
1 change: 1 addition & 0 deletions android/app/src/main/java/com/learnproai/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import com.facebook.react.ReactActivity
import com.facebook.react.ReactActivityDelegate
import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.fabricEnabled
import com.facebook.react.defaults.DefaultReactActivityDelegate
import com.doublesymmetry.trackplayer.service.MusicService;

class MainActivity : ReactActivity() {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.load
import com.facebook.react.defaults.DefaultReactHost.getDefaultReactHost
import com.facebook.react.defaults.DefaultReactNativeHost
import com.facebook.soloader.SoLoader
import com.doublesymmetry.trackplayer.TrackPlayer;

class MainApplication : Application(), ReactApplication {

Expand Down
2 changes: 1 addition & 1 deletion android/app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<resources>
<string name="app_name">LearnProAi</string>
<string name="app_name">LanguageMe</string>
</resources>
10 changes: 8 additions & 2 deletions android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
buildscript {
ext {
buildToolsVersion = "34.0.0"
minSdkVersion = 21
minSdkVersion = 24
compileSdkVersion = 34
targetSdkVersion = 34
ndkVersion = "22.1.7171670"
Expand All @@ -15,6 +15,7 @@ buildscript {
classpath("com.android.tools.build:gradle:7.0.0")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion")
classpath("com.facebook.react:react-native-gradle-plugin")
// classpath('com.google.gms:google-services:4.3.10')
}
}

Expand All @@ -28,7 +29,7 @@ allprojects {
buildscript {
ext {
buildToolsVersion = "34.0.0"
minSdkVersion = 21
minSdkVersion = 24
compileSdkVersion = 34
targetSdkVersion = 34
ndkVersion = "22.1.7171670"
Expand All @@ -42,6 +43,7 @@ buildscript {
classpath("com.android.tools.build:gradle:7.0.0")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion")
classpath("com.facebook.react:react-native-gradle-plugin")
// classpath('com.google.gms:google-services:4.3.10')
}
}

Expand All @@ -52,3 +54,7 @@ allprojects {
google()
}
}

gradle.startParameter.excludedTaskNames.addAll(
gradle.startParameter.taskNames.findAll { it.contains("testClasses") }
)
3 changes: 3 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,8 @@ import 'react-native-gesture-handler';
import { AppRegistry } from 'react-native';
import App from './App';
import { name as appName } from './app.json';
import TrackPlayer from 'react-native-track-player';

AppRegistry.registerComponent(appName, () => App);
TrackPlayer.registerPlaybackService(() => require('./trackPlayerService.js'));

23 changes: 13 additions & 10 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"@react-native-firebase/auth": "^20.1.0",
"@react-native-firebase/firestore": "^20.1.0",
"@react-native-firebase/messaging": "^20.1.0",
"@react-native-masked-view/masked-view": "^0.3.1",
"@react-native-masked-view/masked-view": "^0.2.9",
"@react-navigation/bottom-tabs": "^6.5.20",
"@react-navigation/native": "^6.1.17",
"@react-navigation/stack": "^6.3.29",
Expand Down
15 changes: 12 additions & 3 deletions setup/PlayerSetup.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useEffect } from 'react';
import { Platform } from 'react-native';
import { AppState, Platform } from 'react-native';
import TrackPlayer from 'react-native-track-player';

export const usePlayerSetup = () => {
Expand All @@ -14,10 +14,18 @@ export const usePlayerSetup = () => {
TrackPlayer.CAPABILITY_STOP,
TrackPlayer.CAPABILITY_SEEK_TO,
],
notificationCapabilities: [
TrackPlayer.CAPABILITY_PLAY,
TrackPlayer.CAPABILITY_PAUSE,
TrackPlayer.CAPABILITY_STOP,
TrackPlayer.CAPABILITY_SEEK_TO,
],
compactCapabilities: [
TrackPlayer.CAPABILITY_PLAY,
TrackPlayer.CAPABILITY_PAUSE,
],
foregroundService: true,
alwaysPauseOnInterruption: true,
});

// Set the audio session category to allow playback in silent mode (iOS only)
Expand All @@ -27,7 +35,8 @@ export const usePlayerSetup = () => {
});
}
};

setupPlayer();
if (AppState.currentState === 'active') {
setupPlayer();
}
}, []);
};
1 change: 1 addition & 0 deletions types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ export type Reading = {
difficulty: string;
wordCount: number;
passage: string | null;
previewText: string; // first 100 characters of the passage
createdAt: Date;
wordTimestamps: ReadingWithWordTimeStamps | null
};