()
| 1105 | } |
| 1106 | |
| 1107 | func (gui *Gui) showBreakingChangesMessage() { |
| 1108 | _, err := types.ParseVersionNumber(gui.Config.GetVersion()) |
| 1109 | if err != nil { |
| 1110 | // We don't have a parseable version, so we'll assume it's a developer |
| 1111 | // build, or a build from HEAD with a version such as 0.40.0-g1234567; |
| 1112 | // in these cases we don't show release notes. |
| 1113 | return |
| 1114 | } |
| 1115 | |
| 1116 | last := &types.VersionNumber{} |
| 1117 | lastVersionStr := gui.c.GetAppState().LastVersion |
| 1118 | // If there's no saved last version, we show all release notes. This is for |
| 1119 | // people upgrading from a version before we started to save lastVersion. |
| 1120 | // First time new users won't see the release notes because we show them the |
| 1121 | // intro popup instead. |
| 1122 | if lastVersionStr != "" { |
| 1123 | last, err = types.ParseVersionNumber(lastVersionStr) |
| 1124 | if err != nil { |
| 1125 | // The last version was a developer build, so don't show release |
| 1126 | // notes in this case either. |
| 1127 | return |
| 1128 | } |
| 1129 | } |
| 1130 | |
| 1131 | // Now collect all release notes texts for versions newer than lastVersion. |
| 1132 | // We don't need to bother checking the current version here, because we |
| 1133 | // can't possibly have texts for versions newer than current. |
| 1134 | type versionAndText struct { |
| 1135 | version *types.VersionNumber |
| 1136 | text string |
| 1137 | } |
| 1138 | texts := []versionAndText{} |
| 1139 | for versionStr, text := range gui.Tr.BreakingChangesByVersion { |
| 1140 | v, err := types.ParseVersionNumber(versionStr) |
| 1141 | if err != nil { |
| 1142 | // Ignore bogus entries in the BreakingChanges map |
| 1143 | continue |
| 1144 | } |
| 1145 | if last.IsOlderThan(v) { |
| 1146 | texts = append(texts, versionAndText{version: v, text: text}) |
| 1147 | } |
| 1148 | } |
| 1149 | |
| 1150 | if len(texts) > 0 { |
| 1151 | sort.Slice(texts, func(i, j int) bool { |
| 1152 | return texts[i].version.IsOlderThan(texts[j].version) |
| 1153 | }) |
| 1154 | message := strings.Join(lo.Map(texts, func(t versionAndText, _ int) string { return t.text }), "\n") |
| 1155 | |
| 1156 | gui.waitForIntro.Add(1) |
| 1157 | gui.c.OnUIThread(func() error { |
| 1158 | onConfirm := func() error { |
| 1159 | gui.waitForIntro.Done() |
| 1160 | return nil |
| 1161 | } |
| 1162 | |
| 1163 | gui.c.Confirm(types.ConfirmOpts{ |
| 1164 | Title: gui.Tr.BreakingChangesTitle, |
no test coverage detected