Alovoa / alovoa-expo

Alovoa frontend for Web, Android and iOS - Made with expo
https://play.google.com/store/apps/details?id=com.alovoa.expo
Mozilla Public License 2.0
54 stars 13 forks source link

About Location on f-droid #14

Closed linonetwo closed 1 year ago

linonetwo commented 1 year ago

So this basically means when using expo, location feature is unavailable if we are targeting f-droid?

I'm also writing an opensource app, I want to upload it to f-droid, so I'm learning how to do it on your repo, thanks!

Nonononoki commented 1 year ago

Hi, I removed the proprietary code from expo-location (https://github.com/Nonononoki/expo-location) and wrote a script to simply replace the library in node_modules (see the scripts folder). Same must be done with expo-application, which is the base of every expo app (https://github.com/Nonononoki/expo-application). F-droid maintainers are really helpful, don't be shy to ask for help from them :)

It's quite tedious to patch every release of expo-location and expo-application tho, I wouldn't mind some help ;)

linonetwo commented 1 year ago

Cool, so thins means Location still works even after remove those proprietary code.

I will give it a try, I found it is https://www.npmjs.com/package/expo-get-location and I didn't found npm package for https://github.com/Nonononoki/expo-application .


I think I can use git-submodule to link it to https://github.com/Alovoa/alovoa-expo/tree/master/script/res/node_modules ? And later we only need to update https://github.com/Nonononoki/expo-application

And only on F-Droid's CI we need this clean version of expo-location and expo-application. On local development we just use normal version as usual, right?

Nonononoki commented 1 year ago

The expo-get-location package was my futile effort to create my own location library for expo, didn't work. Not sure why it's still on npm. You can try using git-submodules, I wasn't sure if F-droid supported that. I will also use that if supported. For development you can use the regular version. Also note that I only implemented a single method to get the users location, the regular version is more powerful.

linonetwo commented 1 year ago

I will have a try on the weekend, thanks.

Also note that I only implemented a single method to get the users location

I'm currently only use these two methods

const location = (await Location.getLastKnownPositionAsync()) ?? await Location.getCurrentPositionAsync({
          accuracy: Location.Accuracy.Lowest,
        });

And expose them as JSB to the webview by https://github.com/linonetwo/react-native-postmessage-cat

I'm curious how this works without GMS, where can it get GPS info from? And in some development countries without google service, can they get locations? There are some app that uses open street map, maybe I can read the source code there...

And I'm considering https://f-droid.org/docs/Setup_an_F-Droid_App_Repo/ , have you consider this? Seems to be a low-hanging fruit.

Nonononoki commented 1 year ago

Currently only getCurrentPositionAsync works. You get the location info directly from the device's GPS module.

linonetwo commented 1 year ago

Can you build it on github action? https://github.com/tiddly-gittly/TidGi-Mobile/actions/runs/6149805681

I'm always getting

e: /usr/share/gradle-8.3/lib/kotlin-stdlib-1.9.0.jar!/META-INF/kotlin-stdlib-jdk8.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1.

It works! Next step is using your modified dependences...