示例#1
0
  public static void removeWpComUserRelatedData(Context context) {
    // cancel all Volley requests - do this before unregistering push since that uses
    // a Volley request
    VolleyUtils.cancelAllRequests(requestQueue);

    NotificationsUtils.unregisterDevicePushNotifications(context);
    try {
      GCMRegistrar.checkDevice(context);
      GCMRegistrar.unregister(context);
    } catch (Exception e) {
      AppLog.v(T.NOTIFS, "Could not unregister for GCM: " + e.getMessage());
    }

    // delete wpcom blogs
    wpDB.deleteWordPressComBlogs(context);

    // reset default account
    AccountHelper.getDefaultAccount().signout();

    // reset all reader-related prefs & data
    AppPrefs.reset();
    ReaderDatabase.reset();

    // Reset Stats Data
    StatsDatabaseHelper.getDatabase(context).reset();

    // Reset Simperium buckets (removes local data)
    SimperiumUtils.resetBucketsAndDeauthorize();
  }
 public static ReaderDatabase getDatabase() {
   if (mReaderDb == null) {
     synchronized (mDbLock) {
       if (mReaderDb == null) {
         mReaderDb = new ReaderDatabase(WordPress.getContext());
         // this ensures that onOpen() is called with a writable database (open will fail if app
         // calls getReadableDb() first)
         mReaderDb.getWritableDatabase();
       }
     }
   }
   return mReaderDb;
 }