Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 354bdb31 authored by Marvin W.'s avatar Marvin W. 🐿️
Browse files

Update for new auth manager

parent cef1ce27
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -18,7 +18,7 @@
    xmlns:tools="http://schemas.android.com/tools"
    package="com.google.android.gms"
    android:versionName="1.0"
    android:versionCode="6599436">
    android:versionCode="6772000">

    <uses-sdk
        android:minSdkVersion="16"

protos-repo/auth.proto

0 → 100644
+17 −0
Original line number Diff line number Diff line
option java_package = "org.microg.gms.auth";

option java_outer_classname = "AuthProto";

message ConsentData {
    message AppDetails {
        optional string title = 1;
        optional string email = 3;
    }
    optional AppDetails app = 1;
    message ScopeDetails {
        optional string title = 1;
        optional string description = 2;
        optional string id = 6;
    }
    repeated ScopeDetails scopes = 2;
}
 No newline at end of file
+243 −0
Original line number Diff line number Diff line
// Code generated by Wire protocol buffer compiler, do not edit.
// Source file: protos-repo/auth.proto
package org.microg.gms.auth;

import com.squareup.wire.Message;
import com.squareup.wire.ProtoField;
import java.util.Collections;
import java.util.List;

import static com.squareup.wire.Message.Datatype.STRING;
import static com.squareup.wire.Message.Label.REPEATED;

public final class ConsentData extends Message {

  public static final List<ScopeDetails> DEFAULT_SCOPES = Collections.emptyList();

  @ProtoField(tag = 1)
  public final AppDetails app;

  @ProtoField(tag = 2, label = REPEATED, messageType = ScopeDetails.class)
  public final List<ScopeDetails> scopes;

  public ConsentData(AppDetails app, List<ScopeDetails> scopes) {
    this.app = app;
    this.scopes = immutableCopyOf(scopes);
  }

  private ConsentData(Builder builder) {
    this(builder.app, builder.scopes);
    setBuilder(builder);
  }

  @Override
  public boolean equals(Object other) {
    if (other == this) return true;
    if (!(other instanceof ConsentData)) return false;
    ConsentData o = (ConsentData) other;
    return equals(app, o.app)
        && equals(scopes, o.scopes);
  }

  @Override
  public int hashCode() {
    int result = hashCode;
    if (result == 0) {
      result = app != null ? app.hashCode() : 0;
      result = result * 37 + (scopes != null ? scopes.hashCode() : 1);
      hashCode = result;
    }
    return result;
  }

  public static final class Builder extends Message.Builder<ConsentData> {

    public AppDetails app;
    public List<ScopeDetails> scopes;

    public Builder() {
    }

    public Builder(ConsentData message) {
      super(message);
      if (message == null) return;
      this.app = message.app;
      this.scopes = copyOf(message.scopes);
    }

    public Builder app(AppDetails app) {
      this.app = app;
      return this;
    }

    public Builder scopes(List<ScopeDetails> scopes) {
      this.scopes = checkForNulls(scopes);
      return this;
    }

    @Override
    public ConsentData build() {
      return new ConsentData(this);
    }
  }

  public static final class AppDetails extends Message {

    public static final String DEFAULT_TITLE = "";
    public static final String DEFAULT_EMAIL = "";

    @ProtoField(tag = 1, type = STRING)
    public final String title;

    @ProtoField(tag = 3, type = STRING)
    public final String email;

    public AppDetails(String title, String email) {
      this.title = title;
      this.email = email;
    }

    private AppDetails(Builder builder) {
      this(builder.title, builder.email);
      setBuilder(builder);
    }

    @Override
    public boolean equals(Object other) {
      if (other == this) return true;
      if (!(other instanceof AppDetails)) return false;
      AppDetails o = (AppDetails) other;
      return equals(title, o.title)
          && equals(email, o.email);
    }

    @Override
    public int hashCode() {
      int result = hashCode;
      if (result == 0) {
        result = title != null ? title.hashCode() : 0;
        result = result * 37 + (email != null ? email.hashCode() : 0);
        hashCode = result;
      }
      return result;
    }

    public static final class Builder extends Message.Builder<AppDetails> {

