Skip to content

Commit 97b51a1

Browse files
authored
Merge pull request #2553 from kiwix/release/3.4.3
Release/3.4.3
2 parents f003379 + ae549b9 commit 97b51a1

File tree

53 files changed

+283
-144
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+283
-144
lines changed

CHANGELOG

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
3.4.3
2+
NEW: Updated translations
3+
BUGFIX: Video seek was not working
4+
BUGFIX: Back button in history and bookmarks toolbar always took to library
5+
BUGFIX: Books hosted from android client were not updating on browser dynamically
6+
BUGFIX: Creating multiple tabs was causing `loading` in previously opened tabs
7+
BUGFIX: Messages displayed when no books are present were inconsistent typographically
8+
19
3.4.2
210
NEW: Service worker support for war2c zim files
311
NEW: Updated translations

app/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ apply(from = rootProject.file("jacoco.gradle"))
1111
ext {
1212
set("versionMajor", 3)
1313
set("versionMinor", 4)
14-
set("versionPatch", 2)
14+
set("versionPatch", 3)
1515
}
1616

1717
fun generateVersionName() = "${ext["versionMajor"]}.${ext["versionMinor"]}.${ext["versionPatch"]}"

app/src/main/assets/credits.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,12 @@ <h2>Contributors</h2>
2424
Adeel Zafar<br>
2525
Aditya Sood<br>
2626
Ayoub Dardory<br>
27+
Ayush Shrivastava<br>
2728
Christian Pühringer<br>
2829
Elad Keyshawn<br>
2930
Emmanuel Engelhart<br>
31+
Frans-Lukas Lövenvald<br>
32+
Gourishankar Panda<br>
3033
Isaac Hutt<br>
3134
Joseph E. Reeve<br>
3235
Julian Harty<br>

app/src/main/java/org/kiwix/kiwixmobile/di/modules/ServiceModule.kt

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,8 @@ import android.app.Service
2323
import android.content.Context
2424
import dagger.Module
2525
import dagger.Provides
26-
import org.kiwix.kiwixlib.JNIKiwixServer
27-
import org.kiwix.kiwixlib.Library
2826
import org.kiwix.kiwixmobile.di.ServiceScope
27+
import org.kiwix.kiwixmobile.webserver.KiwixServer
2928
import org.kiwix.kiwixmobile.webserver.WebServerHelper
3029
import org.kiwix.kiwixmobile.webserver.wifi_hotspot.HotspotNotificationManager
3130
import org.kiwix.kiwixmobile.webserver.wifi_hotspot.HotspotStateReceiver
@@ -38,25 +37,15 @@ class ServiceModule {
3837
@Provides
3938
@ServiceScope
4039
fun providesWebServerHelper(
41-
jniKiwixLibrary: Library,
42-
kiwixServer: JNIKiwixServer,
40+
kiwixServerFactory: KiwixServer.Factory,
4341
ipAddressCallbacks: IpAddressCallbacks
44-
): WebServerHelper = WebServerHelper(jniKiwixLibrary, kiwixServer, ipAddressCallbacks)
42+
): WebServerHelper = WebServerHelper(kiwixServerFactory, ipAddressCallbacks)
4543

4644
@Provides
4745
@ServiceScope
4846
fun providesIpAddressCallbacks(service: Service): IpAddressCallbacks =
4947
service as IpAddressCallbacks
5048

51-
@Provides
52-
@ServiceScope
53-
fun providesLibrary(): Library = Library()
54-
55-
@Provides
56-
@ServiceScope
57-
fun providesJNIKiwixServer(jniKiwixLibrary: Library): JNIKiwixServer =
58-
JNIKiwixServer(jniKiwixLibrary)
59-
6049
@Provides
6150
@ServiceScope
6251
fun providesHotspotNotificationManager(

app/src/main/java/org/kiwix/kiwixmobile/intro/IntroFragment.kt

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ import android.os.Looper
2323
import android.view.LayoutInflater
2424
import android.view.View
2525
import android.view.ViewGroup
26-
import androidx.appcompat.app.AppCompatActivity
2726
import androidx.core.view.isVisible
27+
import androidx.navigation.fragment.findNavController
2828
import androidx.viewpager.widget.ViewPager
2929
import kotlinx.android.synthetic.main.fragment_intro.get_started
3030
import kotlinx.android.synthetic.main.fragment_intro.tab_indicator
@@ -35,7 +35,6 @@ import org.kiwix.kiwixmobile.cachedComponent
3535
import org.kiwix.kiwixmobile.core.base.BaseActivity
3636
import org.kiwix.kiwixmobile.core.base.BaseFragment
3737
import org.kiwix.kiwixmobile.core.base.FragmentActivityExtensions
38-
import org.kiwix.kiwixmobile.main.KiwixMainActivity
3938
import org.kiwix.kiwixmobile.zim_manager.SimplePageChangeListener
4039
import java.util.Timer
4140
import java.util.TimerTask
@@ -103,15 +102,10 @@ class IntroFragment : BaseFragment(), IntroContract.View, FragmentActivityExtens
103102
views = emptyArray()
104103
}
105104

