Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Remove geolocation service #1283

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
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
94 changes: 0 additions & 94 deletions __mocks__/react-native-background-geolocation-mock.ts

This file was deleted.

6 changes: 0 additions & 6 deletions __tests__/jestSetupFile.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import mockBackHandler from 'react-native/Libraries/Utilities/__mocks__/BackHand
import mockRNDeviceInfo from 'react-native-device-info/jest/react-native-device-info-mock'
import mockRNPermissions from 'react-native-permissions/mock'

import { mockRNBackgroundGeolocation } from '../__mocks__/react-native-background-geolocation-mock'
import { mockRNFS } from '../__mocks__/react-native-fs-mock'
import { mockRNIAP } from '../__mocks__/react-native-iap-mock'
import { mockRNInAppBrowser } from '../__mocks__/react-native-inappbrowser-reborn-mock'
Expand Down Expand Up @@ -104,11 +103,6 @@ jest.mock('../src/locales/i18n', () => {
jest.mock('react-native/Libraries/Animated/NativeAnimatedHelper')
jest.mock('@notifee/react-native', () => mockNotifee)

jest.mock(
'react-native-background-geolocation',
() => mockRNBackgroundGeolocation
)

jest.mock('react-native/Libraries/Components/Switch/Switch', () => {
const mockComponent = require('react-native/jest/mockComponent')
return {
Expand Down
1 change: 0 additions & 1 deletion android/app/brand.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ android {
manifestPlaceholders = [
universalLinkUrl: "links.mycozy.cloud",
appScheme: "cozy",
reactNativeBackgroundGeolocationKey: "c6c304fbd6010061e1f29903f277b40c9fc55ac085803495dde2caa32f536657",
]
}
}
9 changes: 0 additions & 9 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@ apply plugin: "com.facebook.react"
apply plugin: 'com.google.gms.google-services'
apply from: project(':react-native-config').projectDir.getPath() + "/dotenv.gradle"

Project background_geolocation = project(':react-native-background-geolocation')
apply from: "${background_geolocation.projectDir}/app.gradle"

import com.android.build.OutputFile

/**
Expand Down Expand Up @@ -129,7 +126,6 @@ android {
// signingConfig signingConfigs.debug
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
proguardFiles "${background_geolocation.projectDir}/proguard-rules.pro"
}
}

Expand Down Expand Up @@ -185,11 +181,6 @@ dependencies {
}
}
}
implementation ("androidx.appcompat:appcompat:1.3.1") {
version {
strictly '1.3.1'
}
}
implementation 'com.google.android.play:integrity:1.3.0'
}
}
Expand Down
1 change: 0 additions & 1 deletion android/app/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,3 @@
-keep class io.cozy.flagship.mobile.BuildConfig { *; }
-keep public class io.cozy.flagship.mobile.MainActivitybase { *; }
-keep public class io.cozy.flagship.mobile.MainActivitymespapiers { *; }
-keep class com.transistorsoft.rnbackgroundfetch.HeadlessTask { *; }
6 changes: 0 additions & 6 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,6 @@
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES"/>
<uses-permission android:name="android.permission.READ_MEDIA_VIDEO"/>
<uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACTIVITY_RECOGNITION" />

<queries>
<intent>
<action android:name="android.intent.action.VIEW" />
Expand Down Expand Up @@ -137,7 +132,6 @@
android:name="com.google.firebase.messaging.default_notification_color"
android:resource="@color/black"
tools:replace="android:resource" />
<meta-data android:name="com.transistorsoft.locationmanager.license" android:value="${reactNativeBackgroundGeolocationKey}" />
</application>

</manifest>
13 changes: 0 additions & 13 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ buildscript {
compileSdkVersion = 34
targetSdkVersion = 34
androidXBrowser = "1.4.0"
googlePlayServicesLocationVersion = "20.0.0"
DocumentScanner_compileSdkVersion = 34
DocumentScanner_targetSdkVersion = 34
kotlinVersion = '1.8.0' // react-native-receive-sharing-intent requires a global kotlin version else the build fails
Expand All @@ -26,18 +25,6 @@ buildscript {
}

allprojects {
repositories {
maven {
url("${project(':react-native-background-geolocation').projectDir}/libs")
}
maven {
url("${project(':react-native-background-fetch').projectDir}/libs")
}
maven {
url 'https://developer.huawei.com/repo/'
}
}

// androidx.annotation:annotation:1.9.1 breaks our build, maybe because of kotlin version
// https://developer.android.com/jetpack/androidx/releases/annotation#1.9.1
configurations.all {
Expand Down
4 changes: 0 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
import { AppRegistry } from 'react-native'
import BackgroundGeolocation from 'react-native-background-geolocation'
import 'react-native-gesture-handler'
import 'react-native-url-polyfill/auto'

import App from './src/App'
import { GeolocationTrackingHeadlessTask } from './src/app/domain/geolocation/tracking'
import { name as appName } from './src/app.json'

AppRegistry.registerComponent(appName, () => App)

BackgroundGeolocation.registerHeadlessTask(GeolocationTrackingHeadlessTask)
6 changes: 0 additions & 6 deletions ios/CozyReactNative.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@
E4924AB629963CAD00F415CE /* Lato-Regular.ttf in Resources */ = {isa = PBXBuildFile; fileRef = A0572B798A7D41908174A427 /* Lato-Regular.ttf */; };
E4924AC12996437D00F415CE /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = E4924AC02996437D00F415CE /* GoogleService-Info.plist */; };
E4924AC32996438600F415CE /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = E4924AC22996438600F415CE /* GoogleService-Info.plist */; };
E4F47BF72AAA008D008ACFC1 /* RNBackgroundFetch+AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = E4F47BF62AAA0081008ACFC1 /* RNBackgroundFetch+AppDelegate.m */; };
E4F47BF82AAA008D008ACFC1 /* RNBackgroundFetch+AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = E4F47BF62AAA0081008ACFC1 /* RNBackgroundFetch+AppDelegate.m */; };
E4F8716029DDEC1E00C52A35 /* [email protected] in Resources */ = {isa = PBXBuildFile; fileRef = E4F8715C29DDEC1E00C52A35 /* [email protected] */; };
E4F8716129DDEC1E00C52A35 /* [email protected] in Resources */ = {isa = PBXBuildFile; fileRef = E4F8715C29DDEC1E00C52A35 /* [email protected] */; };
E4F8716229DDEC1E00C52A35 /* [email protected] in Resources */ = {isa = PBXBuildFile; fileRef = E4F8715D29DDEC1E00C52A35 /* [email protected] */; };
Expand Down Expand Up @@ -121,7 +119,6 @@
E4924ABF29963CAD00F415CE /* CozyReactNativeDev-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = "CozyReactNativeDev-Info.plist"; path = "/Users/theo/cozy/cozy-flagship-app/ios/CozyReactNativeDev-Info.plist"; sourceTree = "<absolute>"; };
E4924AC02996437D00F415CE /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = "GoogleService-Info.plist"; path = "Dev/GoogleService-Info.plist"; sourceTree = "<group>"; };
E4924AC22996438600F415CE /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = "GoogleService-Info.plist"; path = "Prod/GoogleService-Info.plist"; sourceTree = "<group>"; };
E4F47BF62AAA0081008ACFC1 /* RNBackgroundFetch+AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = "RNBackgroundFetch+AppDelegate.m"; path = "../node_modules/react-native-background-fetch/ios/RNBackgroundFetch/RNBackgroundFetch+AppDelegate.m"; sourceTree = "<group>"; };
E4F8715C29DDEC1E00C52A35 /* [email protected] */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "[email protected]"; sourceTree = "<group>"; };
E4F8715D29DDEC1E00C52A35 /* [email protected] */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "[email protected]"; sourceTree = "<group>"; };
E4F8715E29DDEC1E00C52A35 /* [email protected] */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "[email protected]"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -199,7 +196,6 @@
81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */,
13B07FB71A68108700A75B9A /* main.m */,
997B98B12769CFD100089037 /* BootSplash.storyboard */,
E4F47BF62AAA0081008ACFC1 /* RNBackgroundFetch+AppDelegate.m */,
);
name = CozyReactNative;
sourceTree = "<group>";
Expand Down Expand Up @@ -800,7 +796,6 @@
13B07FBC1A68108700A75B9A /* AppDelegate.m in Sources */,
13B07FC11A68108700A75B9A /* main.m in Sources */,
2C7AA455281584D30052F4D8 /* HttpServer.m in Sources */,
E4F47BF72AAA008D008ACFC1 /* RNBackgroundFetch+AppDelegate.m in Sources */,
2C7AA45328157D2E0052F4D8 /* HttpServer.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand All @@ -820,7 +815,6 @@
E4924AAA29963CAD00F415CE /* AppDelegate.m in Sources */,
E4924AAB29963CAD00F415CE /* main.m in Sources */,
E4924AAC29963CAD00F415CE /* HttpServer.m in Sources */,
E4F47BF82AAA008D008ACFC1 /* RNBackgroundFetch+AppDelegate.m in Sources */,
E4924AAD29963CAD00F415CE /* HttpServer.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down
4 changes: 0 additions & 4 deletions ios/CozyReactNative/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
#import <React/RCTBundleURLProvider.h>
#import <React/RCTHTTPRequestHandler.h>

#import <TSBackgroundFetch/TSBackgroundFetch.h>

#import "RNBootSplash.h" // <- add the header import
#import "RNCConfig.h"

Expand Down Expand Up @@ -40,8 +38,6 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(

SetCustomNSURLSessionConfiguration();

[[TSBackgroundFetch sharedInstance] didFinishLaunching]; // danger

[super application:application didFinishLaunchingWithOptions:launchOptions];

[RNBootSplash initWithStoryboard:@"BootSplash" rootView:self.window.rootViewController.view]; // danger
Expand Down
15 changes: 0 additions & 15 deletions ios/CozyReactNative/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>BGTaskSchedulerPermittedIdentifiers</key>
<array>
<string>com.transistorsoft.fetch</string>
</array>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDisplayName</key>
Expand Down Expand Up @@ -119,14 +115,6 @@
<string>Afin de prendre des photos pour Drive ou MesPapiers afin d'importer des documents</string>
<key>NSFaceIDUsageDescription</key>
<string>Permet le dΓ©verouillage de l'application en utilisant FaceID</string>
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
<string>MΓ©moriser vos dΓ©placements nΓ©cessite de β‰ͺ toujours autoriser ≫</string>
<key>NSLocationAlwaysUsageDescription</key>
<string>MΓ©moriser vos dΓ©placements nΓ©cessite de β‰ͺ toujours autoriser ≫</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>MΓ©moriser vos dΓ©placements nΓ©cessite d' β‰ͺ autoriser lorsque l'app est active ≫</string>
<key>NSMotionUsageDescription</key>
<string>Autoriser l'accès aux mouvements améliore la détection des déplacements.</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>Pour faire un backup de vos photos</string>
<key>UIAppFonts</key>
Expand All @@ -136,9 +124,6 @@
</array>
<key>UIBackgroundModes</key>
<array>
<string>fetch</string>
<string>location</string>
<string>processing</string>
<string>remote-notification</string>
</array>
<key>UILaunchStoryboardName</key>
Expand Down
3 changes: 0 additions & 3 deletions ios/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@ end
setup_permissions([
'PhotoLibrary',
'Notifications',
'LocationAlways',
'LocationWhenInUse',
'Motion'
])

target 'CozyReactNative' do
Expand Down
13 changes: 0 additions & 13 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -639,11 +639,6 @@ PODS:
- React-jsi (= 0.72.12)
- React-logger (= 0.72.12)
- React-perflogger (= 0.72.12)
- RNBackgroundFetch (4.2.5):
- React-Core
- RNBackgroundGeolocation (4.16.4):
- CocoaLumberjack (~> 3.8.5)
- React-Core
- RNBootSplash (3.2.4):
- React-Core
- RNCAsyncStorage (1.21.0):
Expand Down Expand Up @@ -790,8 +785,6 @@ DEPENDENCIES:
- React-runtimescheduler (from `../node_modules/react-native/ReactCommon/react/renderer/runtimescheduler`)
- React-utils (from `../node_modules/react-native/ReactCommon/react/utils`)
- ReactCommon/turbomodule/core (from `../node_modules/react-native/ReactCommon`)
- RNBackgroundFetch (from `../node_modules/react-native-background-fetch`)
- RNBackgroundGeolocation (from `../node_modules/react-native-background-geolocation`)
- RNBootSplash (from `../node_modules/react-native-bootsplash`)
- "RNCAsyncStorage (from `../node_modules/@react-native-async-storage/async-storage`)"
- "RNCClipboard (from `../node_modules/@react-native-clipboard/clipboard`)"
Expand Down Expand Up @@ -971,10 +964,6 @@ EXTERNAL SOURCES:
:path: "../node_modules/react-native/ReactCommon/react/utils"
ReactCommon:
:path: "../node_modules/react-native/ReactCommon"
RNBackgroundFetch:
:path: "../node_modules/react-native-background-fetch"
RNBackgroundGeolocation:
:path: "../node_modules/react-native-background-geolocation"
RNBootSplash:
:path: "../node_modules/react-native-bootsplash"
RNCAsyncStorage:
Expand Down Expand Up @@ -1114,8 +1103,6 @@ SPEC CHECKSUMS:
React-runtimescheduler: 8aea338c561b2175f47018124c076d89d3808d30
React-utils: 9a24cb88f950d1020ee55bddacbc8c16a611e2dc
ReactCommon: 76843a9bb140596351ac2786257ac9fe60cafabb
RNBackgroundFetch: 2f800a04434620db15ede2e8f21886608a2d1743
RNBackgroundGeolocation: 7df16548756b443aac809663cba8a4e03f0b8732
RNBootSplash: 4844706cbb56a3270556c9b94e59dedadccd47e4
RNCAsyncStorage: 618d03a5f52fbccb3d7010076bc54712844c18ef
RNCClipboard: 60fed4b71560d7bfe40e9d35dea9762b024da86d
Expand Down
7 changes: 1 addition & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,6 @@
"react-dom": "18.2.0",
"react-i18next": "14.0.0",
"react-native": "0.72.12",
"react-native-background-fetch": "^4.2.5",
"react-native-background-geolocation": "^4.16.3",
"react-native-background-upload": "^6.6.0",
"react-native-biometrics": "3.0.1",
"react-native-bootsplash": "github:cozy/react-native-bootsplash#0.0.3",
Expand Down Expand Up @@ -193,9 +191,6 @@
},
"reactNativePermissionsIOS": [
"PhotoLibrary",
"Notifications",
"LocationAlways",
"LocationWhenInUse",
"Motion"
"Notifications"
]
}
2 changes: 0 additions & 2 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ import { ThemeProvider } from '/app/theme/ThemeProvider'
import { useInitI18n } from '/locales/useInitI18n'
import { SecureBackgroundSplashScreenWrapper } from '/app/theme/SecureBackgroundSplashScreenWrapper'
import { PermissionsChecker } from '/app/domain/nativePermissions/components/PermissionsChecker'
import { useGeolocationTracking } from '/app/domain/geolocation/hooks/useGeolocationTracking'
import { OsReceiveProvider } from '/app/view/OsReceive/OsReceiveProvider'
import { ErrorProvider } from '/app/view/Error/ErrorProvider'
import { LoadingOverlayProvider } from '/app/view/Loading/LoadingOverlayProvider'
Expand Down Expand Up @@ -98,7 +97,6 @@ const App = ({ setClient }) => {
useSecureBackgroundSplashScreen()
useCookieResyncOnResume()
useNotifications()
useGeolocationTracking()
useCozyEnvironmentOverride()

const {
Expand Down
Loading
Loading