mobile: Remove proprietary dependencies and unecessary permissions

This commit is contained in:
PaddiM8 2022-12-10 02:10:08 +01:00
parent 8484d76a89
commit a322f6732c
17 changed files with 91 additions and 95 deletions

3
.idea/.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
# Default ignored files
/shelf/
/workspace.xml

4
.idea/encodings.xml Normal file
View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding" addBOMForNewFiles="with BOM under Windows, with no BOM otherwise" />
</project>

9
.idea/kalker.iml Normal file
View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

8
.idea/modules.xml Normal file
View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/kalker.iml" filepath="$PROJECT_DIR$/.idea/kalker.iml" />
</modules>
</component>
</project>

6
.idea/vcs.xml Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>

View File

@ -1,10 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RunConfigurationProducerService">
<option name="ignoredProducers">
<set>
<option value="com.android.tools.idea.compose.preview.runconfiguration.ComposePreviewRunConfigurationProducer" />
</set>
</option>
</component>
</project>

View File

@ -4,7 +4,12 @@
<option name="autoReloadType" value="NONE" />
</component>
<component name="ChangeListManager">
<list default="true" id="f715975d-940d-4ed4-9dbe-0bcb3d72e51d" name="Default Changelist" comment="" />
<list default="true" id="f715975d-940d-4ed4-9dbe-0bcb3d72e51d" name="Default Changelist" comment="">
<change beforePath="$PROJECT_DIR$/android/app/build.gradle" beforeDir="false" afterPath="$PROJECT_DIR$/android/app/build.gradle" afterDir="false" />
<change beforePath="$PROJECT_DIR$/android/app/src/main/AndroidManifest.xml" beforeDir="false" afterPath="$PROJECT_DIR$/android/app/src/main/AndroidManifest.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/android/build.gradle" beforeDir="false" afterPath="$PROJECT_DIR$/android/build.gradle" afterDir="false" />
<change beforePath="$PROJECT_DIR$/android/variables.gradle" beforeDir="false" afterPath="$PROJECT_DIR$/android/variables.gradle" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
@ -22,6 +27,8 @@
<component name="PropertiesComponent">
<property name="RunOnceActivity.OpenProjectViewOnStart" value="true" />
<property name="RunOnceActivity.ShowReadmeOnStart" value="true" />
<property name="RunOnceActivity.cidr.known.project.marker" value="true" />
<property name="cidr.known.project.marker" value="true" />
<property name="last_opened_file_path" value="$PROJECT_DIR$/android" />
</component>
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
@ -38,14 +45,4 @@
</task>
<servers />
</component>
<component name="WindowStateProjectService">
<state x="738" y="345" key="#com.intellij.execution.impl.EditConfigurationsDialog" timestamp="1622829848954">
<screen x="0" y="0" width="2560" height="1440" />
</state>
<state x="738" y="345" key="#com.intellij.execution.impl.EditConfigurationsDialog/0.0.2560.1440/2560.0.1920.1080@0.0.2560.1440" timestamp="1622829848954" />
<state x="1063" y="445" width="424" height="476" key="FileChooserDialogImpl" timestamp="1622829905435">
<screen x="0" y="0" width="2560" height="1440" />
</state>
<state x="1063" y="445" width="424" height="476" key="FileChooserDialogImpl/0.0.2560.1440/2560.0.1920.1080@0.0.2560.1440" timestamp="1622829905435" />
</component>
</project>

View File

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="true" project-jdk-name="11" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">

View File

@ -1,10 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RunConfigurationProducerService">
<option name="ignoredProducers">
<set>
<option value="com.android.tools.idea.compose.preview.runconfiguration.ComposePreviewRunConfigurationProducer" />
</set>
</option>
</component>
</project>

View File

@ -48,13 +48,4 @@ dependencies {
implementation project(':capacitor-cordova-android-plugins')
}
apply from: 'capacitor.build.gradle'
try {
def servicesJSON = file('google-services.json')
if (servicesJSON.text) {
apply plugin: 'com.google.gms.google-services'
}
} catch(Exception e) {
logger.warn("google-services.json not found, google-services plugin not applied. Push Notifications won't work")
}
apply from: 'capacitor.build.gradle'

View File

@ -29,34 +29,5 @@
</intent-filter>
</activity>
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.fileprovider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/file_paths"></meta-data>
</provider>
</application>
<!-- Permissions -->
<uses-permission android:name="android.permission.INTERNET" />
<!-- Camera, Photos, input file -->
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<!-- Geolocation API -->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-feature android:name="android.hardware.location.gps" />
<!-- Network API -->
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<!-- Navigator.getUserMedia -->
<!-- Video -->
<uses-permission android:name="android.permission.CAMERA" />
<!-- Audio -->
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS"/>
</manifest>

View File

@ -9,5 +9,8 @@
"SplashScreen": {
"launchShowDuration": 0
}
}
}
},
"includePlugins": [
"SplashScreen"
]
}

View File

@ -8,7 +8,7 @@ buildscript {
}
dependencies {
classpath 'com.android.tools.build:gradle:3.6.1'
classpath 'com.google.gms:google-services:4.3.3'
//classpath 'com.google.gms:google-services:4.3.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files

View File

@ -8,8 +8,6 @@ ext {
androidxBrowserVersion = '1.2.0'
androidxLocalbroadcastmanagerVersion = '1.0.0'
androidxExifInterfaceVersion = '1.2.0'
firebaseMessagingVersion = '20.1.2'
playServicesLocationVersion = '17.0.0'
junitVersion = '4.12'
androidxJunitVersion = '1.1.1'
androidxEspressoCoreVersion = '3.2.0'

View File

@ -9,5 +9,8 @@
"SplashScreen": {
"launchShowDuration": 0
}
}
}
},
"includePlugins": [
"SplashScreen"
]
}

