-
Notifications
You must be signed in to change notification settings - Fork 88
SMM2->3 migration modal, new user modal, disk space warning, markdown format annoucements #224
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 13 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
e9c8908
WIP modals for smm2->smm3 user migration, first time user
budak7273 c22a0be
Simplify language selector implementation
budak7273 fb7ede3
Fix formatting breaking caused by dl/dd/dt/list-dl
budak7273 3b74afc
WIP detection of needing to migrate, need for first time user popup
budak7273 0b88eb3
Change settings subsection icon
budak7273 af762bf
Warning modal for low disk space. <10GB produces a warning
budak7273 a02c892
Merge branch 'master' into new-user-modals
budak7273 ee3117d
Swap FirstTimeSetup checker to the real setting
budak7273 0b5633a
Markdown format annoucements
budak7273 089188d
Merge branch 'add-1.0-install-types' into new-user-modals
budak7273 f9f3959
Description text in migration popup
budak7273 b29077f
Appease linter
budak7273 32e3b76
Cleanup
budak7273 fd1396f
Suggestions from code review
budak7273 3687f59
Render markdown in announcement tooltips
budak7273 b751c20
Suggestions from code review
budak7273 17d4cb3
Apply two-button patch from Mircea
budak7273 74d1038
Merge branch 'master' into new-user-modals
budak7273 a3ab95a
Fix unclosed div
budak7273 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
package migration | ||
|
||
import ( | ||
"errors" | ||
"fmt" | ||
"log/slog" | ||
"os" | ||
) | ||
|
||
type migration struct { | ||
smm2Dir string | ||
} | ||
|
||
var Migration *migration | ||
|
||
func Init() error { | ||
if Migration == nil { | ||
dir, err := os.UserConfigDir() | ||
if err != nil { | ||
return fmt.Errorf("failed to get user home directory for migration check: %w", err) | ||
} | ||
Migration = &migration{} | ||
Migration.smm2Dir = dir + "\\SatisfactoryModManager\\profiles\\" | ||
} | ||
return nil | ||
} | ||
|
||
const migrationSuccessMarkerFile = ".smm3_migration_acknowledged" | ||
|
||
// https://stackoverflow.com/questions/12518876/how-to-check-if-a-file-exists-in-go | ||
func pathExists(path string) bool { | ||
if _, err := os.Stat(path); err == nil { | ||
return true | ||
} else if errors.Is(err, os.ErrNotExist) { | ||
return false | ||
} else { | ||
slog.Warn("Error when checking path exists, so assuming it does not exist: "+path, slog.Any("error", err)) | ||
return false | ||
} | ||
} | ||
|
||
func (m *migration) NeedsSmm2Migration() bool { | ||
if pathExists(m.smm2Dir) { | ||
return !pathExists(m.smm2Dir + migrationSuccessMarkerFile) | ||
} | ||
return false | ||
} | ||
|
||
func (m *migration) MarkSmm2MigrationSuccess() error { | ||
file, err := os.Create(m.smm2Dir + migrationSuccessMarkerFile) | ||
if err != nil { | ||
return fmt.Errorf("failed to create migration success marker file: %w", err) | ||
} | ||
err = file.Close() | ||
if err != nil { | ||
return fmt.Errorf("failed to close file: %w", err) | ||
} | ||
return nil | ||
} | ||
mircearoata marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,7 @@ | |
"Maximised", | ||
"Minimised", | ||
"mircearoata", | ||
"noclose", | ||
"Nyan", | ||
"smmanager", | ||
"smmprofile", | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
budak7273 marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.