106-
override fun onBackPressed(activity: AppCompatActivity): FragmentActivityExtensions.Super {
107-
activity.finish()
108-
return super.onBackPressed(activity)
109-
}
110-
111105
private fun navigateToLibrary() {
112106
dismissAutoRotate()
113107
presenter.setIntroShown()
114-
(requireActivity() as KiwixMainActivity).navController.popBackStack()
108+
findNavController().navigate(IntroFragmentDirections.actionIntrofragmentToLibraryFragment())
115109
}
116110

117111
private fun updateView(position: Int) {

app/src/main/java/org/kiwix/kiwixmobile/main/KiwixMainActivity.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ import org.kiwix.kiwixmobile.core.base.FragmentActivityExtensions
3838
import org.kiwix.kiwixmobile.core.di.components.CoreComponent
3939
import org.kiwix.kiwixmobile.core.main.CoreMainActivity
4040
import org.kiwix.kiwixmobile.kiwixActivityComponent
41+
import org.kiwix.kiwixmobile.nav.destination.library.LocalLibraryFragmentDirections
4142

4243
const val NAVIGATE_TO_ZIM_HOST_FRAGMENT = "navigate_to_zim_host_fragment"
4344

@@ -94,7 +95,7 @@ class KiwixMainActivity : CoreMainActivity() {
9495
}
9596
}
9697
if (sharedPreferenceUtil.showIntro()) {
97-
navigate(R.id.introFragment)
98+
navigate(LocalLibraryFragmentDirections.actionLibraryFragmentToIntrofragment())
9899
}
99100
}
100101

