Skip to content

Commit fa3c874

Browse files
committed
Add one-time release note display for 1.4.
Also bumped to 1.4 to match. Signed-off-by: Katharine Berry <[email protected]>
1 parent c673f25 commit fa3c874

File tree

6 files changed

+135
-1
lines changed

6 files changed

+135
-1
lines changed

app/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,4 +83,5 @@ add_executable(tiny_assistant_app
8383
src/c/util/memory/malloc.c
8484
src/c/util/memory/pressure.c
8585
src/c/util/memory/sdk.c
86+
src/c/release_notes.c
8687
)

app/package.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "Bobby",
33
"author": "Rebble",
4-
"version": "1.3.0",
4+
"version": "1.4.0",
55
"keywords": [
66
"pebble-app"
77
],
@@ -498,6 +498,11 @@
498498
"file": "images/skull.pdc",
499499
"name": "IMAGE_SKULL",
500500
"type": "raw"
501+
},
502+
{
503+
"file": "text/changelog/1.4.txt",
504+
"name": "CHANGELOG_1_4",
505+
"type": "raw"
501506
}
502507
]
503508
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# New Features
2+
Bobby has been updated! We have some new features:
3+
## Directions
4+
Bobby can now give you driving, walking, cycling, and transit directions. Try asking questions like "how long would it take to drive to McDonald's?" or "when is the next train to San Francisco?". You can get directions too, e.g. "give me walking directions to the library".
5+
## Settings
6+
You can now ask Bobby to change settings verbally, e.g. "always use metric units", "use the Mario pattern for timers", or "set the response language to French". Every setting on the settings page except for location permissions can be changed verbally.
7+
## Release notes
8+
You're reading them! Bobby will show you these release notes on the first launch after an update.
9+
Since this is the first batch, here are some other features we've added since 1.0...
10+
## Places and maps
11+
Now when you ask Bobby about places (e.g. "where's a ramen place nearby?"), Bobby will now show up a map with the results on it. Bobby also now has more accurate location data in most regions (from Google Maps), and also knows the star ratings of each place - so you could, for instance, ask Bobby "which is the best?"
12+
Directions will show a map, too.
13+
## Weather
14+
Bobby now knows the UV index, wind speed, and direction for current, hourly, and daily forecasts.
15+
## Bug fixes
16+
We have some! Most notably, "double quotes" in your question now work - which can be helpful when, for instance, asking for translations.

app/src/c/assistant.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
*/
1616

1717
#include "root_window.h"
18+
#include "release_notes.h"
1819
#include "consent/consent.h"
1920
#include "converse/session_window.h"
2021
#include "converse/conversation_manager.h"
@@ -79,6 +80,7 @@ int main(void) {
7980
s_root_window = root_window_create();
8081
root_window_push(s_root_window);
8182
}
83+
release_notes_maybe_push();
8284
}
8385
}
8486

app/src/c/release_notes.c

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
/*
2+
* Copyright 2025 Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
#include "release_notes.h"
18+
#include <pebble.h>
19+
20+
#include "util/formatted_text_layer.h"
21+
#include "util/logging.h"
22+
#include "util/memory/malloc.h"
23+
#include "util/memory/sdk.h"
24+
#include "version/version.h"
25+
26+
typedef struct {
27+
Window *window;
28+
ScrollLayer *scroll_layer;
29+
FormattedTextLayer *text_layer;
30+
char* text;
31+
} ReleaseNotesWindowData;
32+
33+
static void prv_load(Window *window);
34+
static void prv_unload(Window *window);
35+
// static void prv_click_config_provider(void *context);
36+
static char* prv_create_release_notes();
37+
38+
void prv_release_notes_push() {
39+
Window *window = bwindow_create();
40+
ReleaseNotesWindowData *data = bmalloc(sizeof(ReleaseNotesWindowData));
41+
data->window = window;
42+
window_set_user_data(window, data);
43+
window_set_window_handlers(window, (WindowHandlers) {
44+
.load = prv_load,
45+
.unload = prv_unload,
46+
});
47+
window_stack_push(window, true);
48+
}
49+
50+
void release_notes_maybe_push() {
51+
if (version_is_updated() && !version_is_first_launch()) {
52+
BOBBY_LOG(APP_LOG_LEVEL_INFO, "Showing release notes");
53+
prv_release_notes_push();
54+
} else {
55+
BOBBY_LOG(APP_LOG_LEVEL_INFO, "Not showing release notes. Is updated: %d, Is first launch: %d", version_is_updated(), version_is_first_launch());
56+
}
57+
}
58+
59+
static char* prv_create_release_notes() {
60+
ResHandle handle = resource_get_handle(RESOURCE_ID_CHANGELOG_1_4);
61+
size_t size = resource_size(handle) + 1;
62+
char* text = bmalloc(size);
63+
text[size - 1] = '\0';
64+
resource_load(handle, (uint8_t*)text, size);
65+
return text;
66+
}
67+
68+
static void prv_load(Window *window) {
69+
GRect bounds = layer_get_bounds(window_get_root_layer(window));
70+
ReleaseNotesWindowData *data = window_get_user_data(window);
71+
data->text = prv_create_release_notes();
72+
data->text_layer = formatted_text_layer_create(GRect(5, 0, bounds.size.w - 10, 5000));
73+
formatted_text_layer_set_text(data->text_layer, data->text);
74+
GSize content_size = formatted_text_layer_get_content_size(data->text_layer);
75+
layer_set_frame(data->text_layer, GRect(5, 0, bounds.size.w - 10, content_size.h + 10));
76+
data->scroll_layer = scroll_layer_create(GRect(0, 0, bounds.size.w, bounds.size.h));
77+
scroll_layer_set_shadow_hidden(data->scroll_layer, true);
78+
scroll_layer_set_content_size(data->scroll_layer, layer_get_frame(data->text_layer).size);
79+
scroll_layer_set_click_config_onto_window(data->scroll_layer, window);
80+
scroll_layer_add_child(data->scroll_layer, data->text_layer);
81+
layer_add_child(window_get_root_layer(window), scroll_layer_get_layer(data->scroll_layer));
82+
scroll_layer_set_click_config_onto_window(data->scroll_layer, window);
83+
}
84+
85+
static void prv_unload(Window *window) {
86+
ReleaseNotesWindowData *data = window_get_user_data(window);
87+
free(data->text);
88+
formatted_text_layer_destroy(data->text_layer);
89+
scroll_layer_destroy(data->scroll_layer);
90+
free(data);
91+
window_destroy(window);
92+
}

app/src/c/release_notes.h

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/*
2+
* Copyright 2025 Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
#pragma once
17+
18+
void release_notes_maybe_push();

0 commit comments

Comments
 (0)