Fix login with custom protocol
This commit is contained in:
		
							parent
							
								
									93aa4dd280
								
							
						
					
					
						commit
						891edcc0a3
					
				
					 2 changed files with 9 additions and 2 deletions
				
			
		| 
						 | 
					@ -35,6 +35,13 @@
 | 
				
			||||||
                <data android:host="app.mapcomplete.org" />
 | 
					                <data android:host="app.mapcomplete.org" />
 | 
				
			||||||
                <data android:path="/passthrough.html" />
 | 
					                <data android:path="/passthrough.html" />
 | 
				
			||||||
            </intent-filter>
 | 
					            </intent-filter>
 | 
				
			||||||
 | 
					            <intent-filter>
 | 
				
			||||||
 | 
					                <action android:name="android.intent.action.VIEW" />
 | 
				
			||||||
 | 
					                <category android:name="android.intent.category.DEFAULT" />
 | 
				
			||||||
 | 
					                <category android:name="android.intent.category.BROWSABLE" />
 | 
				
			||||||
 | 
					                <data android:scheme="orgmapcomplete" />
 | 
				
			||||||
 | 
					                <data android:path="/passthrough.html" />
 | 
				
			||||||
 | 
					            </intent-filter>
 | 
				
			||||||
        </activity>
 | 
					        </activity>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        <provider
 | 
					        <provider
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -87,7 +87,8 @@ public class MainActivity extends BridgeActivity {
 | 
				
			||||||
            return;
 | 
					            return;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (Objects.equals(url.getPath(), "/passthrough.html")) {
 | 
					        System.out.println("urlPath: " + url.getPath()+";"+ String.join(", ",url.getQueryParameterNames()));
 | 
				
			||||||
 | 
					        if (url.getQueryParameterNames().contains("oauth_token")) {
 | 
				
			||||||
            var token = url.getQueryParameter("oauth_token");
 | 
					            var token = url.getQueryParameter("oauth_token");
 | 
				
			||||||
            JSObject obj = new JSObject();
 | 
					            JSObject obj = new JSObject();
 | 
				
			||||||
            obj.put("oauth_token", token);
 | 
					            obj.put("oauth_token", token);
 | 
				
			||||||
| 
						 | 
					@ -98,7 +99,6 @@ public class MainActivity extends BridgeActivity {
 | 
				
			||||||
            if (this.authRequest != null) {
 | 
					            if (this.authRequest != null) {
 | 
				
			||||||
                this.authRequest.resolve(res);
 | 
					                this.authRequest.resolve(res);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            return;
 | 
					 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        System.out.println("Intercepted URL: " + url);
 | 
					        System.out.println("Intercepted URL: " + url);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue