Files
SubMusic/source/View/SubMusicConfigureSyncDebugDelegate.mc
memen45 f26e33df0d Added menu options (debug options)
- fixed progressbar - only count songs that are not yet local
- fixed crash on sync empty playlist (progress divide by 0)
- fixed initial Sync setup (removed deprecated uses)
- fixed crashes on Error handling
- added last sync time record
- added support for descentmk2 device
2020-12-02 16:54:17 +01:00

56 lines
1.6 KiB
MonkeyC

using Toybox.WatchUi;
using Toybox.Media;
class SubMusicConfigureSyncDebugDelegate extends WatchUi.Menu2InputDelegate {
private var d_provider = SubMusic.Provider.get();
function initialize() {
Menu2InputDelegate.initialize();
}
function onSelect(item) {
var id = item.getId();
if (SyncDebugMenu.TEST_SERVER == id) {
WatchUi.pushView(new SubMusicTestView(d_provider), new WatchUi.BehaviorDelegate(), WatchUi.SLIDE_IMMEDIATE);
return;
}
if (SyncDebugMenu.PLAYLIST_DETAIL == id) {
var ids = PlaylistStore.getIds();
var storage = PlaylistStore.get(ids[0]); // disconnected playlist, viewing only
WatchUi.pushView(new SubMusicPlaylistView(new Playlist(storage)), new WatchUi.BehaviorDelegate(), WatchUi.SLIDE_IMMEDIATE);
return;
}
if (SyncDebugMenu.SERVER_DETAIL == id) {
WatchUi.pushView(new SubMusicServerView(), new WatchUi.BehaviorDelegate(), WatchUi.SLIDE_IMMEDIATE);
return;
}
if (SyncDebugMenu.REMOVE_ALL == id) {
var msg = "Are you sure you want to delete all Application data?";
WatchUi.pushView(new WatchUi.Confirmation(msg), new SubMusicConfirmationDelegate(self.method(:onRemoveAll)), WatchUi.SLIDE_IMMEDIATE);
return;
}
WatchUi.popView(WatchUi.SLIDE_IMMEDIATE);
return;
}
function onRemoveAll() {
// collect all ids of songs
var ids = SongStore.getIds();
for (var idx = 0; idx != ids.size(); ++idx) {
var id = ids[idx];
var isong = new ISong(id);
isong.setRefId(null); // delete from cache
isong.remove(); // remove from Store
}
// remove all metadata
Application.Storage.clearValues();
// check storage to set the storage version number
Storage.check();
}
}