app/src/main/java/org/kiwix/kiwixmobile/nav/destination/reader/KiwixReaderFragment.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,9 @@ class KiwixReaderFragment : CoreReaderFragment() {
251251
val zimFile = settings.getString(TAG_CURRENT_FILE, null)
252252

253253
if (zimFile != null) {
254-
openZimFile(File(zimFile))
254+
if (zimReaderContainer.zimFile == null) {
255+
openZimFile(File(zimFile))
256+
}
255257
} else {
256258
getCurrentWebView().snack(R.string.zim_not_opened)
257259
}
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
/*
2+
* Kiwix Android
3+
* Copyright (c) 2020 Kiwix <android.kiwix.org>
4+
* This program is free software: you can redistribute it and/or modify
5+
* it under the terms of the GNU General Public License as published by
6+
* the Free Software Foundation, either version 3 of the License, or
7+
* (at your option) any later version.
8+
*
9+
* This program is distributed in the hope that it will be useful,
10+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
* GNU General Public License for more details.
13+
*
14+
* You should have received a copy of the GNU General Public License
15+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
16+
*
17+
*/
18+
19+
package org.kiwix.kiwixmobile.webserver
20+
21+
import android.util.Log
22+
import org.kiwix.kiwixlib.JNIKiwixException
23+
import org.kiwix.kiwixlib.JNIKiwixServer
24+
import org.kiwix.kiwixlib.Library
25+
import javax.inject.Inject
26+
27+
private const val TAG = "KiwixServer"
28+
29+
class KiwixServer @Inject constructor(private val jniKiwixServer: JNIKiwixServer) {
30+
31+
class Factory @Inject constructor() {
32+
fun createKiwixServer(selectedBooksPath: ArrayList<String>): KiwixServer {
33+
val kiwixLibrary = Library()
34+
selectedBooksPath.forEach { path ->
35+
try {
36+
kiwixLibrary.addBook(path)
37+
} catch (e: JNIKiwixException) {
38+
Log.v(TAG, "Couldn't add book with path:{ $path }")
39+
}
40+
}
41+
return KiwixServer(JNIKiwixServer(kiwixLibrary))
42+
}
43+
}
44+
45+
fun startServer(port: Int): Boolean {
46+
jniKiwixServer.setPort(port)
47+
return jniKiwixServer.start()
48+
}
49+
50+
fun stopServer() = jniKiwixServer.stop()
51+
}

app/src/main/java/org/kiwix/kiwixmobile/webserver/WebServerHelper.java

Lines changed: 9 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,7 @@
2525
import java.util.ArrayList;
2626
import java.util.concurrent.TimeUnit;
2727
import javax.inject.Inject;
28-
import org.kiwix.kiwixlib.JNIKiwixException;
2928
import org.kiwix.kiwixlib.JNIKiwixServer;
30-
import org.kiwix.kiwixlib.Library;
3129
import org.kiwix.kiwixmobile.core.utils.ServerUtils;
3230
import org.kiwix.kiwixmobile.webserver.wifi_hotspot.IpAddressCallbacks;
3331

@@ -41,15 +39,14 @@
4139

4240
public class WebServerHelper {
4341
private static final String TAG = "WebServerHelper";
44-
private Library kiwixLibrary;
45-
private JNIKiwixServer kiwixServer;
42+
private KiwixServer kiwixServer;
43+
private KiwixServer.Factory kiwixServerFactory;
4644
private IpAddressCallbacks ipAddressCallbacks;
4745
private boolean isServerStarted;
4846

49-
@Inject public WebServerHelper(@NonNull Library kiwixLibrary,
50-
@NonNull JNIKiwixServer kiwixServer, @NonNull IpAddressCallbacks ipAddressCallbacks) {
51-
this.kiwixLibrary = kiwixLibrary;
52-
this.kiwixServer = kiwixServer;
47+
@Inject public WebServerHelper(@NonNull KiwixServer.Factory kiwixServerFactory,
48+
@NonNull IpAddressCallbacks ipAddressCallbacks) {
49+
this.kiwixServerFactory = kiwixServerFactory;
5350
this.ipAddressCallbacks = ipAddressCallbacks;
5451
}
5552

@@ -65,7 +62,7 @@ public boolean startServerHelper(@NonNull ArrayList<String> selectedBooksPath) {
6562

6663
public void stopAndroidWebServer() {
6764
if (isServerStarted) {
68-
kiwixServer.stop();
65+
kiwixServer.stopServer();
6966
updateServerState(false);
7067
}
7168
}
@@ -74,17 +71,9 @@ private boolean startAndroidWebServer(ArrayList<String> selectedBooksPath) {
7471
if (!isServerStarted) {
7572
int DEFAULT_PORT = 8080;
7673
ServerUtils.port = DEFAULT_PORT;
77-
for (String path : selectedBooksPath) {
78-
try {
79-
boolean isBookAdded = kiwixLibrary.addBook(path);
80-
Log.v(TAG, "isBookAdded: " + isBookAdded + path);
81-
} catch (JNIKiwixException e) {
82-
Log.v(TAG, "Couldn't add book " + path);
83-
}
84-
}
85-
kiwixServer.setPort(ServerUtils.port);
86-
updateServerState(kiwixServer.start());
87-
Log.v(TAG, "Server status" + isServerStarted);
74+
kiwixServer = kiwixServerFactory.createKiwixServer(selectedBooksPath);
75+
updateServerState(kiwixServer.startServer(ServerUtils.port));
76+
Log.d(TAG, "Server status" + isServerStarted);
8877
}
8978
return isServerStarted;
9079
}

app/src/main/res/layout/fragment_destination_download.xml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@
1818

1919
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
2020
xmlns:app="http://schemas.android.com/apk/res-auto"
21+
xmlns:tools="http://schemas.android.com/tools"
2122
android:layout_width="match_parent"
22-
android:layout_height="match_parent"
23-
xmlns:tools="http://schemas.android.com/tools">
23+
android:layout_height="match_parent">
2424

2525
<org.kiwix.kiwixmobile.core.utils.NestedCoordinatorLayout
2626
android:layout_width="match_parent"
@@ -44,23 +44,24 @@
4444
app:layout_behavior="@string/appbar_scrolling_view_behavior">
4545

4646
<androidx.recyclerview.widget.RecyclerView
47-
tools:listitem="@layout/item_download"
4847
android:id="@+id/libraryList"
4948
android:layout_width="match_parent"
5049
android:layout_height="match_parent"
51-
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
50+
app:layout_behavior="@string/appbar_scrolling_view_behavior"
51+
tools:listitem="@layout/item_download" />
5252

5353
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
5454
</org.kiwix.kiwixmobile.core.utils.NestedCoordinatorLayout>
5555

5656

5757
<TextView
5858
android:id="@+id/libraryErrorText"
59-
style="@style/no_list_content_text"
59+
style="@style/no_content"
6060
app:layout_constraintBottom_toBottomOf="parent"
6161
app:layout_constraintEnd_toEndOf="parent"
6262
app:layout_constraintStart_toStartOf="parent"
63-
app:layout_constraintTop_toTopOf="parent" />
63+
app:layout_constraintTop_toTopOf="parent"
64+
app:layout_constraintVertical_bias="0.45" />
6465

6566

6667
</androidx.constraintlayout.widget.ConstraintLayout>

0 commit comments

Comments
 (0)