Unable to Add more than Two SFTP Servers
Using the Play Store version, adding upto two SFTP servers works just fine, but when I add the third one, the first one just vanishes from the top of the pull-out drawer as well as from Settings > Storage.
The newly added one and the second one work fine at this point. If I repeat the above process with a fourth server, then the second one vanishes and I can only use the third and fourth, and so on.
I’ve tried adding using the “+ Add Storage” option in the pull-out, and also the “+” FAB in the Settings > Storage section.
I’ll be glad to provide logs if required.
I can't reproduce this locally and I was able to add 3 SFTP servers. Could you your upload a video showing what exactly you did to trigger this? Note that you don't need to use actual hostname/username/password for the video if you press "Add" instead of "Connect and add".
https://user-images.githubusercontent.com/6301593/167088170-35474445-53a8-4b97-bf29-5a326f8effa2.mp4
Using just the “Add” button increases the limit from 2 to 4 items, but the problem is still there.
It seems that 5 somehow replaced 3. However, the app logic is that replace only happens when the ID of two storage matches, which is a random long for a newly created storage. And I also checked that the Random is always initialized with a seed relavent to system time. So this is indeed weird.
https://github.com/zhanghai/MaterialFiles/blob/e424dcc0ee2732681c026c00bdd3a6da4b327cd5/app/src/main/java/me/zhanghai/android/files/storage/EditSftpServerFragment.kt#L362
https://github.com/zhanghai/MaterialFiles/blob/e424dcc0ee2732681c026c00bdd3a6da4b327cd5/app/src/main/java/me/zhanghai/android/files/storage/EditSftpServerFragment.kt#L239-L243
https://github.com/zhanghai/MaterialFiles/blob/e424dcc0ee2732681c026c00bdd3a6da4b327cd5/app/src/main/java/me/zhanghai/android/files/storage/SftpServer.kt#L29-L35
https://github.com/zhanghai/MaterialFiles/blob/e424dcc0ee2732681c026c00bdd3a6da4b327cd5/app/src/main/java/me/zhanghai/android/files/storage/Storages.kt#L13-L23
Meanwhile, I was able to add 6 SFTP servers normally, so this is indeed strange... 🤔
