Skip to content

Commit

Permalink
Link to Notes in OSM profile
Browse files Browse the repository at this point in the history
Signed-off-by: map-per <[email protected]>
  • Loading branch information
map-per authored and pastk committed Dec 21, 2024
1 parent 693e1aa commit ceb321d
Show file tree
Hide file tree
Showing 6 changed files with 131 additions and 2 deletions.
6 changes: 6 additions & 0 deletions android/app/src/main/cpp/app/organicmaps/editor/OsmOAuth.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,4 +112,10 @@ Java_app_organicmaps_editor_OsmOAuth_nativeGetHistoryUrl(JNIEnv * env, jclass, j
{
return jni::ToJavaString(env, OsmOAuth::ServerAuth().GetHistoryURL(jni::ToNativeString(env, user)));
}

JNIEXPORT jstring JNICALL
Java_app_organicmaps_editor_OsmOAuth_nativeGetNotesUrl(JNIEnv * env, jclass, jstring user)
{
return jni::ToJavaString(env, OsmOAuth::ServerAuth().GetNotesURL(jni::ToNativeString(env, user)));
}
} // extern "C"
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,11 @@ public static String getHistoryUrl(@NonNull Context context)
return nativeGetHistoryUrl(getUsername(context));
}

public static String getNotesUrl(@NonNull Context context)
{
return nativeGetNotesUrl(getUsername(context));
}

/*
Returns 5 strings: ServerURL, ClientId, ClientSecret, Scope, RedirectUri
*/
Expand Down Expand Up @@ -133,6 +138,10 @@ public static String getHistoryUrl(@NonNull Context context)
@NonNull
public static native String nativeGetHistoryUrl(String user);

@WorkerThread
@NonNull
public static native String nativeGetNotesUrl(String user);

