MCPcopy Create free account
hub / github.com/crosspoint-reader/crosspoint-reader / onEnter

Method onEnter

src/activities/reader/ReaderActivity.cpp:112–147  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

110}
111
112void ReaderActivity::onEnter() {
113 Activity::onEnter();
114
115 if (initialBookPath.empty()) {
116 goToLibrary(); // Start from root when entering via Browse
117 return;
118 }
119
120 sdFontSystem.ensureLoaded(renderer);
121
122 currentBookPath = initialBookPath;
123 if (isBmpFile(initialBookPath)) {
124 onGoToBmpViewer(initialBookPath);
125 } else if (isXtcFile(initialBookPath)) {
126 auto xtc = loadXtc(initialBookPath);
127 if (!xtc) {
128 onGoBack();
129 return;
130 }
131 onGoToXtcReader(std::move(xtc));
132 } else if (isTxtFile(initialBookPath)) {
133 auto txt = loadTxt(initialBookPath);
134 if (!txt) {
135 onGoBack();
136 return;
137 }
138 onGoToTxtReader(std::move(txt));
139 } else {
140 auto epub = loadEpub(initialBookPath);
141 if (!epub) {
142 onGoBack();
143 return;
144 }
145 onGoToEpubReader(std::move(epub));
146 }
147}
148
149void ReaderActivity::onGoBack() { finish(); }

Callers

nothing calls this directly

Calls 2

ensureLoadedMethod · 0.80
emptyMethod · 0.45

Tested by

no test coverage detected