@@ -156,40 +156,43 @@ public Type getType() {
156156 if (repoModule != null ) {
157157 remoteVersionCode = String .valueOf (repoModule .moduleInfo .versionCode );
158158 }
159- // now, coerce everything into an int
160- int localVersionCode = Integer .parseInt (String .valueOf (moduleInfo .versionCode ));
161- int remoteVersionCodeInt = Integer .parseInt (remoteVersionCode );
162- int wantsVersion = Integer .parseInt (version .split (":" )[1 ].replaceAll ("[^0-9]" , "" ));
163- // now find out if user wants up to and including this version, or this version and newer
164- // if it starts with ^, it's this version and newer, if it ends with $, it's this version and older
165- if (version .startsWith ("^" )) {
166- // this version and newer
167- if (wantsVersion <= remoteVersionCodeInt || wantsVersion <= localVersionCode ) {
159+ if (!version .isEmpty ()) {
160+ // now, coerce everything into an int
161+ int localVersionCode = Integer .parseInt (String .valueOf (moduleInfo .versionCode ));
162+ int remoteVersionCodeInt = Integer .parseInt (remoteVersionCode );
163+ int wantsVersion = Integer .parseInt (version .split (":" )[1 ].replaceAll ("[^0-9]" , "" ));
164+ // now find out if user wants up to and including this version, or this version and newer
165+ // if it starts with ^, it's this version and newer, if it ends with $, it's this version and older
166+ if (version .startsWith ("^" )) {
167+ // this version and newer
168+ if (wantsVersion <= remoteVersionCodeInt || wantsVersion <= localVersionCode ) {
169+ // if it is, we skip it
170+ ignoreUpdate = true ;
171+ }
172+ } else if (version .endsWith ("$" )) {
173+ // this version and older
174+ if (wantsVersion >= remoteVersionCodeInt || wantsVersion >= localVersionCode ) {
175+ // if it is, we skip it
176+ ignoreUpdate = true ;
177+ }
178+ } else if (wantsVersion == remoteVersionCodeInt || wantsVersion == localVersionCode ) {
168179 // if it is, we skip it
169180 ignoreUpdate = true ;
170181 }
171- } else if (version .endsWith ("$" )) {
172- // this version and older
173- if (wantsVersion >= remoteVersionCodeInt || wantsVersion >= localVersionCode ) {
174- // if it is, we skip it
175- ignoreUpdate = true ;
176- }
177- } else if (wantsVersion == remoteVersionCodeInt || wantsVersion == localVersionCode ) {
178- // if it is, we skip it
179- ignoreUpdate = true ;
180182 }
181- MainApplication .getINSTANCE ().modulesHaveUpdates = true ;
182- if (!MainApplication .getINSTANCE ().updateModules .contains (this .moduleId )) {
183- MainApplication .getINSTANCE ().updateModules .add (this .moduleId );
184- MainApplication .getINSTANCE ().updateModuleCount ++;
185- }
186- Timber .d ("modulesHaveUpdates = %s, updateModuleCount = %s" , MainApplication .getINSTANCE ().modulesHaveUpdates , MainApplication .getINSTANCE ().updateModuleCount );
187183 if (ignoreUpdate ) {
188184 Timber .d ("Module %s has update, but is ignored" , this .moduleId );
189185 return Type .INSTALLABLE ;
186+ } else {
187+ MainApplication .getINSTANCE ().modulesHaveUpdates = true ;
188+ if (!MainApplication .getINSTANCE ().updateModules .contains (this .moduleId )) {
189+ MainApplication .getINSTANCE ().updateModules .add (this .moduleId );
190+ MainApplication .getINSTANCE ().updateModuleCount ++;
191+ }
192+ Timber .d ("modulesHaveUpdates = %s, updateModuleCount = %s" , MainApplication .getINSTANCE ().modulesHaveUpdates , MainApplication .getINSTANCE ().updateModuleCount );
193+ Timber .d ("Module %s has update" , this .moduleId );
194+ return Type .UPDATABLE ;
190195 }
191- Timber .d ("Module %s has update" , this .moduleId );
192- return Type .UPDATABLE ;
193196 } else {
194197 return Type .INSTALLED ;
195198 }
0 commit comments