/**
* @return < 0 if failed to get changesets count.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ private void initViews(View view)
mProfileImage = mUserInfoBlock.findViewById(R.id.user_profile_image);
view.findViewById(R.id.about_osm).setOnClickListener((v) -> Utils.openUrl(requireActivity(), getString(R.string.osm_wiki_about_url)));
view.findViewById(R.id.osm_history).setOnClickListener((v) -> Utils.openUrl(requireActivity(), OsmOAuth.getHistoryUrl(requireContext())));
view.findViewById(R.id.osm_notes).setOnClickListener((v) -> Utils.openUrl(requireActivity(), OsmOAuth.getNotesUrl(requireContext())));

}

Expand Down
21 changes: 19 additions & 2 deletions android/app/src/main/res/layout/fragment_osm_profile.xml
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,13 @@
</LinearLayout>
</LinearLayout>
</FrameLayout>

<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:padding="@dimen/margin_base">

<TextView
android:id="@+id/osm_history"
android:layout_width="match_parent"
Expand All @@ -100,10 +102,25 @@
android:gravity="center"
android:paddingTop="@dimen/margin_half"
android:paddingBottom="@dimen/margin_half"
android:text="@string/history"
android:text="@string/editor_osm_history"
android:textAppearance="@style/MwmTextAppearance.Body2"
android:textColor="?colorAccent"
app:layout_constraintTop_toTopOf="parent"/>
app:layout_constraintTop_toTopOf="parent" />

<TextView
android:id="@+id/osm_notes"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:background="?clickableBackground"
android:gravity="center"
android:paddingTop="@dimen/margin_half"
android:paddingBottom="@dimen/margin_half"
android:text="@string/editor_osm_notes"
android:textAppearance="@style/MwmTextAppearance.Body2"
android:textColor="?colorAccent"
app:layout_constraintTop_toBottomOf="@id/osm_history" />

<TextView
android:id="@+id/about_osm"
android:layout_width="match_parent"
Expand Down
92 changes: 92 additions & 0 deletions data/strings/strings.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17424,6 +17424,98 @@
zh-Hans = 关于 OpenStreetMap 的更多信息
zh-Hant = 關於 OpenStreetMap 的更多資訊

[editor_osm_history]
tags = android
en = Your editing history
af = Jou redigeergeskiedenis
ar = سجل التحرير الخاص بك
az = Redaktə tarixçəniz
be = Ваша гісторыя рэдагавання
bg = Вашата история на редактиране
ca = El teu historial d'edició
cs = Vaše historie úprav
da = Din redigeringshistorik
de = Ihr Bearbeitungsverlauf
el = Το ιστορικό επεξεργασίας σας
es = Mi historial de edición
et = Teie toimetamise ajalugu
eu = Zure edizio-historia
fa = سابقه ویرایش شما
fi = Muokkaushistoriasi
fr = Votre historique d'édition
he = היסטוריית העריכה שלך
hi = आपका संपादन इतिहास
hu = Az Ön szerkesztési előzményei
id = Riwayat pengeditan Anda
it = La sua storia di editing
ja = 編集履歴
ko = 편집 기록
lt = Jūsų redagavimo istorija
lv = Tava kartes izmaiņu vēsture
mr = तुमचा संपादन इतिहास
nb = Din redigeringshistorikk
nl = Uw bewerkingsgeschiedenis
pl = Twoja historia edycji
pt = O seu histórico de edições
pt-BR = Seu histórico de edição
ro = Istoricul dvs. de editare
ru = Ваша история редактирования
sk = Vaša história úprav
sv = Din redigeringshistorik
sw = Historia yako ya uhariri
th = ประวัติการแก้ไขของคุณ
tr = Düzenleme geçmişiniz
uk = Ваша історія редагувань
vi = Lịch sử chỉnh sửa của bạn
zh-Hans = 您的编辑历史
zh-Hant = 您的編輯歷史記錄

[editor_osm_notes]
tags = android
en = Your map data notes
af = Jou kaartdata notas
ar = ملاحظات بيانات الخريطة الخاصة بك
az = Xəritə məlumatı qeydləriniz
be = Заўвагі да дадзеных карты
bg = Бележки за данните на вашата карта
ca = Notes de les vostres dades del mapa
cs = Vaše poznámky k mapovým podkladům
da = Dine noter til kortdata
de = Ihre Hinweise zu den Kartendaten
el = Σημειώσεις δεδομένων του χάρτη σας
es = Mis notas de datos cartográficos
et = Teie kaardiandmete märkmed
eu = Zure mapa-datuen oharrak
fa = یادداشت های داده های نقشه شما
fi = Karttatietosi muistiinpanot
fr = Vos notes sur les données cartographiques
he = הערות נתוני המפה שלך
hi = आपका मानचित्र डेटा नोट्स
hu = A térképadatok jegyzetei
id = Catatan data peta Anda
it = Le sue note sui dati della mappa
ja = 地図データのメモ
ko = 지도 데이터 노트
lt = Jūsų žemėlapio duomenų pastabos
lv = Tavas kartes datu piezīmes
mr = तुमचा नकाशा डेटा नोट्स
nb = Notater om kartdataene dine
nl = Opmerkingen over uw kaartgegevens
pl = Twoje uwagi dotyczące danych mapy
pt = As suas notas de dados do mapa
pt-BR = Suas notas de dados do mapa
ro = Note privind datele hărții dvs.
ru = Ваши заметки о данных карты
sk = Vaše poznámky k mapovým údajom
sv = Anteckningar om dina kartdata
sw = Vidokezo vya data ya ramani yako
th = บันทึกข้อมูลแผนที่ของคุณ
tr = Harita veri notlarınız
uk = Ваші нотатки на мапі
vi = Ghi chú dữ liệu bản đồ của bạn
zh-Hans = 您的地图数据说明
zh-Hant = 您的地圖資料註釋

[editor_operator]
tags = android,ios
en = Operator
Expand Down
4 changes: 4 additions & 0 deletions editor/osm_auth.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,10 @@ class OsmOAuth
{
return m_baseUrl + "/user/" + user + "/history";
}
std::string GetNotesURL(std::string const & user) const
{
return m_baseUrl + "/user/" + user + "/notes";
}
std::string BuildOAuth2Url() const;
//@}

Expand Down

0 comments on commit ceb321d

Please sign in to comment.