Catfriend1 / syncthing-android

Syncthing-Fork - A Syncthing Wrapper for Android.
Mozilla Public License 2.0
2.04k stars 62 forks source link

Syncthing-Fork called "Sync. Camera" on F-Droid #606

Closed tomasz1986 closed 4 years ago

tomasz1986 commented 4 years ago

Description of the issue

F-Droid seems to pick up "Sync. Camera" as a name of the whole application. I do not think this is intended, is it?

Website:

image

F-Droid app store:

image

On the application installation screen, it is still Syncthing-Fork.

image

Catfriend1 commented 4 years ago

Hmm... My fdroid client shows: Screenshot_2020-01-18-10-43-52-996_org fdroid fdroid

Catfriend1 commented 4 years ago

They parse the app manifest and somehow pickup the secondary launch activity instrad of the one marked as primary. Feel free to report it to fdroidserver repo at gitlab. I cannot solve this from my side.

Catfriend1 commented 4 years ago

Duplicate of: https://github.com/Catfriend1/syncthing-android/issues/519

Ref.: https://gitlab.com/fdroid/fdroiddata/issues/1851

tomasz1986 commented 4 years ago

https://gitlab.com/fdroid/fdroiddata/issues/1924

Catfriend1 commented 4 years ago

Thanks for your help

forrestguice commented 4 years ago

This happened to my app like 10 months ago after I added a second launcher activity. As you've discovered, the name is taken from the wrong activity when there is more than one activity with a launch intent-filter.

I found a work around by adding an activity-alias that pointed to my second activity, and moving the launch intent-filter into that. As an added bonus, this also made it possible to toggle the second launcher icon of/off using an option.

Catfriend1 commented 4 years ago

Hi, could you please post the relevant manifest xml part so I could look at it?

forrestguice commented 4 years ago

Sure. I've copied the relevant parts of my manifest into this gist.

To toggle the alias on/off at runtime, I'm using the following from inside a CheckBoxPreference's onPreferenceChange listener:

ComponentName componentName = new ComponentName(context, "com.forrestguice.suntimeswidget.alarmclock.ui.AlarmClockActivityLauncher");
int state = (Boolean)newValue ? PackageManager.COMPONENT_ENABLED_STATE_ENABLED : PackageManager.COMPONENT_ENABLED_STATE_DISABLED;
PackageManager packageManager = context.getPackageManager();
packageManager.setComponentEnabledSetting(componentName, state, PackageManager.DONT_KILL_APP);

I'm not sure that feature is actually useful (but there it is).

Catfriend1 commented 4 years ago

@forrestguice Thank you. Do I get this right that I just have to add the following part "alias" for my main activity (which should be the default and is NOT the camera launcher)?

Toggling on off the secondary (camera) launcher activity already works in Syncthing-Fork.

<activity-alias
            android:name=".alarmclock.ui.AlarmClockActivityLauncher"
            android:targetActivity=".alarmclock.ui.AlarmClockActivity"
            android:enabled="true">

            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>

            <meta-data android:name="android.app.shortcuts"
                android:resource="@xml/shortcuts_alarms" />

        </activity-alias>
forrestguice commented 4 years ago

Hrm, I think the other way around. Leave your main activity alone. Add an alias pointing to the camera launcher that contains the intent-filter

<activity-alias
            android:name=".activities.PhotoShootActivityAliasOrWhateverYouWantToCallIt"
            android:targetActivity=".activities.PhotoShootActivity"
            android:enabled="true">

            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>

</activity-alias>

and remove the intent-filter from the camera activity itself

<activity
                android:name=".activities.PhotoShootActivity"
                android:icon="@mipmap/ic_launcher_photoshoot"
                android:label="@string/photo_shoot_launcher_title"
                android:launchMode="singleInstance">
</activity>

F-Droid will only discover the main activity (it overlooks the alias) and should take the right name.

Catfriend1 commented 4 years ago

Seems to be ok "by its own" now. https://f-droid.org/de/packages/com.github.catfriend1.syncthingandroid/ https://f-droid.org/en/packages/com.github.catfriend1.syncthingandroid/

and on the f-droid app it is okay on my test android, too.