Skip to content

Commit

Permalink
fix: android multiple media service crash
Browse files Browse the repository at this point in the history
  • Loading branch information
KestasVenslauskas committed May 18, 2024
1 parent e4a56b5 commit ebad679
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 8 deletions.
2 changes: 0 additions & 2 deletions App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import useNotificationsPermission from './app/util/useNotificationsPermission';
import useGoogleAnalyticsSetup from './app/util/useGoogleAnalyticsSetup';
import ThemeProvider from './app/theme/ThemeProvider';
import useCarPlayController from './app/car/useCarPlayController';
import useTrackPlayerSetup from './app/car/useTrackPlayerSetup';

const ReduxProvider: React.FC<React.PropsWithChildren<{}>> = ({children}) => {
return (
Expand All @@ -33,7 +32,6 @@ const App: React.FC = () => {
useAppTrackingPermission();
useGoogleAnalyticsSetup();
useGemiusSetup();
useTrackPlayerSetup();

const {isConnected: _} =
Platform.OS === 'ios'
Expand Down
4 changes: 2 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ android {
applicationId "lt.mediapark.lrt"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 204105
versionName "2.41.5"
versionCode 204106
versionName "2.41.6"
multiDexEnabled true
}
signingConfigs {
Expand Down
4 changes: 4 additions & 0 deletions app/car/useCarPlayController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,16 @@ import useCarPlayRootTemplate from './root/useCarPlayRootTemplate';
import Gemius from 'react-native-gemius-plugin';
import analytics from '@react-native-firebase/analytics';
import TrackPlayer from 'react-native-track-player';
import useTrackPlayerSetup from './useTrackPlayerSetup';

type ReturnType = CarPlayContextType;

const useCarPlayController = (): ReturnType => {
const [isConnected, setIsConnected] = useState(CarPlay.connected);

// Setup TrackPlayer
useTrackPlayerSetup();

const rootTemplate = useCarPlayRootTemplate(isConnected);

useEffect(() => {
Expand Down
3 changes: 1 addition & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,5 @@ if (Platform.OS === 'android') {
AppRegistry.registerComponent(appName, () => App);
} else {
AppRegistry.registerComponent(appName, () => App);
TrackPlayer.registerPlaybackService(() => PlaybackService);
}

TrackPlayer.registerPlaybackService(() => PlaybackService);
4 changes: 2 additions & 2 deletions ios/lrtApp.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -783,7 +783,7 @@
CODE_SIGN_ENTITLEMENTS = lrtApp/lrtApp.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 100;
CURRENT_PROJECT_VERSION = 101;
DEVELOPMENT_TEAM = TGMUP98888;
ENABLE_BITCODE = NO;
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = "i386 arm64";
Expand Down Expand Up @@ -817,7 +817,7 @@
CODE_SIGN_ENTITLEMENTS = lrtApp/lrtAppRelease.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 100;
CURRENT_PROJECT_VERSION = 101;
DEVELOPMENT_TEAM = TGMUP98888;
INFOPLIST_FILE = lrtApp/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
Expand Down

0 comments on commit ebad679

Please sign in to comment.