@ -158,11 +158,7 @@ public class MainActivity extends FoxActivity implements SwipeRefreshLayout.OnRe
moduleViewListBuilder . addNotification ( NotificationType . MAGISK_OUTDATED ) ;
moduleViewListBuilder . addNotification ( NotificationType . MAGISK_OUTDATED ) ;
if ( ! MainApplication . isShowcaseMode ( ) )
if ( ! MainApplication . isShowcaseMode ( ) )
moduleViewListBuilder . addNotification ( NotificationType . INSTALL_FROM_STORAGE ) ;
moduleViewListBuilder . addNotification ( NotificationType . INSTALL_FROM_STORAGE ) ;
noodleDebug . setEnabled ( noodleDebugState ) ;
noodleDebug . bind ( ) ;
noodleDebug . push ( "Ensure Permissions" ) ;
ensurePermissions ( ) ;
ensurePermissions ( ) ;
noodleDebug . pop ( ) ;
ModuleManager . getINSTANCE ( ) . scan ( ) ;
ModuleManager . getINSTANCE ( ) . scan ( ) ;
ModuleManager . getINSTANCE ( ) . runAfterScan ( moduleViewListBuilder : : appendInstalledModules ) ;
ModuleManager . getINSTANCE ( ) . runAfterScan ( moduleViewListBuilder : : appendInstalledModules ) ;
this . commonNext ( ) ;
this . commonNext ( ) ;
@ -171,21 +167,17 @@ public class MainActivity extends FoxActivity implements SwipeRefreshLayout.OnRe
@Override
@Override
public void onFailure ( int error ) {
public void onFailure ( int error ) {
Log . i ( TAG , "Failed to get magisk path!" ) ;
Log . i ( TAG , "Failed to get magisk path!" ) ;
noodleDebug . setEnabled ( noodleDebugState ) ;
noodleDebug . bind ( ) ;
moduleViewListBuilder . addNotification ( InstallerInitializer . getErrorNotification ( ) ) ;
moduleViewListBuilder . addNotification ( InstallerInitializer . getErrorNotification ( ) ) ;
this . commonNext ( ) ;
this . commonNext ( ) ;
}
}
public void commonNext ( ) {
public void commonNext ( ) {
NoodleDebug noodleDebug = NoodleDebug . getNoodleDebug ( ) ;
swipeRefreshBlocker = System . currentTimeMillis ( ) + 5_000L ;
swipeRefreshBlocker = System . currentTimeMillis ( ) + 5_000L ;
updateScreenInsets ( ) ; // Fix an edge case
updateScreenInsets ( ) ; // Fix an edge case
if ( MainApplication . isShowcaseMode ( ) )
if ( MainApplication . isShowcaseMode ( ) )
moduleViewListBuilder . addNotification ( NotificationType . SHOWCASE_MODE ) ;
moduleViewListBuilder . addNotification ( NotificationType . SHOWCASE_MODE ) ;
if ( ! Http . hasWebView ( ) ) // Check Http for WebView availability
if ( ! Http . hasWebView ( ) ) // Check Http for WebView availability
moduleViewListBuilder . addNotification ( NotificationType . NO_WEB_VIEW ) ;
moduleViewListBuilder . addNotification ( NotificationType . NO_WEB_VIEW ) ;
noodleDebug . push ( "Apply" ) ;
moduleViewListBuilder . applyTo ( moduleList , moduleViewAdapter ) ;
moduleViewListBuilder . applyTo ( moduleList , moduleViewAdapter ) ;
runOnUiThread ( ( ) - > {
runOnUiThread ( ( ) - > {
progressIndicator . setIndeterminate ( false ) ;
progressIndicator . setIndeterminate ( false ) ;
@ -194,14 +186,14 @@ public class MainActivity extends FoxActivity implements SwipeRefreshLayout.OnRe
updateScreenInsets ( getResources ( ) . getConfiguration ( ) ) ;
updateScreenInsets ( getResources ( ) . getConfiguration ( ) ) ;
} ) ;
} ) ;
Log . i ( TAG , "Scanning for modules!" ) ;
Log . i ( TAG , "Scanning for modules!" ) ;
noodleDebug . replace ( "Initialize Update" ) ;
if ( BuildConfig . DEBUG ) Log . d ( "NoodleDebug" , "Initialize Update" ) ;
final int max = ModuleManager . getINSTANCE ( ) . getUpdatableModuleCount ( ) ;
final int max = ModuleManager . getINSTANCE ( ) . getUpdatableModuleCount ( ) ;
if ( RepoManager . getINSTANCE ( ) . getCustomRepoManager ( ) . needUpdate ( ) ) {
if ( RepoManager . getINSTANCE ( ) . getCustomRepoManager ( ) . needUpdate ( ) ) {
Log . w ( TAG , "Need update on create?" ) ;
Log . w ( TAG , "Need update on create?" ) ;
}
}
noodleDebug . replace ( "Check Update Compat" ) ;
if ( BuildConfig . DEBUG ) Log . d ( "NoodleDebug" , "Check Update Compat" ) ;
AppUpdateManager . getAppUpdateManager ( ) . checkUpdateCompat ( ) ;
AppUpdateManager . getAppUpdateManager ( ) . checkUpdateCompat ( ) ;
noodleDebug . replace ( "Check Update" ) ;
if ( BuildConfig . DEBUG ) Log . d ( "NoodleDebug" , "Check Update" ) ;
RepoManager . getINSTANCE ( ) . update ( value - > runOnUiThread ( max = = 0 ? ( ) - > progressIndicator . setProgressCompat ( ( int ) ( value * PRECISION ) , true ) : ( ) - > progressIndicator . setProgressCompat ( ( int ) ( value * PRECISION * 0.75F ) , true ) ) ) ;
RepoManager . getINSTANCE ( ) . update ( value - > runOnUiThread ( max = = 0 ? ( ) - > progressIndicator . setProgressCompat ( ( int ) ( value * PRECISION ) , true ) : ( ) - > progressIndicator . setProgressCompat ( ( int ) ( value * PRECISION * 0.75F ) , true ) ) ) ;
NotificationType . NEED_CAPTCHA_ANDROIDACY . autoAdd ( moduleViewListBuilder ) ;
NotificationType . NEED_CAPTCHA_ANDROIDACY . autoAdd ( moduleViewListBuilder ) ;
if ( ! NotificationType . NO_INTERNET . shouldRemove ( ) ) {
if ( ! NotificationType . NO_INTERNET . shouldRemove ( ) ) {
@ -211,16 +203,16 @@ public class MainActivity extends FoxActivity implements SwipeRefreshLayout.OnRe
} else {
} else {
// Compatibility data still needs to be updated
// Compatibility data still needs to be updated
AppUpdateManager appUpdateManager = AppUpdateManager . getAppUpdateManager ( ) ;
AppUpdateManager appUpdateManager = AppUpdateManager . getAppUpdateManager ( ) ;
noodleDebug . replace ( "Check App Update" ) ;
if ( BuildConfig . DEBUG ) Log . d ( "NoodleDebug" , "Check App Update" ) ;
if ( BuildConfig . ENABLE_AUTO_UPDATER & & appUpdateManager . checkUpdate ( true ) )
if ( BuildConfig . ENABLE_AUTO_UPDATER & & appUpdateManager . checkUpdate ( true ) )
moduleViewListBuilder . addNotification ( NotificationType . UPDATE_AVAILABLE ) ;
moduleViewListBuilder . addNotification ( NotificationType . UPDATE_AVAILABLE ) ;
noodleDebug . replace ( "Check Json Update" ) ;
if ( BuildConfig . DEBUG ) Log . d ( "NoodleDebug" , "Check Json Update" ) ;
if ( max ! = 0 ) {
if ( max ! = 0 ) {
int current = 0 ;
int current = 0 ;
noodleDebug . push ( "" ) ;
// noodleDebug.push("");
for ( LocalModuleInfo localModuleInfo : ModuleManager . getINSTANCE ( ) . getModules ( ) . values ( ) ) {
for ( LocalModuleInfo localModuleInfo : ModuleManager . getINSTANCE ( ) . getModules ( ) . values ( ) ) {
if ( localModuleInfo . updateJson ! = null ) {
if ( localModuleInfo . updateJson ! = null ) {
noodleDebug . replace ( localModuleInfo . id ) ;
if ( BuildConfig . DEBUG ) Log . d ( "NoodleDebug" , localModuleInfo . id ) ;
try {
try {
localModuleInfo . checkModuleUpdate ( ) ;
localModuleInfo . checkModuleUpdate ( ) ;
} catch ( Exception e ) {
} catch ( Exception e ) {
@ -231,7 +223,6 @@ public class MainActivity extends FoxActivity implements SwipeRefreshLayout.OnRe
runOnUiThread ( ( ) - > progressIndicator . setProgressCompat ( ( int ) ( ( 1F * currentTmp / max ) * PRECISION * 0.25F + ( PRECISION * 0.75F ) ) , true ) ) ;
runOnUiThread ( ( ) - > progressIndicator . setProgressCompat ( ( int ) ( ( 1F * currentTmp / max ) * PRECISION * 0.25F + ( PRECISION * 0.75F ) ) , true ) ) ;
}
}
}
}
noodleDebug . pop ( ) ;
}
}
}
}
runOnUiThread ( ( ) - > {
runOnUiThread ( ( ) - > {
@ -241,12 +232,11 @@ public class MainActivity extends FoxActivity implements SwipeRefreshLayout.OnRe
setActionBarBackground ( null ) ;
setActionBarBackground ( null ) ;
updateScreenInsets ( getResources ( ) . getConfiguration ( ) ) ;
updateScreenInsets ( getResources ( ) . getConfiguration ( ) ) ;
} ) ;
} ) ;
noodleDebug . replace ( "Apply" ) ;
if ( BuildConfig . DEBUG ) Log . d ( "NoodleDebug" , "Apply" ) ;
RepoManager . getINSTANCE ( ) . runAfterUpdate ( moduleViewListBuilder : : appendRemoteModules ) ;
RepoManager . getINSTANCE ( ) . runAfterUpdate ( moduleViewListBuilder : : appendRemoteModules ) ;
moduleViewListBuilder . applyTo ( moduleList , moduleViewAdapter ) ;
moduleViewListBuilder . applyTo ( moduleList , moduleViewAdapter ) ;
noodleDebug . pop ( ) ;
Log . i ( TAG , "Finished app opening state!" ) ;
Log . i ( TAG , "Finished app opening state!" ) ;
noodleDebug . unbind ( ) ;
// noodleDebug.unbind();
}
}
} , true ) ;
} , true ) ;
ExternalHelper . INSTANCE . refreshHelper ( this ) ;
ExternalHelper . INSTANCE . refreshHelper ( this ) ;
@ -328,8 +318,6 @@ public class MainActivity extends FoxActivity implements SwipeRefreshLayout.OnRe
moduleViewListBuilder . addNotification ( NotificationType . MAGISK_OUTDATED ) ;
moduleViewListBuilder . addNotification ( NotificationType . MAGISK_OUTDATED ) ;
if ( ! MainApplication . isShowcaseMode ( ) )
if ( ! MainApplication . isShowcaseMode ( ) )
moduleViewListBuilder . addNotification ( NotificationType . INSTALL_FROM_STORAGE ) ;
moduleViewListBuilder . addNotification ( NotificationType . INSTALL_FROM_STORAGE ) ;
noodleDebug . setEnabled ( noodleDebugState ) ;
noodleDebug . bind ( ) ;
ModuleManager . getINSTANCE ( ) . scan ( ) ;
ModuleManager . getINSTANCE ( ) . scan ( ) ;
ModuleManager . getINSTANCE ( ) . runAfterScan ( moduleViewListBuilder : : appendInstalledModules ) ;
ModuleManager . getINSTANCE ( ) . runAfterScan ( moduleViewListBuilder : : appendInstalledModules ) ;
this . commonNext ( ) ;
this . commonNext ( ) ;
@ -345,7 +333,6 @@ public class MainActivity extends FoxActivity implements SwipeRefreshLayout.OnRe
public void commonNext ( ) {
public void commonNext ( ) {
Log . i ( TAG , "Common Before" ) ;
Log . i ( TAG , "Common Before" ) ;
NoodleDebug noodleDebug = NoodleDebug . getNoodleDebug ( ) ;
if ( MainApplication . isShowcaseMode ( ) )
if ( MainApplication . isShowcaseMode ( ) )
moduleViewListBuilder . addNotification ( NotificationType . SHOWCASE_MODE ) ;
moduleViewListBuilder . addNotification ( NotificationType . SHOWCASE_MODE ) ;
NotificationType . NEED_CAPTCHA_ANDROIDACY . autoAdd ( moduleViewListBuilder ) ;
NotificationType . NEED_CAPTCHA_ANDROIDACY . autoAdd ( moduleViewListBuilder ) ;
@ -354,26 +341,23 @@ public class MainActivity extends FoxActivity implements SwipeRefreshLayout.OnRe
else if ( AppUpdateManager . getAppUpdateManager ( ) . checkUpdate ( false ) )
else if ( AppUpdateManager . getAppUpdateManager ( ) . checkUpdate ( false ) )
moduleViewListBuilder . addNotification ( NotificationType . UPDATE_AVAILABLE ) ;
moduleViewListBuilder . addNotification ( NotificationType . UPDATE_AVAILABLE ) ;
RepoManager . getINSTANCE ( ) . updateEnabledStates ( ) ;
RepoManager . getINSTANCE ( ) . updateEnabledStates ( ) ;
noodleDebug . push ( "" ) ;
if ( RepoManager . getINSTANCE ( ) . getCustomRepoManager ( ) . needUpdate ( ) ) {
if ( RepoManager . getINSTANCE ( ) . getCustomRepoManager ( ) . needUpdate ( ) ) {
runOnUiThread ( ( ) - > {
runOnUiThread ( ( ) - > {
progressIndicator . setIndeterminate ( false ) ;
progressIndicator . setIndeterminate ( false ) ;
progressIndicator . setMax ( PRECISION ) ;
progressIndicator . setMax ( PRECISION ) ;
} ) ;
} ) ;
noodleDebug . replace ( "Check Update" ) ;
if ( BuildConfig . DEBUG ) Log . d ( "NoodleDebug" , "Check Update" ) ;
RepoManager . getINSTANCE ( ) . update ( value - > runOnUiThread ( ( ) - > progressIndicator . setProgressCompat ( ( int ) ( value * PRECISION ) , true ) ) ) ;
RepoManager . getINSTANCE ( ) . update ( value - > runOnUiThread ( ( ) - > progressIndicator . setProgressCompat ( ( int ) ( value * PRECISION ) , true ) ) ) ;
runOnUiThread ( ( ) - > {
runOnUiThread ( ( ) - > {
progressIndicator . setProgressCompat ( PRECISION , true ) ;
progressIndicator . setProgressCompat ( PRECISION , true ) ;
progressIndicator . setVisibility ( View . GONE ) ;
progressIndicator . setVisibility ( View . GONE ) ;
} ) ;
} ) ;
}
}
noodleDebug . replace ( "Apply" ) ;
if ( BuildConfig . DEBUG ) Log . d ( "NoodleDebug" , "Apply" ) ;
RepoManager . getINSTANCE ( ) . runAfterUpdate ( moduleViewListBuilder : : appendRemoteModules ) ;
RepoManager . getINSTANCE ( ) . runAfterUpdate ( moduleViewListBuilder : : appendRemoteModules ) ;
Log . i ( TAG , "Common Before applyTo" ) ;
Log . i ( TAG , "Common Before applyTo" ) ;
moduleViewListBuilder . applyTo ( moduleList , moduleViewAdapter ) ;
moduleViewListBuilder . applyTo ( moduleList , moduleViewAdapter ) ;
noodleDebug . pop ( ) ;
Log . i ( TAG , "Common After" ) ;
Log . i ( TAG , "Common After" ) ;
noodleDebug . unbind ( ) ;
}
}
} ) ;
} ) ;
this . initMode = false ;
this . initMode = false ;
@ -390,33 +374,33 @@ public class MainActivity extends FoxActivity implements SwipeRefreshLayout.OnRe
this . swipeRefreshLayout . setRefreshing ( false ) ;
this . swipeRefreshLayout . setRefreshing ( false ) ;
return ; // Do not double scan
return ; // Do not double scan
}
}
if ( BuildConfig . DEBUG ) Log . d ( "NoodleDebug" , "Refresh" ) ;
this . progressIndicator . setVisibility ( View . VISIBLE ) ;
this . progressIndicator . setVisibility ( View . VISIBLE ) ;
this . progressIndicator . setProgressCompat ( 0 , false ) ;
this . progressIndicator . setProgressCompat ( 0 , false ) ;
this . swipeRefreshBlocker = System . currentTimeMillis ( ) + 5_000L ;
this . swipeRefreshBlocker = System . currentTimeMillis ( ) + 5_000L ;
// this.swipeRefreshLayout.setRefreshing(true); ??
// this.swipeRefreshLayout.setRefreshing(true); ??
new Thread ( ( ) - > {
new Thread ( ( ) - > {
noodleDebug . setEnabled ( noodleDebugState ) ;
NoodleDebug noodleDebug = this . noodleDebug . bind ( ) ;
Http . cleanDnsCache ( ) ; // Allow DNS reload from network
Http . cleanDnsCache ( ) ; // Allow DNS reload from network
noodleDebug . push ( "Check Update" ) ;
// noodleDebug.push("Check Update");
final int max = ModuleManager . getINSTANCE ( ) . getUpdatableModuleCount ( ) ;
final int max = ModuleManager . getINSTANCE ( ) . getUpdatableModuleCount ( ) ;
RepoManager . getINSTANCE ( ) . update ( value - > runOnUiThread ( max = = 0 ? ( ) - > progressIndicator . setProgressCompat ( ( int ) ( value * PRECISION ) , true ) : ( ) - > progressIndicator . setProgressCompat ( ( int ) ( value * PRECISION * 0.75F ) , true ) ) ) ;
RepoManager . getINSTANCE ( ) . update ( value - > runOnUiThread ( max = = 0 ? ( ) - > progressIndicator . setProgressCompat ( ( int ) ( value * PRECISION ) , true ) : ( ) - > progressIndicator . setProgressCompat ( ( int ) ( value * PRECISION * 0.75F ) , true ) ) ) ;
NotificationType . NEED_CAPTCHA_ANDROIDACY . autoAdd ( moduleViewListBuilder ) ;
NotificationType . NEED_CAPTCHA_ANDROIDACY . autoAdd ( moduleViewListBuilder ) ;
if ( ! NotificationType . NO_INTERNET . shouldRemove ( ) ) {
if ( ! NotificationType . NO_INTERNET . shouldRemove ( ) ) {
moduleViewListBuilder . addNotification ( NotificationType . NO_INTERNET ) ;
moduleViewListBuilder . addNotification ( NotificationType . NO_INTERNET ) ;
} else if ( ! NotificationType . REPO_UPDATE_FAILED . shouldRemove ( ) ) {
moduleViewListBuilder . addNotification ( NotificationType . REPO_UPDATE_FAILED ) ;
} else {
} else {
// Compatibility data still needs to be updated
// Compatibility data still needs to be updated
AppUpdateManager appUpdateManager = AppUpdateManager . getAppUpdateManager ( ) ;
AppUpdateManager appUpdateManager = AppUpdateManager . getAppUpdateManager ( ) ;
// noodleDebug.replace("Check App Update");
if ( BuildConfig . DEBUG ) Log . d ( "NoodleDebug" , "Check App Update" ) ;
if ( BuildConfig . ENABLE_AUTO_UPDATER & & appUpdateManager . checkUpdate ( true ) )
if ( BuildConfig . ENABLE_AUTO_UPDATER & & appUpdateManager . checkUpdate ( true ) )
moduleViewListBuilder . addNotification ( NotificationType . UPDATE_AVAILABLE ) ;
moduleViewListBuilder . addNotification ( NotificationType . UPDATE_AVAILABLE ) ;
// noodleDebug.replace("Check Json Update");
if ( BuildConfig . DEBUG ) Log . d ( "NoodleDebug" , "Check Json Update" ) ;
if ( max ! = 0 ) {
if ( max ! = 0 ) {
int current = 0 ;
int current = 0 ;
noodleDebug . push ( "" ) ;
for ( LocalModuleInfo localModuleInfo : ModuleManager . getINSTANCE ( ) . getModules ( ) . values ( ) ) {
for ( LocalModuleInfo localModuleInfo : ModuleManager . getINSTANCE ( ) . getModules ( ) . values ( ) ) {
if ( localModuleInfo . updateJson ! = null ) {
if ( localModuleInfo . updateJson ! = null ) {
noodleDebug . replace ( localModuleInfo . id ) ;
if ( BuildConfig . DEBUG ) Log . d ( "NoodleDebug" , localModuleInfo . id ) ;
try {
try {
localModuleInfo . checkModuleUpdate ( ) ;
localModuleInfo . checkModuleUpdate ( ) ;
} catch ( Exception e ) {
} catch ( Exception e ) {
@ -427,23 +411,20 @@ public class MainActivity extends FoxActivity implements SwipeRefreshLayout.OnRe
runOnUiThread ( ( ) - > progressIndicator . setProgressCompat ( ( int ) ( ( 1F * currentTmp / max ) * PRECISION * 0.25F + ( PRECISION * 0.75F ) ) , true ) ) ;
runOnUiThread ( ( ) - > progressIndicator . setProgressCompat ( ( int ) ( ( 1F * currentTmp / max ) * PRECISION * 0.25F + ( PRECISION * 0.75F ) ) , true ) ) ;
}
}
}
}
noodleDebug . pop ( ) ;
}
}
}
}
// noodleDebug.replace("Apply");
if ( BuildConfig . DEBUG ) Log . d ( "NoodleDebug" , "Apply" ) ;
runOnUiThread ( ( ) - > {
runOnUiThread ( ( ) - > {
this . progressIndicator . setVisibility ( View . GONE ) ;
this . progressIndicator . setVisibility ( View . GONE ) ;
this . swipeRefreshLayout . setRefreshing ( false ) ;
this . swipeRefreshLayout . setRefreshing ( false ) ;
} ) ;
} ) ;
NotificationType . NEED_CAPTCHA_ANDROIDACY . autoAdd ( moduleViewListBuilder ) ;
NotificationType . NEED_CAPTCHA_ANDROIDACY . autoAdd ( moduleViewListBuilder ) ;
if ( ! NotificationType . NO_INTERNET . shouldRemove ( ) ) {
this . moduleViewListBuilder . addNotification ( NotificationType . NO_INTERNET ) ;
}
RepoManager . getINSTANCE ( ) . updateEnabledStates ( ) ;
RepoManager . getINSTANCE ( ) . updateEnabledStates ( ) ;
RepoManager . getINSTANCE ( ) . runAfterUpdate ( moduleViewListBuilder : : appendRemoteModules ) ;
RepoManager . getINSTANCE ( ) . runAfterUpdate ( moduleViewListBuilder : : appendRemoteModules ) ;
this . moduleViewListBuilder . applyTo ( moduleList , moduleViewAdapter ) ;
this . moduleViewListBuilder . applyTo ( moduleList , moduleViewAdapter ) ;
// noodleDebug.pop();
/ *
// noodleDebug.unbind();
noodleDebug . unbind ( ) ;
* /
} , "Repo update thread" ) . start ( ) ;
} , "Repo update thread" ) . start ( ) ;
}
}