mirror of
				https://framagit.org/tom79/fedilab-tube
				synced 2025-06-05 21:09:11 +02:00 
			
		
		
		
	Issue #133 - history not working in URL
This commit is contained in:
		| @@ -549,7 +549,7 @@ public class MainActivity extends AppCompatActivity implements ChromeCastsListen | |||||||
|         searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() { |         searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() { | ||||||
|             @Override |             @Override | ||||||
|             public boolean onQueryTextSubmit(String query) { |             public boolean onQueryTextSubmit(String query) { | ||||||
|                 Pattern link = Pattern.compile("(https?://[\\da-z.-]+\\.[a-z.]{2,10})/videos/watch/(\\w{8}-\\w{4}-\\w{4}-\\w{4}-\\w{12})$"); |                 Pattern link = Pattern.compile("(https?://[\\da-z.-]+\\.[a-z.]{2,10})/videos/watch/(\\w{8}-\\w{4}-\\w{4}-\\w{4}-\\w{12})(\\?start=(\\d+[hH])?(\\d+[mM])?(\\d+[sS])?)?$"); | ||||||
|                 Matcher matcherLink = link.matcher(query.trim()); |                 Matcher matcherLink = link.matcher(query.trim()); | ||||||
|                 if (matcherLink.find()) { |                 if (matcherLink.find()) { | ||||||
|                     Intent intent = new Intent(MainActivity.this, PeertubeActivity.class); |                     Intent intent = new Intent(MainActivity.this, PeertubeActivity.class); | ||||||
|   | |||||||
| @@ -610,7 +610,7 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd | |||||||
|                     peertube.setEmbedUrl(url); |                     peertube.setEmbedUrl(url); | ||||||
|                     if (totalSeconds > 0) { |                     if (totalSeconds > 0) { | ||||||
|                         VideoData.UserHistory userHistory = new VideoData.UserHistory(); |                         VideoData.UserHistory userHistory = new VideoData.UserHistory(); | ||||||
|                         userHistory.setCurrentTime(totalSeconds * 1000); |                         userHistory.setCurrentTime(totalSeconds); | ||||||
|                         peertube.setUserHistory(userHistory); |                         peertube.setUserHistory(userHistory); | ||||||
|                     } |                     } | ||||||
|                     TimelineVM viewModelTimeline = new ViewModelProvider(PeertubeActivity.this).get(TimelineVM.class); |                     TimelineVM viewModelTimeline = new ViewModelProvider(PeertubeActivity.this).get(TimelineVM.class); | ||||||
| @@ -925,7 +925,7 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd | |||||||
|                     isRemote = true; |                     isRemote = true; | ||||||
|                     if (totalSeconds > 0) { |                     if (totalSeconds > 0) { | ||||||
|                         VideoData.UserHistory userHistory = new VideoData.UserHistory(); |                         VideoData.UserHistory userHistory = new VideoData.UserHistory(); | ||||||
|                         userHistory.setCurrentTime(totalSeconds * 1000); |                         userHistory.setCurrentTime(totalSeconds); | ||||||
|                         peertube.setUserHistory(userHistory); |                         peertube.setUserHistory(userHistory); | ||||||
|                     } |                     } | ||||||
|                     TimelineVM viewModelTimeline = new ViewModelProvider(PeertubeActivity.this).get(TimelineVM.class); |                     TimelineVM viewModelTimeline = new ViewModelProvider(PeertubeActivity.this).get(TimelineVM.class); | ||||||
| @@ -951,7 +951,14 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd | |||||||
|         } |         } | ||||||
|         long position = -1; |         long position = -1; | ||||||
|  |  | ||||||
|  |         long previousPositionHistory = 0; | ||||||
|  |         if (peertube != null && peertube.getUserHistory() != null) { | ||||||
|  |             previousPositionHistory = peertube.getUserHistory().getCurrentTime(); | ||||||
|  |         } | ||||||
|         peertube = apiResponse.getPeertubes().get(0); |         peertube = apiResponse.getPeertubes().get(0); | ||||||
|  |         VideoData.UserHistory userHistory = new VideoData.UserHistory(); | ||||||
|  |         userHistory.setCurrentTime(previousPositionHistory); | ||||||
|  |         peertube.setUserHistory(userHistory); | ||||||
|  |  | ||||||
|         if (peertube.getUserHistory() != null) { |         if (peertube.getUserHistory() != null) { | ||||||
|             position = peertube.getUserHistory().getCurrentTime() * 1000; |             position = peertube.getUserHistory().getCurrentTime() * 1000; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user