@@ -148,46 +148,50 @@ public Type getType() {
148148 // oh, and because i hate myself, i made ^ at the beginning match that version and newer, and $ at the end match that version and older
149149 Set <String > stringSetT = MainApplication .getSharedPreferences ("mmm" ).getStringSet ("pref_background_update_check_excludes_version" , new HashSet <>());
150150 String version = "" ;
151- Set <String > stringSet = stringSetT ;
152- Timber .d (stringSet .toString ());
153- if (stringSet .contains (this .moduleInfo .id )) {
154- // get the one matching
155- Timber .d ("found mod in ig ver" );
156- version = stringSet .stream ().filter (s -> s .startsWith (this .moduleInfo .id )).findFirst ().orElse ("" );
157- Timber .d ("igV:%s" , version );
151+ Timber .d (stringSetT .toString ());
152+ // unfortunately, stringsett.contains() doesn't work for partial matches
153+ // so we have to iterate through the set
154+ for (String s : stringSetT ) {
155+ if (s .startsWith (this .moduleInfo .id )) {
156+ version = s ;
157+ Timber .d ("igV: %s" , version );
158+ break ;
159+ }
158160 }
159161 String remoteVersionCode = String .valueOf (moduleInfo .updateVersionCode );
160162 if (repoModule != null ) {
161163 remoteVersionCode = String .valueOf (repoModule .moduleInfo .versionCode );
162164 }
163165 if (!version .isEmpty ()) {
164166 // now, coerce everything into an int
165- int localVersionCode = Integer .parseInt (String .valueOf (moduleInfo .versionCode ));
166167 int remoteVersionCodeInt = Integer .parseInt (remoteVersionCode );
167168 int wantsVersion = Integer .parseInt (version .split (":" )[1 ].replaceAll ("[^0-9]" , "" ));
168169 // now find out if user wants up to and including this version, or this version and newer
169- // if it starts with ^, it's this version and newer, if it ends with $, it's this version and older
170+ Timber .d ("igV start with" );
171+ version = version .split (":" )[1 ];
172+ // this version and newer
170173 if (version .startsWith ("^" )) {
171- Timber .d ("igV start with" );
172- // this version and newer
173- if (wantsVersion <= remoteVersionCodeInt || wantsVersion <= localVersionCode ) {
174+ Timber .d ("igV: newer" );
175+ // the wantsversion and newer
176+ if (remoteVersionCodeInt >= wantsVersion ) {
177+ Timber .d ("igV: skipping" );
174178 // if it is, we skip it
175- Timber .d ("igu true" );
176179 ignoreUpdate = true ;
177180 }
178181 } else if (version .endsWith ("$" )) {
179- Timber .d ("igV end with" );
180- // this version and older
181- if (wantsVersion >= remoteVersionCodeInt || wantsVersion >= localVersionCode ) {
182+ Timber .d ("igV: older" );
183+ // this wantsversion and older
184+ if (remoteVersionCodeInt <= wantsVersion ) {
185+ Timber .d ("igV: skipping" );
182186 // if it is, we skip it
183- Timber .d ("igu true" );
184187 ignoreUpdate = true ;
185188 }
186- } else if (wantsVersion == remoteVersionCodeInt || wantsVersion == localVersionCode ) {
189+ } else if (wantsVersion == remoteVersionCodeInt ) {
190+ Timber .d ("igV: equal" );
187191 // if it is, we skip it
188- Timber .d ("igu true" );
189192 ignoreUpdate = true ;
190193 }
194+
191195 }
192196 if (ignoreUpdate ) {
193197 Timber .d ("Module %s has update, but is ignored" , this .moduleId );
0 commit comments