      public String title;
      public String email;

      public Builder() {
      }

      public Builder(AppDetails message) {
        super(message);
        if (message == null) return;
        this.title = message.title;
        this.email = message.email;
      }

      public Builder title(String title) {
        this.title = title;
        return this;
      }

      public Builder email(String email) {
        this.email = email;
        return this;
      }

      @Override
      public AppDetails build() {
        return new AppDetails(this);
      }
    }
  }

  public static final class ScopeDetails extends Message {

    public static final String DEFAULT_TITLE = "";
    public static final String DEFAULT_DESCRIPTION = "";
    public static final String DEFAULT_ID = "";

    @ProtoField(tag = 1, type = STRING)
    public final String title;

    @ProtoField(tag = 2, type = STRING)
    public final String description;

    @ProtoField(tag = 6, type = STRING)
    public final String id;

    public ScopeDetails(String title, String description, String id) {
      this.title = title;
      this.description = description;
      this.id = id;
    }

    private ScopeDetails(Builder builder) {
      this(builder.title, builder.description, builder.id);
      setBuilder(builder);
    }

    @Override
    public boolean equals(Object other) {
      if (other == this) return true;
      if (!(other instanceof ScopeDetails)) return false;
      ScopeDetails o = (ScopeDetails) other;
      return equals(title, o.title)
          && equals(description, o.description)
          && equals(id, o.id);
    }

    @Override
    public int hashCode() {
      int result = hashCode;
      if (result == 0) {
        result = title != null ? title.hashCode() : 0;
        result = result * 37 + (description != null ? description.hashCode() : 0);
        result = result * 37 + (id != null ? id.hashCode() : 0);
        hashCode = result;
      }
      return result;
    }

    public static final class Builder extends Message.Builder<ScopeDetails> {

      public String title;
      public String description;
      public String id;

      public Builder() {
      }

      public Builder(ScopeDetails message) {
        super(message);
        if (message == null) return;
        this.title = message.title;
        this.description = message.description;
        this.id = message.id;
      }

      public Builder title(String title) {
        this.title = title;
        return this;
      }

      public Builder description(String description) {
        this.description = description;
        return this;
      }

      public Builder id(String id) {
        this.id = id;
        return this;
      }

      @Override
      public ScopeDetails build() {
        return new ScopeDetails(this);
      }
    }
  }
}
+1 −1
Original line number Diff line number Diff line
@@ -150,7 +150,7 @@
    <string name="permission_scope_www.googleapis.com_auth_latitude.current.city">Manage your city-level location</string>
    <string name="permission_scope_www.googleapis.com_auth_mapsengine">provides read and write access to the user\'s Maps Engine data from your application.</string>
    <string name="permission_scope_www.googleapis.com_auth_mapsengine.readonly">provides read-only access to the user\'s Maps Engine data from your</string>
    <string name="permission_scope_www.googleapis.com_auth_mobilemaps.firstparty">Full access to your Google Maps account</string>
    <string name="permission_scope_www.googleapis.com_auth_mobilemaps.firstparty">View and manage your Google Maps for mobile experience</string>
    <string name="permission_scope_www.googleapis.com_auth_orkut">Manage your Orkut activity</string>
    <string name="permission_scope_www.googleapis.com_auth_orkut.readonly">View your Orkut data</string>
    <string name="permission_scope_www.googleapis.com_auth_plus.login">Know your name, basic info, and list of people you\'re connected to on Google+</string>
+1 −2
Original line number Diff line number Diff line
@@ -43,8 +43,7 @@ public class CheckinManager {
        List<CheckinClient.Account> accounts = new ArrayList<>();
        AccountManager accountManager = AccountManager.get(context);
        for (Account account : accountManager.getAccountsByType("com.google")) {
            String token = AuthManager.getToken(context, account, Constants.GMS_PACKAGE_NAME,
                    Constants.GMS_PACKAGE_SIGNATURE_SHA1, "ac2dm");
            String token = new AuthManager(context, account.name, Constants.GMS_PACKAGE_NAME, "ac2dm").getAuthToken();
            accounts.add(new CheckinClient.Account(account.name, token));
        }
        CheckinRequest request =
Loading