View File

@ -1,18 +1,18 @@
{
"name": "kalk_mobile",
"version": "1.0.1",
"version": "2.0.1",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "kalk_mobile",
"version": "1.0.1",
"version": "2.0.1",
"license": "MIT",
"dependencies": {
"@capacitor/android": "^2.4.5",
"@capacitor/cli": "^2.4.5",
"@capacitor/core": "^2.4.5",
"@paddim8/kalk-component": "^1.3.0"
"@paddim8/kalk-component": "^2.0.1"
},
"devDependencies": {
"@capacitor-community/electron": "^1.3.2",
@ -194,16 +194,16 @@
}
},
"node_modules/@paddim8/kalk": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/@paddim8/kalk/-/kalk-2.1.1.tgz",
"integrity": "sha512-lIWvZqNOjclV4yAcsYMKZuqXkP0bhml2D/2BmoyzB/JkSgIQblPa+OVjxtntekFjoY1XUnx9R0sWcIVNXBuaPA=="
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/@paddim8/kalk/-/kalk-3.0.1.tgz",
"integrity": "sha512-7QDYJVdIzJMSvxzFwm2dQDnrnYVzFVzTF6RhS2DwnAXotRc85NPJEy8Hti7xlTgzF5tjGqi9TN8txJ1ZILMPsw=="
},
"node_modules/@paddim8/kalk-component": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/@paddim8/kalk-component/-/kalk-component-1.3.0.tgz",
"integrity": "sha512-MnDzXiOwRGdRGIGHm+nBlCDsGaVK9kMzK5RhOs3wY/wbbviSfAKiIU5uqATxtQk9aa+T3di1obz0AkoIjFs/HQ==",
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/@paddim8/kalk-component/-/kalk-component-2.0.1.tgz",
"integrity": "sha512-ic+/Mc0lrQJJHo0BZa7qq/CFHdkLxDcQmrtAgW9iIv6/O/Ucoqw9S/XhBTJElt/YKh68881Qcd2GBVT50/Cwpg==",
"dependencies": {
"@paddim8/kalk": "^2.1.0",
"@paddim8/kalk": "^3.0.1",
"shadow-selection-polyfill": "^1.1.0"
}
},
@ -5250,16 +5250,16 @@
}
},
"@paddim8/kalk": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/@paddim8/kalk/-/kalk-2.1.1.tgz",
"integrity": "sha512-lIWvZqNOjclV4yAcsYMKZuqXkP0bhml2D/2BmoyzB/JkSgIQblPa+OVjxtntekFjoY1XUnx9R0sWcIVNXBuaPA=="
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/@paddim8/kalk/-/kalk-3.0.1.tgz",
"integrity": "sha512-7QDYJVdIzJMSvxzFwm2dQDnrnYVzFVzTF6RhS2DwnAXotRc85NPJEy8Hti7xlTgzF5tjGqi9TN8txJ1ZILMPsw=="
},
"@paddim8/kalk-component": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/@paddim8/kalk-component/-/kalk-component-1.3.0.tgz",
"integrity": "sha512-MnDzXiOwRGdRGIGHm+nBlCDsGaVK9kMzK5RhOs3wY/wbbviSfAKiIU5uqATxtQk9aa+T3di1obz0AkoIjFs/HQ==",
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/@paddim8/kalk-component/-/kalk-component-2.0.1.tgz",
"integrity": "sha512-ic+/Mc0lrQJJHo0BZa7qq/CFHdkLxDcQmrtAgW9iIv6/O/Ucoqw9S/XhBTJElt/YKh68881Qcd2GBVT50/Cwpg==",
"requires": {
"@paddim8/kalk": "^2.1.0",
"@paddim8/kalk": "^3.0.1",
"shadow-selection-polyfill": "^1.1.0"
}
},

22
mobile/remove-proprietary.sh Executable file
View File

@ -0,0 +1,22 @@
#!/bin/sh
dir="./node_modules/@capacitor/android/capacitor"
# remove lines related to play service/firebase dependencies
sed -i '/playServices/d' "$dir/build.gradle"
sed -i '/firebase/d' "$dir/build.gradle"
# remove the files that rely on the proprietary services
rm "$dir/src/main/java/com/getcapacitor/plugin/Geolocation.java"
rm "$dir/src/main/java/com/getcapacitor/plugin/PushNotifications.java"
rm "$dir/src/main/java/com/getcapacitor/CapacitorFirebaseMessagingService.java"
# remove the references to the plugins in Bridge.java
sed -i '/Geolocation/d' "$dir/src/main/java/com/getcapacitor/Bridge.java"
sed -i '/PushNotifications/d' "$dir/src/main/java/com/getcapacitor/Bridge.java"
# remove unecessary permissions and now redundant lines from manifest
sed -i '/WAKE_LOCK/d' "$dir/src/main/AndroidManifest.xml"
sed -i '/RECEIVE_BOOT_COMPLETED/d' "$dir/src/main/AndroidManifest.xml"
i=$(grep -n "firebase_messaging_auto_init_enabled" "$dir/src/main/AndroidManifest.xml" | cut -d : -f 1)
sed -i "$i,$(($i+12))d" "$dir/src/main/AndroidManifest.xml"